File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,8 @@ func (c *CanaryDeployer) Promote(cd *flaggerv1.Canary) error {
77
77
}
78
78
primaryCopy .Spec .Template .Annotations = annotations
79
79
80
+ primaryCopy .Spec .Template .Labels = makePrimaryLabels (canary .Spec .Template .Labels , primaryName )
81
+
80
82
_ , err = c .kubeClient .AppsV1 ().Deployments (cd .Namespace ).Update (primaryCopy )
81
83
if err != nil {
82
84
return fmt .Errorf ("updating deployment %s.%s template spec failed: %v" ,
@@ -403,7 +405,7 @@ func (c *CanaryDeployer) createPrimaryDeployment(cd *flaggerv1.Canary) error {
403
405
},
404
406
Template : corev1.PodTemplateSpec {
405
407
ObjectMeta : metav1.ObjectMeta {
406
- Labels : map [ string ] string { "app" : primaryName } ,
408
+ Labels : makePrimaryLabels ( canaryDep . Spec . Template . Labels , primaryName ) ,
407
409
Annotations : annotations ,
408
410
},
409
411
// update spec with the primary secrets and config maps
@@ -544,3 +546,16 @@ func (c *CanaryDeployer) makeAnnotations(annotations map[string]string) (map[str
544
546
545
547
return res , nil
546
548
}
549
+
550
+ func makePrimaryLabels (labels map [string ]string , primaryName string ) map [string ]string {
551
+ idKey := "app"
552
+ res := make (map [string ]string )
553
+ for k , v := range labels {
554
+ if k != idKey {
555
+ res [k ] = v
556
+ }
557
+ }
558
+ res [idKey ] = primaryName
559
+
560
+ return res
561
+ }
You can’t perform that action at this time.
0 commit comments