Skip to content

Commit 10c57dd

Browse files
author
Per Goncalves da Silva
committed
Update ClusterExtensionRevision API docs
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent 5ed8cf4 commit 10c57dd

File tree

4 files changed

+436
-100
lines changed

4 files changed

+436
-100
lines changed

api/v1/clusterextensionrevision_types.go

Lines changed: 115 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ 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
35+
// Condition reasons
3236
ClusterExtensionRevisionReasonAvailable = "Available"
3337
ClusterExtensionRevisionReasonReconcileFailure = "ReconcileFailure"
3438
ClusterExtensionRevisionReasonRevisionValidationFailure = "RevisionValidationFailure"
@@ -44,22 +48,47 @@ const (
4448

4549
// ClusterExtensionRevisionSpec defines the desired state of ClusterExtensionRevision.
4650
type ClusterExtensionRevisionSpec struct {
47-
// Specifies the lifecycle state of the ClusterExtensionRevision.
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.
4859
//
4960
// +kubebuilder:default="Active"
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"
61+
// +kubebuilder:validation:Enum=Active;Archived
62+
// +kubebuilder:validation:XValidation:rule="oldSelf == 'Active' || oldSelf == 'Archived' && oldSelf == self", message="cannot un-archive"
5263
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.
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.
5671
//
5772
// +kubebuilder:validation:Required
5873
// +kubebuilder:validation:Minimum:=1
5974
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="revision is immutable"
6075
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.
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 simultaneously.
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.
6392
//
6493
// +kubebuilder:validation:XValidation:rule="self == oldSelf || oldSelf.size() == 0", message="phases is immutable"
6594
// +listType=map
@@ -75,33 +104,68 @@ const (
75104
// ClusterExtensionRevisionLifecycleStateActive / "Active" is the default lifecycle state.
76105
ClusterExtensionRevisionLifecycleStateActive ClusterExtensionRevisionLifecycleState = "Active"
77106
// ClusterExtensionRevisionLifecycleStatePaused / "Paused" disables reconciliation of the ClusterExtensionRevision.
78-
// Only Status updates will still propagated, but object changes will not be reconciled.
107+
// Object changes will not be reconciled. However, status updates will be propagated.
79108
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.
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.
83112
ClusterExtensionRevisionLifecycleStateArchived ClusterExtensionRevisionLifecycleState = "Archived"
84113
)
85114

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.
115+
// ClusterExtensionRevisionPhase represents a group of objects that are applied together.
116+
//
117+
// Objects in a phase are applied simultaneously.
118+
// All objects must pass their readiness probes before the revision progresses to the next phase.
119+
// Phases are applied in a defined order based on the types of objects they contain.
88120
type ClusterExtensionRevisionPhase struct {
89-
// Name identifies this phase.
121+
// name is a required identifier for this phase.
122+
//
123+
// phase names must follow the DNS label standard as defined in [RFC 1123].
124+
// They must contain only lowercase alphanumeric characters or hyphens (-),
125+
// start and end with an alphanumeric character, and be no longer than 63 characters.
126+
//
127+
// Common phase names include: namespaces, policies, rbac, crds, storage, deploy, publish.
128+
//
129+
// [RFC 1123]: https://tools.ietf.org/html/rfc1123
90130
//
91131
// +kubebuilder:validation:MaxLength=63
92132
// +kubebuilder:validation:Pattern=`^[a-z]([-a-z0-9]*[a-z0-9])?$`
93133
Name string `json:"name"`
94-
// Objects are a list of all the objects within this phase.
134+
135+
// objects is a required list of all Kubernetes objects in this phase.
136+
//
137+
// All objects in this list are applied to the cluster simultaneously.
138+
// The phase is considered complete only after all objects pass their readiness probes.
95139
Objects []ClusterExtensionRevisionObject `json:"objects"`
96140
}
97141

98-
// ClusterExtensionRevisionObject contains an object and settings for it.
142+
// ClusterExtensionRevisionObject represents a Kubernetes object to be applied as part
143+
// of a ClusterExtensionRevision, along with its collision protection settings.
99144
type ClusterExtensionRevisionObject struct {
145+
// object is a required embedded Kubernetes object to be applied.
146+
//
147+
// This object must be a valid Kubernetes resource with apiVersion, kind, and metadata fields.
148+
// Status fields are not permitted and are removed if present.
149+
// Only specific metadata fields are preserved: name, namespace, labels, and annotations.
150+
//
100151
// +kubebuilder:validation:EmbeddedResource
101152
// +kubebuilder:pruning:PreserveUnknownFields
102153
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.
154+
155+
// collisionProtection controls whether the operator can adopt and modify objects
156+
// that already exist on the cluster.
157+
//
158+
// When set to "Prevent" (the default), the operator only manages objects it created itself.
159+
// This prevents ownership collisions.
160+
//
161+
// When set to "IfNoController", the operator can adopt and modify pre-existing objects
162+
// that are not owned by another controller.
163+
// This is useful for taking over management of manually-created resources.
164+
//
165+
// When set to "None", the operator can adopt and modify any pre-existing object, even if
166+
// owned by another controller.
167+
// Use this setting with extreme caution as it may cause multiple controllers to fight over
168+
// the same resource, resulting in increased load on the API server and etcd.
105169
//
106170
// +kubebuilder:default="Prevent"
107171
// +kubebuilder:validation:Enum=Prevent;IfNoController;None
@@ -128,6 +192,27 @@ const (
128192

129193
// ClusterExtensionRevisionStatus defines the observed state of a ClusterExtensionRevision.
130194
type ClusterExtensionRevisionStatus struct {
195+
// conditions is an optional list of status conditions describing the state of the
196+
// ClusterExtensionRevision.
197+
//
198+
// The Progressing condition represents whether the revision is actively rolling out:
199+
// - When status is True and reason is Progressing, the revision rollout is actively making progress and is in transition.
200+
// - When Progressing is not present, the revision is not currently in transition.
201+
//
202+
// The Available condition represents whether the revision has been successfully rolled out and is available:
203+
// - When status is True and reason is Available, the revision has been successfully rolled out and all objects pass their readiness probes.
204+
// - When status is False and reason is Incomplete, the revision rollout has not yet completed but no specific failures have been detected.
205+
// - When status is False and reason is ProbeFailure, one or more objects are failing their readiness probes during rollout.
206+
// - When status is False and reason is ReconcileFailure, the revision has encountered a general reconciliation failure.
207+
// - When status is False and reason is RevisionValidationFailure, the revision failed preflight validation checks.
208+
// - When status is False and reason is PhaseValidationError, a phase within the revision failed preflight validation checks.
209+
// - When status is False and reason is ObjectCollisions, objects in the revision collide with existing cluster objects that cannot be adopted.
210+
// - When status is Unknown and reason is Archived, the revision has been archived and its objects have been torn down.
211+
// - 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.
212+
//
213+
// The Succeeded condition represents whether the revision has successfully completed its rollout:
214+
// - 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.
215+
//
131216
// +listType=map
132217
// +listMapKey=type
133218
// +optional
@@ -137,19 +222,24 @@ type ClusterExtensionRevisionStatus struct {
137222
// +kubebuilder:object:root=true
138223
// +kubebuilder:resource:scope=Cluster
139224
// +kubebuilder:subresource:status
140-
141-
// ClusterExtensionRevision is the Schema for the clusterextensionrevisions API
142225
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=`.status.conditions[?(@.type=='Available')].status`
143226
// +kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp`
227+
228+
// ClusterExtensionRevision is the schema for the ClusterExtensionRevisions API.
229+
//
230+
// A ClusterExtensionRevision represents an immutable snapshot of Kubernetes objects
231+
// for a specific version of a ClusterExtension. Each revision contains objects
232+
// organized into phases that roll out sequentially. Multiple revisions can be active at the same time
233+
// the parent ClusterExtension upgrades or reconfigures.
144234
type ClusterExtensionRevision struct {
145235
metav1.TypeMeta `json:",inline"`
146236
metav1.ObjectMeta `json:"metadata,omitempty"`
147237

148-
// spec is an optional field that defines the desired state of the ClusterExtension.
238+
// spec defines the desired state of the ClusterExtensionRevision.
149239
// +optional
150240
Spec ClusterExtensionRevisionSpec `json:"spec,omitempty"`
151241

152-
// status is an optional field that defines the observed state of the ClusterExtension.
242+
// status is optional and defines the observed state of the ClusterExtensionRevision.
153243
// +optional
154244
Status ClusterExtensionRevisionStatus `json:"status,omitempty"`
155245
}

0 commit comments

Comments
 (0)