Skip to content

Commit 93bf7ab

Browse files
Merge pull request #570 from openshift-bot/synchronize-upstream
NO-ISSUE: Synchronize From Upstream Repositories
2 parents 496965e + f45bd14 commit 93bf7ab

21 files changed

+1044
-135
lines changed

api/v1/clusterextensionrevision_types.go

Lines changed: 109 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.
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 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.
6392
//
6493
// +kubebuilder:validation:XValidation:rule="self == oldSelf || oldSelf.size() == 0", message="phases is immutable"
6594
// +listType=map
@@ -75,33 +104,62 @@ 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. The phase is considered
116+
// complete only after all objects pass their status probes.
88117
type ClusterExtensionRevisionPhase struct {
89-
// Name identifies this phase.
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
90127
//
91128
// +kubebuilder:validation:MaxLength=63
92129
// +kubebuilder:validation:Pattern=`^[a-z]([-a-z0-9]*[a-z0-9])?$`
93130
Name string `json:"name"`
94-
// Objects are a list of all the objects within this phase.
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.
95135
Objects []ClusterExtensionRevisionObject `json:"objects"`
96136
}
97137

98-
// ClusterExtensionRevisionObject contains an object and settings for it.
138+
// ClusterExtensionRevisionObject represents a Kubernetes object to be applied as part
139+
// of a phase, along with its collision protection settings.
99140
type 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+
//
100145
// +kubebuilder:validation:EmbeddedResource
101146
// +kubebuilder:pruning:PreserveUnknownFields
102147
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.
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.
105163
//
106164
// +kubebuilder:default="Prevent"
107165
// +kubebuilder:validation:Enum=Prevent;IfNoController;None
@@ -128,6 +186,27 @@ const (
128186

129187
// ClusterExtensionRevisionStatus defines the observed state of a ClusterExtensionRevision.
130188
type 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+
//
131210
// +listType=map
132211
// +listMapKey=type
133212
// +optional
@@ -137,19 +216,24 @@ type ClusterExtensionRevisionStatus struct {
137216
// +kubebuilder:object:root=true
138217
// +kubebuilder:resource:scope=Cluster
139218
// +kubebuilder:subresource:status
140-
141-
// ClusterExtensionRevision is the Schema for the clusterextensionrevisions API
142219
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=`.status.conditions[?(@.type=='Available')].status`
143220
// +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.
144228
type ClusterExtensionRevision struct {
145229
metav1.TypeMeta `json:",inline"`
146230
metav1.ObjectMeta `json:"metadata,omitempty"`
147231

148-
// spec is an optional field that defines the desired state of the ClusterExtension.
232+
// spec defines the desired state of the ClusterExtensionRevision.
149233
// +optional
150234
Spec ClusterExtensionRevisionSpec `json:"spec,omitempty"`
151235

152-
// status is an optional field that defines the observed state of the ClusterExtension.
236+
// status is optional and defines the observed state of the ClusterExtensionRevision.
153237
// +optional
154238
Status ClusterExtensionRevisionStatus `json:"status,omitempty"`
155239
}

commitchecker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
expectedMergeBase: 045989d84a7570b1cfddeee47eae64d47245aff2
1+
expectedMergeBase: 34394ce0a7067e1f1622dc2c381a9a12439b10d2
22
upstreamBranch: main
33
upstreamOrg: operator-framework
44
upstreamRepo: operator-controller

hack/test/install-prometheus.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ echo "Patching namespace to ${PROMETHEUS_NAMESPACE}..."
3838
echo "Applying Prometheus base..."
3939
kubectl apply -k "$TMPDIR" --server-side
4040

41+
echo "Waiting for Prometheus Operator deployment to become available..."
42+
kubectl wait --for=condition=Available deployment/prometheus-operator -n "$PROMETHEUS_NAMESPACE" --timeout=180s
43+
4144
echo "Waiting for Prometheus Operator pod to become ready..."
42-
kubectl wait --for=condition=Ready pod -n "$PROMETHEUS_NAMESPACE" -l app.kubernetes.io/name=prometheus-operator
45+
kubectl wait --for=condition=Ready pod -n "$PROMETHEUS_NAMESPACE" -l app.kubernetes.io/name=prometheus-operator --timeout=120s
4346

4447
echo "Applying prometheus Helm chart..."
4548
${HELM} template prometheus helm/prometheus ${PROMETHEUS_VALUES} | sed "s/cert-git-version/cert-${VERSION}/g" | kubectl apply -f -

hack/tools/crd-generator/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ A semi-colon separated list of enumerations, similar to the `+kubebuilder:valida
3333

3434
An XValidation scheme, similar to the `+kubebuilder:validation:XValidation` scheme, but more limited.
3535

36+
* `Optional`
37+
38+
Indicating that this field should not be listed as required in its parent.
39+
40+
* `Required`
41+
42+
Indicating that this field should be listed as required in its parent.
43+
3644
## Experimental Description
3745

3846
* Start Tag: `<opcon:experimental:description>`
@@ -44,6 +52,18 @@ All text between the tags is included in the experimental CRD, but removed from
4452
This is only useful if the field is included in the standard CRD, but there's additional meaning in
4553
the experimental CRD when feature gates are enabled.
4654

55+
## Standard Description
56+
57+
* Start Tag: `<opcon:standard:description>`
58+
* End Tag: `</opcon:standard:description>`
59+
60+
Descriptive text that is only included as part of the field description within the standard CRD.
61+
All text between the tags is included in the standard CRD, but removed from the experimental CRD.
62+
63+
This is useful if the field is included in the standard CRD and has differing meaning than when the
64+
field is used in the experimental CRD when feature gates are enabled.
65+
66+
4767
## Exclude from CRD Description
4868

4969
* Start Tag: `<opcon:util:excludeFromCRD>`

0 commit comments

Comments
 (0)