Documentation ¶
Index ¶
- func CallWebhook(name string, namespace string, w flaggerv1.CanaryWebhook) error
- func CheckMetricsServer(address string) (bool, error)
- type CanaryDeployer
- func (c *CanaryDeployer) IncrementStatusIterations(cd *flaggerv1.Canary) error
- func (c *CanaryDeployer) IsCanaryReady(cd *flaggerv1.Canary) (bool, error)
- func (c *CanaryDeployer) IsNewSpec(cd *flaggerv1.Canary) (bool, error)
- func (c *CanaryDeployer) IsPrimaryReady(cd *flaggerv1.Canary) (bool, error)
- func (c *CanaryDeployer) Promote(cd *flaggerv1.Canary) error
- func (c *CanaryDeployer) Scale(cd *flaggerv1.Canary, replicas int32) error
- func (c *CanaryDeployer) SetStatusFailedChecks(cd *flaggerv1.Canary, val int) error
- func (c *CanaryDeployer) SetStatusIterations(cd *flaggerv1.Canary, val int) error
- func (c *CanaryDeployer) SetStatusPhase(cd *flaggerv1.Canary, phase flaggerv1.CanaryPhase) error
- func (c *CanaryDeployer) SetStatusWeight(cd *flaggerv1.Canary, val int) error
- func (c *CanaryDeployer) ShouldAdvance(cd *flaggerv1.Canary) (bool, error)
- func (c *CanaryDeployer) Sync(cd *flaggerv1.Canary) error
- func (c *CanaryDeployer) SyncStatus(cd *flaggerv1.Canary, status flaggerv1.CanaryStatus) error
- type CanaryJob
- type CanaryObserver
- func (c *CanaryObserver) GetDeploymentCounter(name string, namespace string, metric string, interval string) (float64, error)
- func (c *CanaryObserver) GetDeploymentHistogram(name string, namespace string, metric string, interval string) (time.Duration, error)
- func (c *CanaryObserver) GetEnvoySuccessRate(name string, namespace string, metric string, interval string) (float64, error)
- func (c *CanaryObserver) GetScalar(query string) (float64, error)
- type CanaryRecorder
- type ConfigRef
- type ConfigRefType
- type ConfigTracker
- func (ct *ConfigTracker) ApplyPrimaryConfigs(spec corev1.PodSpec, refs map[string]ConfigRef) corev1.PodSpec
- func (ct *ConfigTracker) CreatePrimaryConfigs(cd *flaggerv1.Canary, refs map[string]ConfigRef) error
- func (ct *ConfigTracker) GetConfigRefs(cd *flaggerv1.Canary) (*map[string]string, error)
- func (ct *ConfigTracker) GetTargetConfigs(cd *flaggerv1.Canary) (map[string]ConfigRef, error)
- func (ct *ConfigTracker) HasConfigChanged(cd *flaggerv1.Canary) (bool, error)
- type Controller
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 ¶
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 ¶
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 ¶
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
type ConfigRef ¶
type ConfigRef struct { Name string Type ConfigRefType Checksum string }
ConfigRef holds the reference to a tracked Kubernetes ConfigMap or Secret
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 ¶
GetConfigRefs returns a map of configs and their checksum
func (*ConfigTracker) GetTargetConfigs ¶
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