diff --git a/pkg/canary/daemonset_controller.go b/pkg/canary/daemonset_controller.go index a8d74de8..cff63280 100644 --- a/pkg/canary/daemonset_controller.go +++ b/pkg/canary/daemonset_controller.go @@ -108,6 +108,7 @@ func (c *DaemonSetController) Promote(cd *flaggerv1.Canary) error { } label, labelValue, err := c.getSelectorLabel(canary) + primaryLabelValue := fmt.Sprintf("%s-primary", labelValue); if err != nil { return fmt.Errorf("getSelectorLabel failed: %w", err) } @@ -146,7 +147,7 @@ func (c *DaemonSetController) Promote(cd *flaggerv1.Canary) error { } primaryCopy.Spec.Template.Annotations = annotations - primaryCopy.Spec.Template.Labels = makePrimaryLabels(canary.Spec.Template.Labels, labelValue, label) + primaryCopy.Spec.Template.Labels = makePrimaryLabels(canary.Spec.Template.Labels, primaryLabelValue, label) // apply update _, err = c.kubeClient.AppsV1().DaemonSets(cd.Namespace).Update(context.TODO(), primaryCopy, metav1.UpdateOptions{}) diff --git a/pkg/canary/deployment_controller.go b/pkg/canary/deployment_controller.go index b57a8d09..c3e3cc4e 100644 --- a/pkg/canary/deployment_controller.go +++ b/pkg/canary/deployment_controller.go @@ -73,6 +73,7 @@ func (c *DeploymentController) Promote(cd *flaggerv1.Canary) error { } label, labelValue, err := c.getSelectorLabel(canary) + primaryLabelValue := fmt.Sprintf("%s-primary", labelValue); if err != nil { return fmt.Errorf("getSelectorLabel failed: %w", err) } @@ -107,7 +108,7 @@ func (c *DeploymentController) Promote(cd *flaggerv1.Canary) error { } primaryCopy.Spec.Template.Annotations = annotations - primaryCopy.Spec.Template.Labels = makePrimaryLabels(canary.Spec.Template.Labels, labelValue, label) + primaryCopy.Spec.Template.Labels = makePrimaryLabels(canary.Spec.Template.Labels, primaryLabelValue, label) // apply update _, err = c.kubeClient.AppsV1().Deployments(cd.Namespace).Update(context.TODO(), primaryCopy, metav1.UpdateOptions{})