Skip to content

[OTA-1545] Extend ClusterVersion for accepted risks #2360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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

Large diffs are not rendered by default.

58 changes: 55 additions & 3 deletions config/v1/types_cluster_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,20 @@ type ClusterVersionStatus struct {
// +listType=atomic
// +optional
ConditionalUpdates []ConditionalUpdate `json:"conditionalUpdates,omitempty"`

// conditionalUpdateRisks contains the list of risks associated with conditionalUpdates.
// When performing a conditional update, all its associated risks will be compared with the set of accepted risks in the spec.desiredUpdate.accept field.
// If all risks for a conditional update are included in the spec.desiredUpdate.accept set, the conditional update will proceed, otherwise it is blocked.
// The risk's names in the list must be unique.
Copy link
Contributor

Choose a reason for hiding this comment

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

Double plural reads oddly to me, WDYT?

Suggested change
// The risk's names in the list must be unique.
// The risk names in the list must be unique.

// conditionalUpdateRisks must not contain more than 500 entries.
// +openshift:enable:FeatureGate=ClusterUpdateAcceptedRisks
// +kubebuilder:validation:MaxItems=500
// +patchMergeKey=name
// +patchStrategy=merge
Comment on lines +210 to +211
Copy link
Contributor

Choose a reason for hiding this comment

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

Not valid for CRDs, please remove

// +listType=map
// +listMapKey=name
// +optional
ConditionalUpdateRisks []ConditionalUpdateRisk `json:"conditionalUpdateRisks,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ConditionalUpdateRisks []ConditionalUpdateRisk `json:"conditionalUpdateRisks,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
ConditionalUpdateRisks []ConditionalUpdateRisk `json:"conditionalUpdateRisks,omitempty"`

}

// UpdateState is a constant representing whether an update was successfully
Expand Down Expand Up @@ -255,10 +269,11 @@ type UpdateHistory struct {
Verified bool `json:"verified"`

// acceptedRisks records risks which were accepted to initiate the update.
// For example, it may menition an Upgradeable=False or missing signature
// that was overriden via desiredUpdate.force, or an update that was
// For example, it may mention an Upgradeable=False or missing signature
// that was overridden via desiredUpdate.force, or an update that was
// initiated despite not being in the availableUpdates set of recommended
// update targets.
// update targets, or in the conditionUpdates set and all associated risks
// are specified in desiredUpdate.accept.
Comment on lines +275 to +276
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, this change also appears in the default CRD. You may want to include that this part of the description only applies when the particular feature gate is enabled or drop it from the description until you GA the feature.

// +optional
AcceptedRisks string `json:"acceptedRisks,omitempty"`
}
Expand Down Expand Up @@ -725,6 +740,17 @@ type Update struct {
//
// +optional
Force bool `json:"force"`

// accept is an optional set of names of conditional update risks that are considered acceptable.
// A conditional update is performed only if all of its risks are acceptable.
// Entries must be unique and must not exceed 256 characters.
// accept must not contain more than 1000 entries.
// +openshift:enable:FeatureGate=ClusterUpdateAcceptedRisks
// +kubebuilder:validation:items:MaxLength=256
// +kubebuilder:validation:MaxItems=1000
// +listType=set
// +optional
Accept []string `json:"accept"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of interest, why not acceptedRisks to match with the history version of this field?

}

// Release represents an OpenShift release image and associated metadata.
Expand Down Expand Up @@ -780,11 +806,24 @@ type ConditionalUpdate struct {
// +required
Release Release `json:"release"`

// riskNames represents the set of the names of conditionalUpdateRisks in the status that are exposed to the release in this conditional update.
// A condition update is accepted only if each of its risk is either not applied to the cluster or considered acceptable by the cluster administrator.
// Entries must be unique and must not exceed 256 characters.
// riskNames must not contain more than 500 entries.
// +openshift:enable:FeatureGate=ClusterUpdateAcceptedRisks
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:items:MaxLength=256
// +kubebuilder:validation:MaxItems=500
// +listType=set
// +optional
RiskNames []string `json:"riskNames,omitempty"`
Comment on lines +809 to +819
Copy link
Contributor

Choose a reason for hiding this comment

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

So this is an odd direction for a change. Why are we moving from a list of structured objects to a list of strings? Normally, I see this the other way around?

Comment on lines +809 to +819
Copy link
Contributor

Choose a reason for hiding this comment

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

What does it mean to set both risks and riskNames?


// risks represents the range of issues associated with
// updating to the target release. The cluster-version
// operator will evaluate all entries, and only recommend the
// update if there is at least one entry and all entries
// recommend the update.
// Deprecated: the risks has been deprecated by riskNames.
Copy link
Contributor

Choose a reason for hiding this comment

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

Something worth noting - this shows up on the non-featuregated version of the API.

I'm not sure there is much of a workaround for this unless you wait to add this deprecation text until you actually go to promote the feature-gate that deprecates this to GA.

I would probably recommend removing this for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Deprecated: the risks has been deprecated by riskNames.
// Deprecated: the risks field has been deprecated in favour of riskNames.

// +kubebuilder:validation:MinItems=1
// +patchMergeKey=name
// +patchStrategy=merge
Expand All @@ -806,6 +845,19 @@ type ConditionalUpdate struct {
// for not recommending a conditional update.
// +k8s:deepcopy-gen=true
type ConditionalUpdateRisk struct {
// conditions represents the observations of the conditional update
// risk's current status. Known types are:
// * Applies, for whether the risk applies to the current cluster.
// The condition's types in the list must be unique.
// conditions must not contain more than one entry.
// +openshift:enable:FeatureGate=ClusterUpdateAcceptedRisks
// +kubebuilder:validation:items:XValidation:rule="has(self.type) && self.type == 'Applies'",message="type must be 'Applies'"
// +kubebuilder:validation:MaxItems=1
Copy link
Contributor

Choose a reason for hiding this comment

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

MinItems too please

// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`

// url contains information about this risk.
// +kubebuilder:validation:Format=uri
// +kubebuilder:validation:MinLength=1
Expand Down
Loading