diff --git a/controllers/mdutil/util.go b/controllers/mdutil/util.go index 2edf8939f359..34bef06a5a6f 100644 --- a/controllers/mdutil/util.go +++ b/controllers/mdutil/util.go @@ -26,7 +26,7 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/go-logr/logr" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -34,6 +34,7 @@ import ( intstrutil "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/utils/integer" clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + "sigs.k8s.io/cluster-api/util/conversion" ) const ( @@ -139,11 +140,18 @@ func Revision(obj runtime.Object) (int64, error) { } var annotationsToSkip = map[string]bool{ - v1.LastAppliedConfigAnnotation: true, + corev1.LastAppliedConfigAnnotation: true, clusterv1.RevisionAnnotation: true, clusterv1.RevisionHistoryAnnotation: true, clusterv1.DesiredReplicasAnnotation: true, clusterv1.MaxReplicasAnnotation: true, + + // Exclude the conversion annotation, to avoid infinite loops between the conversion webhook + // and the MachineDeployment controller syncing the annotations between a MachineDeployment + // and its linked MachineSets. + // + // See https://github.com/kubernetes-sigs/cluster-api/pull/3010#issue-413767831 for more details. + conversion.DataAnnotation: true, } // skipCopyAnnotation returns true if we should skip copying the annotation with the given annotation key