controller

package
v0.0.0-...-662d0f3 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallWebhook

func CallWebhook(name string, namespace string, w flaggerv1.CanaryWebhook) error

CallWebhook does a HTTP POST to an external service and returns an error if the response status code is non-2xx

func CheckMetricsServer

func CheckMetricsServer(address string) (bool, error)

CheckMetricsServer call Prometheus status endpoint and returns an error if the API is unreachable

Types

type CanaryDeployer

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

CanaryDeployer is managing the operations for Kubernetes deployment kind

func (*CanaryDeployer) IncrementStatusIterations

func (c *CanaryDeployer) IncrementStatusIterations(cd *flaggerv1.Canary) error

SetStatusWeight updates the canary status weight value

func (*CanaryDeployer) IsCanaryReady

func (c *CanaryDeployer) IsCanaryReady(cd *flaggerv1.Canary) (bool, error)

IsCanaryReady checks the primary deployment status and returns an error if the deployment is in the middle of a rolling update or if the pods are unhealthy it will return a non retriable error if the rolling update is stuck

func (*CanaryDeployer) IsNewSpec

func (c *CanaryDeployer) IsNewSpec(cd *flaggerv1.Canary) (bool, error)

IsNewSpec returns true if the canary deployment pod spec has changed

func (*CanaryDeployer) IsPrimaryReady

func (c *CanaryDeployer) IsPrimaryReady(cd *flaggerv1.Canary) (bool, error)

IsPrimaryReady checks the primary deployment status and returns an error if the deployment is in the middle of a rolling update or if the pods are unhealthy it will return a non retriable error if the rolling update is stuck

func (*CanaryDeployer) Promote

func (c *CanaryDeployer) Promote(cd *flaggerv1.Canary) error

Promote copies the pod spec, secrets and config maps from canary to primary

func (*CanaryDeployer) Scale

func (c *CanaryDeployer) Scale(cd *flaggerv1.Canary, replicas int32) error

Scale sets the canary deployment replicas

func (*CanaryDeployer) SetStatusFailedChecks

func (c *CanaryDeployer) SetStatusFailedChecks(cd *flaggerv1.Canary, val int) error

SetStatusFailedChecks updates the canary failed checks counter

func (*CanaryDeployer) SetStatusIterations

func (c *CanaryDeployer) SetStatusIterations(cd *flaggerv1.Canary, val int) error

SetStatusIterations updates the canary status iterations value

func (*CanaryDeployer) SetStatusPhase

func (c *CanaryDeployer) SetStatusPhase(cd *flaggerv1.Canary, phase flaggerv1.CanaryPhase) error

SetStatusPhase updates the canary status phase

func (*CanaryDeployer) SetStatusWeight

func (c *CanaryDeployer) SetStatusWeight(cd *flaggerv1.Canary, val int) error

SetStatusWeight updates the canary status weight value

func (*CanaryDeployer) ShouldAdvance

func (c *CanaryDeployer) ShouldAdvance(cd *flaggerv1.Canary) (bool, error)

ShouldAdvance determines if the canary analysis can proceed

func (*CanaryDeployer) Sync

func (c *CanaryDeployer) Sync(cd *flaggerv1.Canary) error

Sync creates the primary deployment and hpa and scales to zero the canary deployment

func (*CanaryDeployer) SyncStatus

func (c *CanaryDeployer) SyncStatus(cd *flaggerv1.Canary, status flaggerv1.CanaryStatus) error

SyncStatus encodes the canary pod spec and updates the canary status

type CanaryJob

type CanaryJob struct {
	Name      string
	Namespace string
	SkipTests bool
	// contains filtered or unexported fields
}

CanaryJob holds the reference to a canary deployment schedule

func (CanaryJob) GetCanaryAnalysisInterval

func (j CanaryJob) GetCanaryAnalysisInterval() time.Duration

func (CanaryJob) Start

func (j CanaryJob) Start()

Start runs the canary analysis on a schedule

func (CanaryJob) Stop

func (j CanaryJob) Stop()

Stop closes the job channel and stops the ticker

type CanaryObserver

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

CanaryObserver is used to query the Istio Prometheus db

func (*CanaryObserver) GetDeploymentCounter

func (c *CanaryObserver) GetDeploymentCounter(name string, namespace string, metric string, interval string) (float64, error)

