-
Notifications
You must be signed in to change notification settings - Fork 562
[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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,6 +199,19 @@ 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.acceptRisks field. | ||
// If all risks for a conditional update are included in the spec.desiredUpdate.acceptRisks set, the conditional update can proceed, otherwise it is blocked. | ||
// The risk names in the list must be unique. | ||
// conditionalUpdateRisks must not contain more than 500 entries. | ||
// +openshift:enable:FeatureGate=ClusterUpdateAcceptRisks | ||
// +kubebuilder:validation:MaxItems=500 | ||
hongkailiu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// +kubebuilder:validation:MinItems=1 | ||
// +listType=map | ||
// +listMapKey=name | ||
// +optional | ||
ConditionalUpdateRisks []ConditionalUpdateRisk `json:"conditionalUpdateRisks,omitempty"` | ||
hongkailiu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// UpdateState is a constant representing whether an update was successfully | ||
|
@@ -255,8 +268,8 @@ 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. | ||
// +optional | ||
|
@@ -725,6 +738,30 @@ type Update struct { | |
// | ||
// +optional | ||
Force bool `json:"force"` | ||
|
||
// acceptRisks 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. | ||
hongkailiu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// This list may contain entries that apply to current, previous or future updates. | ||
// The entries therefore may not map directly to a risk in .status.conditionalUpdateRisks. | ||
// acceptRisks must not contain more than 1000 entries. | ||
// Only one accept risk is allowed per risk name. | ||
// +openshift:enable:FeatureGate=ClusterUpdateAcceptRisks | ||
// +kubebuilder:validation:MaxItems=1000 | ||
hongkailiu marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why can this list be longer than the Please also add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
See this and this where I'm trying to explain why I think allowing additional
Is that "if you set it, you cannot set it to an empty list?". Do we care? It seems pretty easy to have the CVO treat "property unset" and "property set to an empty list" identically (and actually, likely hard for the CVO to distinguish between those two cases) , and I don't see much benefit in making empty-list illegal. Although just to save some network traffic, I guess I could stomach a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Done. Update: Otherwise, the lint failed with
And that conflict to the previous choice here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh, I'm in the process of mulling over making You are correct, that if we don't have The reason we care is that if you don't have If you prefer to stay with the choice for discoverability/consistency, I'm ok with that, but I'm also ok with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Can unstructured clients actually set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For custom resources, the API server has no idea what the Go types look like and treats the data as unstructured all the way through into etcd, so, yes, it's absolutely possible for an unstructured client, writing a CRD to write
The issue presents as, unstructured client writes value, value gets accepted and persisted, then a structured client writes to the object and it gets removed (resource version + generation creeping up), unstructured client (lets call it a GitOps apply) notices the difference between there manifest, and writes the object again to put There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After like 5 times of reading, I finally understood the options we have. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the patch 0e60cc1 the choice goes to |
||
// +kubebuilder:validation:MinItems=1 | ||
// +listType=map | ||
// +listMapKey=name | ||
// +optional | ||
AcceptRisks []AcceptRisk `json:"acceptRisks,omitempty"` | ||
} | ||
|
||
// AcceptRisk represents a risk that is considered acceptable. | ||
type AcceptRisk struct { | ||
// name is the name of the acceptable risk. | ||
// It must be a non-empty string and must not exceed 256 characters. | ||
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=256 | ||
// +required | ||
Name string `json:"name,omitempty"` | ||
} | ||
|
||
// Release represents an OpenShift release image and associated metadata. | ||
|
@@ -780,6 +817,20 @@ type ConditionalUpdate struct { | |
// +required | ||
Release Release `json:"release"` | ||
|
||
// riskNames represents the set of the names of conditionalUpdateRisks that are relevant to this update for some clusters. | ||
// The Applies condition of each conditionalUpdateRisks entry declares if that risk applies to this cluster. | ||
// A conditional update is accepted only if each of its risks either does not apply to the cluster or is considered acceptable by the cluster administrator. | ||
// The latter means that the risk names are included in value of the spec.desiredUpdate.acceptRisks field. | ||
// Entries must be unique and must not exceed 256 characters. | ||
// riskNames must not contain more than 500 entries. | ||
// +openshift:enable:FeatureGate=ClusterUpdateAcceptRisks | ||
// +kubebuilder:validation:MinItems=1 | ||
// +kubebuilder:validation:items:MaxLength=256 | ||
// +kubebuilder:validation:MaxItems=500 | ||
// +listType=set | ||
// +optional | ||
RiskNames []string `json:"riskNames,omitempty"` | ||
|
||
// 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 | ||
|
@@ -806,6 +857,20 @@ 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. | ||
hongkailiu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// The condition's types in the list must be unique. | ||
// conditions must not contain more than one entry. | ||
// +openshift:enable:FeatureGate=ClusterUpdateAcceptRisks | ||
// +kubebuilder:validation:items:XValidation:rule="has(self.type) && self.type == 'Applies'",message="type must be 'Applies'" | ||
// +kubebuilder:validation:MaxItems=1 | ||
hongkailiu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// +kubebuilder:validation:MinItems=1 | ||
// +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 | ||
|
Uh oh!
There was an error while loading. Please reload this page.