-
Notifications
You must be signed in to change notification settings - Fork 587
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
base: master
Are you sure you want to change the base?
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@fao89: This pull request references OTA-253 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
📝 WalkthroughWalkthroughAdds a preflight update mode to ClusterVersion: introduces UpdateModePolicy and an Update.Mode field with value "Preflight"; registers a ClusterUpdatePreflight feature gate and updates feature-gate manifests; adds a ClusterUpdate preflight test configuration; and updates generated Swagger/OpenAPI and feature-gate documentation to expose the new mode property. 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.5.0)Error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented Comment |
|
Hello @fao89! Some important instructions when contributing to openshift/api: |
|
@fao89: This pull request references OTA-253 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
|
[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 |
8c3f649 to
b2750d9
Compare
Implements preflight update mode that allows checking update compatibility without committing to performing the actual cluster update. Changes: - Add optional 'mode' field to Update struct with value "Preflight" - Gate new field behind ClusterUpdatePreflight feature (TechPreviewNoUpgrade) - When mode="Preflight", cluster runs compatibility checks only - When mode omitted, normal update behavior is preserved Related: openshift/enhancements#1930 Signed-off-by: Fabricio Aguiar <fabricio.aguiar@gmail.com> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
b2750d9 to
fb4267a
Compare
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@openapi/generated_openapi/zz_generated.openapi.go`:
- Around line 21484-21490: The OpenAPI schema for the "mode" property currently
allows any string; add an enum constraint so only "Preflight" is permitted by
updating the source validation annotation that defines this field (so the
generator emits Enum: ["Preflight"]) and then regenerate the OpenAPI output;
specifically ensure the generated SchemaProps for "mode" includes an Enum entry
(e.g., Enum: []interface{}{"Preflight"}) rather than only Type/Description, by
changing the validation/tag on the source field that corresponds to the "mode"
schema before running the generator.
| "mode": { | ||
| SchemaProps: spec.SchemaProps{ | ||
| Description: "mode allows an update to be checked for compatibility without committing to updating the cluster. Allowed values are \"Preflight\" and omitted. When omitted, the default mode allows existing clients to request normal updates. When set to \"Preflight\", the cluster will run compatibility checks against the target release without performing an actual update.", | ||
| Type: []string{"string"}, | ||
| Format: "", | ||
| }, | ||
| }, |
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.
Add an enum constraint for mode in the OpenAPI schema.
The description states only "Preflight" (or omitted) is allowed, but the schema allows any string. This makes docs/client-side validation too permissive. Please ensure the generator emits an Enum: ["Preflight"] (e.g., via the source field’s validation annotation) and regenerate.
🔧 Expected generated output after adding enum in the source
"mode": {
SchemaProps: spec.SchemaProps{
Description: "mode allows an update to be checked for compatibility without committing to updating the cluster. Allowed values are \"Preflight\" and omitted. When omitted, the default mode allows existing clients to request normal updates. When set to \"Preflight\", the cluster will run compatibility checks against the target release without performing an actual update.",
Type: []string{"string"},
+ Enum: []interface{}{"Preflight"},
Format: "",
},
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "mode": { | |
| SchemaProps: spec.SchemaProps{ | |
| Description: "mode allows an update to be checked for compatibility without committing to updating the cluster. Allowed values are \"Preflight\" and omitted. When omitted, the default mode allows existing clients to request normal updates. When set to \"Preflight\", the cluster will run compatibility checks against the target release without performing an actual update.", | |
| Type: []string{"string"}, | |
| Format: "", | |
| }, | |
| }, | |
| "mode": { | |
| SchemaProps: spec.SchemaProps{ | |
| Description: "mode allows an update to be checked for compatibility without committing to updating the cluster. Allowed values are \"Preflight\" and omitted. When omitted, the default mode allows existing clients to request normal updates. When set to \"Preflight\", the cluster will run compatibility checks against the target release without performing an actual update.", | |
| Type: []string{"string"}, | |
| Enum: []interface{}{"Preflight"}, | |
| Format: "", | |
| }, | |
| }, |
🤖 Prompt for AI Agents
In `@openapi/generated_openapi/zz_generated.openapi.go` around lines 21484 -
21490, The OpenAPI schema for the "mode" property currently allows any string;
add an enum constraint so only "Preflight" is permitted by updating the source
validation annotation that defines this field (so the generator emits Enum:
["Preflight"]) and then regenerate the OpenAPI output; specifically ensure the
generated SchemaProps for "mode" includes an Enum entry (e.g., Enum:
[]interface{}{"Preflight"}) rather than only Type/Description, by changing the
validation/tag on the source field that corresponds to the "mode" schema before
running the generator.
|
@fao89: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
User description
Implements preflight update mode that allows checking update compatibility without committing to performing the actual cluster update.
Changes:
Related: openshift/enhancements#1930
PR Type
Enhancement
Description
Add optional
modefield toUpdatestruct supporting "Preflight" valueGate new field behind
ClusterUpdatePreflightfeature (TechPreviewNoUpgrade)Enable preflight mode for compatibility checks without actual cluster update
Add comprehensive test coverage for preflight mode with various configurations
Diagram Walkthrough
File Walkthrough
types_cluster_version.go
Define UpdateModePolicy type and add mode field to Updateconfig/v1/types_cluster_version.go
UpdateModePolicytype with enum validation for "Preflight"UpdateModePolicyPreflightfor the preflight mode valuemodefield toUpdatestruct with feature gate annotationzz_generated.swagger_doc_generated.go
Generate swagger documentation for mode fieldconfig/v1/zz_generated.swagger_doc_generated.go
modefield inUpdatestructzz_generated.openapi.go
Generate OpenAPI schema for mode fieldopenapi/generated_openapi/zz_generated.openapi.go
modefield inUpdatestructfeatures.go
Register ClusterUpdatePreflight feature gatefeatures/features.go
FeatureGateClusterUpdatePreflightfeature gate0000_00_cluster-version-operator_01_clusterversions-CustomNoUpgrade.crd.yaml
Update CRD manifest with mode field schemaconfig/v1/zz_generated.crd-manifests/0000_00_cluster-version-operator_01_clusterversions-CustomNoUpgrade.crd.yaml
modefield to CRD schema with enum validation for "Preflight"zz_generated.featuregated-crd-manifests.yaml
Register feature gate in manifest indexconfig/v1/zz_generated.featuregated-crd-manifests.yaml
ClusterUpdatePreflightto the list of feature gates forclusterversions CRD
ClusterUpdatePreflight.yaml
Generate feature-gated CRD manifest for preflight modeconfig/v1/zz_generated.featuregated-crd-manifests/clusterversions.config.openshift.io/ClusterUpdatePreflight.yaml
ClusterUpdatePreflight
modefield and all validationsClusterUpdatePreflight.yaml
Add comprehensive preflight mode test suiteconfig/v1/tests/clusterversions.config.openshift.io/ClusterUpdatePreflight.yaml