Merge pull request #1960 from calvin0327/move-cluster-annotations

rename cache resource annotation
This commit is contained in:
karmada-bot 2022-06-10 14:19:01 +08:00 committed by GitHub
commit a4576872ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -4,7 +4,6 @@ const (
// TaintClusterUnscheduler will be added when cluster becomes unschedulable
// and removed when cluster becomes scheduable.
TaintClusterUnscheduler = "cluster.karmada.io/unschedulable"
// TaintClusterNotReady will be added when cluster is not ready
// and removed when cluster becomes ready.
TaintClusterNotReady = "cluster.karmada.io/not-ready"
@ -12,4 +11,8 @@ const (
// (corresponding to ClusterConditionReady status ConditionUnknown)
// and removed when cluster becomes reachable (ClusterConditionReady status ConditionTrue).
TaintClusterUnreachable = "cluster.karmada.io/unreachable"
// CacheSourceAnnotationKey is the annotation that added to a resource to
// represent which cluster it cached from.
CacheSourceAnnotationKey = "resource.karmada.io/cached-from-cluster"
)

View File

@ -140,8 +140,8 @@ func addAnnotationWithClusterName(resourceObjects []runtime.Object, clusterName
if annotations == nil {
annotations = make(map[string]string)
}
// TODO: move this annotation key `cluster.karmada.io/name` to the Cluster API.
annotations["cluster.karmada.io/name"] = clusterName
annotations[clusterv1alpha1.CacheSourceAnnotationKey] = clusterName
resource.SetAnnotations(annotations)
resources = append(resources, resource)

View File

@ -175,7 +175,8 @@ func (os *OpenSearch) upsert(obj interface{}) {
if annotations == nil {
annotations = make(map[string]string)
}
annotations["cluster.karmada.io/name"] = os.cluster
annotations[clusterv1alpha1.CacheSourceAnnotationKey] = os.cluster
us.SetAnnotations(annotations)
doc := map[string]interface{}{