@@ -5,72 +5,102 @@ import (
5
5
"k8s.io/apimachinery/pkg/runtime"
6
6
)
7
7
8
- // OperatorStatusList is a list of OperatorStatus resources.
8
+ // ClusterOperatorList is a list of OperatorStatus resources.
9
9
// +k8s:deepcopy-gen=true
10
10
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
11
- type OperatorStatusList struct {
11
+ type ClusterOperatorList struct {
12
12
metav1.TypeMeta `json:",inline"`
13
13
metav1.ListMeta `json:"metadata"`
14
14
15
- Items []OperatorStatus `json:"items"`
15
+ Items []ClusterOperator `json:"items"`
16
16
}
17
17
18
- // OperatorStatus is the Custom Resource object which holds the current state
18
+ // ClusterOperator is the Custom Resource object which holds the current state
19
19
// of an operator. This object is used by operators to convey their state to
20
20
// the rest of the cluster.
21
21
// +genclient
22
22
// +k8s:deepcopy-gen=true
23
23
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
24
- type OperatorStatus struct {
24
+ type ClusterOperator struct {
25
25
metav1.TypeMeta `json:",inline"`
26
26
metav1.ObjectMeta `json:"metadata"`
27
27
28
- // Condition describes the state of the operator's reconciliation
29
- // functionality.
30
- Condition OperatorStatusCondition `json:"condition"`
28
+ // Spec hold the intent of how this operator should behave.
29
+ Spec ClusterOperatorSpec `json:"spec"`
31
30
32
- // Version indicates which version of the operator updated the current
31
+ // status holds the information about the state of an operator. It is consistent with status information across
32
+ // the kube ecosystem.
33
+ Status ClusterOperatorStatus `json:"status"`
34
+ }
35
+
36
+ // ClusterOperatorSpec is empty for now, but you could imagine holding information like "pause".
37
+ type ClusterOperatorSpec struct {
38
+ }
39
+
40
+ // ClusterOperatorStatus provides information about the status of the operator.
41
+ // +k8s:deepcopy-gen=true
42
+ type ClusterOperatorStatus struct {
43
+ // conditions describes the state of the operator's reconciliation functionality.
44
+ // +patchMergeKey=type
45
+ // +patchStrategy=merge
46
+ Conditions []ClusterOperatorStatusCondition `json:"conditions"`
47
+
48
+ // version indicates which version of the operator updated the current
33
49
// status object.
34
50
Version string `json:"version"`
35
51
36
- // LasteUpdate is the time of the last update to the current status object.
37
- LastUpdate metav1.Time `json:"lastUpdate"`
38
-
39
- // Extension contains any additional status information specific to the
52
+ // extension contains any additional status information specific to the
40
53
// operator which owns this status object.
41
- Extension runtime.RawExtension `json:"extension"`
54
+ Extension runtime.RawExtension `json:"extension,omitempty "`
42
55
}
43
56
44
- // OperatorStatusCondition represents the state of the operator's
57
+ type ConditionStatus string
58
+
59
+ // These are valid condition statuses. "ConditionTrue" means a resource is in the condition.
60
+ // "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes
61
+ // can't decide if a resource is in the condition or not. In the future, we could add other
62
+ // intermediate conditions, e.g. ConditionDegraded.
63
+ const (
64
+ ConditionTrue ConditionStatus = "True"
65
+ ConditionFalse ConditionStatus = "False"
66
+ ConditionUnknown ConditionStatus = "Unknown"
67
+ )
68
+
69
+ // ClusterOperatorStatusCondition represents the state of the operator's
45
70
// reconciliation functionality.
46
- type OperatorStatusCondition struct {
47
- // Type specifies the state of the operator's reconciliation functionality.
48
- Type OperatorStatusConditionType `json:"type"`
71
+ // +k8s:deepcopy-gen=true
72
+ type ClusterOperatorStatusCondition struct {
73
+ // type specifies the state of the operator's reconciliation functionality.
74
+ Type ClusterStatusConditionType `json:"type"`
75
+
76
+ // Status of the condition, one of True, False, Unknown.
77
+ Status ConditionStatus `json:"status"`
49
78
50
- // Message provides any additional information about the current condition.
79
+ // LastTransitionTime is the time of the last update to the current status object.
80
+ LastTransitionTime metav1.Time `json:"lastTransitionTime"`
81
+
82
+ // reason is the reason for the condition's last transition. Reasons are CamelCase
83
+ Reason string `json:"reason,omitempty"`
84
+
85
+ // message provides additional information about the current condition.
51
86
// This is only to be consumed by humans.
52
- Message string `json:"message"`
87
+ Message string `json:"message,omitempty "`
53
88
}
54
89
55
- // OperatorStatusConditionType is the state of the operator's reconciliation
56
- // functionality.
57
- type OperatorStatusConditionType string
90
+ // ClusterStatusConditionType is the state of the operator's reconciliation functionality.
91
+ type ClusterStatusConditionType string
58
92
59
93
const (
60
- // OperatorStatusConditionTypeWaiting indicates that the operator isn't
61
- // running its reconciliation functionality. This may be because a
62
- // dependency or other prerequisite hasn't been satisfied.
63
- OperatorStatusConditionTypeWaiting OperatorStatusConditionType = "Waiting"
64
-
65
- // OperatorStatusConditionTypeWorking indicates that the operator is
66
- // actively reconciling its operands.
67
- OperatorStatusConditionTypeWorking OperatorStatusConditionType = "Working"
68
-
69
- // OperatorStatusConditionTypeDone indicates that the operator has finished
70
- // reconciling its operands and is waiting for changes.
71
- OperatorStatusConditionTypeDone OperatorStatusConditionType = "Done"
72
-
73
- // OperatorStatusConditionTypeDegraded indicates that the operator has
74
- // encountered an error that is preventing it from working properly.
75
- OperatorStatusConditionTypeDegraded OperatorStatusConditionType = "Degraded"
94
+ // OperatorAvailable indicates that the binary maintained by the operator (eg: openshift-apiserver for the
95
+ // openshift-apiserver-operator), is functional and available in the cluster.
96
+ OperatorAvailable ClusterStatusConditionType = "Available"
97
+
98
+ // OperatorProgressing indicates that the operator is actively making changes to the binary maintained by the
99
+ // operator (eg: openshift-apiserver for the openshift-apiserver-operator).
100
+ OperatorProgressing ClusterStatusConditionType = "Progressing"
101
+
102
+ // OperatorFailing indicates that the operator has encountered an error that is preventing it from working properly.
103
+ // The binary maintained by the operator (eg: openshift-apiserver for the openshift-apiserver-operator) may still be
104
+ // available, but the user intent cannot be fulfilled.
105
+ OperatorFailing ClusterStatusConditionType = "Failing"
76
106
)
0 commit comments