spec

package
v0.9.2-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KoliPrefixValue    = "kolihub.io"
	ReleaseExpireAfter = 20
)

KoliPrefixValue is used for creating annotations and labels

View Source
const GroupName = "platform.koli.io"

GroupName is the group name use in this package

View Source
const (
	// ResourceNamespace , number
	ResourceNamespace v1.ResourceName = "namespaces"
)

Variables

View Source
var (
	// SchemeBuilder collects functions that add things to a scheme. It's to allow
	// code to compile without explicitly referencing generated types. You should
	// declare one in each package that will have generated deep copy or conversion
	// functions.
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme applies all the stored functions to the scheme. A non-nil error
	// indicates that one function failed and the attempt was abandoned.
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var PlatformRegisteredRoles []PlatformRole

PlatformRegisteredRoles contains all the cluster roles provisioned on the platform

View Source
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}

SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}

Functions

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns a Group qualified GroupKind

func KoliPrefix

func KoliPrefix(value string) string

KoliPrefix returns a value with the default prefix - spec.KoliPrefix

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type Addon

type Addon struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              AddonSpec `json:"spec"`
}

Addon defines integration with external resources

func (*Addon) GetImage

func (a *Addon) GetImage() string

GetImage gets the BaseImage + Version

func (*Addon) GetReplicas

func (a *Addon) GetReplicas() *int32

GetReplicas returns the size of replicas, if is less than 1 sets a default value

type AddonList

type AddonList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []Addon `json:"items"`
}

AddonList is a list of Addons.

type AddonSpec

type AddonSpec struct {
	Type      string      `json:"type"`
	BaseImage string      `json:"baseImage"`
	Version   string      `json:"version"`
	Replicas  int32       `json:"replicas"`
	Port      int32       `json:"port"`
	Env       []v1.EnvVar `json:"env"`
	// More info: http://releases.k8s.io/HEAD/docs/user-guide/containers.md#containers-and-commands
	Args []string `json:"args,omitempty"`
}

AddonSpec holds specification parameters of an addon

type Domain

type Domain struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   DomainSpec   `json:"spec,omitempty"`
	Status DomainStatus `json:"status,omitempty"`
}

Domain are a way for users to "claim" a domain and be able to create ingresses

func (*Domain) GetDomain

func (d *Domain) GetDomain() string

func (*Domain) GetDomainType

func (d *Domain) GetDomainType() string

GetDomainType returns the type of the resource: 'primary' or 'shared'

func (*Domain) GetPrimaryDomain

func (d *Domain) GetPrimaryDomain() string

GetPrimaryDomain returns the primary domain of the resource

func (*Domain) HasDelegate

func (d *Domain) HasDelegate(namespace string) bool

HasDelegate verifies if the the resource has the target namespace in the delegates attribute

func (*Domain) HasFinalizer

func (d *Domain) HasFinalizer(finalizer string) bool

func (*Domain) IsOK

func (d *Domain) IsOK() bool

IsOK verifies if the resource is in the OK state

func (*Domain) IsPrimary

func (d *Domain) IsPrimary() bool

IsPrimary validates if it's a primary domain

func (*Domain) IsValidDomain

func (d *Domain) IsValidDomain() bool

func (*Domain) IsValidSharedDomain

func (d *Domain) IsValidSharedDomain() bool

IsValidSharedDomain verifies if the shared domain it's a subdomain from the primary

type DomainList

type DomainList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []Domain `json:"items"`
}

DomainList is a List of Domain

type DomainPhase

type DomainPhase string

DomainPhase is a label for the condition of a domain at the current time.

const (
	// DomainStatusNew means it's a new resource and the phase it's not set
	DomainStatusNew DomainPhase = ""
	// DomainStatusOK means the domain doesn't have no pending operations or prohibitions,
	// and new ingresses could be created using the target domain.
	DomainStatusOK DomainPhase = "OK"
	// DomainStatusPending indicates that a request to create a new domain
	// has been received and is being processed.
	DomainStatusPending DomainPhase = "Pending"
	// DomainStatusFailed means the resource has failed on claiming the domain
	DomainStatusFailed DomainPhase = "Failed"
)

