rename misleading label constant
Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
This commit is contained in:
parent
5c3336e84c
commit
56d1570439
|
@ -11,14 +11,23 @@ const (
|
|||
// It will be used to retrieve all Works objects that derived by a specific ClusterResourceBinding object.
|
||||
ClusterResourceBindingReferenceKey = "clusterresourcebinding.karmada.io/key"
|
||||
|
||||
// ResourceBindingNamespaceLabel is added to objects to specify associated ResourceBinding's namespace.
|
||||
ResourceBindingNamespaceLabel = "resourcebinding.karmada.io/namespace"
|
||||
// ResourceBindingNamespaceAnnotationKey is added to object to describe the associated ResourceBinding's namespace.
|
||||
// It is added to:
|
||||
// - Work object: describes the namespace of ResourceBinding which the Work derived from.
|
||||
// - Manifest in Work object: describes the namespace of ResourceBinding which the manifest derived from.
|
||||
ResourceBindingNamespaceAnnotationKey = "resourcebinding.karmada.io/namespace"
|
||||
|
||||
// ResourceBindingNameLabel is added to objects to specify associated ResourceBinding's name.
|
||||
ResourceBindingNameLabel = "resourcebinding.karmada.io/name"
|
||||
// ResourceBindingNameAnnotationKey is added to object to describe the associated ResourceBinding's name.
|
||||
// It is added to:
|
||||
// - Work object: describes the name of ResourceBinding which the Work derived from.
|
||||
// - Manifest in Work object: describes the name of ResourceBinding which the manifest derived from.
|
||||
ResourceBindingNameAnnotationKey = "resourcebinding.karmada.io/name"
|
||||
|
||||
// ClusterResourceBindingLabel is added to objects to specify associated ClusterResourceBinding.
|
||||
ClusterResourceBindingLabel = "clusterresourcebinding.karmada.io/name"
|
||||
// ClusterResourceBindingAnnotationKey is added to object to describe associated ClusterResourceBinding's name.
|
||||
// It is added to:
|
||||
// - Work object: describes the name of ClusterResourceBinding which the Work derived from.
|
||||
// - Manifest in Work object: describes the name of ClusterResourceBinding which the manifest derived from.
|
||||
ClusterResourceBindingAnnotationKey = "clusterresourcebinding.karmada.io/name"
|
||||
|
||||
// WorkNamespaceLabel is added to objects to specify associated Work's namespace.
|
||||
WorkNamespaceLabel = "work.karmada.io/namespace"
|
|
@ -208,8 +208,8 @@ func (c *ResourceBindingController) SetupWithManager(mgr controllerruntime.Manag
|
|||
func(a client.Object) []reconcile.Request {
|
||||
var requests []reconcile.Request
|
||||
annotations := a.GetAnnotations()
|
||||
crNamespace, namespaceExist := annotations[workv1alpha2.ResourceBindingNamespaceLabel]
|
||||
crName, nameExist := annotations[workv1alpha2.ResourceBindingNameLabel]
|
||||
crNamespace, namespaceExist := annotations[workv1alpha2.ResourceBindingNamespaceAnnotationKey]
|
||||
crName, nameExist := annotations[workv1alpha2.ResourceBindingNameAnnotationKey]
|
||||
if namespaceExist && nameExist {
|
||||
requests = append(requests, reconcile.Request{
|
||||
NamespacedName: types.NamespacedName{
|
||||
|
|
|
@ -151,7 +151,7 @@ func (c *ClusterResourceBindingController) SetupWithManager(mgr controllerruntim
|
|||
func(a client.Object) []reconcile.Request {
|
||||
var requests []reconcile.Request
|
||||
annotations := a.GetAnnotations()
|
||||
crbName, nameExist := annotations[workv1alpha2.ClusterResourceBindingLabel]
|
||||
crbName, nameExist := annotations[workv1alpha2.ClusterResourceBindingAnnotationKey]
|
||||
if nameExist {
|
||||
requests = append(requests, reconcile.Request{
|
||||
NamespacedName: types.NamespacedName{
|
||||
|
|
|
@ -198,13 +198,13 @@ func mergeLabel(workload *unstructured.Unstructured, workNamespace string, bindi
|
|||
func mergeAnnotations(workload *unstructured.Unstructured, binding metav1.Object, scope apiextensionsv1.ResourceScope) map[string]string {
|
||||
annotations := make(map[string]string)
|
||||
if scope == apiextensionsv1.NamespaceScoped {
|
||||
util.MergeAnnotation(workload, workv1alpha2.ResourceBindingNamespaceLabel, binding.GetNamespace())
|
||||
util.MergeAnnotation(workload, workv1alpha2.ResourceBindingNameLabel, binding.GetName())
|
||||
annotations[workv1alpha2.ResourceBindingNamespaceLabel] = binding.GetNamespace()
|
||||
annotations[workv1alpha2.ResourceBindingNameLabel] = binding.GetName()
|
||||
util.MergeAnnotation(workload, workv1alpha2.ResourceBindingNamespaceAnnotationKey, binding.GetNamespace())
|
||||
util.MergeAnnotation(workload, workv1alpha2.ResourceBindingNameAnnotationKey, binding.GetName())
|
||||
annotations[workv1alpha2.ResourceBindingNamespaceAnnotationKey] = binding.GetNamespace()
|
||||
annotations[workv1alpha2.ResourceBindingNameAnnotationKey] = binding.GetName()
|
||||
} else {
|
||||
util.MergeAnnotation(workload, workv1alpha2.ClusterResourceBindingLabel, binding.GetName())
|
||||
annotations[workv1alpha2.ClusterResourceBindingLabel] = binding.GetName()
|
||||
util.MergeAnnotation(workload, workv1alpha2.ClusterResourceBindingAnnotationKey, binding.GetName())
|
||||
annotations[workv1alpha2.ClusterResourceBindingAnnotationKey] = binding.GetName()
|
||||
}
|
||||
|
||||
return annotations
|
||||
|
|
Loading…
Reference in New Issue