Skip to content

Commit 2b3deb4

Browse files
author
Per G. da Silva
committed
📖 Apply the proposed GA API shape
ClusterExtension: optional namespace with managed-namespace mode, serviceAccount historic role and fail-open documentation, Ready condition mirroring the managing ClusterObjectDeployment, and experimental retention of spec.progressDeadlineMinutes and status.install.bundle.release. ClusterObjectDeployment (new): condition constants and the Ready condition defined around the active revision's own readiness. ClusterObjectSet (new): grouped objectCounts without health counts, status.phases with pinned contentDigest and sparse per-object diagnostics identified by target identity, objectSliceRef object sources, per-object progressionProbes with ConditionEqual and CEL rules, and experimental phase status fields. ClusterObjectSlice (new): discriminated-union spec with the InlineManifests content type storing embedded manifests inline. Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
1 parent e2ee138 commit 2b3deb4

5 files changed

Lines changed: 1544 additions & 40 deletions

File tree

‎tmp/README.md‎

Lines changed: 89 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,92 @@
11
# GA API shape — review copies
22

3-
This directory holds Go API type definitions for reviewing the proposed GA
4-
API shape. The first files are verbatim copies of the current definitions
5-
from `api/v1`; subsequent commits apply the proposed GA shape so each kind's
6-
changes can be reviewed as a diff.
3+
These are the complete Go API type definitions for ClusterObjectDeployment,
4+
ClusterObjectSet, ClusterExtension, and ClusterObjectSlice (with their kind-scoped condition
5+
constants), copied from the `refactor/clusterobjectset-status-api` branch.
6+
They are copied here so the proposed GA shape can be reviewed in its entirety
7+
rather than as a diff against the current types.
78

