Skip to content

Conversation

@fao89
Copy link
Member

@fao89 fao89 commented Jan 30, 2026

User description

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


PR Type

Enhancement


Description

  • Add optional mode field to Update struct supporting "Preflight" value

  • Gate new field behind ClusterUpdatePreflight feature (TechPreviewNoUpgrade)

  • Enable preflight mode for compatibility checks without actual cluster update

  • Add comprehensive test coverage for preflight mode with various configurations


Diagram Walkthrough

flowchart LR
  A["Update struct"] -->|adds optional field| B["mode: UpdateModePolicy"]
  B -->|supports value| C["Preflight"]
  C -->|gated by feature| D["ClusterUpdatePreflight"]
  D -->|enables| E["Compatibility checks only"]
  A -->|preserves| F["Normal update behavior when mode omitted"]
Loading

File Walkthrough

Relevant files
Enhancement
types_cluster_version.go
Define UpdateModePolicy type and add mode field to Update

config/v1/types_cluster_version.go

  • Define new UpdateModePolicy type with enum validation for "Preflight"
  • Add constant UpdateModePolicyPreflight for the preflight mode value
  • Add optional mode field to Update struct with feature gate annotation
  • Field includes comprehensive documentation about preflight behavior
+19/-0   
Documentation
zz_generated.swagger_doc_generated.go
Generate swagger documentation for mode field                       

config/v1/zz_generated.swagger_doc_generated.go

  • Add swagger documentation for the new mode field in Update struct
  • Document allowed values and behavior when mode is set or omitted
+1/-0     
zz_generated.openapi.go
Generate OpenAPI schema for mode field                                     

openapi/generated_openapi/zz_generated.openapi.go

  • Add OpenAPI schema definition for mode field in Update struct
  • Include field description and type information for API documentation
+7/-0     
Configuration changes
features.go
Register ClusterUpdatePreflight feature gate                         

features/features.go

  • Register new FeatureGateClusterUpdatePreflight feature gate
  • Configure gate for TechPreviewNoUpgrade scope
  • Set contact person and link to enhancement PR
+7/-0     
0000_00_cluster-version-operator_01_clusterversions-CustomNoUpgrade.crd.yaml
Update CRD manifest with mode field schema                             

config/v1/zz_generated.crd-manifests/0000_00_cluster-version-operator_01_clusterversions-CustomNoUpgrade.crd.yaml

  • Add mode field to CRD schema with enum validation for "Preflight"
  • Include field description and type information in manifest
+10/-0   
zz_generated.featuregated-crd-manifests.yaml
Register feature gate in manifest index                                   

config/v1/zz_generated.featuregated-crd-manifests.yaml

  • Add ClusterUpdatePreflight to the list of feature gates for
    clusterversions CRD
+1/-0     
ClusterUpdatePreflight.yaml
Generate feature-gated CRD manifest for preflight mode     

config/v1/zz_generated.featuregated-crd-manifests/clusterversions.config.openshift.io/ClusterUpdatePreflight.yaml

  • Generate complete feature-gated CRD manifest for
    ClusterUpdatePreflight
  • Include full schema with mode field and all validations
  • Define enum constraint for "Preflight" value
+775/-0 
Tests
ClusterUpdatePreflight.yaml
Add comprehensive preflight mode test suite                           

config/v1/tests/clusterversions.config.openshift.io/ClusterUpdatePreflight.yaml

  • Add comprehensive test suite for preflight mode functionality
  • Test setting mode to Preflight with version, image, and architecture
  • Test mode field with acceptRisks configuration
  • Test invalid mode values are rejected
  • Test mode transitions between normal and preflight states
  • Test changing target version while in preflight mode
+181/-0 

@openshift-ci-robot
Copy link

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 30, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 30, 2026

@fao89: This pull request references OTA-253 which is a valid jira issue.

Details

In response to this:

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

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.

@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

Adds 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)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'OTA-253: Add cluster update preflight mode API' clearly and specifically describes the main enhancement—adding a preflight mode to the cluster update API.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, covering the implementation of preflight update mode, field additions, feature gating, test coverage, and providing a visual walkthrough with file-by-file details.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
The command is terminated due to an error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented


Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 30, 2026

Hello @fao89! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 30, 2026

@fao89: This pull request references OTA-253 which is a valid jira issue.

Details

In response to this:

User description

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


PR Type

Enhancement


Description

  • Add optional mode field to Update struct supporting "Preflight" value

  • Gate new field behind ClusterUpdatePreflight feature (TechPreviewNoUpgrade)

  • Enable preflight mode for compatibility checks without actual cluster update

  • Add comprehensive test coverage for preflight mode with various configurations


Diagram Walkthrough

flowchart LR
 A["Update struct"] -->|adds optional field| B["mode: UpdateModePolicy"]
 B -->|supports value| C["Preflight"]
 C -->|gated by feature| D["ClusterUpdatePreflight"]
 D -->|enables| E["Compatibility checks only"]
 A -->|preserves| F["Normal update behavior when mode omitted"]
