Documentation ¶
Index ¶
- Constants
- func BlueGreenURLForKind(url string, kind BlueGreenServiceSet) string
- func LoadResource(res *Gist, namespace, localPath string) error
- type Annotation
- type BlueGreenServiceSet
- type BlueGreenSettings
- type Container
- type ContainerLimits
- type ContainerRequests
- type DeploymentSettings
- type EnvVar
- type Environment
- type Environments
- type EnvironmentsBitesize
- type ExecAction
- type Gist
- type Gists
- type GistsRepository
- type HTTPGetAction
- type HTTPHeader
- type Handler
- type HealthCheck
- type HorizontalPodAutoscaler
- type KeyToPath
- type Metric
- type Pod
- type Port
- type Probe
- type Service
- func (e Service) ActiveDeploymentName() string
- func (e Service) ActiveDeploymentTag() BlueGreenServiceSet
- func (e Service) DeploymentMethod() string
- func (e Service) ExternalSecretExist(namespace, name string) bool
- func (e Service) HasExternalURL() bool
- func (e Service) InactiveDeploymentName() string
- func (e Service) InactiveDeploymentTag() BlueGreenServiceSet
- func (e Service) IsActiveBlueGreenDeployment() bool
- func (e Service) IsBlueGreenChildDeployment() bool
- func (e Service) IsBlueGreenParentDeployment() bool
- func (e Service) IsServiceMeshEnabled() bool
- func (e Service) IsTLSEnabled() bool
- func (e *Service) UnmarshalYAML(unmarshal func(interface{}) error) error
- type ServiceEntry_Endpoint
- type ServiceStatus
- type Services
- type TCPSocketAction
- type Test
- type Volume
Constants ¶
const ( // TypeConfigMap k8s configmap type TypeConfigMap string = "configmap" // TypeJob k8s job type TypeJob string = "job" // TypeCronJob k8s cronjob type TypeCronJob string = "cronjob" // TypeSecret k8s secret type TypeSecret string = "secret" )
Variables ¶
This section is empty.
Functions ¶
func BlueGreenURLForKind ¶
func BlueGreenURLForKind(url string, kind BlueGreenServiceSet) string
BlueGreenURLForKind constructs preformatted URL for environment given "parent" service's url and environment's colour
func LoadResource ¶
LoadResource loads named resource from a filename with a given path
Types ¶
type Annotation ¶
Annotation represents annotation variables in pod
type BlueGreenServiceSet ¶
type BlueGreenServiceSet int
BlueGreenServiceSet is a type specifying whether environment is blue or green
const ( BlueService BlueGreenServiceSet = 1 GreenService BlueGreenServiceSet = 2 )
func BlueGreenDeploymentID ¶
func BlueGreenDeploymentID(name string) BlueGreenServiceSet
BlueGreenDeploymentID converts string representation to BlueGreenServiceSet type
func (BlueGreenServiceSet) String ¶
func (e BlueGreenServiceSet) String() string
func (*BlueGreenServiceSet) UnmarshalYAML ¶
func (e *BlueGreenServiceSet) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for BlueGreenServiceSet.
type BlueGreenSettings ¶
type BlueGreenSettings struct { Active *BlueGreenServiceSet // used in "parent" service to determine which environment is active DeploymentColour *BlueGreenServiceSet // used in "child" blue/green service to indicate it's colour ActiveFlag bool // used in "child" blue/green service to indicate whethen this environment is currently active }
BlueGreenSettings is a collection of internal bluegreen settings used as a various helpers in deployment
type Container ¶
type Container struct { Application string `yaml:"application,omitempty"` Name string `yaml:"name" validate:"nonzero"` Version string `yaml:"version,omitempty"` EnvVars []EnvVar `yaml:"env,omitempty"` Command []string `yaml:"command"` Volumes []Volume `yaml:"volumes,omitempty"` }
Container maps a single application container that you want to run within a pod
type ContainerLimits ¶
ContainerLimits maps to limits in kubernetes
type ContainerRequests ¶
ContainerRequests maps to requests in kubernetes
type DeploymentSettings ¶
type DeploymentSettings struct { Method string `yaml:"method,omitempty" validate:"regexp=^(bluegreen|rolling-upgrade)*$"` Mode string `yaml:"mode,omitempty" validate:"regexp=^(manual|auto)*$"` BlueGreen *BlueGreenSettings `yaml:"-"` CustomURLs map[string][]string `yaml:"custom_urls,omitempty"` }
DeploymentSettings represent "deployment" block in environments.bitesize
func (*DeploymentSettings) UnmarshalYAML ¶
func (e *DeploymentSettings) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for DeploymentSettings.
type EnvVar ¶
type EnvVar struct { Name string `yaml:"name,omitempty"` Value string `yaml:"value,omitempty"` Secret string `yaml:"secret,omitempty"` PodField string `yaml:"pod_field,omitempty"` }
EnvVar represents environment variables in pod
type Environment ¶
type Environment struct { Name string `yaml:"name" validate:"nonzero"` Namespace string `yaml:"namespace,omitempty" validate:"regexp=^[a-zA-Z0-9\\-]*$"` // This field should be optional now Deployment *DeploymentSettings `yaml:"deployment,omitempty"` Services Services `yaml:"services"` Tests []Test `yaml:"tests,omitempty"` Gists Gists `yaml:"gists,omitempty"` Repo GistsRepository `yaml:"gists_repository,omitempty"` }
Environment represents full managed environment, including services, HTTP endpoints and deployments. It can be either built from environments.bitesize configuration file or Kubernetes cluster
func LoadEnvironment ¶
func LoadEnvironment(pathToBitesizeFile, envName string) (*Environment, error)
LoadEnvironment loads named environment from a filename with a given path
func LoadEnvironmentFromConfig ¶
func LoadEnvironmentFromConfig(c config.Config) (*Environment, error)
LoadEnvironmentFromConfig returns bitesize.Environment object constructed from environment variables
func (*Environment) UnmarshalYAML ¶
func (e *Environment) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for BitesizeEnvironment.
type Environments ¶
type Environments []Environment
Environments is a custom type to implement sort.Interface
func (Environments) Len ¶
func (slice Environments) Len() int
func (Environments) Less ¶
func (slice Environments) Less(i, j int) bool
func (Environments) Swap ¶
func (slice Environments) Swap(i, j int)
type EnvironmentsBitesize ¶
type EnvironmentsBitesize struct { Project string `yaml:"project"` Environments Environments `yaml:"environments"` }
EnvironmentsBitesize is a 1:1 mapping to environments.bitesize file
func LoadFromFile ¶
func LoadFromFile(path string) (*EnvironmentsBitesize, error)
LoadFromFile returns BitesizeEnvironment object loaded from file, passed as a path argument.
func LoadFromString ¶
func LoadFromString(cfg string) (*EnvironmentsBitesize, error)
LoadFromString returns BitesizeEnvironment object from yaml string
type ExecAction ¶
type ExecAction struct {
Command []string `yaml:"command,omitempty"`
}
type Gist ¶
type Gist struct { Name string `yaml:"name"` Path string `yaml:"path,omitempty"` Files []string `yaml:"files,omitempty"` Type string `yaml:"type"` ConfigMap v1.ConfigMap `yaml:"-"` Job v1batch.Job `yaml:"-"` CronJob v1beta1.CronJob `yaml:"-"` Secret v1.Secret `yaml:"-"` }
Gist represent a resource
type Gists ¶
type Gists []Gist
Gists is the struct to hold all imported resources per env
func (Gists) Find ¶
Find returns service with a name match path is a UNC path relative to the configured repository root rstype is the resource type of the imported resource
available type are: - configmap - job - cronjob
if resource found returns the resource else returns nil
func (Gists) FindByName ¶
FindByName returns configmap resource matched with name parameter rstype is the resource type of the imported resource
available type are: - bitesize.TypeConfigMap - bitesize.TypeJob - bitesize.TypeCronJob
if resource found returns the resource else returns nil
func (Gists) FindByType ¶
FindByType returns slice of resources matched with type parameter rstype is the resource type of the imported resource
available type are: - bitesize.TypeConfigMap - bitesize.TypeJob - bitesize.TypeCronJob
if resource found returns the resource else returns nil
type GistsRepository ¶
type GistsRepository struct { Remote string `yaml:"remote"` Branch string `yaml:"branch,omitempty" default:"master"` }
GistsRepository contains the repository info all the imports per env
type HTTPGetAction ¶
type HTTPHeader ¶
type Handler ¶
type Handler struct { Exec *ExecAction `yaml:"exec,omitempty"` HTTPGet *HTTPGetAction `yaml:"http_get,omitempty"` TCPSocket *TCPSocketAction `yaml:"tcp_socket,omitempty"` }
type HealthCheck ¶
type HealthCheck struct { Command []string `yaml:"command"` InitialDelay int `yaml:"initial_delay,omitempty"` Timeout int `yaml:"timeout,omitempty"` }
HealthCheck maps to LivenessProbe in Kubernetes
func (*HealthCheck) UnmarshalYAML ¶
func (e *HealthCheck) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for HealthCHeck.
type HorizontalPodAutoscaler ¶
type HorizontalPodAutoscaler struct { MinReplicas int32 `yaml:"min_replicas"` MaxReplicas int32 `yaml:"max_replicas"` Metric Metric `yaml:"metric"` }
HorizontalPodAutoscaler maps to HPA in kubernetes
type KeyToPath ¶
type KeyToPath struct { // The key to project. Key string `yaml:"key"` // The relative path of the file to map the key to. // May not be an absolute path. // May not contain the path element '..'. // May not start with the string '..'. Path string `yaml:"path"` // Optional: mode bits to use on this file, must be a value between 0 // and 0777. If not specified, the volume defaultMode will be used. // This might be in conflict with other options that affect the file // mode, like fsGroup, and the result can be other mode bits set. // +optional Mode *int32 `yaml:"mode,omitempty"` }
KeyToPath Maps a string key to a path within a volume.
type Metric ¶
type Metric struct { Name string `yaml:"name"` TargetAverageValue string `yaml:"target_average_value,omitempty"` TargetAverageUtilization int32 `yaml:"target_average_utilization,omitempty"` }
Metric maps to HPA targets in kubernetes
type Pod ¶
type Pod struct { Name string `yaml:"name"` Phase v1.PodPhase `yaml:"phase"` StartTime string `yaml:"start_time"` Message string `yaml:"message"` Logs string `yaml:"logs"` }
Pod represents Pod in Kubernetes
type Port ¶
type Port struct { Number uint32 `yaml:"number,omitempty"` Protocol string `yaml:"protocol,omitempty"` Name string `yaml:"name,omitempty"` }
Port represents format for these mappings
type Probe ¶
type Probe struct { Handler `yaml:"handler"` InitialDelaySeconds int32 `yaml:"initial_delay_seconds,omitempty"` TimeoutSeconds int32 `yaml:"timeout_seconds,omitempty"` PeriodSeconds int32 `yaml:"period_seconds,omitempty"` SuccessThreshold int32 `yaml:"success_threshold,omitempty"` FailureThreshold int32 `yaml:"failure_threshold,omitempty"` }
Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.
type Service ¶
type Service struct { Name string `yaml:"name" validate:"nonzero"` ExternalURL []string `yaml:"-"` ServiceMesh string `yaml:"service_mesh,omitempty" validate:"regexp=^(enable|disable)*$"` Backend string `yaml:"backend"` BackendPort int `yaml:"backend_port"` Ports []int `yaml:"-"` // Ports have custom unmarshaler Ssl string `yaml:"ssl" validate:"regexp=^(true|false)*$"` Version string `yaml:"version,omitempty"` Application string `yaml:"application,omitempty"` Replicas int `yaml:"replicas,omitempty"` Deployment *DeploymentSettings `yaml:"deployment,omitempty"` HPA HorizontalPodAutoscaler `yaml:"hpa" validate:"hpa"` Requests ContainerRequests `yaml:"requests" validate:"requests"` Limits ContainerLimits `yaml:"limits" validate:"limits"` HealthCheck *HealthCheck `yaml:"health_check,omitempty"` LivenessProbe *Probe `yaml:"liveness_probe,omitempty"` ReadinessProbe *Probe `yaml:"readiness_probe,omitempty"` EnvVars []EnvVar `yaml:"env,omitempty"` Commands []string `yaml:"command,omitempty"` InitContainers *[]Container `yaml:"init_containers,omitempty"` Annotations map[string]string `yaml:"-"` // Annotations have custom unmarshaler Volumes []Volume `yaml:"volumes,omitempty"` Options map[string]interface{} `yaml:"-"` // Options have custom unmarshaler HTTP2 string `yaml:"http2,omitempty" validate:"regexp=^(true|false)*$"` HTTPSOnly string `yaml:"httpsOnly" validate:"regexp=^(true|false)*$"` HTTPSBackend string `yaml:"httpsBackend,omitempty" validate:"regexp=^(true|false)*$"` Type string `yaml:"type,omitempty"` Status ServiceStatus `yaml:"status"` DatabaseType string `yaml:"database_type,omitempty" validate:"regexp=^(mongo)*$"` GracePeriod *int64 `yaml:"graceperiod,omitempty"` ResourceVersion string `yaml:"resourceVersion,omitempty"` TargetNamespace string `yaml:"target_namespace,omitempty"` Chart string `yaml:"chart,omitempty"` Repo string `yaml:"repo,omitempty"` Set map[string]intstr.IntOrString `yaml:"set,omitempty"` ValuesContent string `yaml:"values_content,omitempty"` Ignore bool `yaml:"ignore,omitempty"` Hosts []string `yaml:"hosts,omitempty"` Addresses []string `yaml:"addresses,omitempty"` ServiceEntryPorts []Port `yaml:"service_entry_ports,omitempty"` Location string `yaml:"location,omitempty"` Resolution string `yaml:"resolution,omitempty"` Endpoints []ServiceEntry_Endpoint `yaml:"endpoints,omitempty"` ExportTo []string `yaml:"export_to,omitempty"` Protocol string `yaml:"protocol,omitempty"` }
Service represents a single service and it's configuration, running in environment
func ServiceWithDefaults ¶
func ServiceWithDefaults() *Service
ServiceWithDefaults returns new *Service object with default values set default values should match those in bitesize.AddDeployment
func (Service) ActiveDeploymentName ¶
ActiveDeploymentName returns a fully formatted name for active bluegreen deployment
func (Service) ActiveDeploymentTag ¶
func (e Service) ActiveDeploymentTag() BlueGreenServiceSet
ActiveDeploymentTag returns active deployment in bluegreen set
func (Service) DeploymentMethod ¶
DeploymentMethod returns deployment method for service. rolling-upgrade or bluegreen
func (Service) ExternalSecretExist ¶
func (Service) HasExternalURL ¶
HasExternalURL checks if the service has an external_url defined
func (Service) InactiveDeploymentName ¶
InactiveDeploymentName returns a fully formatted name for the inactive bluegreen deployment
func (Service) InactiveDeploymentTag ¶
func (e Service) InactiveDeploymentTag() BlueGreenServiceSet
InactiveDeploymentTag returns inactive deployment in bluegreen set
func (Service) IsActiveBlueGreenDeployment ¶
IsActiveBlueGreenDeployment returns a boolean specifying whether current "child" service is service active traffic
func (Service) IsBlueGreenChildDeployment ¶
IsBlueGreenChildDeployment returns true if this service is a child of main bluegreen service
func (Service) IsBlueGreenParentDeployment ¶
IsBlueGreenParentDeployment verifies if deployment method set for the service is bluegreen
func (Service) IsServiceMeshEnabled ¶
IsServiceMeshEnabled checks if the service_mesh is enabled
func (Service) IsTLSEnabled ¶
func (*Service) UnmarshalYAML ¶
UnmarshalYAML converts Service yaml to *bitesize.Service
type ServiceEntry_Endpoint ¶
type ServiceEntry_Endpoint struct { Address string `yaml:"address,omitempty"` Ports map[string]uint32 `yaml:"ports,omitempty"` Labels map[string]string `yaml:"labels,omitempty"` Network string `yaml:"network,omitempty"` Locality string `yaml:"locality,omitempty"` Weight uint32 `yaml:"weight,omitempty"` }
ServiceEntry_Endpoint represents one or more endpoints associated with the service.
type ServiceStatus ¶
type ServiceStatus struct { DeployedAt string AvailableReplicas int DesiredReplicas int CurrentReplicas int }
ServiceStatus represents cluster service's status metrics
type Services ¶
type Services []Service
Services implement sort.Interface
func (Services) FindByName ¶
FindByName returns service with a name match
type TCPSocketAction ¶
type Test ¶
type Test struct { Name string `yaml:"name"` Repository string `yaml:"repository"` Branch string `yaml:"branch"` Commands []map[string]string `yaml:"commands"` }
Test is obsolete and not used by environment-operator, but it's here for configuration compatability
type Volume ¶
type Volume struct { // Name of the referent. Name string `yaml:"name"` // Path Path string `yaml:"path"` Modes string `yaml:"modes" validate:"volume_modes"` Size string `yaml:"size"` Type string `yaml:"type"` // If unspecified, each key-value pair in the Data field of the referenced // ConfigMap will be projected into the volume as a file whose name is the // key and content is the value. If specified, the listed keys will be // projected into the specified paths, and unlisted keys will not be // present. If a key is specified which is not present in the ConfigMap, // the volume setup will error unless it is marked optional. Paths must be // relative and may not contain the '..' path or start with '..'. // +optional Items []KeyToPath `yaml:"items"` // contains filtered or unexported fields }
Volume represents volume & it's mount
func SortVolumesByVolName ¶
Sorts volumes by name so they can be put in config file in any order. This allows the diff function to be clean when the volums are out of order.
func (*Volume) HasManualProvisioning ¶
HasManualProvisioning check weather the provisioning manual if manual returns true
func (*Volume) IsConfigMapVolume ¶
IsConfigMapVolume is check for volume type defined and if the type is configmap it will return true.
func (*Volume) IsSecretVolume ¶
IsSecretVolume returns true if volume is secret
func (*Volume) UnmarshalYAML ¶
UnmarshalYAML will unmarshal yaml volume definitions to Volume struct