Skip to content

Commit 42d2bfc

Browse files
refactor labels comments (#29)
1 parent dcf4e9b commit 42d2bfc

File tree

1 file changed

+50
-25
lines changed

1 file changed

+50
-25
lines changed

apps/v1alpha1/well_known_labels.go

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,39 @@ const (
2222

2323
// PodOpsLifecycle labels
2424
const (
25-
PodOperatingLabelPrefix = "operating.podopslifecycle.kusionstack.io" // indicate a pod is operating
26-
PodOperationTypeLabelPrefix = "operation-type.podopslifecycle.kusionstack.io" // indicate the type of operation
27-
PodOperationPermissionLabelPrefix = "operation-permission.podopslifecycle.kusionstack.io" // indicate the permission of operation
28-
PodUndoOperationTypeLabelPrefix = "undo-operation-type.podopslifecycle.kusionstack.io" // indicate the type of operation has been canceled
29-
PodDoneOperationTypeLabelPrefix = "done-operation-type.podopslifecycle.kusionstack.io" // indicate the type of operation has been done
25+
// PodOperatingLabelPrefix indicates a pod is operating
26+
PodOperatingLabelPrefix = "operating.podopslifecycle.kusionstack.io"
27+
// PodOperationTypeLabelPrefix indicates the type of operation
28+
PodOperationTypeLabelPrefix = "operation-type.podopslifecycle.kusionstack.io"
29+
// PodOperationPermissionLabelPrefix indicates the permission of operation
30+
PodOperationPermissionLabelPrefix = "operation-permission.podopslifecycle.kusionstack.io"
31+
// PodUndoOperationTypeLabelPrefix indicates the type of operation has been canceled
32+
PodUndoOperationTypeLabelPrefix = "undo-operation-type.podopslifecycle.kusionstack.io"
33+
// PodDoneOperationTypeLabelPrefix indicates the type of operation has been done
34+
PodDoneOperationTypeLabelPrefix = "done-operation-type.podopslifecycle.kusionstack.io"
3035

31-
PodPreCheckLabelPrefix = "pre-check.podopslifecycle.kusionstack.io" // indicate a pod is in pre-check phase
32-
PodPreCheckedLabelPrefix = "pre-checked.podopslifecycle.kusionstack.io" // indicate a pod has finished pre-check phase
33-
PodPreparingLabelPrefix = "preparing.podopslifecycle.kusionstack.io" // indicate a pod is preparing for operation
34-
PodOperateLabelPrefix = "operate.podopslifecycle.kusionstack.io" // indicate a pod is in operate phase
35-
PodOperatedLabelPrefix = "operated.podopslifecycle.kusionstack.io" // indicate a pod has finished operate phase
36-
PodPostCheckLabelPrefix = "post-check.podopslifecycle.kusionstack.io" // indicate a pod is in post-check phase
37-
PodPostCheckedLabelPrefix = "post-checked.podopslifecycle.kusionstack.io" // indicate a pod has finished post-check phase
38-
PodCompletingLabelPrefix = "completing.podopslifecycle.kusionstack.io" // indicate a pod is completing operation
36+
// PodPreCheckLabelPrefix indicates a pod is in pre-check phase
37+
PodPreCheckLabelPrefix = "pre-check.podopslifecycle.kusionstack.io"
38+
// PodPreCheckedLabelPrefix indicates a pod has finished pre-check phase
39+
PodPreCheckedLabelPrefix = "pre-checked.podopslifecycle.kusionstack.io"
40+
// PodPreparingLabelPrefix indicates a pod is preparing for operation
41+
PodPreparingLabelPrefix = "preparing.podopslifecycle.kusionstack.io"
42+
// PodOperateLabelPrefix indicates a pod is in operate phase
43+
PodOperateLabelPrefix = "operate.podopslifecycle.kusionstack.io"
44+
// PodOperatedLabelPrefix indicates a pod has finished operate phase
45+
PodOperatedLabelPrefix = "operated.podopslifecycle.kusionstack.io"
46+
// PodPostCheckLabelPrefix indicates a pod is in post-check phase
47+
PodPostCheckLabelPrefix = "post-check.podopslifecycle.kusionstack.io"
48+
// PodPostCheckedLabelPrefix indicates a pod has finished post-check phase
49+
PodPostCheckedLabelPrefix = "post-checked.podopslifecycle.kusionstack.io"
50+
// PodCompletingLabelPrefix indicates a pod is completing operation
51+
PodCompletingLabelPrefix = "completing.podopslifecycle.kusionstack.io"
3952

40-
PodServiceAvailableLabel = "podopslifecycle.kusionstack.io/service-available" // indicate a pod is available to serve
41-
PodStayOfflineLabel = "podopslifecycle.kusionstack.io/stay-offline" // indicate a pod is not ready and available to serve
42-
PodPreparingDeleteLabel = "podopslifecycle.kusionstack.io/preparing-to-delete"
53+
// PodServiceAvailableLabel indicates a pod is available to serve
54+
PodServiceAvailableLabel = "podopslifecycle.kusionstack.io/service-available"
55+
// PodStayOfflineLabel indicates a pod is not ready and available to serve
56+
PodStayOfflineLabel = "podopslifecycle.kusionstack.io/stay-offline"
57+
PodPreparingDeleteLabel = "podopslifecycle.kusionstack.io/preparing-to-delete"
4358
)
4459

4560
var (
@@ -50,19 +65,29 @@ var (
5065

5166
// CollaSet labels
5267
const (
53-
PodInstanceIDLabelKey = "collaset.kusionstack.io/instance-id" // used to attach Pod instance ID on Pod
54-
CollaSetUpdateIndicateLabelKey = "collaset.kusionstack.io/update-included" // used to indicate a pod should be updated by label
55-
PodUpgradeByRecreateLabelKey = "collaset.kusionstack.io/upgrade-by-recreating" // used to indicate a pod is upgraded by recreate
68+
// PodInstanceIDLabelKey is used to attach Pod instance ID on Pod
69+
PodInstanceIDLabelKey = "collaset.kusionstack.io/instance-id"
70+
// CollaSetUpdateIndicateLabelKey is used to indicate a pod should be updated by label
71+
CollaSetUpdateIndicateLabelKey = "collaset.kusionstack.io/update-included"
5672

57-
PodDeletionIndicationLabelKey = "collaset.kusionstack.io/to-delete" // users can use this label to indicate a pod to delete
58-
PodReplaceIndicationLabelKey = "collaset.kusionstack.io/to-replace" // users can use this label to indicate a pod to replace
73+
// PodDeletionIndicationLabelKey indicates a pod will be deleted by collaset
74+
PodDeletionIndicationLabelKey = "collaset.kusionstack.io/to-delete"
75+
// PodReplaceIndicationLabelKey indicates a pod will be replaced by collaset
76+
PodReplaceIndicationLabelKey = "collaset.kusionstack.io/to-replace"
77+
// PodReplaceByReplaceUpdateLabelKey indicates a pod is replaced by update by collaset
5978
PodReplaceByReplaceUpdateLabelKey = "collaset.kusionstack.io/replaced-by-replace-update"
60-
PodIgnoringIndicationLabelKey = "collaset.kusionstack.io/to-ignore" // users can use this label to indicate a pod to be ignored by collaset
79+
// PodIgnoringIndicationLabelKey indicates a pod to be ignored by collaset. For example,
80+
// a Pod is stuck to delete when it is on a failed node or its network communication to
81+
// the outside world is completely cut, then the Pod can be ignored by CollaSet.
82+
PodIgnoringIndicationLabelKey = "collaset.kusionstack.io/to-ignore"
6183

62-
PodReplacePairOriginName = "collaset.kusionstack.io/replace-pair-origin-name" // used to indicate the original Pod name for replacement.
63-
PodReplacePairNewId = "collaset.kusionstack.io/replace-pair-new-id" // used to indicate the new created Pod instance ID for replacement.
84+
// PodReplacePairOriginName is used to indicate replace origin Pod name on the new created Pod
85+
PodReplacePairOriginName = "collaset.kusionstack.io/replace-pair-origin-name"
86+
// PodReplacePairNewId is used to indicate the new created Pod instance on the replace origin Pod
87+
PodReplacePairNewId = "collaset.kusionstack.io/replace-pair-new-id"
6488

65-
PvcTemplateHashLabelKey = "collaset.kusionstack.io/pvc-template-hash" // used to attach hash of pvc template to pvc resource
89+
// PvcTemplateHashLabelKey is used to attach hash of pvc template to pvc resource
90+
PvcTemplateHashLabelKey = "collaset.kusionstack.io/pvc-template-hash"
6691
)
6792

6893
// PodDecoration labels

0 commit comments

Comments
 (0)