GetDeploymentCounter returns the requests success rate using istio_requests_total metric

func (*CanaryObserver) GetDeploymentHistogram

func (c *CanaryObserver) GetDeploymentHistogram(name string, namespace string, metric string, interval string) (time.Duration, error)

GetDeploymentHistogram returns the 99P requests delay using istio_request_duration_seconds_bucket metrics

func (*CanaryObserver) GetEnvoySuccessRate

func (c *CanaryObserver) GetEnvoySuccessRate(name string, namespace string, metric string, interval string) (float64, error)

func (*CanaryObserver) GetScalar

func (c *CanaryObserver) GetScalar(query string) (float64, error)

GetScalar runs the promql query and returns the first value found

type CanaryRecorder

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

CanaryRecorder records the canary analysis as Prometheus metrics

func NewCanaryRecorder

func NewCanaryRecorder(register bool) CanaryRecorder

NewCanaryRecorder creates a new recorder and registers the Prometheus metrics

func (*CanaryRecorder) SetDuration

func (cr *CanaryRecorder) SetDuration(cd *flaggerv1.Canary, duration time.Duration)

SetDuration sets the time spent in seconds performing canary analysis

func (*CanaryRecorder) SetStatus

func (cr *CanaryRecorder) SetStatus(cd *flaggerv1.Canary)

SetStatus sets the last known canary analysis status

func (*CanaryRecorder) SetTotal

func (cr *CanaryRecorder) SetTotal(namespace string, total int)

SetTotal sets the total number of canaries per namespace

func (*CanaryRecorder) SetWeight

func (cr *CanaryRecorder) SetWeight(cd *flaggerv1.Canary, primary int, canary int)

SetWeight sets the weight values for primary and canary destinations

type ConfigRef

type ConfigRef struct {
	Name     string
	Type     ConfigRefType
	Checksum string
}

ConfigRef holds the reference to a tracked Kubernetes ConfigMap or Secret

func (*ConfigRef) GetName

func (c *ConfigRef) GetName() string

GetName returns the config ref type and name

type ConfigRefType

type ConfigRefType string
const (
	ConfigRefMap    ConfigRefType = "configmap"
	ConfigRefSecret ConfigRefType = "secret"
)

type ConfigTracker

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

ConfigTracker is managing the operations for Kubernetes ConfigMaps and Secrets

func (*ConfigTracker) ApplyPrimaryConfigs

func (ct *ConfigTracker) ApplyPrimaryConfigs(spec corev1.PodSpec, refs map[string]ConfigRef) corev1.PodSpec

ApplyPrimaryConfigs appends the primary suffix to all ConfigMaps and Secretes found in the PodSpec

func (*ConfigTracker) CreatePrimaryConfigs

func (ct *ConfigTracker) CreatePrimaryConfigs(cd *flaggerv1.Canary, refs map[string]ConfigRef) error

CreatePrimaryConfigs syncs the primary Kubernetes ConfigMaps and Secretes with those found in the target deployment

func (*ConfigTracker) GetConfigRefs

func (ct *ConfigTracker) GetConfigRefs(cd *flaggerv1.Canary) (*map[string]string, error)

GetConfigRefs returns a map of configs and their checksum

func (*ConfigTracker) GetTargetConfigs

func (ct *ConfigTracker) GetTargetConfigs(cd *flaggerv1.Canary) (map[string]ConfigRef, error)

GetTargetConfigs scans the target deployment for Kubernetes ConfigMaps and Secretes and returns a list of config references

func (*ConfigTracker) HasConfigChanged

func (ct *ConfigTracker) HasConfigChanged(cd *flaggerv1.Canary) (bool, error)

HasConfigChanged checks for changes in ConfigMaps and Secretes by comparing the checksum for each ConfigRef stored in Canary.Status.TrackedConfigs

type Controller

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

Controller is managing the canary objects and schedules canary deployments

func NewController

func NewController(
	kubeClient kubernetes.Interface,
	istioClient clientset.Interface,
	flaggerClient clientset.Interface,
	flaggerInformer flaggerinformers.CanaryInformer,
	flaggerWindow time.Duration,
	metricServer string,
	logger *zap.SugaredLogger,
	notifier *notifier.Slack,
	meshProvider string,

) *Controller

func (*Controller) Run

func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error

Run starts the K8s workers and the canary scheduler

Jump to

Keyboard shortcuts

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