mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -50,13 +50,13 @@ func (c *Controller) finalize(old interface{}) error {
|
||||
return fmt.Errorf("canary not ready during finalizing: %w", err)
|
||||
}
|
||||
|
||||
labelSelector, ports, err := canaryController.GetMetadata(canary)
|
||||
labelSelector, labelValue, ports, err := canaryController.GetMetadata(canary)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get metadata for router finalizing: %w", err)
|
||||
}
|
||||
|
||||
// Revert the Kubernetes service
|
||||
router := c.routerFactory.KubernetesRouter(canary.Spec.TargetRef.Kind, labelSelector, ports)
|
||||
router := c.routerFactory.KubernetesRouter(canary.Spec.TargetRef.Kind, labelSelector, labelValue, ports)
|
||||
if err := router.Finalize(canary); err != nil {
|
||||
return fmt.Errorf("failed revert router: %w", err)
|
||||
}
|
||||
|
||||
@@ -139,14 +139,14 @@ func (c *Controller) advanceCanary(name string, namespace string) {
|
||||
|
||||
// init controller based on target kind
|
||||
canaryController := c.canaryFactory.Controller(cd.Spec.TargetRef.Kind)
|
||||
labelSelector, ports, err := canaryController.GetMetadata(cd)
|
||||
labelSelector, labelValue, ports, err := canaryController.GetMetadata(cd)
|
||||
if err != nil {
|
||||
c.recordEventWarningf(cd, "%v", err)
|
||||
return
|
||||
}
|
||||
|
||||
// init Kubernetes router
|
||||
kubeRouter := c.routerFactory.KubernetesRouter(cd.Spec.TargetRef.Kind, labelSelector, ports)
|
||||
kubeRouter := c.routerFactory.KubernetesRouter(cd.Spec.TargetRef.Kind, labelSelector, labelValue, ports)
|
||||
|
||||
// reconcile the canary/primary services
|
||||
if err := kubeRouter.Initialize(cd); err != nil {
|
||||
@@ -271,7 +271,7 @@ func (c *Controller) advanceCanary(name string, namespace string) {
|
||||
}
|
||||
|
||||
// check if analysis should be skipped
|
||||
if skip := c.shouldSkipAnalysis(cd, canaryController, meshRouter); skip {
|
||||
if skip := c.shouldSkipAnalysis(cd, canaryController, meshRouter, err, retriable); skip {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -654,11 +654,20 @@ func (c *Controller) runAnalysis(canary *flaggerv1.Canary) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (c *Controller) shouldSkipAnalysis(canary *flaggerv1.Canary, canaryController canary.Controller, meshRouter router.Interface) bool {
|
||||
func (c *Controller) shouldSkipAnalysis(canary *flaggerv1.Canary, canaryController canary.Controller, meshRouter router.Interface, err error, retriable bool) bool {
|
||||
if !canary.SkipAnalysis() {
|
||||
return false
|
||||
}
|
||||
|
||||
// regardless if analysis is being skipped, rollback if canary failed to progress
|
||||
if !retriable || canary.Status.FailedChecks >= canary.GetAnalysisThreshold() {
|
||||
c.recordEventWarningf(canary, "Rolling back %s.%s progress deadline exceeded %v", canary.Name, canary.Namespace, err)
|
||||
c.alert(canary, fmt.Sprintf("Progress deadline exceeded %v", err), false, flaggerv1.SeverityError)
|
||||
c.rollback(canary, canaryController, meshRouter)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// route all traffic to primary
|
||||
primaryWeight := c.fullWeight(canary)
|
||||
canaryWeight := 0
|
||||
|
||||
@@ -87,7 +87,7 @@ func newDaemonSetFixture(c *flaggerv1.Canary) daemonSetFixture {
|
||||
KubeClient: kubeClient,
|
||||
FlaggerClient: flaggerClient,
|
||||
}
|
||||
canaryFactory := canary.NewFactory(kubeClient, flaggerClient, configTracker, []string{"app", "name"}, logger)
|
||||
canaryFactory := canary.NewFactory(kubeClient, flaggerClient, configTracker, []string{"app", "name"}, []string{""}, logger)
|
||||
|
||||
ctrl := &Controller{
|
||||
kubeClient: kubeClient,
|
||||
|
||||
@@ -115,7 +115,7 @@ func newDeploymentFixture(c *flaggerv1.Canary) fixture {
|
||||
KubeClient: kubeClient,
|
||||
FlaggerClient: flaggerClient,
|
||||
}
|
||||
canaryFactory := canary.NewFactory(kubeClient, flaggerClient, configTracker, []string{"app", "name"}, logger)
|
||||
canaryFactory := canary.NewFactory(kubeClient, flaggerClient, configTracker, []string{"app", "name"}, []string{""}, logger)
|
||||
|
||||
ctrl := &Controller{
|
||||
kubeClient: kubeClient,
|
||||
|
||||
@@ -65,7 +65,7 @@ func (c *Controller) checkMetricProviderAvailability(canary *flaggerv1.Canary) e
|
||||
}
|
||||
|
||||
if ok, err := provider.IsOnline(); !ok || err != nil {
|
||||
return fmt.Errorf("%v in metric tempalte %s.%s not avaiable: %v", template.Spec.Provider.Type,
|
||||
return fmt.Errorf("%v in metric template %s.%s not avaiable: %v", template.Spec.Provider.Type,
|
||||
template.Name, template.Namespace, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user