Merge pull request #4950 from whitewindmills/bindID-webhook
cleanup dead code of generating binding permanent id
This commit is contained in:
commit
1ebaf1d5a8
|
@ -20,7 +20,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/google/uuid"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/equality"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
|
@ -407,10 +406,6 @@ func (c *MCSController) propagateService(ctx context.Context, mcs *networkingv1a
|
|||
"try again later after binding is garbage collected, see https://github.com/karmada-io/karmada/issues/2090")
|
||||
}
|
||||
|
||||
if util.GetLabelValue(bindingCopy.Labels, workv1alpha2.ResourceBindingPermanentIDLabel) == "" {
|
||||
bindingCopy.Labels = util.DedupeAndMergeLabels(bindingCopy.Labels,
|
||||
map[string]string{workv1alpha2.ResourceBindingPermanentIDLabel: uuid.New().String()})
|
||||
}
|
||||
// Just update necessary fields, especially avoid modifying Spec.Clusters which is scheduling result, if already exists.
|
||||
bindingCopy.Annotations = util.DedupeAndMergeAnnotations(bindingCopy.Annotations, binding.Annotations)
|
||||
bindingCopy.Labels = util.DedupeAndMergeLabels(bindingCopy.Labels, binding.Labels)
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/google/uuid"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
|
@ -538,8 +537,6 @@ func (d *DependenciesDistributor) createOrUpdateAttachedBinding(attachedBinding
|
|||
return err
|
||||
}
|
||||
|
||||
attachedBinding.Labels = util.DedupeAndMergeLabels(attachedBinding.Labels,
|
||||
map[string]string{workv1alpha2.ResourceBindingPermanentIDLabel: uuid.New().String()})
|
||||
if err := d.Client.Create(context.TODO(), attachedBinding); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -653,8 +650,8 @@ func buildAttachedBinding(binding *workv1alpha2.ResourceBinding, object *unstruc
|
|||
Clusters: binding.Spec.Clusters,
|
||||
})
|
||||
|
||||
policyID := util.GetLabelValue(binding.Labels, workv1alpha2.ResourceBindingPermanentIDLabel)
|
||||
dependedLabels = util.DedupeAndMergeLabels(dependedLabels, map[string]string{bindingDependedIDLabelKey: policyID})
|
||||
bindingID := util.GetLabelValue(binding.Labels, workv1alpha2.ResourceBindingPermanentIDLabel)
|
||||
dependedLabels = util.DedupeAndMergeLabels(dependedLabels, map[string]string{bindingDependedIDLabelKey: bindingID})
|
||||
return &workv1alpha2.ResourceBinding{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: names.GenerateBindingName(object.GetKind(), object.GetName()),
|
||||
|
|
|
@ -496,10 +496,6 @@ func (d *ResourceDetector) ApplyPolicy(object *unstructured.Unstructured, object
|
|||
"try again later after binding is garbage collected, see https://github.com/karmada-io/karmada/issues/2090")
|
||||
}
|
||||
|
||||
if util.GetLabelValue(bindingCopy.Labels, workv1alpha2.ResourceBindingPermanentIDLabel) == "" {
|
||||
bindingCopy.Labels = util.DedupeAndMergeLabels(bindingCopy.Labels,
|
||||
map[string]string{workv1alpha2.ResourceBindingPermanentIDLabel: uuid.New().String()})
|
||||
}
|
||||
// Just update necessary fields, especially avoid modifying Spec.Clusters which is scheduling result, if already exists.
|
||||
bindingCopy.Annotations = util.DedupeAndMergeAnnotations(bindingCopy.Annotations, binding.Annotations)
|
||||
bindingCopy.Labels = util.DedupeAndMergeLabels(bindingCopy.Labels, binding.Labels)
|
||||
|
@ -596,10 +592,6 @@ func (d *ResourceDetector) ApplyClusterPolicy(object *unstructured.Unstructured,
|
|||
"try again later after binding is garbage collected, see https://github.com/karmada-io/karmada/issues/2090")
|
||||
}
|
||||
|
||||
if util.GetLabelValue(bindingCopy.Labels, workv1alpha2.ResourceBindingPermanentIDLabel) == "" {
|
||||
bindingCopy.Labels = util.DedupeAndMergeLabels(bindingCopy.Labels,
|
||||
map[string]string{workv1alpha2.ResourceBindingPermanentIDLabel: uuid.New().String()})
|
||||
}
|
||||
// Just update necessary fields, especially avoid modifying Spec.Clusters which is scheduling result, if already exists.
|
||||
bindingCopy.Annotations = util.DedupeAndMergeAnnotations(bindingCopy.Annotations, binding.Annotations)
|
||||
bindingCopy.Labels = util.DedupeAndMergeLabels(bindingCopy.Labels, binding.Labels)
|
||||
|
@ -646,10 +638,6 @@ func (d *ResourceDetector) ApplyClusterPolicy(object *unstructured.Unstructured,
|
|||
"try again later after binding is garbage collected, see https://github.com/karmada-io/karmada/issues/2090")
|
||||
}
|
||||
|
||||
if util.GetLabelValue(bindingCopy.Labels, workv1alpha2.ClusterResourceBindingPermanentIDLabel) == "" {
|
||||
bindingCopy.Labels = util.DedupeAndMergeLabels(bindingCopy.Labels,
|
||||
map[string]string{workv1alpha2.ClusterResourceBindingPermanentIDLabel: uuid.New().String()})
|
||||
}
|
||||
// Just update necessary fields, especially avoid modifying Spec.Clusters which is scheduling result, if already exists.
|
||||
bindingCopy.Annotations = util.DedupeAndMergeAnnotations(bindingCopy.Annotations, binding.Annotations)
|
||||
bindingCopy.Labels = util.DedupeAndMergeLabels(bindingCopy.Labels, binding.Labels)
|
||||
|
|
Loading…
Reference in New Issue