draft

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deployment

type Deployment struct {
	DraftMeta
	v1beta1.Deployment
}

Deployment it's a draft for composing and acessing platform attributes from a v1beta1.Deployment more easily

func NewDeployment

func NewDeployment(obj *v1beta1.Deployment) *Deployment

NewDeployment generates a new draft.Deployment

func (*Deployment) AuthToken

func (d *Deployment) AuthToken() string

func (Deployment) BuildRevision

func (d Deployment) BuildRevision() int

func (*Deployment) Copy

func (d *Deployment) Copy() (*Deployment, error)

Copy performs a deep copy of the resource

func (*Deployment) GetClusterPlan

func (d *Deployment) GetClusterPlan() *MapValue

func (*Deployment) GetContainers

func (d *Deployment) GetContainers() []v1.Container

func (*Deployment) GetObject

func (d *Deployment) GetObject() *v1beta1.Deployment

GetObject returns the original resource

func (*Deployment) GetStoragePlan

func (d *Deployment) GetStoragePlan() *MapValue

func (*Deployment) GitBranch

func (d *Deployment) GitBranch() string

func (*Deployment) GitCompare

func (d *Deployment) GitCompare() string

func (*Deployment) GitHubUser

func (d *Deployment) GitHubUser() *MapValue

func (*Deployment) GitHubWebHookSecret

func (d *Deployment) GitHubWebHookSecret() string

func (*Deployment) GitRepository

func (d *Deployment) GitRepository() string

func (*Deployment) GitRevision

func (d *Deployment) GitRevision() (*SHA, error)

func (*Deployment) GitSource

func (d *Deployment) GitSource() string

func (*Deployment) HasAutoDeployAnnotation

func (d *Deployment) HasAutoDeployAnnotation() bool

func (*Deployment) HasBuildAnnotation

func (d *Deployment) HasBuildAnnotation() bool

func (*Deployment) HasContainers

func (d *Deployment) HasContainers() bool

func (*Deployment) HasMultipleReplicas

func (d *Deployment) HasMultipleReplicas() bool

func (*Deployment) HasSetupPVCAnnotation

func (d *Deployment) HasSetupPVCAnnotation() bool

func (*Deployment) IsMarkedForDeletion

func (d *Deployment) IsMarkedForDeletion() bool

IsMarkedForDeletion verifies if the metadata.deletionTimestamp is set, meaning the resource is marked to be excluded

func (*Deployment) PodSpec

func (d *Deployment) PodSpec() *v1.PodSpec

func (*Deployment) SetClusterPlan

func (d *Deployment) SetClusterPlan(planName string)

func (*Deployment) SetStoragePlan

func (d *Deployment) SetStoragePlan(planName string)

type DeploymentInterface

type DeploymentInterface interface {
	Object
	// Labels
	GetClusterPlan() *MapValue
	GetStoragePlan() *MapValue
	SetStoragePlan(planName string)
	SetClusterPlan(planName string)
	// Annotations
	BuildRevision() int
	HasAutoDeployAnnotation() bool
	HasSetupPVCAnnotation() bool
	HasBuildAnnotation() bool
	GitRepository() string
	GitRevision() (*SHA, error)
	GitBranch() string
	GitSource() string
	GitCompare() string
	GitHubUser() string
	GitHubWebHookSecret() string
	AuthToken() string

	GetObject() *v1beta1.Deployment
	HasMultipleReplicas() bool
	IsMarkedForDeletion() bool
	GetContainers() []v1.Container
	HasContainers() bool
	PodSpec() *v1.PodSpec
	DeepCopy() (*Deployment, error)
}

type DraftMeta

type DraftMeta struct {
	// contains filtered or unexported fields
}

DraftMeta contains common helper methods for all draft objects

func (*DraftMeta) GetAnnotation

func (o *DraftMeta) GetAnnotation(key string) *MapValue

func (*DraftMeta) GetKubernetesObjectMeta

func (o *DraftMeta) GetKubernetesObjectMeta() *metav1.ObjectMeta

