diff --git a/pkg/apis/work/v1alpha2/well_known_constants.go b/pkg/apis/work/v1alpha2/well_known_constants.go index 746ae74a6be3..746b318a3e23 100644 --- a/pkg/apis/work/v1alpha2/well_known_constants.go +++ b/pkg/apis/work/v1alpha2/well_known_constants.go @@ -124,12 +124,6 @@ const ( // Additional options will be added here in the future. DeletionProtectionLabelKey = "resourcetemplate.karmada.io/deletion-protected" DeletionProtectionAlways = "Always" - - // ResourceBindingFailoverLabel If a resource is failed over by karmada, this label will be attached - // to the rescheduled workload. The value will denote the type of failover that occurred, either cluster or application. - // This can be useful if applications are stateful and need to know when they have been failed over by Karmada, - // as opposed to being scheduled fresh. - ResourceBindingFailoverLabel = "resourcebinding.karmada.io/failover-type" ) // Define eviction reasons. diff --git a/pkg/controllers/utils/common.go b/pkg/controllers/utils/common.go index be31617323e6..dcf9c01f9a90 100644 --- a/pkg/controllers/utils/common.go +++ b/pkg/controllers/utils/common.go @@ -25,12 +25,18 @@ import ( "k8s.io/klog/v2" "sigs.k8s.io/controller-runtime/pkg/client" + policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" "github.com/karmada-io/karmada/pkg/util/helper" ) // UpdateFailoverStatus adds a failoverHistoryItem to the failoverHistory field in the ResourceBinding. func UpdateFailoverStatus(client client.Client, binding *workv1alpha2.ResourceBinding, clusters []string, failoverType workv1alpha2.FailoverReason) (err error) { + // If the resource is Duplicated, then it does not have a concept of failover. We skip attaching that status here. + placement := binding.Spec.Placement + if placement != nil && binding.Spec.Placement.ReplicaSchedulingType() == policyv1alpha1.ReplicaSchedulingTypeDuplicated { + return nil + } klog.V(4).Infof("Updating failover status for ResourceBinding(%s/%s)", binding.Name, binding.Namespace) err = retry.RetryOnConflict(retry.DefaultRetry, func() (err error) { _, err = helper.UpdateStatus(context.Background(), client, binding, func() error {