@@ -41,17 +41,50 @@ const (
4141)
4242
4343// Type - A summarizing name for a given condition
44+ // ---
45+ // Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
46+ // useful (see .node.status.conditions), the ability to deconflict is important.
47+ // The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
48+ // +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$`
49+ // +kubebuilder:validation:MaxLength=316
4450type Type string
4551
4652// Reason - Why a particular condition is true, false or unknown
53+ // reason contains a programmatic identifier indicating the reason for the condition's last transition.
54+ // Producers of specific condition types may define expected values and meanings for this field,
55+ // and whether the values are considered a guaranteed API.
56+ // The value should be a CamelCase string.
57+ // This field may not be empty.
58+ // +kubebuilder:validation:MaxLength=1024
59+ // +kubebuilder:validation:MinLength=1
60+ // +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$`
4761type Reason string
4862
49- // Condition defines an observation of a API resource operational state.
63+ // Condition contains details for one aspect of the current state of this API Resource.
64+ // ---
65+ // This struct is intended for direct use as an array at the field path .status.conditions. For example,
66+ //
67+ // type FooStatus struct{
68+ // // Represents the observations of a foo's current state.
69+ // // Known .status.conditions.type are: "Available", "Progressing", and "Degraded"
70+ // // +patchMergeKey=type
71+ // // +patchStrategy=merge
72+ // // +listType=map
73+ // // +listMapKey=type
74+ // Conditions []condition.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
75+ //
76+ // // other fields
77+ // }
5078type Condition struct {
5179 // Type of condition in CamelCase.
80+ // +required
81+ // +kubebuilder:validation:Required
5282 Type Type `json:"type"`
5383
54- // Status of the condition, one of True, False, Unknown.
84+ // status of the condition, one of True, False, Unknown.
85+ // +required
86+ // +kubebuilder:validation:Required
87+ // +kubebuilder:validation:Enum=True;False;Unknown
5588 Status corev1.ConditionStatus `json:"status"`
5689
5790 // Severity provides a classification of Reason code, so the current situation is immediately
@@ -62,20 +95,31 @@ type Condition struct {
6295 // For conditions where Status=Unknown or Status=True the Severity should be SeverityNone.
6396 Severity Severity `json:"severity,omitempty"`
6497
65- // Last time the condition transitioned from one status to another.
66- // This should be when the underlying condition changed. If that is not known, then using the time when
67- // the API field changed is acceptable.
98+ // lastTransitionTime is the last time the condition transitioned from one status to another.
99+ // This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
100+ // +required
101+ // +kubebuilder:validation:Required
102+ // +kubebuilder:validation:Type=string
103+ // +kubebuilder:validation:Format=date-time
68104 LastTransitionTime metav1.Time `json:"lastTransitionTime"`
69105
70106 // The reason for the condition's last transition in CamelCase.
107+ // +required
108+ // +kubebuilder:validation:Required
71109 Reason Reason `json:"reason,omitempty"`
72110
73- // A human readable message indicating details about the transition.
111+ // message is a human readable message indicating details about the transition.
112+ // This may be an empty string.
74113 // +optional
114+ // +kubebuilder:validation:MaxLength=32768
75115 Message string `json:"message,omitempty"`
76116}
77117
78118// Conditions provide observations of the operational state of a API resource.
119+ // +patchMergeKey=type
120+ // +patchStrategy=merge
121+ // +listType=map
122+ // +listMapKey=type
79123type Conditions []Condition
80124
81125// conditionGroup defines a group of conditions with the same status and severity,
0 commit comments