func (*DraftMeta) GetLabel

func (o *DraftMeta) GetLabel(key string) *MapValue

func (*DraftMeta) GetNamespaceMetadata

func (o *DraftMeta) GetNamespaceMetadata() *NamespaceMeta

GetNamespaceMetadata parses the kubernetes namespace and returns a *NamespaceMeta

func (*DraftMeta) SetAnnotation

func (o *DraftMeta) SetAnnotation(key, value string)

SetAnnotation initializes and add a new key-value annotation

func (*DraftMeta) SetLabel

func (o *DraftMeta) SetLabel(key, value string)

SetRef initializes and add a new key=value label

type ErrInvalidGitSha

type ErrInvalidGitSha struct {
	// contains filtered or unexported fields
}

ErrInvalidGitSha is returned by NewSha if the given raw sha is invalid for any reason.

func (ErrInvalidGitSha) Error

func (e ErrInvalidGitSha) Error() string

Error is the error interface implementation.

type Ingress

type Ingress struct {
	DraftMeta
	v1beta1.Ingress
}

Ingress provides the primitives for interacting with platform attributes

func NewIngress

func NewIngress(obj *v1beta1.Ingress) *Ingress

NewDeployment generates a new draft.Deployment

func (*Ingress) Copy

func (d *Ingress) Copy() (*Ingress, error)

Copy performs a deep copy of the resource

func (*Ingress) DomainPrimaryKeys

func (i *Ingress) DomainPrimaryKeys() (m map[string]string)

DomainPrimaryKeys returns annotations matching domains, e.g.: 'kolihub.io/domain.tld'

func (*Ingress) GetObject

func (i *Ingress) GetObject() *v1beta1.Ingress

GetObject returns the original resource

type MapValue

type MapValue struct {
	Val string
}

MapValue represents the value from a map[string]string

func NewMapValue

func NewMapValue(value string) *MapValue

NewMapValue creates a new *MapValue

func (MapValue) AsBool

func (m MapValue) AsBool() bool

func (MapValue) AsInt

func (m MapValue) AsInt() int

func (MapValue) Exists

func (m MapValue) Exists() bool

func (MapValue) Get

func (m MapValue) Get() (string, bool)

func (MapValue) String

func (m MapValue) String() string

func (MapValue) Value

func (m MapValue) Value() (string, bool)

type NamespaceMeta

type NamespaceMeta struct {
	// contains filtered or unexported fields
}

NamespaceMeta is a object to extract metadata information about a kubernetes namespace, the platform could enforce policies based with this information. The namespace is created using the JWT claims from an user

func NewNamespaceMetadata

func NewNamespaceMetadata(namespace string) *NamespaceMeta

func (NamespaceMeta) Customer

func (n NamespaceMeta) Customer() string

func (NamespaceMeta) IsValid

func (n NamespaceMeta) IsValid() bool

func (NamespaceMeta) KubernetesNamespace

func (n NamespaceMeta) KubernetesNamespace() string

func (NamespaceMeta) Namespace

func (n NamespaceMeta) Namespace() string

func (NamespaceMeta) Organization

func (n NamespaceMeta) Organization() string

func (NamespaceMeta) Valid

func (n NamespaceMeta) Valid() bool

type Object

type Object interface {
	GetKubernetesObjectMeta() *metav1.ObjectMeta
	GetLabel(key string) *MapValue
	GetAnnotation(key string) *MapValue
	GetNamespaceMetadata() *NamespaceMeta
	SetAnnotation(key, value string)
	SetLabel(key, value string)
}

type SHA

type SHA struct {
	// contains filtered or unexported fields
}

SHA is the representaton of a git sha

func NewSha

func NewSha(rawSha string) (*SHA, error)

NewSha creates a raw string to a SHA. Returns ErrInvalidGitSha if the sha was invalid.

func (SHA) Full

func (s SHA) Full() string

Full returns the full git sha.

func (SHA) Short

func (s SHA) Short() string

Short returns the first 8 characters of the sha.

Jump to

Keyboard shortcuts

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