8-
This directory is for review only and will not be merged. The files rely
9-
only on the unchanged `groupversion_info.go` boilerplate.
9+
This directory is for review only and will not be merged. The files are otherwise
10+
unmodified; they rely only on the unchanged `groupversion_info.go` boilerplate.
11+
Channel-specific descriptions are marked with `<opcon:standard:...>` and
12+
`<opcon:experimental:...>` directives; CRD schemas, printer columns, and
13+
validation are generated from the kubebuilder markers shown here.
14+
15+
## Differences from the current upstream/main experimental CRDs
16+
17+
Note: "removed" below means the field is not part of the proposed standard GA
18+
API, or is not relevant under the `BoxcutterRuntime` feature gate — not
19+
necessarily that the capability is gone from the product.
20+
21+
### ClusterObjectDeployment (`clusterobjectdeployment_types.go`)
22+
23+
- `spec.progressDeadlineMinutes` and the `ProgressDeadlineExceeded` Progressing
24+
reason are retained as experimental (omitted from standard-channel CRDs).
25+
- `Available` renamed to `Ready` and redefined around the active revision's own
26+
Ready condition instead of per-object probe health: True when the single
27+
active revision is Ready (`RevisionReady`), False when it is not
28+
(`RevisionNotReady`) or when no active revision is controlled
29+
(`NoActiveRevision`), Unknown while more than one active revision exists
30+
(`MultipleActiveRevisions`) or when its readiness is undetermined
31+
(`Unknown`).
32+
- `status.conditions` documentation restructured per Progressing reason, without
33+
controller internals; `NewClusterObjectSetProgressing` now also covers revision
34+
creation and adoption.
35+
- `spec.template.metadata` documents its reserved labels
36+
(`olm.operatorframework.io/template-hash`, `app.kubernetes.io/managed-by`) and
37+
the label/annotation entry limits and validation.
38+
39+
### ClusterObjectSet (`clusterobjectset_types.go`)
40+
41+
- Object sources: `secretRef` (Secret reference) replaced by `objectSliceRef`
42+
(slice name plus entry identity — apiVersion, kind, name, namespace — into a
43+
cluster-scoped `ClusterObjectSlice`); the object `type` enum is now
44+
`InlineManifest`/`ObjectSliceRef`.
45+
- `ClusterObjectSlice` (started from #3195, reworked here): the spec is a
46+
discriminated union with a single content type, `inlineManifests`, whose
47+
`manifests` list stores embedded Kubernetes manifests inline, each carrying
48+
its own target identity (replacing the encoded-envelope entry design).
49+
- Probes: revision-level `progressionProbes` (selector +
50+
`ConditionEqual`/`FieldsEqual`/`FieldValue` assertions) replaced by per-object
51+
`progressionProbes` supporting `ConditionEqual` and `CEL` rules.
52+
- Status counts: remain grouped under `status.objectCounts`, now with
53+
`{total,present,synced,superseded,colliding}`; `ready` and the health counts
54+
(`healthyObjects`, `unhealthyObjects`) are removed.
55+
- `status.observedPhases` replaced by `status.phases`: pinned `contentDigest`,
56+
lifecycle `status`, machine-readable `reason`, and sparse per-object
57+
`diagnostics` categorized by reason; object entries are identified by
58+
apiVersion, kind, name, and namespace, matching the spec's object
59+
references. The phase `status`, `reason`, `message`,
60+
and `lastTransitionTime` fields are experimental (standard-channel CRDs omit
61+
them); `completedAt`, `contentDigest`, and `objectDetails` are standard.
62+
- `spec.lifecycleState` documentation updated to assign archival responsibility:
63+
the owning ClusterObjectDeployment decides when to archive older revisions (on
64+
recorded rollout completion), the ClusterObjectSet controller tears down a
65+
revision once `lifecycleState` is set to `Archived`, and standalone callers
66+
archive explicitly.
67+
- New printer columns: `Superseded` and `Colliding` (counts now served from
68+
`status.objectCounts`).
69+
70+
### ClusterExtension (`clusterextension_types.go`)
71+
72+
- `spec.namespace` is optional at GA: when omitted, operator-controller
73+
resolves and creates a managed namespace from the bundle's metadata. Whether
74+
namespace is set or omitted is fixed at creation time; the value itself is
75+
immutable and DNS-label validated. (The standard CRD previously required it.)
76+
- `spec.config` (inline bundle configuration) is part of the standard API.
77+
- Retained as experimental (omitted from standard-channel CRDs):
78+
`spec.progressDeadlineMinutes` and `status.install.bundle.release`.
79+
- Conditions documentation: the `Ready` condition (replacing `Available`)
80+
mirrors the managing ClusterObjectDeployment's `Ready` condition.
81+
- Condition constants are kind-scoped (`ClusterExtensionType*`,
82+
`ClusterExtensionReason*`) and live in `clusterextension_types.go`;
83+
`common_types.go` is removed (see #3205).
84+
85+
The only other change is the `controller-gen.kubebuilder.io/version` annotation
86+
(v0.21.0 → v0.23.0), from regenerating with the current toolchain.
87+
88+
To reproduce a full diff for a kind:
89+
90+
```console
91+
git diff upstream/main:api/v1/<kind>_types.go tmp/<kind>_types.go
92+
```

‎tmp/clusterextension_types.go‎

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -50,46 +50,36 @@ const (
5050
// ClusterExtensionSpec defines the desired state of ClusterExtension
5151
type ClusterExtensionSpec struct {
5252
// namespace specifies a Kubernetes namespace.
53-
// <opcon:standard:description>It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
54-
// Some extensions may contain namespace-scoped resources to be applied in other namespaces.
55-
// This namespace must exist.
56-
//
57-
// The namespace field is required, immutable, and follows the DNS label standard as defined in [RFC 1123].
58-
// It must contain only lowercase alphanumeric characters or hyphens (-), start and end with an alphanumeric character,
59-
// and be no longer than 63 characters.
60-
//
61-
// [RFC 1123]: https://tools.ietf.org/html/rfc1123
62-
// </opcon:standard:description>
63-
// <opcon:experimental:description>
6453
// It designates the default namespace where namespace-scoped resources for the extension
65-
// are applied to.
54+
// are applied.
6655
//
67-
// namespace is optional. When set, it must reference an existing namespace on the cluster.
56+
// namespace is optional. When set, it must reference an existing namespace on the cluster. This namespace is unmanaged and will not be affected by deleting the ClusterExtension.
6857
// When omitted, operator-controller resolves and creates a managed namespace from the
69-
// bundle's metadata. Whether namespace is set or omitted is fixed at creation time and
58+
// bundle's metadata. This namespace will be deleted if the ClusterExtension is deleted. Whether namespace is set or omitted is fixed at creation time and
7059
// cannot be changed afterwards.
7160
//
7261
// The namespace field follows the DNS label standard as defined in [RFC 1123].
7362
// It must contain only lowercase alphanumeric characters or hyphens (-), start and end with an alphanumeric character,
7463
// and be no longer than 63 characters.
7564
//
7665
// [RFC 1123]: https://tools.ietf.org/html/rfc1123
77-
// </opcon:experimental:description>
78-
//
79-
// <opcon:standard:validation:XValidation:rule="self == oldSelf",message="namespace is immutable">
80-
// <opcon:standard:validation:XValidation:rule="self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")",message="namespace must be a valid DNS1123 label">
81-
// <opcon:experimental:validation:XValidation:rule="self == oldSelf",message="namespace is immutable">
82-
// <opcon:experimental:validation:XValidation:rule="self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")",message="namespace must be a valid DNS1123 label">
83-
// <opcon:experimental:validation:Optional>
8466
//
67+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="namespace is immutable"
68+
// +kubebuilder:validation:XValidation:rule="self.matches(\"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$\")",message="namespace must be a valid DNS1123 label"
8569
// +kubebuilder:validation:MaxLength:=63
86-
// +required
70+
// +optional
8771
Namespace string `json:"namespace,omitzero"`
8872

8973
// serviceAccount is a deprecated field and is completely ignored.
90-
// OLMv1 is a single-tenant system where users with ClusterExtension write access are
91-
// effectively delegated cluster-admin trust. The operator-controller runs with
92-
// cluster-admin privileges and uses its own service account for all cluster interactions.
74+
// Historically, serviceAccount specified the service account used to apply
75+
// this extension's content, letting adopters scope installation privileges.
76+
// It has no effect: ClusterExtension is a cluster-scoped resource where
77+
// users with write access are effectively delegated cluster-admin trust,
78+
// and the operator-controller runs with cluster-admin privileges and uses
79+
// its own service account for all cluster interactions.
80+
// Because the field is silently accepted, its presence must not be read as
81+
// confirmation that an extension's content requires no additional
82+
// privileges; it provides no signal either way.
9383
//
9484
// Deprecated: serviceAccount is no longer used and will be removed in a future release.
9585
//
@@ -397,6 +387,8 @@ type CatalogFilter struct {
397387
}
398388

399389
// ServiceAccountReference is a deprecated type and is completely ignored.
390+
// Historically, it selected the service account used to apply a
391+
// ClusterExtension's content.
400392
//
401393
// Deprecated: ServiceAccountReference is no longer used and will be removed in a future release.
402394
//
@@ -478,10 +470,10 @@ const (
478470
ClusterExtensionReasonAbsent = "Absent"
479471

480472
// Progressing reasons
481-
ClusterExtensionReasonRollingOut = "RollingOut"
482-
ClusterExtensionReasonRetrying = "Retrying"
483-
ClusterExtensionReasonBlocked = "Blocked"
484-
ClusterExtensionReasonInvalidConfiguration = "InvalidConfiguration"
473+
ClusterExtensionReasonNewRevisionRollingOut = "NewRevisionRollingOut"
474+
ClusterExtensionReasonRetrying = "Retrying"
475+
ClusterExtensionReasonBlocked = "Blocked"
476+
ClusterExtensionReasonInvalidConfiguration = "InvalidConfiguration"
485477

486478
// Deprecation reasons
487479
ClusterExtensionReasonDeprecated = "Deprecated"
@@ -553,9 +545,15 @@ type ClusterExtensionStatus struct {
553545
// When Progressing is True and the Reason is Succeeded, the ClusterExtension is making progress towards a new state.
554546
// When Progressing is True and the Reason is Retrying, the ClusterExtension has encountered an error that could be resolved on subsequent reconciliation attempts.
555547
// When Progressing is False and the Reason is Blocked, the ClusterExtension has encountered an error that requires manual intervention for recovery.
556-
// <opcon:experimental:description>
557-
// When Progressing is True and Reason is RollingOut, the ClusterExtension has one or more ClusterObjectSets in active roll out.
558-
// </opcon:experimental:description>
548+
// When Progressing is True and Reason is NewRevisionRollingOut, a new revision of the
549+
// ClusterExtension's content has been determined, for example for an initial installation,
550+
// upgrade, or reconfiguration, and that revision is actively rolling out.
551+
// The Ready condition reports whether the extension's content is rolled out and its objects are ready:
552+
// - True with reason RevisionReady: the extension's current content is rolled out and all of its objects are ready.
553+
// - False with reason RevisionNotReady: the extension's current content is rolled out, but one or more of its objects are not ready.
554+
// - False with reason NoActiveRevision: the extension has no content being rolled out.
555+
// - Unknown with reason MultipleActiveRevisions: a new version of the extension's content is rolling out; readiness is not evaluated until the rollout completes.
556+
// - Unknown with reason Unknown: the readiness of the extension's content is not yet determined.
559557
//
560558
// When the ClusterExtension is sourced from a catalog, it surfaces deprecation conditions based on catalog metadata.
561559
// These are indications from a package owner to guide users away from a particular package, channel, or bundle:
@@ -607,8 +605,7 @@ type ClusterExtension struct {
607605
metav1.ObjectMeta `json:"metadata,omitempty"`
608606

609607
// spec is an optional field that defines the desired state of the ClusterExtension.
610-
//
611-
// <opcon:experimental:validation:XValidation:rule="has(oldSelf.namespace) == has(self.namespace)",message="namespace presence is immutable; it cannot be added or removed after creation">
608+
// +kubebuilder:validation:XValidation:rule="has(oldSelf.namespace) == has(self.namespace)",message="namespace presence is immutable; it cannot be added or removed after creation"
612609
// +optional
613610
Spec ClusterExtensionSpec `json:"spec,omitempty"`
614611

0 commit comments

Comments
 (0)