@@ -24,42 +24,121 @@ import (
2424const (
2525 ClusterExtensionRevisionKind = "ClusterExtensionRevision"
2626
27- // Condition Types
27+ // ClusterExtensionRevisionTypeAvailable is the condition type that represents whether the
28+ // ClusterExtensionRevision is available and has been successfully rolled out.
2829 ClusterExtensionRevisionTypeAvailable = "Available"
30+
31+ // ClusterExtensionRevisionTypeSucceeded is the condition type that represents whether the
32+ // ClusterExtensionRevision rollout has succeeded at least once.
2933 ClusterExtensionRevisionTypeSucceeded = "Succeeded"
3034
31- // Condition Reasons
32- ClusterExtensionRevisionReasonAvailable = "Available"
33- ClusterExtensionRevisionReasonReconcileFailure = "ReconcileFailure"
35+ // ClusterExtensionRevisionReasonAvailable is set when the revision is available
36+ // and passes all probes after a successful rollout.
37+ // Condition: Available, Status: True
38+ ClusterExtensionRevisionReasonAvailable = "Available"
39+
40+ // ClusterExtensionRevisionReasonReconcileFailure is set when the ClusterExtensionRevision
41+ // encounters a general reconciliation failure, such as errors ensuring finalizers or
42+ // establishing watches.
43+ // Condition: Available, Status: False
44+ ClusterExtensionRevisionReasonReconcileFailure = "ReconcileFailure"
45+
46+ // ClusterExtensionRevisionReasonRevisionValidationFailure is set when the revision
47+ // fails preflight validation checks at the revision level.
48+ // Condition: Available, Status: False
3449 ClusterExtensionRevisionReasonRevisionValidationFailure = "RevisionValidationFailure"
35- ClusterExtensionRevisionReasonPhaseValidationError = "PhaseValidationError"
36- ClusterExtensionRevisionReasonObjectCollisions = "ObjectCollisions"
37- ClusterExtensionRevisionReasonRolloutSuccess = "RolloutSuccess"
38- ClusterExtensionRevisionReasonProbeFailure = "ProbeFailure"
39- ClusterExtensionRevisionReasonIncomplete = "Incomplete"
40- ClusterExtensionRevisionReasonProgressing = "Progressing"
41- ClusterExtensionRevisionReasonArchived = "Archived"
42- ClusterExtensionRevisionReasonMigrated = "Migrated"
50+
51+ // ClusterExtensionRevisionReasonPhaseValidationError is set when a phase within
52+ // the revision fails preflight validation checks.
53+ // Condition: Available, Status: False
54+ ClusterExtensionRevisionReasonPhaseValidationError = "PhaseValidationError"
55+
56+ // ClusterExtensionRevisionReasonObjectCollisions is set when objects in the revision
57+ // collide with existing objects on the cluster that cannot be adopted based on
58+ // the configured collision protection policy.
59+ // Condition: Available, Status: False
60+ ClusterExtensionRevisionReasonObjectCollisions = "ObjectCollisions"
61+
62+ // ClusterExtensionRevisionReasonRolloutSuccess is set when the revision has
63+ // successfully completed its rollout for the first time.
64+ // Condition: Succeeded, Status: True
65+ ClusterExtensionRevisionReasonRolloutSuccess = "RolloutSuccess"
66+
67+ // ClusterExtensionRevisionReasonProbeFailure is set when one or more objects
68+ // in the revision fail their readiness probes during rollout.
69+ // Condition: Available, Status: False
70+ ClusterExtensionRevisionReasonProbeFailure = "ProbeFailure"
71+
72+ // ClusterExtensionRevisionReasonIncomplete is set when the revision rollout
73+ // has not completed but no specific probe failures have been detected.
74+ // Condition: Available, Status: False
75+ ClusterExtensionRevisionReasonIncomplete = "Incomplete"
76+
77+ // ClusterExtensionRevisionReasonProgressing is set when the revision rollout
78+ // is actively making progress and is in transition.
79+ // Condition: Progressing, Status: True
80+ ClusterExtensionRevisionReasonProgressing = "Progressing"
81+
82+ // ClusterExtensionRevisionReasonArchived is set when the revision has been
83+ // archived and its objects have been torn down.
84+ // Condition: Available, Status: Unknown
85+ ClusterExtensionRevisionReasonArchived = "Archived"
86+
87+ // ClusterExtensionRevisionReasonMigrated is set when the revision has been
88+ // migrated from an existing Helm release to a ClusterExtensionRevision
89+ // Condition: Available, Status: Unknown
90+ ClusterExtensionRevisionReasonMigrated = "Migrated"
4391)
4492
4593// ClusterExtensionRevisionSpec defines the desired state of ClusterExtensionRevision.
94+ //
95+ // A ClusterExtensionRevision represents a specific immutable snapshot of the objects
96+ // to be installed for a ClusterExtension. Each revision is rolled out in phases,
97+ // with objects organized by their Group-Kind into well-known phases such as namespaces,
98+ // rbac, crds, and deploy.
4699type ClusterExtensionRevisionSpec struct {
47- // Specifies the lifecycle state of the ClusterExtensionRevision.
100+ // lifecycleState specifies the lifecycle state of the ClusterExtensionRevision.
101+ //
102+ // When set to "Active" (the default), the revision is actively managed and reconciled.
103+ // When set to "Paused", reconciliation is disabled but status updates continue.
104+ // When set to "Archived", the revision is torn down and scaled to zero - the revision is removed from the owner
105+ // list of all other objects previously under management and all objects that did not transition to a
106+ // succeeding revision are deleted.
107+ //
108+ // Once a revision is set to "Archived", it cannot be un-archived.
48109 //
49110 // +kubebuilder:default="Active"
50111 // +kubebuilder:validation:Enum=Active;Paused;Archived
51112 // +kubebuilder:validation:XValidation:rule="oldSelf == 'Active' || oldSelf == 'Paused' || oldSelf == 'Archived' && oldSelf == self", message="can not un-archive"
52113 LifecycleState ClusterExtensionRevisionLifecycleState `json:"lifecycleState,omitempty"`
53- // Revision is a sequence number representing a specific revision of the ClusterExtension instance.
54- // Must be positive. Each ClusterExtensionRevision of the same parent ClusterExtension needs to have
55- // a unique value assigned. It is immutable after creation. The new revision number must always be previous revision +1.
114+
115+ // revision is a required, immutable sequence number representing a specific revision
116+ // of the parent ClusterExtension.
117+ //
118+ // Must be a positive integer. Each ClusterExtensionRevision belonging to the same
119+ // parent ClusterExtension must have a unique revision number. The revision number
120+ // must always be the previous revision number plus one, or 1 for the first revision.
56121 //
57122 // +kubebuilder:validation:Required
58123 // +kubebuilder:validation:Minimum:=1
59124 // +kubebuilder:validation:XValidation:rule="self == oldSelf", message="revision is immutable"
60125 Revision int64 `json:"revision"`
61- // Phases are groups of objects that will be applied at the same time.
62- // All objects in the phase will have to pass their probes in order to progress to the next phase.
126+
127+ // phases is an optional, immutable list of phases that group objects to be applied together.
128+ //
129+ // Objects are organized into phases based on their Group-Kind. Common phases include:
130+ // - namespaces: Namespace objects
131+ // - policies: ResourceQuota, LimitRange, NetworkPolicy objects
132+ // - rbac: ServiceAccount, Role, RoleBinding, ClusterRole, ClusterRoleBinding objects
133+ // - crds: CustomResourceDefinition objects
134+ // - storage: PersistentVolume, PersistentVolumeClaim, StorageClass objects
135+ // - deploy: Deployment, StatefulSet, DaemonSet, Service, ConfigMap, Secret objects
136+ // - publish: Ingress, APIService, Route, Webhook objects
137+ //
138+ // All objects within a phase are applied simultaneously. The revision only progresses
139+ // to the next phase once all objects in the current phase pass their readiness probes.
140+ //
141+ // Once set (even if empty), this field is immutable.
63142 //
64143 // +kubebuilder:validation:XValidation:rule="self == oldSelf || oldSelf.size() == 0", message="phases is immutable"
65144 // +listType=map
@@ -75,33 +154,70 @@ const (
75154 // ClusterExtensionRevisionLifecycleStateActive / "Active" is the default lifecycle state.
76155 ClusterExtensionRevisionLifecycleStateActive ClusterExtensionRevisionLifecycleState = "Active"
77156 // ClusterExtensionRevisionLifecycleStatePaused / "Paused" disables reconciliation of the ClusterExtensionRevision.
78- // Only Status updates will still propagated, but object changes will not be reconciled .
157+ // Object changes will not be reconciled. However, status updates will be propagated .
79158 ClusterExtensionRevisionLifecycleStatePaused ClusterExtensionRevisionLifecycleState = "Paused"
80159 // ClusterExtensionRevisionLifecycleStateArchived / "Archived" disables reconciliation while also "scaling to zero",
81- // which deletes all objects that are not excluded via the pausedFor property and
82- // removes itself from the owner list of all other objects previously under management.
160+ // the revision is torn down and scaled to zero - the revision is removed from the owner
161+ // list of all other objects previously under management and all objects that did not transition to a succeeding
162+ // revision are deleted.
83163 ClusterExtensionRevisionLifecycleStateArchived ClusterExtensionRevisionLifecycleState = "Archived"
84164)
85165
86- // ClusterExtensionRevisionPhase are groups of objects that will be applied at the same time.
87- // All objects in the a phase will have to pass their probes in order to progress to the next phase.
166+ // ClusterExtensionRevisionPhase represents a group of objects that are applied together.
167+ //
168+ // Objects within a phase are applied simultaneously, and all objects must pass their
169+ // readiness probes before the revision progresses to the next phase. Phases are applied
170+ // in a well-defined order based on the types of objects they contain.
88171type ClusterExtensionRevisionPhase struct {
89- // Name identifies this phase.
172+ // name is a required identifier for this phase.
173+ //
174+ // Phase names must follow the DNS label standard as defined in [RFC 1123].
175+ // They must contain only lowercase alphanumeric characters or hyphens (-),
176+ // start and end with an alphanumeric character, and be no longer than 63 characters.
177+ //
178+ // Common phase names include: namespaces, policies, rbac, crds, storage, deploy, publish.
179+ //
180+ // [RFC 1123]: https://tools.ietf.org/html/rfc1123
90181 //
91182 // +kubebuilder:validation:MaxLength=63
92183 // +kubebuilder:validation:Pattern=`^[a-z]([-a-z0-9]*[a-z0-9])?$`
93184 Name string `json:"name"`
94- // Objects are a list of all the objects within this phase.
185+
186+ // objects is a required list of all Kubernetes objects within this phase.
187+ //
188+ // All objects in this list will be applied to the cluster simultaneously.
189+ // The phase will only be considered complete once all objects pass their
190+ // readiness probes.
95191 Objects []ClusterExtensionRevisionObject `json:"objects"`
96192}
97193
98- // ClusterExtensionRevisionObject contains an object and settings for it.
194+ // ClusterExtensionRevisionObject represents a Kubernetes object to be applied as part
195+ // of a ClusterExtensionRevision, along with its collision protection settings.
99196type ClusterExtensionRevisionObject struct {
197+ // object is a required embedded Kubernetes object to be applied.
198+ //
199+ // This object must be a valid Kubernetes resource with apiVersion, kind, and metadata
200+ // fields. Status fields are not permitted and will be removed if present.
201+ // Only specific metadata fields are preserved: name, namespace, labels, and annotations.
202+ //
100203 // +kubebuilder:validation:EmbeddedResource
101204 // +kubebuilder:pruning:PreserveUnknownFields
102205 Object unstructured.Unstructured `json:"object"`
103- // CollisionProtection controls whether OLM can adopt and modify objects
104- // already existing on the cluster or even owned by another controller.
206+
207+ // collisionProtection controls whether the operator can adopt and modify objects
208+ // that already exist on the cluster.
209+ //
210+ // When set to "Prevent" (the default), the operator will only manage objects it
211+ // has created itself, preventing any ownership collisions.
212+ //
213+ // When set to "IfNoController", the operator can adopt and modify pre-existing
214+ // objects that are not owned by another controller. This is useful for taking
215+ // over management of manually-created resources.
216+ //
217+ // When set to "None", the operator can adopt and modify any pre-existing object,
218+ // even if owned by another controller. Use this setting with extreme caution as
219+ // it may cause multiple controllers to fight over the same resource, resulting
220+ // in increased load on the API server and etcd.
105221 //
106222 // +kubebuilder:default="Prevent"
107223 // +kubebuilder:validation:Enum=Prevent;IfNoController;None
@@ -128,6 +244,41 @@ const (
128244
129245// ClusterExtensionRevisionStatus defines the observed state of a ClusterExtensionRevision.
130246type ClusterExtensionRevisionStatus struct {
247+ // conditions is an optional list of status conditions describing the state of the
248+ // ClusterExtensionRevision.
249+ //
250+ // The Available condition represents whether the revision has been successfully rolled out
251+ // and is available:
252+ // - When Available is True with Reason Available, the revision has been successfully
253+ // rolled out and all objects pass their readiness probes.
254+ // - When Available is False with Reason Incomplete, the revision rollout has not yet
255+ // completed but no specific failures have been detected.
256+ // - When Available is False with Reason ProbeFailure, one or more objects are failing
257+ // their readiness probes during rollout.
258+ // - When Available is False with Reason ReconcileFailure, the revision has encountered
259+ // a general reconciliation failure.
260+ // - When Available is False with Reason RevisionValidationFailure, the revision failed
261+ // preflight validation checks.
262+ // - When Available is False with Reason PhaseValidationError, a phase within the revision
263+ // failed preflight validation checks.
264+ // - When Available is False with Reason ObjectCollisions, objects in the revision collide
265+ // with existing cluster objects that cannot be adopted.
266+ // - When Available is Unknown with Reason Archived, the revision has been archived and
267+ // its objects have been torn down.
268+ // - When Available is Unknown with Reason Migrated, the revision was a result from a migration
269+ // from an existing release and object status probe results have not yet been observed.
270+ //
271+ // The Succeeded condition represents whether the revision has successfully completed its
272+ // rollout at least once:
273+ // - When Succeeded is True with Reason RolloutSuccess, the revision has successfully
274+ // completed its rollout. This condition is set once and persists even if the revision
275+ // later becomes unavailable.
276+ //
277+ // The Progressing condition represents whether the revision is actively rolling out:
278+ // - When Progressing is True with Reason Progressing, the revision rollout is actively
279+ // making progress and is in transition.
280+ // - When Progressing is not present, the revision is not currently in transition.
281+ //
131282 // +listType=map
132283 // +listMapKey=type
133284 // +optional
@@ -137,19 +288,39 @@ type ClusterExtensionRevisionStatus struct {
137288// +kubebuilder:object:root=true
138289// +kubebuilder:resource:scope=Cluster
139290// +kubebuilder:subresource:status
140-
141- // ClusterExtensionRevision is the Schema for the clusterextensionrevisions API
142291// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=`.status.conditions[?(@.type=='Available')].status`
143292// +kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp`
293+
294+ // ClusterExtensionRevision is the schema for the ClusterExtensionRevisions API.
295+ //
296+ // A ClusterExtensionRevision represents an immutable snapshot of the Kubernetes objects
297+ // to be installed for a specific version of a ClusterExtension. Each revision contains
298+ // a set of objects organized into phases that are rolled out sequentially.
299+ //
300+ // ClusterExtensionRevisions are created and managed automatically by the
301+ // ClusterExtension controller and should not be created directly by users. Each
302+ // ClusterExtension may have multiple revisions over its lifetime as it is upgraded
303+ // or reconfigured.
304+ //
305+ // The revision rollout follows a phased approach where objects are applied in a
306+ // well-defined order based on their types (e.g., namespaces, then RBAC, then CRDs,
307+ // then deployments). Within each phase, all objects are applied simultaneously and
308+ // must pass their readiness probes before the rollout progresses to the next phase.
309+ //
310+ // Revisions have three lifecycle states:
311+ // - Active: The revision is actively managed and reconciled (default state)
312+ // - Paused: Reconciliation is disabled but status updates continue
313+ // - Archived: The revision is torn down, objects are deleted, and the revision
314+ // removes itself from the owner list of managed objects
144315type ClusterExtensionRevision struct {
145316 metav1.TypeMeta `json:",inline"`
146317 metav1.ObjectMeta `json:"metadata,omitempty"`
147318
148- // spec is an optional field that defines the desired state of the ClusterExtension .
319+ // spec is an optional field that defines the desired state of the ClusterExtensionRevision .
149320 // +optional
150321 Spec ClusterExtensionRevisionSpec `json:"spec,omitempty"`
151322
152- // status is an optional field that defines the observed state of the ClusterExtension .
323+ // status is an optional field that defines the observed state of the ClusterExtensionRevision .
153324 // +optional
154325 Status ClusterExtensionRevisionStatus `json:"status,omitempty"`
155326}
0 commit comments