Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@ spec:
required:
- clusterID
properties:
capabilities:
description: capabilities configures the installation of optional, core cluster components. A null value here is identical to an empty object; see the child properties for default semantics.
type: object
properties:
additionalEnabledCapabilities:
description: additionalEnabledCapabilities extends the set of managed capabilities beyond the baseline defined in baselineCapabilitySet. The default is an empty set.
type: array
items:
description: ClusterVersionCapability enumerates optional, core cluster components.
type: string
enum:
- openshift-samples
x-kubernetes-list-type: atomic
baselineCapabilitySet:
description: baselineCapabilitySet selects an initial set of optional capabilities to enable, which can be extended via additionalEnabledCapabilities. If unset, the cluster will choose a default, and the default may change over time. The current default is vCurrent.
type: string
enum:
- None
- v4.11
- vCurrent
channel:
description: channel is an identifier for explicitly requesting that a non-default set of updates be applied to this cluster. The default channel will be contain stable updates that are appropriate for production clusters.
type: string
Expand Down Expand Up @@ -133,6 +153,28 @@ spec:
description: version is a semantic versioning identifying the update version. When this field is part of spec, version is optional if image is specified.
type: string
nullable: true
capabilities:
description: capabilities describes the state of optional, core cluster components.
type: object
properties:
enabledCapabilities:
description: enabledCapabilities lists all the capabilities that are currently managed.
type: array
items:
description: ClusterVersionCapability enumerates optional, core cluster components.
type: string
enum:
- openshift-samples
x-kubernetes-list-type: atomic
knownCapabilities:
description: knownCapabilities lists all the capabilities known to the current cluster.
type: array
items:
description: ClusterVersionCapability enumerates optional, core cluster components.
type: string
enum:
- openshift-samples
x-kubernetes-list-type: atomic
conditionalUpdates:
description: conditionalUpdates contains the list of updates that may be recommended for this cluster if it meets specific required conditions. Consumers interested in the set of updates that are actually recommended for this cluster should use availableUpdates. This list may be empty if no updates are recommended, if the update service is unavailable, or if an empty or invalid channel has been specified.
type: array
Expand Down
89 changes: 89 additions & 0 deletions config/v1/types_cluster_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ type ClusterVersionSpec struct {
// +optional
Channel string `json:"channel,omitempty"`

// capabilities configures the installation of optional, core
// cluster components. A null value here is identical to an
// empty object; see the child properties for default semantics.
// +optional
Capabilities *ClusterVersionCapabilitiesSpec `json:"capabilities,omitempty"`

// overrides is list of overides for components that are managed by
// cluster version operator. Marking a component unmanaged will prevent
// the operator from creating or updating the object.
Expand Down Expand Up @@ -113,6 +119,9 @@ type ClusterVersionStatus struct {
// +required
VersionHash string `json:"versionHash"`

// capabilities describes the state of optional, core cluster components.
Capabilities ClusterVersionCapabilitiesStatus `json:"capabilities"`

// conditions provides information about the cluster version. The condition
// "Available" is set to true if the desiredUpdate has been reached. The
// condition "Progressing" is set to true if an update is being applied.
Expand Down Expand Up @@ -215,6 +224,86 @@ type UpdateHistory struct {
// ClusterID is string RFC4122 uuid.
type ClusterID string

// ClusterVersionCapability enumerates optional, core cluster components.
// +kubebuilder:validation:Enum=openshift-samples
type ClusterVersionCapability string

const (
// ClusterVersionCapabilityOpenShiftSamples manages the sample
// image streams and templates stored in the openshift
// namespace, and any registry credentials, stored as a secret,
// needed for the image streams to import the images they
// reference.
ClusterVersionCapabilityOpenShiftSamples ClusterVersionCapability = "openshift-samples"
)

// ClusterVersionCapabilitySet defines sets of cluster version capabilities.
// +kubebuilder:validation:Enum=None;v4.11;vCurrent
type ClusterVersionCapabilitySet string

const (
// ClusterVersionCapabilitySetNone is an empty set enabling
// no optional capabilities.
ClusterVersionCapabilitySetNone ClusterVersionCapabilitySet = "None"

// ClusterVersionCapabilitySet4_11 is the recommended set of
// optional capabilities to enable for the 4.11 version of
// OpenShift. This list will remain the same no matter which
// version of OpenShift is installed.
ClusterVersionCapabilitySet4_11 ClusterVersionCapabilitySet = "v4.11"

// ClusterVersionCapabilitySetCurrent is the recommended set
// of optional capabilities to enable for the cluster's
// current version of OpenShift.
ClusterVersionCapabilitySetCurrent ClusterVersionCapabilitySet = "vCurrent"
)

// ClusterVersionCapabilitySets defines sets of cluster version capabilities.
var ClusterVersionCapabilitySets = map[ClusterVersionCapabilitySet][]ClusterVersionCapability{
ClusterVersionCapabilitySetNone: {},
ClusterVersionCapabilitySet4_11: {
ClusterVersionCapabilityOpenShiftSamples,
},
ClusterVersionCapabilitySetCurrent: {
ClusterVersionCapabilityOpenShiftSamples,
},
}

// ClusterVersionCapabilitiesSpec selects the managed set of
// optional, core cluster components.
// +k8s:deepcopy-gen=true
type ClusterVersionCapabilitiesSpec struct {
// baselineCapabilitySet selects an initial set of
// optional capabilities to enable, which can be extended via
// additionalEnabledCapabilities. If unset, the cluster will
// choose a default, and the default may change over time.
// The current default is vCurrent.
// +optional
BaselineCapabilitySet ClusterVersionCapabilitySet `json:"baselineCapabilitySet,omitempty"`

// additionalEnabledCapabilities extends the set of managed
// capabilities beyond the baseline defined in
// baselineCapabilitySet. The default is an empty set.
// +listType=atomic
// +optional
AdditionalEnabledCapabilities []ClusterVersionCapability `json:"additionalEnabledCapabilities,omitempty"`
}

// ClusterVersionCapabilitiesStatus describes the state of optional,
// core cluster components.
// +k8s:deepcopy-gen=true
type ClusterVersionCapabilitiesStatus struct {
// enabledCapabilities lists all the capabilities that are currently managed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be clear, this will include "implicilty enabled" capabilities, it's not just an enumeration of what is contained in the baselineCapabilitySet plus what is in additionalEnabledCapabilities, right?

where an implicitly enabled capability would be a situation like:

  1. v4.10 - fooCap is enabled and includes resourceA+resourceB
  2. v4.11 - resourceA moves to barCap. barCap now appears in "EnabledCapabilities" even if barCap is not part of whatever baselineCapSet is set to, and is not listed in additionalEnabledCaps (and of course this means any additional resources in barCap are not reconciled, in additional to resourceA)

// +listType=atomic
// +optional
EnabledCapabilities []ClusterVersionCapability `json:"enabledCapabilities,omitempty"`

// knownCapabilities lists all the capabilities known to the current cluster.
// +listType=atomic
// +optional
KnownCapabilities []ClusterVersionCapability `json:"knownCapabilities,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this set defined/managed/populated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the semantics are basically "here are all the enum values from the CRD". I'm 🤷 on the mechanics. Is there a way for CRDs to hard-code property values? If not, I expect the CVO can stuff in the vCurrent set for now, and we can refine later if we decide to name a new "all caps" set and back vCurrent off to a recommended subset.

I don't think we can ever drop a named cap, because knownCapabilities would have the outgoing value, and my impression is that the Kube-API server would reject the CRD that dropped that enum, because the knownCapabilties entry listing the outgoing cap wouldn't match the incoming enum.

}

// ComponentOverride allows overriding cluster version operator's behavior
// for a component.
// +k8s:deepcopy-gen=true
Expand Down
53 changes: 53 additions & 0 deletions config/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions config/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.