type DomainSpec

type DomainSpec struct {
	// PrimaryDomain is the name of the primary domain, to set the resource as primary,
	// 'name' and 'primary' must have the same value.
	// +required
	PrimaryDomain string `json:"primary,omitempty"`
	// Sub is the label of the Primary Domain to form a subdomain
	// +optional
	Sub string `json:"sub,omitempty"`
	// Delegates contains a list of namespaces that are allowed to use this domain.
	// New domain resources could be referenced to primary ones using the 'parent' key.
	// A wildcard ("*") allows delegate access to all namespaces in the cluster.
	// +optional
	Delegates []string `json:"delegates,omitempty"`
	// Parent refers to the namespace where the primary domain is in.
	// It only makes sense when the type of the domain is set to 'shared',
	// +optional
	Parent string `json:"parent,omitempty"`
}

DomainSpec represents information about a domain claim

type DomainStatus

type DomainStatus struct {
	// The state of the domain, an empty state means it's a new resource
	// +optional
	Phase DomainPhase `json:"phase,omitempty"`
	// A human readable message indicating details about why the domain claim is in this state.
	// +optional
	Message string `json:"message,omitempty"`
	// A brief CamelCase message indicating details about why the domain claim is in this state. e.g. 'AlreadyClaimed'
	// +optional
	Reason string `json:"reason,omitempty"`
	// The last time the resource was updated
	LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`
	// DeletionTimestamp it's a temporary field to work around the issue:
	// https://github.com/kubernetes/kubernetes/issues/40715, once it's solved,
	// remove this field and use the DeletionTimestamp from metav1.ObjectMeta
	DeletionTimestamp *metav1.Time `json:"deletionTimestamp,omitempty"`
}

DomainStatus represents information about the status of a domain.

type Label

type Label struct {
	labels.Set
	Prefix string
}

Label wraps a labels.Set

func NewLabel

func NewLabel(prefixS ...string) *Label

NewLabel generates a new *spec.Label, if a prefix isn't provided it will use the the default one: spec.KoliPrefixValue.

func (*Label) Add

func (l *Label) Add(mapLabels map[string]string) *Label

Add values to a labels.Set using a pre-defined prefix

func (*Label) Exists

func (l *Label) Exists(key string) bool

Exists verifies if the given key exists

func (*Label) Remove

func (l *Label) Remove(key string) *Label

Remove a key from the labels.Set using a pre-defined prefix

type Plan

type Plan struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec PlanSpec `json:"spec"`
}

Plan defines how resources could be managed and distributed

type PlanList

type PlanList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []Plan `json:"items"`
}

PlanList is a list of ServicePlans

type PlanSpec

type PlanSpec struct {
	// Compute Resources required by containers.
	Resources v1.ResourceRequirements `json:"resources,omitempty"`
	// Hard is the set of desired hard limits for each named resource.
	Hard  ResourceList   `json:"hard,omitempty"`
	Roles []PlatformRole `json:"roles,omitempty"`
}

PlanSpec holds specification parameters of an Plan

type PlatformRole

type PlatformRole string

PlatformRole is the name identifying various roles in a PlatformRoleList.

const (
	// RoleExecAllow cluster role name
	RoleExecAllow PlatformRole = "exec-allow"
	// RolePortForwardAllow cluster role name
	RolePortForwardAllow PlatformRole = "portforward-allow"
	// RoleAutoScaleAllow cluster role name
	RoleAutoScaleAllow PlatformRole = "autoscale-allow"
	// RoleAttachAllow cluster role name
	RoleAttachAllow PlatformRole = "attach-allow"
	// RoleAddonManagement cluster role name
	RoleAddonManagement PlatformRole = "addon-management"
)

func NewPlatformRoles

func NewPlatformRoles(roles string) []PlatformRole

NewPlatformRoles converts a string of comma separated roles to registered []PlatformRoles

func (PlatformRole) Exists

func (r PlatformRole) Exists(roles []PlatformRole) bool

Exists verifies if the slice contains the role

func (PlatformRole) GetRoleBinding

func (r PlatformRole) GetRoleBinding(subjects []rbac.Subject) *rbac.RoleBinding

GetRoleBinding retrieves a role binding for this role

func (PlatformRole) IsRegisteredRole

func (r PlatformRole) IsRegisteredRole() bool

IsRegisteredRole check if the role matches with the registered roles.

type Release

type Release struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              ReleaseSpec `json:"spec"`
}

Release refers to compiled slug file versions

func (*Release) BuildRevision

func (r *Release) BuildRevision() int

BuildRevision returns the revision as int, if the conversion fails returns 0

func (*Release) Expired

func (r *Release) Expired() bool

Expired verifies if the creation time of the resource is expired.

func (*Release) GitCloneURL

func (r *Release) GitCloneURL() (string, error)

GitCloneURL constructs the remote clone URL for the given release

func (*Release) GitReleaseURL

func (r *Release) GitReleaseURL(host string) string

GitReleaseURL constructs the URL where the release must be stored

func (*Release) IsGitHubSource

func (r *Release) IsGitHubSource() bool

IsGitHubSource check if the source of the build is from github

type ReleaseList

type ReleaseList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Release `json:"items"`
}

ReleaseList is a list of Release

type ReleaseSpec

type ReleaseSpec struct {
	// The URL of the git remote server to download the git revision tarball
	GitRemote     string     `json:"gitRemote"`
	GitRevision   string     `json:"gitRevision"`
	GitRepository string     `json:"gitRepository"`
	BuildRevision string     `json:"buildRevision"`
	AutoDeploy    bool       `json:"autoDeploy"`
	ExpireAfter   int32      `json:"expireAfter"`
	DeployName    string     `json:"deployName"`
	Build         bool       `json:"build"`
	AuthToken     string     `json:"authToken"` // expirable token
	Source        SourceType `json:"sourceType"`
}

ReleaseSpec holds specification parameters of a release

type ResourceList

type ResourceList v1.ResourceList

ResourceList is a set of (resource name, quantity) pairs.

var PlatformRegisteredResources *ResourceList

PlatformRegisteredResources contains all the resources allowed for a user to configure in resource quotas: http://kubernetes.io/docs/admin/resourcequota/#Object-Count-Quota

func (*ResourceList) RemoveUnregisteredResources

func (r *ResourceList) RemoveUnregisteredResources()

RemoveUnregisteredResources removes resources which are not registered on the platform

type ServicePlanPhase

type ServicePlanPhase string

ServicePlanPhase is the current lifecycle phase of the Service Plan.

const (
	// ServicePlanActive means the ServicePlan is available for use in the system
	ServicePlanActive ServicePlanPhase = "Active"
	// ServicePlanPending means the ServicePlan isn't associate with any global ServicePlan
	ServicePlanPending ServicePlanPhase = "Pending"
	// ServicePlanNotFound means the reference plan wasn't found
	ServicePlanNotFound ServicePlanPhase = "NotFound"
	// ServicePlanDisabled means the ServicePlan is disabled and cannot be associated with resources
	ServicePlanDisabled ServicePlanPhase = "Disabled"
)

type SourceType

type SourceType string

SourceType refers to the source of the build

const (
	// GitHubSource means the build came from a webhook
	GitHubSource SourceType = "github"
	// GitLocalSource means the build came from the git local server
	GitLocalSource SourceType = "local"
)

type User

type User struct {
	ID           string `json:"id"`
	Username     string `json:"username"`
	Customer     string `json:"customer"`
	Organization string `json:"org"`
	// Groups are a set of strings which associate users with as set of commonly grouped users.
	// A group name is unique in the cluster and it's formed by it's namespace, customer or the organization name:
	// [org] - Matches all the namespaces of the broker
	// [customer]-[org] - Matches all namespaces from the customer broker
	// [name]-[customer]-[org] - Matches a specific namespace
	// http://kubernetes.io/docs/admin/authentication/
	Groups []string `json:"groups"`
}

User identifies an user on the platform

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL