Skip to content

Commit 6d18fdd

Browse files
author
Per Goncalves da Silva
committed
Update ClusterExtensionRevision API docs
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent f3569d5 commit 6d18fdd

File tree

4 files changed

+605
-90
lines changed

4 files changed

+605
-90
lines changed

api/v1/clusterextensionrevision_types.go

Lines changed: 203 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,121 @@ import (
2424
const (
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 was
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.
4699
type 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,69 @@ 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"
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.
159+
// ClusterExtensionRevisionLifecycleStateArchived / "Archived" archives the revision for historical or auditing purposes.
160+
// The revision is removed from the owner list of all other objects previously under management and all objects
161+
// that did not transition to a succeeding revision are deleted.
83162
ClusterExtensionRevisionLifecycleStateArchived ClusterExtensionRevisionLifecycleState = "Archived"
84163
)
85164

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.
165+
// ClusterExtensionRevisionPhase represents a group of objects that are applied together.
166+
//
167+
// Objects within a phase are applied simultaneously, and all objects must pass their
168+
// readiness probes before the revision progresses to the next phase. Phases are applied
169+
// in a well-defined order based on the types of objects they contain.
88170
type ClusterExtensionRevisionPhase struct {
89-
// Name identifies this phase.
171+
// name is a required identifier for this phase.
172+
//
173+
// Phase names must follow the DNS label standard as defined in [RFC 1123].
174+
// They must contain only lowercase alphanumeric characters or hyphens (-),
175+
// start and end with an alphanumeric character, and be no longer than 63 characters.
176+
//
177+
// Common phase names include: namespaces, policies, rbac, crds, storage, deploy, publish.
178+
//
179+
// [RFC 1123]: https://tools.ietf.org/html/rfc1123
90180
//
91181
// +kubebuilder:validation:MaxLength=63
92182
// +kubebuilder:validation:Pattern=`^[a-z]([-a-z0-9]*[a-z0-9])?$`
93183
Name string `json:"name"`
94-
// Objects are a list of all the objects within this phase.
184+
185+
// objects is a required list of all Kubernetes objects within this phase.
186+
//
187+
// All objects in this list will be applied to the cluster simultaneously.
188+
// The phase will only be considered complete once all objects pass their
189+
// readiness probes.
95190
Objects []ClusterExtensionRevisionObject `json:"objects"`
96191
}
97192

98-
// ClusterExtensionRevisionObject contains an object and settings for it.
193+
// ClusterExtensionRevisionObject represents a Kubernetes object to be applied as part
194+
// of a ClusterExtensionRevision, along with its collision protection settings.
99195
type ClusterExtensionRevisionObject struct {
196+
// object is a required embedded Kubernetes object to be applied.
197+
//
198+
// This object must be a valid Kubernetes resource with apiVersion, kind, and metadata
199+
// fields. Status fields are not permitted and will be removed if present.
200+
// Only specific metadata fields are preserved: name, namespace, labels, and annotations.
201+
//
100202
// +kubebuilder:validation:EmbeddedResource
101203
// +kubebuilder:pruning:PreserveUnknownFields
102204
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.
205+
206+
// collisionProtection controls whether the operator can adopt and modify objects
207+
// that already exist on the cluster.
208+
//
209+
// When set to "Prevent" (the default), the operator will only manage objects it
210+
// has created itself, preventing any ownership collisions.
211+
//
212+
// When set to "IfNoController", the operator can adopt and modify pre-existing
213+
// objects that are not owned by another controller. This is useful for taking
214+
// over management of manually-created resources.
215+
//
216+
// When set to "None", the operator can adopt and modify any pre-existing object,
217+
// even if owned by another controller. Use this setting with extreme caution as
218+
// it may cause multiple controllers to fight over the same resource, resulting
219+
// in increased load on the API server and etcd.
105220
//
106221
// +kubebuilder:default="Prevent"
107222
// +kubebuilder:validation:Enum=Prevent;IfNoController;None
@@ -128,6 +243,41 @@ const (
128243

129244
// ClusterExtensionRevisionStatus defines the observed state of a ClusterExtensionRevision.
130245
type ClusterExtensionRevisionStatus struct {
246+
// conditions is an optional list of status conditions describing the state of the
247+
// ClusterExtensionRevision.
248+
//
249+
// The Available condition represents whether the revision has been successfully rolled out
250+
// and is available:
251+
// - When Available is True with Reason Available, the revision has been successfully
252+
// rolled out and all objects pass their readiness probes.
253+
// - When Available is False with Reason Incomplete, the revision rollout has not yet
254+
// completed but no specific failures have been detected.
255+
// - When Available is False with Reason ProbeFailure, one or more objects are failing
256+
// their readiness probes during rollout.
257+
// - When Available is False with Reason ReconcileFailure, the revision has encountered
258+
// a general reconciliation failure.
259+
// - When Available is False with Reason RevisionValidationFailure, the revision failed
260+
// preflight validation checks.
261+
// - When Available is False with Reason PhaseValidationError, a phase within the revision
262+
// failed preflight validation checks.
263+
// - When Available is False with Reason ObjectCollisions, objects in the revision collide
264+
// with existing cluster objects that cannot be adopted.
265+
// - When Available is Unknown with Reason Archived, the revision has been archived and
266+
// its objects have been torn down.
267+
// - When Available is Unknown with Reason Migrated, the revision was migrated
268+
// from an existing release and object status probe results have not yet been observed.
269+
//
270+
// The Succeeded condition represents whether the revision has successfully completed its
271+
// rollout at least once:
272+
// - When Succeeded is True with Reason RolloutSuccess, the revision has successfully
273+
// completed its rollout. This condition is set once and persists even if the revision
274+
// later becomes unavailable.
275+
//
276+
// The Progressing condition represents whether the revision is actively rolling out:
277+
// - When Progressing is True with Reason Progressing, the revision rollout is actively
278+
// making progress and is in transition.
279+
// - When Progressing is not present, the revision is not currently in transition.
280+
//
131281
// +listType=map
132282
// +listMapKey=type
133283
// +optional
@@ -137,19 +287,39 @@ type ClusterExtensionRevisionStatus struct {
137287
// +kubebuilder:object:root=true
138288
// +kubebuilder:resource:scope=Cluster
139289
// +kubebuilder:subresource:status
140-
141-
// ClusterExtensionRevision is the Schema for the clusterextensionrevisions API
142290
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=`.status.conditions[?(@.type=='Available')].status`
143291
// +kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp`
292+
293+
// ClusterExtensionRevision is the schema for the ClusterExtensionRevisions API.
294+
//
295+
// A ClusterExtensionRevision represents an immutable snapshot of the Kubernetes objects
296+
// to be installed for a specific version of a ClusterExtension. Each revision contains
297+
// a set of objects organized into phases that are rolled out sequentially.
298+
//
299+
// ClusterExtensionRevisions are created and managed automatically by the
300+
// ClusterExtension controller and should not be created directly by users. Each
301+
// ClusterExtension may have multiple revisions over its lifetime as it is upgraded
302+
// or reconfigured.
303+
//
304+
// The revision rollout follows a phased approach where objects are applied in a
305+
// well-defined order based on their types (e.g., namespaces, then RBAC, then CRDs,
306+
// then deployments). Within each phase, all objects are applied simultaneously and
307+
// must pass their readiness probes before the rollout progresses to the next phase.
308+
//
309+
// Revisions have three lifecycle states:
310+
// - Active: The revision is actively managed and reconciled (default state)
311+
// - Paused: Reconciliation is disabled but status updates continue
312+
// - Archived: The revision is torn down, objects are deleted, and the revision
313+
// removes itself from the owner list of managed objects
144314
type ClusterExtensionRevision struct {
145315
metav1.TypeMeta `json:",inline"`
146316
metav1.ObjectMeta `json:"metadata,omitempty"`
147317

148-
// spec is an optional field that defines the desired state of the ClusterExtension.
318+
// spec is an optional field that defines the desired state of the ClusterExtensionRevision.
149319
// +optional
150320
Spec ClusterExtensionRevisionSpec `json:"spec,omitempty"`
151321

152-
// status is an optional field that defines the observed state of the ClusterExtension.
322+
// status is an optional field that defines the observed state of the ClusterExtensionRevision.
153323
// +optional
154324
Status ClusterExtensionRevisionStatus `json:"status,omitempty"`
155325
}

0 commit comments

Comments
 (0)