diff --git a/pkg/canary/util.go b/pkg/canary/util.go index e7deb6c07..8ebc06154 100644 --- a/pkg/canary/util.go +++ b/pkg/canary/util.go @@ -83,6 +83,10 @@ func makeAnnotations(annotations map[string]string) (map[string]string, error) { id := fmt.Sprintf("%x-%x-%x-%x-%x", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]) for k, v := range annotations { + // skip Flux GC markers + if strings.Contains(k, "/checksum") { + continue + } if k != idKey { res[k] = v } diff --git a/pkg/router/ingress.go b/pkg/router/ingress.go index 01fd58a3a..2f605d8bb 100644 --- a/pkg/router/ingress.go +++ b/pkg/router/ingress.go @@ -211,7 +211,7 @@ func (i *IngressRouter) SetRoutes( func (i *IngressRouter) makeAnnotations(annotations map[string]string) map[string]string { res := make(map[string]string) - for k, v := range annotations { + for k, v := range makeAnnotations(annotations) { if !strings.Contains(k, i.GetAnnotationWithPrefix("canary")) && !strings.Contains(k, "kubectl.kubernetes.io/last-applied-configuration") && !strings.Contains(k, i.GetAnnotationWithPrefix("canary-weight")) && @@ -232,7 +232,7 @@ func (i *IngressRouter) makeAnnotations(annotations map[string]string) map[strin func (i *IngressRouter) makeHeaderAnnotations(annotations map[string]string, header string, headerValue string, headerRegex string, cookie string) map[string]string { res := make(map[string]string) - for k, v := range annotations { + for k, v := range makeAnnotations(annotations) { if !strings.Contains(v, i.GetAnnotationWithPrefix("canary")) { res[k] = v } diff --git a/pkg/router/istio.go b/pkg/router/istio.go index 7cf6d6f18..6794b28ab 100644 --- a/pkg/router/istio.go +++ b/pkg/router/istio.go @@ -259,6 +259,8 @@ func (ir *IstioRouter) reconcileVirtualService(canary *flaggerv1.Canary) error { if vtClone.ObjectMeta.Annotations == nil { vtClone.ObjectMeta.Annotations = make(map[string]string) + } else { + vtClone.ObjectMeta.Annotations = makeAnnotations(vtClone.ObjectMeta.Annotations) } vtClone.ObjectMeta.Annotations[configAnnotation] = string(b) diff --git a/pkg/router/kubernetes_default.go b/pkg/router/kubernetes_default.go index a289ae3a6..3f79bf2bc 100644 --- a/pkg/router/kubernetes_default.go +++ b/pkg/router/kubernetes_default.go @@ -206,8 +206,8 @@ func (c *KubernetesDefaultRouter) reconcileService(canary *flaggerv1.Canary, nam if svc.ObjectMeta.Annotations == nil { svc.ObjectMeta.Annotations = make(map[string]string) } - if diff := cmp.Diff(metadata.Annotations, svc.ObjectMeta.Annotations); diff != "" { - svcClone.ObjectMeta.Annotations = metadata.Annotations + if diff := cmp.Diff(makeAnnotations(metadata.Annotations), svc.ObjectMeta.Annotations); diff != "" { + svcClone.ObjectMeta.Annotations = makeAnnotations(metadata.Annotations) updateService = true } if diff := cmp.Diff(metadata.Labels, svc.ObjectMeta.Labels); diff != "" { diff --git a/pkg/router/skipper.go b/pkg/router/skipper.go index 76285dbea..50d06bf53 100644 --- a/pkg/router/skipper.go +++ b/pkg/router/skipper.go @@ -129,7 +129,7 @@ func (skp *SkipperRouter) Reconcile(canary *flaggerv1.Canary) error { if cmp.Diff(iClone.Spec, canaryIngress.Spec) != "" { ingressClone := canaryIngress.DeepCopy() ingressClone.Spec = iClone.Spec - ingressClone.Annotations = iClone.Annotations + ingressClone.Annotations = makeAnnotations(iClone.Annotations) _, err := skp.kubeClient.NetworkingV1().Ingresses(canary.Namespace).Update(context.TODO(), ingressClone, metav1.UpdateOptions{}) if err != nil { diff --git a/pkg/router/traefik.go b/pkg/router/traefik.go index b502d0a1a..ab3a79cd7 100644 --- a/pkg/router/traefik.go +++ b/pkg/router/traefik.go @@ -72,7 +72,7 @@ func (tr *TraefikRouter) Reconcile(canary *flaggerv1.Canary) error { Name: apexName, Namespace: canary.Namespace, Labels: tsMetadata.Labels, - Annotations: tsMetadata.Annotations, + Annotations: makeAnnotations(tsMetadata.Annotations), OwnerReferences: []metav1.OwnerReference{ *metav1.NewControllerRef(canary, schema.GroupVersionKind{ Group: flaggerv1.SchemeGroupVersion.Group, diff --git a/pkg/router/util.go b/pkg/router/util.go index e2bb04ee3..d6748968b 100644 --- a/pkg/router/util.go +++ b/pkg/router/util.go @@ -17,3 +17,15 @@ func includeLabelsByPrefix(labels map[string]string, includeLabelPrefixes []stri return filteredLabels } + +func makeAnnotations(in map[string]string) map[string]string { + out := make(map[string]string) + for key, value := range in { + // skip Flux GC markers + if strings.Contains(key, "/checksum") { + continue + } + out[key] = value + } + return out +}