-
Notifications
You must be signed in to change notification settings - Fork 590
OTA-253: Add cluster update preflight mode API #2684
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
fao89
wants to merge
1
commit into
openshift:master
Choose a base branch
from
fao89:preflight-from-target-release
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
config/v1/tests/clusterversions.config.openshift.io/ClusterUpdatePreflight.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this | ||
| name: "ClusterVersion" | ||
| crdName: clusterversions.config.openshift.io | ||
| featureGates: | ||
| - ClusterUpdatePreflight | ||
| tests: | ||
| onCreate: | ||
| - name: Should be able to set mode to Preflight | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: ClusterVersion | ||
| spec: | ||
| clusterID: foo | ||
| desiredUpdate: | ||
| version: 4.22.0 | ||
| mode: Preflight | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: ClusterVersion | ||
| spec: | ||
| clusterID: foo | ||
| desiredUpdate: | ||
| version: 4.22.0 | ||
| mode: Preflight | ||
| - name: Should be able to omit mode field (default behavior) | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: ClusterVersion | ||
| spec: | ||
| clusterID: foo | ||
| desiredUpdate: | ||
| version: 4.22.0 | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: ClusterVersion | ||
| spec: | ||
| clusterID: foo | ||
| desiredUpdate: | ||
| version: 4.22.0 | ||
| - name: Should be able to use Preflight mode with acceptRisks | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: ClusterVersion | ||
| spec: | ||
| clusterID: foo | ||
| desiredUpdate: | ||
| version: 4.22.0 | ||
| mode: Preflight | ||
| acceptRisks: | ||
| - name: RiskA | ||
| - name: RiskB | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: ClusterVersion | ||
| spec: | ||
| clusterID: foo | ||
| desiredUpdate: | ||
| version: 4.22.0 | ||
| mode: Preflight | ||
| acceptRisks: | ||
| - name: RiskA | ||
| - name: RiskB | ||
| - name: Invalid mode value should be rejected | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: ClusterVersion | ||
| spec: | ||
| clusterID: foo | ||
| desiredUpdate: | ||
| version: 4.22.0 | ||
| mode: InvalidMode | ||
| expectedError: "Unsupported value: \"InvalidMode\"" | ||
| - name: Empty mode value should be rejected | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: ClusterVersion | ||
| spec: | ||
| clusterID: foo | ||
| desiredUpdate: | ||
| version: 4.22.0 | ||
| mode: "" | ||
| expectedError: "Unsupported value: \"\"" | ||
| onUpdate: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -283,6 +283,16 @@ type UpdateHistory struct { | |||||||||||
| // ClusterID is string RFC4122 uuid. | ||||||||||||
| type ClusterID string | ||||||||||||
|
|
||||||||||||
| // UpdateModePolicy defines how an update should be processed. | ||||||||||||
| // Valid values are defined as constants below. | ||||||||||||
| // +kubebuilder:validation:Enum=Preflight | ||||||||||||
|
Comment on lines
286
to
288
Member
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. nit nit:
Suggested change
|
||||||||||||
| type UpdateModePolicy string | ||||||||||||
|
|
||||||||||||
| const ( | ||||||||||||
| // UpdateModePolicyPreflight allows an update to be checked for compatibility without committing to updating the cluster. | ||||||||||||
| UpdateModePolicyPreflight UpdateModePolicy = "Preflight" | ||||||||||||
| ) | ||||||||||||
|
|
||||||||||||
| // ClusterVersionArchitecture enumerates valid cluster architectures. | ||||||||||||
| // +kubebuilder:validation:Enum="Multi";"" | ||||||||||||
| type ClusterVersionArchitecture string | ||||||||||||
|
|
@@ -760,6 +770,20 @@ type Update struct { | |||||||||||
| // +listMapKey=name | ||||||||||||
| // +optional | ||||||||||||
| AcceptRisks []AcceptRisk `json:"acceptRisks,omitempty"` | ||||||||||||
|
|
||||||||||||
| // mode determines how an update should be processed. | ||||||||||||
| // The only valid value is "Preflight". | ||||||||||||
| // When omitted, the cluster performs a normal update by applying the specified version or image to the cluster. | ||||||||||||
| // This is the standard update behavior. | ||||||||||||
| // When set to "Preflight", the cluster runs compatibility checks against the target release without | ||||||||||||
| // performing an actual update. The target release's CVO will execute prechecks and report any detected | ||||||||||||
| // risks in status.conditionalUpdates, alongside risks from the update recommendation service. | ||||||||||||
| // This allows administrators to assess update readiness and address issues before committing to the update. | ||||||||||||
| // Preflight mode is particularly useful for skip-level updates where upgrade compatibility needs to be | ||||||||||||
| // verified across multiple minor versions. | ||||||||||||
| // +openshift:enable:FeatureGate=ClusterUpdatePreflight | ||||||||||||
| // +optional | ||||||||||||
| Mode UpdateModePolicy `json:"mode,omitempty"` | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| // AcceptRisk represents a risk that is considered acceptable. | ||||||||||||
|
|
||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep tests cases only which validate actual behavior constraints. Means that basic CRUD is probably out of scope.
We also need a test for
mode: ""as invalid value.