Loading

File Walkthrough

Relevant files
Enhancement
types_cluster_version.go
Define UpdateModePolicy type and add mode field to Update

config/v1/types_cluster_version.go

  • Define new UpdateModePolicy type with enum validation for "Preflight"
  • Add constant UpdateModePolicyPreflight for the preflight mode value
  • Add optional mode field to Update struct with feature gate annotation
  • Field includes comprehensive documentation about preflight behavior
+19/-0   
Documentation
zz_generated.swagger_doc_generated.go
Generate swagger documentation for mode field                       

config/v1/zz_generated.swagger_doc_generated.go

  • Add swagger documentation for the new mode field in Update struct
  • Document allowed values and behavior when mode is set or omitted
+1/-0     
zz_generated.openapi.go
Generate OpenAPI schema for mode field                                     

openapi/generated_openapi/zz_generated.openapi.go

  • Add OpenAPI schema definition for mode field in Update struct
  • Include field description and type information for API documentation
+7/-0     
Configuration changes
features.go
Register ClusterUpdatePreflight feature gate                         

features/features.go

  • Register new FeatureGateClusterUpdatePreflight feature gate
  • Configure gate for TechPreviewNoUpgrade scope
  • Set contact person and link to enhancement PR
+7/-0     
0000_00_cluster-version-operator_01_clusterversions-CustomNoUpgrade.crd.yaml
Update CRD manifest with mode field schema                             

config/v1/zz_generated.crd-manifests/0000_00_cluster-version-operator_01_clusterversions-CustomNoUpgrade.crd.yaml

  • Add mode field to CRD schema with enum validation for "Preflight"
  • Include field description and type information in manifest
+10/-0   
zz_generated.featuregated-crd-manifests.yaml
Register feature gate in manifest index                                   

config/v1/zz_generated.featuregated-crd-manifests.yaml

  • Add ClusterUpdatePreflight to the list of feature gates for
    clusterversions CRD
+1/-0     
ClusterUpdatePreflight.yaml
Generate feature-gated CRD manifest for preflight mode     

config/v1/zz_generated.featuregated-crd-manifests/clusterversions.config.openshift.io/ClusterUpdatePreflight.yaml

  • Generate complete feature-gated CRD manifest for
    ClusterUpdatePreflight
  • Include full schema with mode field and all validations
  • Define enum constraint for "Preflight" value
+775/-0 
Tests
ClusterUpdatePreflight.yaml
Add comprehensive preflight mode test suite                           

config/v1/tests/clusterversions.config.openshift.io/ClusterUpdatePreflight.yaml

  • Add comprehensive test suite for preflight mode functionality
  • Test setting mode to Preflight with version, image, and architecture
  • Test mode field with acceptRisks configuration
  • Test invalid mode values are rejected
  • Test mode transitions between normal and preflight states
  • Test changing target version while in preflight mode
+181/-0 

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.

@openshift-ci openshift-ci bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jan 30, 2026
@qodo-code-review
Copy link

qodo-code-review bot commented Jan 30, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
Audit logging unclear: The diff adds a new administrative action surface (desiredUpdate.mode: Preflight) but does
not show whether requests to use this mode are audit-logged with actor/context and
outcome.

Referred Code
// 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.
// +openshift:enable:FeatureGate=ClusterUpdatePreflight
// +kubebuilder:validation:Enum=Preflight
// +optional
Mode UpdateModePolicy `json:"mode,omitempty"`

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link

qodo-code-review bot commented Jan 30, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Improve API design for future extensibility

Add an explicit Normal value to the UpdateModePolicy enum alongside Preflight.
This makes the API more explicit and extensible for future modes.

config/v1/types_cluster_version.go [286-293]

 // UpdateModePolicy defines how an update should be processed.
-// +kubebuilder:validation:Enum=Preflight
+// +kubebuilder:validation:Enum=Normal;Preflight
 type UpdateModePolicy string
 
 const (
+	// UpdateModePolicyNormal is the default update mode and will commit to updating the cluster.
+	UpdateModePolicyNormal UpdateModePolicy = "Normal"
 	// UpdateModePolicyPreflight allows an update to be checked for compatibility without committing to updating the cluster.
 	UpdateModePolicyPreflight UpdateModePolicy = "Preflight"
 )
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: This is a valid suggestion that improves API design by making the update modes explicit, which enhances clarity and future extensibility.

Low
  • Update

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 30, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign everettraven for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fao89 fao89 force-pushed the preflight-from-target-release branch from 8c3f649 to b2750d9 Compare January 30, 2026 14:16
@openshift-ci openshift-ci bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 30, 2026
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
@fao89 fao89 force-pushed the preflight-from-target-release branch from b2750d9 to fb4267a Compare January 30, 2026 16:25
Copy link

@coderabbitai coderabbitai bot left a 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.

Comment on lines +21484 to +21490
"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: "",
},
},
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
"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.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 30, 2026

@fao89: all tests passed!

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. Review effort 3/5 size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants