fix incorrect primary label value during promotion

This commit is contained in:
Forrest Thomas
2020-08-14 16:35:50 -07:00
parent 6f372d787d
commit c9dc5c5936
2 changed files with 4 additions and 2 deletions

View File

@@ -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{})

View File

@@ -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{})