@@ -24,15 +24,11 @@ import (
2424const (
2525 ClusterExtensionRevisionKind = "ClusterExtensionRevision"
2626
27- // ClusterExtensionRevisionTypeAvailable is the condition type that represents whether the
28- // ClusterExtensionRevision is available and has been successfully rolled out.
27+ // Condition Types
2928 ClusterExtensionRevisionTypeAvailable = "Available"
30-
31- // ClusterExtensionRevisionTypeSucceeded is the condition type that represents whether the
32- // ClusterExtensionRevision rollout has succeeded.
3329 ClusterExtensionRevisionTypeSucceeded = "Succeeded"
3430
35- // Condition reasons
31+ // Condition Reasons
3632 ClusterExtensionRevisionReasonAvailable = "Available"
3733 ClusterExtensionRevisionReasonReconcileFailure = "ReconcileFailure"
3834 ClusterExtensionRevisionReasonRevisionValidationFailure = "RevisionValidationFailure"
@@ -48,47 +44,22 @@ const (
4844
4945// ClusterExtensionRevisionSpec defines the desired state of ClusterExtensionRevision.
5046type ClusterExtensionRevisionSpec struct {
51- // lifecycleState specifies the lifecycle state of the ClusterExtensionRevision.
52- //
53- // When set to "Active" (the default), the revision is actively managed and reconciled.
54- // When set to "Archived", the revision is inactive and any resources not managed by a subsequent revision are deleted.
55- // The revision is removed from the owner list of all objects previously under management.
56- // All objects that did not transition to a succeeding revision are deleted.
57- //
58- // Once a revision is set to "Archived", it cannot be un-archived.
47+ // Specifies the lifecycle state of the ClusterExtensionRevision.
5948 //
6049 // +kubebuilder:default="Active"
61- // +kubebuilder:validation:Enum=Active;Archived
62- // +kubebuilder:validation:XValidation:rule="oldSelf == 'Active' || oldSelf == 'Archived' && oldSelf == self", message="cannot un-archive"
50+ // +kubebuilder:validation:Enum=Active;Paused; Archived
51+ // +kubebuilder:validation:XValidation:rule="oldSelf == 'Active' || oldSelf == 'Paused' || oldSelf == ' Archived' && oldSelf == self", message="can not un-archive"
6352 LifecycleState ClusterExtensionRevisionLifecycleState `json:"lifecycleState,omitempty"`
64-
65- // revision is a required, immutable sequence number representing a specific revision
66- // of the parent ClusterExtension.
67- //
68- // The revision field must be a positive integer.
69- // Each ClusterExtensionRevision belonging to the same parent ClusterExtension must have a unique revision number.
70- // The revision number must always be the previous revision number plus one, or 1 for the first revision.
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.
7156 //
7257 // +kubebuilder:validation:Required
7358 // +kubebuilder:validation:Minimum:=1
7459 // +kubebuilder:validation:XValidation:rule="self == oldSelf", message="revision is immutable"
7560 Revision int64 `json:"revision"`
76-
77- // phases is an optional, immutable list of phases that group objects to be applied together.
78- //
79- // Objects are organized into phases based on their Group-Kind. Common phases include:
80- // - namespaces: Namespace objects
81- // - policies: ResourceQuota, LimitRange, NetworkPolicy objects
82- // - rbac: ServiceAccount, Role, RoleBinding, ClusterRole, ClusterRoleBinding objects
83- // - crds: CustomResourceDefinition objects
84- // - storage: PersistentVolume, PersistentVolumeClaim, StorageClass objects
85- // - deploy: Deployment, StatefulSet, DaemonSet, Service, ConfigMap, Secret objects
86- // - publish: Ingress, APIService, Route, Webhook objects
87- //
88- // All objects in a phase are applied in no particular order.
89- // The revision progresses to the next phase only after all objects in the current phase pass their readiness probes.
90- //
91- // Once set, even if empty, the phases field is immutable.
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.
9263 //
9364 // +kubebuilder:validation:XValidation:rule="self == oldSelf || oldSelf.size() == 0", message="phases is immutable"
9465 // +listType=map
@@ -104,62 +75,33 @@ const (
10475 // ClusterExtensionRevisionLifecycleStateActive / "Active" is the default lifecycle state.
10576 ClusterExtensionRevisionLifecycleStateActive ClusterExtensionRevisionLifecycleState = "Active"
10677 // ClusterExtensionRevisionLifecycleStatePaused / "Paused" disables reconciliation of the ClusterExtensionRevision.
107- // Object changes will not be reconciled. However, status updates will be propagated .
78+ // Only Status updates will still propagated, but object changes will not be reconciled .
10879 ClusterExtensionRevisionLifecycleStatePaused ClusterExtensionRevisionLifecycleState = "Paused"
109- // ClusterExtensionRevisionLifecycleStateArchived / "Archived" archives the revision for historical or auditing purposes.
110- // The revision is removed from the owner list of all other objects previously under management and all objects
111- // that did not transition to a succeeding revision are deleted .
80+ // 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 .
11283 ClusterExtensionRevisionLifecycleStateArchived ClusterExtensionRevisionLifecycleState = "Archived"
11384)
11485
115- // ClusterExtensionRevisionPhase represents a group of objects that are applied together. The phase is considered
116- // complete only after all objects pass their status probes.
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 .
11788type ClusterExtensionRevisionPhase struct {
118- // name is a required identifier for this phase.
119- //
120- // phase names must follow the DNS label standard as defined in [RFC 1123].
121- // They must contain only lowercase alphanumeric characters or hyphens (-),
122- // start and end with an alphanumeric character, and be no longer than 63 characters.
123- //
124- // Common phase names include: namespaces, policies, rbac, crds, storage, deploy, publish.
125- //
126- // [RFC 1123]: https://tools.ietf.org/html/rfc1123
89+ // Name identifies this phase.
12790 //
12891 // +kubebuilder:validation:MaxLength=63
12992 // +kubebuilder:validation:Pattern=`^[a-z]([-a-z0-9]*[a-z0-9])?$`
13093 Name string `json:"name"`
131-
132- // objects is a required list of all Kubernetes objects that belong to this phase.
133- //
134- // All objects in this list are applied to the cluster in no particular order.
94+ // Objects are a list of all the objects within this phase.
13595 Objects []ClusterExtensionRevisionObject `json:"objects"`
13696}
13797
138- // ClusterExtensionRevisionObject represents a Kubernetes object to be applied as part
139- // of a phase, along with its collision protection settings.
98+ // ClusterExtensionRevisionObject contains an object and settings for it.
14099type ClusterExtensionRevisionObject struct {
141- // object is a required embedded Kubernetes object to be applied.
142- //
143- // This object must be a valid Kubernetes resource with apiVersion, kind, and metadata fields.
144- //
145100 // +kubebuilder:validation:EmbeddedResource
146101 // +kubebuilder:pruning:PreserveUnknownFields
147102 Object unstructured.Unstructured `json:"object"`
148-
149- // collisionProtection controls whether the operator can adopt and modify objects
150- // that already exist on the cluster.
151- //
152- // When set to "Prevent" (the default), the operator only manages objects it created itself.
153- // This prevents ownership collisions.
154- //
155- // When set to "IfNoController", the operator can adopt and modify pre-existing objects
156- // that are not owned by another controller.
157- // This is useful for taking over management of manually-created resources.
158- //
159- // When set to "None", the operator can adopt and modify any pre-existing object, even if
160- // owned by another controller.
161- // Use this setting with extreme caution as it may cause multiple controllers to fight over
162- // the same resource, resulting in increased load on the API server and etcd.
103+ // CollisionProtection controls whether OLM can adopt and modify objects
104+ // already existing on the cluster or even owned by another controller.
163105 //
164106 // +kubebuilder:default="Prevent"
165107 // +kubebuilder:validation:Enum=Prevent;IfNoController;None
@@ -186,27 +128,6 @@ const (
186128
187129// ClusterExtensionRevisionStatus defines the observed state of a ClusterExtensionRevision.
188130type ClusterExtensionRevisionStatus struct {
189- // conditions is an optional list of status conditions describing the state of the
190- // ClusterExtensionRevision.
191- //
192- // The Progressing condition represents whether the revision is actively rolling out:
193- // - When status is True and reason is Progressing, the revision rollout is actively making progress and is in transition.
194- // - When Progressing is not present, the revision is not currently in transition.
195- //
196- // The Available condition represents whether the revision has been successfully rolled out and is available:
197- // - When status is True and reason is Available, the revision has been successfully rolled out and all objects pass their readiness probes.
198- // - When status is False and reason is Incomplete, the revision rollout has not yet completed but no specific failures have been detected.
199- // - When status is False and reason is ProbeFailure, one or more objects are failing their readiness probes during rollout.
200- // - When status is False and reason is ReconcileFailure, the revision has encountered a general reconciliation failure.
201- // - When status is False and reason is RevisionValidationFailure, the revision failed preflight validation checks.
202- // - When status is False and reason is PhaseValidationError, a phase within the revision failed preflight validation checks.
203- // - When status is False and reason is ObjectCollisions, objects in the revision collide with existing cluster objects that cannot be adopted.
204- // - When status is Unknown and reason is Archived, the revision has been archived and its objects have been torn down.
205- // - When status is Unknown and reason is Migrated, the revision was migrated from an existing release and object status probe results have not yet been observed.
206- //
207- // The Succeeded condition represents whether the revision has successfully completed its rollout:
208- // - When status is True and reason is RolloutSuccess, the revision has successfully completed its rollout. This condition is set once and persists even if the revision later becomes unavailable.
209- //
210131 // +listType=map
211132 // +listMapKey=type
212133 // +optional
@@ -216,24 +137,19 @@ type ClusterExtensionRevisionStatus struct {
216137// +kubebuilder:object:root=true
217138// +kubebuilder:resource:scope=Cluster
218139// +kubebuilder:subresource:status
140+
141+ // ClusterExtensionRevision is the Schema for the clusterextensionrevisions API
219142// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=`.status.conditions[?(@.type=='Available')].status`
220143// +kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp`
221-
222- // ClusterExtensionRevision represents an immutable snapshot of Kubernetes objects
223- // for a specific version of a ClusterExtension. Each revision contains objects
224- // organized into phases that roll out sequentially. The same object can only be managed by a single revision
225- // at a time. Ownership of objects is transitioned from one revision to the next as the extension is upgraded
226- // or reconfigured. Once the latest revision has rolled out successfully, previous active revisions are archived for
227- // posterity.
228144type ClusterExtensionRevision struct {
229145 metav1.TypeMeta `json:",inline"`
230146 metav1.ObjectMeta `json:"metadata,omitempty"`
231147
232- // spec defines the desired state of the ClusterExtensionRevision .
148+ // spec is an optional field that defines the desired state of the ClusterExtension .
233149 // +optional
234150 Spec ClusterExtensionRevisionSpec `json:"spec,omitempty"`
235151
236- // status is optional and defines the observed state of the ClusterExtensionRevision .
152+ // status is an optional field that defines the observed state of the ClusterExtension .
237153 // +optional
238154 Status ClusterExtensionRevisionStatus `json:"status,omitempty"`
239155}
0 commit comments