-
Notifications
You must be signed in to change notification settings - Fork 865
/
well_known_constants.go
155 lines (127 loc) · 8.36 KB
/
well_known_constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
Copyright 2021 The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
const (
// ResourceBindingPermanentIDLabel is the identifier of a ResourceBinding object.
// Karmada generates a unique identifier, such as metadata.UUID, for each ResourceBinding object.
// This identifier will be used as a label selector to locate corresponding resources, such as Work.
// The reason for generating a new unique identifier instead of simply using metadata.UUID is because:
// In backup scenarios, when applying the backup resource manifest in a new cluster, the UUID may change.
ResourceBindingPermanentIDLabel = "resourcebinding.karmada.io/permanent-id"
// ClusterResourceBindingPermanentIDLabel is the identifier of a ClusterResourceBinding object.
// Karmada generates a unique identifier, such as metadata.UUID, for each ClusterResourceBinding object.
// This identifier will be used as a label selector to locate corresponding resources, such as Work.
// The reason for generating a new unique identifier instead of simply using metadata.UUID is because:
// In backup scenarios, when applying the backup resource manifest in a new cluster, the UUID may change.
ClusterResourceBindingPermanentIDLabel = "clusterresourcebinding.karmada.io/permanent-id"
// WorkPermanentIDLabel is the ID of Work object.
WorkPermanentIDLabel = "work.karmada.io/permanent-id"
// ResourceBindingUIDLabel is the UID of ResourceBinding object.
ResourceBindingUIDLabel = "resourcebinding.karmada.io/uid"
// ClusterResourceBindingUIDLabel is the uid of ClusterResourceBinding object.
ClusterResourceBindingUIDLabel = "clusterresourcebinding.karmada.io/uid"
// WorkNamespaceAnnotation is added to objects to specify associated Work's namespace.
WorkNamespaceAnnotation = "work.karmada.io/namespace"
// WorkNameAnnotation is added to objects to specify associated Work's name.
WorkNameAnnotation = "work.karmada.io/name"
// WorkUIDLabel is the uid of Work object.
WorkUIDLabel = "work.karmada.io/uid"
// ResourceBindingReferenceKey is the key of ResourceBinding object.
// It is usually a unique hash value of ResourceBinding object's namespace and name, intended to be added to the Work object.
// It will be used to retrieve all Works objects that derived from a specific ResourceBinding object.
ResourceBindingReferenceKey = "resourcebinding.karmada.io/key"
// ClusterResourceBindingReferenceKey is the key of ClusterResourceBinding object.
// It is usually a unique hash value of ClusterResourceBinding object's namespace and name, intended to be added to the Work object.
// It will be used to retrieve all Works objects that derived by a specific ClusterResourceBinding object.
ClusterResourceBindingReferenceKey = "clusterresourcebinding.karmada.io/key"
// 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"
// 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"
// 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"
// WorkNameLabel is added to objects to specify associated Work's name.
WorkNameLabel = "work.karmada.io/name"
)
// Define resource conflict resolution
const (
// ResourceConflictResolutionAnnotation is added to the resource template to specify how to resolve the conflict
// in case of resource already existing in member clusters.
// The valid value is:
// - overwrite: always overwrite the resource if already exist. The resource will be overwritten with the
// configuration from control plane.
// - abort: do not resolve the conflict and stop propagating to avoid unexpected overwrites (default value)
// Note: Propagation of the resource template without this annotation will fail in case of already exists.
ResourceConflictResolutionAnnotation = "work.karmada.io/conflict-resolution"
// ResourceConflictResolutionOverwrite is a value of ResourceConflictResolutionAnnotation, indicating the overwrite strategy.
ResourceConflictResolutionOverwrite = "overwrite"
// ResourceConflictResolutionAbort is a value of ResourceConflictResolutionAnnotation, indicating stop propagating.
ResourceConflictResolutionAbort = "abort"
)
// Define annotations that are added to the resource template.
const (
// ResourceTemplateUIDAnnotation is the annotation that is added to the manifest in the Work object.
// The annotation is used to identify the resource template which the manifest is derived from.
// The annotation can also be used to fire events when syncing Work to member clusters.
// For more details about UID, please refer to:
// https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
ResourceTemplateUIDAnnotation = "resourcetemplate.karmada.io/uid"
// ManagedLabels is the annotation that is added to the manifest in the Work object.
// It is used to identify the label keys that are present in the resource template.
// With this annotation, Karmada is able to accurately synchronize label changes
// against resource template and avoid the problem of accidentally retaining
// the deleted labels.
// E.g. "resourcetemplate.karmada.io/managed-labels: bar,foo".
// Note: the keys will be sorted in alphabetical order.
ManagedLabels = "resourcetemplate.karmada.io/managed-labels"
// ManagedAnnotation is the annotation that is added to the manifest in the Work object.
// It is used to identify the annotation keys that are present in the resource template.
// With this annotation, Karmada is able to accurately synchronize annotation changes
// against resource template and avoid the problem of accidentally retaining
// the deleted annotations.
// E.g. "resourcetemplate.karmada.io/managed-annotations: bar,foo".
// Note: the keys will be sorted in alphabetical order.
ManagedAnnotation = "resourcetemplate.karmada.io/managed-annotations"
// DeletionProtectionLabelKey If a user assigns the DeletionProtectionLabelKey label to a specific resource,
// and the value of this label is DeletionProtectionAlways, then deletion requests
// for this resource will be denied.
// In the current design, only the Value set to 'Always' will be protected,
// Additional options will be added here in the future.
DeletionProtectionLabelKey = "resourcetemplate.karmada.io/deletion-protected"
DeletionProtectionAlways = "Always"
)
// Define eviction reasons.
const (
// EvictionReasonTaintUntolerated describes the eviction is triggered
// because can not tolerate taint or exceed toleration period of time.
EvictionReasonTaintUntolerated = "TaintUntolerated"
// EvictionReasonApplicationFailure describes the eviction is triggered
// because the application fails and reaches the condition of ApplicationFailoverBehavior.
EvictionReasonApplicationFailure = "ApplicationFailure"
)
// Define eviction producers.
const (
// EvictionProducerTaintManager represents the name of taint manager.
EvictionProducerTaintManager = "TaintManager"
)