Repository navigation
📖 GA API shape review (full Go definitions) - #3190
perdasilva wants to merge 2 commits into
Conversation
👷 Deploy request for olmv1 pending review.Visit the deploys page to approve it
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
cac6563 to
023840b
Compare
023840b to
26ec94a
Compare
| // namespace specifies a Kubernetes namespace. | ||
| // It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster. | ||
| // Some extensions may contain namespace-scoped resources to be applied in other namespaces. | ||
| // This namespace must exist. | ||
| // | ||
| // The namespace field is required, immutable, and follows the DNS label standard as defined in [RFC 1123]. | ||
| // It must contain only lowercase alphanumeric characters or hyphens (-), start and end with an alphanumeric character, | ||
| // and be no longer than 63 characters. | ||
| // | ||
| // [RFC 1123]: https://tools.ietf.org/html/rfc1123 | ||
| // | ||
| // <opcon:standard:validation:XValidation:rule="self == oldSelf",message="namespace is immutable"> | ||
| // <opcon:standard:validation:XValidation:rule="self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")",message="namespace must be a valid DNS1123 label"> | ||
| // <opcon:experimental:validation:XValidation:rule="self == oldSelf",message="namespace is immutable"> | ||
| // <opcon:experimental:validation:XValidation:rule="self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")",message="namespace must be a valid DNS1123 label"> | ||
| // | ||
| // +kubebuilder:validation:MaxLength:=63 | ||
| // +required |
There was a problem hiding this comment.
For GA, this needs to be optional, and use the new managed-namespace mode that @nader-ziada completed.
| TypeInstalled = "Installed" | ||
| TypeProgressing = "Progressing" |
There was a problem hiding this comment.
Should we drop common types and instead use <Kind>Type<Condition> and <Kind>Reason<Reason> to help make it immediately clear which types/reasons go with which APIs?
I think that would help humans (and bots) easily spot mistakes where types/reasons are used in unexpected places, which seems like it would be really easy to do without scoped types/reasons.
| TypeDeprecated = "Deprecated" | ||
| TypePackageDeprecated = "PackageDeprecated" | ||
| TypeChannelDeprecated = "ChannelDeprecated" | ||
| TypeBundleDeprecated = "BundleDeprecated" |
There was a problem hiding this comment.
Use ClusterExtensionType* for the names of the deprecation type constants to clarify that these are scoped to CEs?
26ec94a to
aaabbae
Compare
| // active revision remains. | ||
| // - Unknown, Unknown: the deployment has a single active revision, but its | ||
| // readiness is not yet determined. | ||
| // - Unknown, NoActiveRevision: the deployment controls no active revision. |
There was a problem hiding this comment.
should this be False?
| // | ||
| // The controller compiles and type-checks rule before evaluation. Its inferred | ||
| // result type must be boolean; compilation failures and non-boolean result types | ||
| // are invalid configuration. CRD admission validates only the configuration's |
There was a problem hiding this comment.
| // are invalid configuration. CRD admission validates only the configuration's | |
| // are invalid configuration. CR admission validates only the configuration's |
?
e379525 to
d6e1e28
Compare
Verbatim copy of api/v1/clusterextension_types.go from main, with deviations decided outside this shape review: .spec.config is moved out of experimental, and the condition constants reflect the Ready condition (ClusterExtensionTypeReady replaces ClusterExtensionTypeAvailable; ClusterExtensionReasonProbesSucceeded and ClusterExtensionReasonProgressDeadlineExceeded are removed). Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
a00bb64 to
43ed9a4
Compare
| // <opcon:experimental> | ||
| ProgressDeadlineMinutes int32 `json:"progressDeadlineMinutes,omitempty"` | ||
|
|
||
| // template is the desired content of newly created ClusterObjectSets. |
There was a problem hiding this comment.
use revision verbiage (ok to call out that a revision is a ClusterObjectSet object)
|
|
||
| // ClusterObjectDeploymentTemplate describes the caller-controlled part of a revision. | ||
| type ClusterObjectDeploymentTemplate struct { | ||
| // metadata contains labels and annotations propagated to each ClusterObjectSet |
There was a problem hiding this comment.
ClusterObjectSet verbiage
| // rollout within spec.progressDeadlineMinutes. | ||
| // </opcon:experimental:description> | ||
| // - True, PreconditionsNotMet: the latest revision is waiting on | ||
| // preconditions that are not yet met, such as RBAC or a CRD that has not yet |
There was a problem hiding this comment.
not clear what CRD that has not yet propagated means exactly...tune language to make examples easy to grok.
| // - False, InvalidSpecification: the revision content is invalid, either | ||
| // because spec.template.metadata contains labels or annotations that are | ||
| // not valid on a ClusterObjectSet, or because objects in the latest | ||
| // revision are invalid. In both cases, correct spec.template to resume. |
There was a problem hiding this comment.
"or because objects in the latest revision are invalid" maybe an example of what invalid might be?
| type ClusterObjectDeploymentStatus struct { | ||
| // conditions describes the rollout state and readiness of the deployment. | ||
| // | ||
| // Progressing reports the rollout of the current revision spec. Once the |
There was a problem hiding this comment.
it's not clear that the current revision spec == the latest revision - maybe tune the language a bit?
| // controller. Remove it, or restore its | ||
| // app.kubernetes.io/managed-by=object-controller label, to resume. | ||
| // | ||
| // Ready reports whether the deployment's objects are at the desired state. |
There was a problem hiding this comment.
instead of "the deployment's objects" maybe we should say "the latest revision"? or "defined in the condition generation's template" or something like that?
|
|
||
| // lifecycleState specifies the lifecycle state of the ClusterObjectSet. | ||
| // | ||
| // When set to "Active", the revision is actively managed and reconciled. |
There was a problem hiding this comment.
let's remove the revision verbiage from the doc strings (with the exception of .spec.revision)
| // +kubebuilder:validation:XValidation:rule="self.collisionProtection == oldSelf.collisionProtection",message="collisionProtection is immutable" | ||
| type ClusterObjectSetSpec struct { | ||
| // group is a required, immutable identifier that links related revisions together. | ||
| // All revisions sharing the same group form an ordered sequence, regardless of owner references. |
There was a problem hiding this comment.
let's remove the revision verbiage (in the sense of using ClusterObjectSet and revision interchangeably - we should point out that the order comes from their .spec.revision
| // | ||
| // Once a revision is set to "Archived", it cannot be un-archived. | ||
| // | ||
| // More than one revision may be "Active" during a rollout. For revisions owned |
There was a problem hiding this comment.
remove revision verbiage
| } | ||
|
|
||
| // ClusterObjectSetContent holds the revision content shared between | ||
| // ClusterObjectSet.spec and a ClusterObjectDeployment's template spec. |
There was a problem hiding this comment.
we can probably do without the "shared between ClusterObjectSet.spec and ClusterObjectDeployment's template spec. This is an implementation detail...?
| // phases is a required list of phases that group objects to be applied together. | ||
| // | ||
| // All objects in a phase are applied in no particular order. | ||
| // The revision progresses to the next phase only after all objects in the current phase pass their progression probes. |
There was a problem hiding this comment.
"...phase pass their progression probes" we should add "if any are defined" or something like that to call out that not all objects will have progression probes.
| // strategy for all objects in this content. Individual phases or objects can override this value. | ||
| // | ||
| // This value is used as the default for any phase or object that does not explicitly specify | ||
| // its own collisionProtection. The resolution order is: object > phase > content. |
There was a problem hiding this comment.
maybe, "object, then phase, then content"? the ">" could be interpreted as a greater than, which mean e.g. the object takes precedence over phase. Or maybe arrow "->""? just a nit
| CollisionProtection CollisionProtection `json:"collisionProtection,omitempty"` | ||
| } | ||
|
|
||
| // ProbeType defines the type of progression probe. |
There was a problem hiding this comment.
let's move to "ProbeType defines the type of object status probe.
| ProbeTypeCEL ProbeType = "CEL" | ||
| ) | ||
|
|
||
| // Probe is a discriminated union defining a progression check for an object. |
There was a problem hiding this comment.
let's move away from progression verbiage for the probe documentation. The same probes could be used for other means later on. Progression probe verbiage should only appear in the progressionProbes set on the objects in the phase.
| InlineManifest unstructured.Unstructured `json:"inlineManifest,omitempty,omitzero"` | ||
|
|
||
| // objectSliceRef is an optional reference to an object manifest within a | ||
| // cluster-scoped ClusterObjectSlice. No namespace is needed for this reference. |
There was a problem hiding this comment.
we can drop "No namespace is needed for this reference."
| InlineManifest unstructured.Unstructured `json:"inlineManifest,omitempty,omitzero"` | ||
|
|
||
| // objectSliceRef is an optional reference to an object manifest within a | ||
| // cluster-scoped ClusterObjectSlice. No namespace is needed for this reference. |
There was a problem hiding this comment.
we can drop "cluster-scoped"
| ObjectSliceRef ObjectSliceSourceRef `json:"objectSliceRef,omitzero"` | ||
|
|
||
| // progressionProbes is an optional list of checks evaluated against this | ||
| // object's live state, regardless of the desired manifest's source. |
There was a problem hiding this comment.
maybe we could clarify "regardless of the desired manifest's source".
| // progressionProbes is an optional list of checks evaluated against this | ||
| // object's live state, regardless of the desired manifest's source. | ||
| // All configured probes must pass for the object to satisfy its progression | ||
| // requirements. Failed or unknown results may block advancement to later phases. |
There was a problem hiding this comment.
"may block" -> "block"
| // at admission. | ||
| // | ||
| // +required | ||
| Entry ObjectSliceEntryRef `json:"entry,omitzero"` |
There was a problem hiding this comment.
Let's rename the field and type to ObjectRef
| // conditions is an optional list of status conditions describing the state of the | ||
| // ClusterObjectSet. | ||
| // | ||
| // The Ready condition represents the state of the revision. |
There was a problem hiding this comment.
move away from revision verbiage
| // ClusterObjectSet. | ||
| // | ||
| // The Ready condition represents the state of the revision. | ||
| // True means this revision's desired state is realized and its progression |
There was a problem hiding this comment.
let's expand on desired state or reword to make clear that the criteria is that all objects:
- are managed by the ClusterObjectSet
- are passing their progression probes (if any are defined)
- are at the desired spec defined in the ClusterObjectSet
(polish the language above)
| // - False with reason ObjectsNotReady: one or more objects are still being applied or have not yet passed their progression probes during rollout. | ||
| // - False with reason Superseded: one or more objects have been adopted by a newer revision of the object set. | ||
| // - False with reason ObjectCollision: one or more objects are controlled by another owner, or are unowned while collision protection prevents adoption, so this revision cannot take ownership of them. | ||
| // - False with reason PreconditionsNotMet: a precondition for applying the revision is not yet satisfied (referenced object content is unavailable, invalid, or changed, or a preflight dry-run was rejected, e.g. an immutable field, a conflicting object, or RBAC/dependency CRDs not yet propagated); the revision keeps retrying and recovers once the precondition is met. |
There was a problem hiding this comment.
CRDs not yet propagated isn't clear
| // +optional | ||
| Present *int64 `json:"present,omitempty"` | ||
|
|
||
| // synced is the number of objects controlled by this revision whose observed |
There was a problem hiding this comment.
desired state for sync'ed means desired spec (i.e. don't include probes). We should make this clear.
| Synced *int64 `json:"synced,omitempty"` | ||
|
|
||
| // superseded is the number of objects observed under the control of a | ||
| // recognized sibling with a higher revision number. During reconciliation, |
There was a problem hiding this comment.
we should call out in the group description (if we already don't) what a recognized sibling is.
210b960 to
0669c81
Compare
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>
0669c81 to
ddcd681
Compare
Draft for review only — not intended to merge.
This PR adds the complete Go API type definitions for ClusterObjectDeployment, ClusterObjectSet, and ClusterExtension (plus the shared
common_types.go) undertmp/, copied from the API work onrefactor/clusterobjectset-status-api. The goal is to review the proposed GA API in its entirety rather than as a diff against the current types. Everything outsidetmp/is unchangedmain.See
tmp/README.mdfor provenance and a per-API summary of the differences from the current upstream/main definitions. Highlights:spec.progressDeadlineMinutesremoved; theAvailablecondition is redefined around per-object probe health — a revision is available when every object it declares is present and passes its progression probes, independent of ownership or spec conformance — with reasonsAvailable,Unavailable,Unknown, andNoActiveRevision; conditions documentation restructured per reason.status.unhealthyObjectscount alongsidehealthyObjects; objects with undetermined probe states count as neither healthy nor unhealthy, sohealthy + unhealthymay be less thanpresentObjects.spec.config,spec.progressDeadlineMinutes, andstatus.install.bundle.releaseremoved;spec.namespaceis optional at GA — when omitted, operator-controller resolves and creates a managed namespace; whether it is set is fixed at creation time, and the value is immutable and DNS-label validated; theAvailablecondition mirrors the managing ClusterObjectDeployment's.spec.progressDeadlineMinutes,spec.config, andstatus.install.bundle.releasewere experimental-only and gated onBoxcutterRuntime, so their removal from the GA shape does not affect standard installs.Once the shape is agreed, the underlying API changes will come through regular PRs against
api/v1.