Skip to content

[Draft] - Adding cabilities for crdcompatibilitychecker and capi CRs#2884

Draft
miyadav wants to merge 2 commits into
openshift:masterfrom
miyadav:ocpcloud3368
Draft

[Draft] - Adding cabilities for crdcompatibilitychecker and capi CRs#2884
miyadav wants to merge 2 commits into
openshift:masterfrom
miyadav:ocpcloud3368

Conversation

@miyadav

@miyadav miyadav commented Jun 10, 2026

Copy link
Copy Markdown
Member

Adding new capability constants
WIP - OCPCLOUD-3368
/hold

Generated by - claude-opus-4-6(2.1.169)

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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 openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 10, 2026
@openshift-ci

openshift-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Hello @miyadav! 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.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 2ae9261d-6dda-4866-923c-858958c2a8b8

📥 Commits

Reviewing files that changed from the base of the PR and between e0a748d and 79a5362.

⛔ Files ignored due to path filters (10)
  • config/v1/zz_generated.crd-manifests/0000_00_cluster-version-operator_01_clusterversions-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.crd-manifests/0000_00_cluster-version-operator_01_clusterversions-Default.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.crd-manifests/0000_00_cluster-version-operator_01_clusterversions-DevPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.crd-manifests/0000_00_cluster-version-operator_01_clusterversions-OKD.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.crd-manifests/0000_00_cluster-version-operator_01_clusterversions-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.featuregated-crd-manifests/clusterversions.config.openshift.io/AAA_ungated.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • config/v1/zz_generated.featuregated-crd-manifests/clusterversions.config.openshift.io/ClusterUpdateAcceptRisks.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • config/v1/zz_generated.featuregated-crd-manifests/clusterversions.config.openshift.io/ClusterUpdatePreflight.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • config/v1/zz_generated.featuregated-crd-manifests/clusterversions.config.openshift.io/ImageStreamImportMode.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • config/v1/zz_generated.featuregated-crd-manifests/clusterversions.config.openshift.io/SignatureStores.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
📒 Files selected for processing (1)
  • config/v1/types_cluster_version.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/v1/types_cluster_version.go

📝 Walkthrough

Walkthrough

This PR extends the ClusterVersion API by introducing two new optional cluster capabilities: CompatibilityRequirements and ClusterAPI. It adds exported constants and enum values for both, registers them in KnownClusterVersionCapabilities and the current capability set, and adds an XValidation rule that prevents enabling ClusterAPI unless CompatibilityRequirements is enabled (either in spec.additionalEnabledCapabilities or in status.capabilities.enabledCapabilities).

🚥 Pre-merge checks | ✅ 4 | ❌ 11

❌ Failed checks (1 warning, 10 inconclusive)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title contains a typo ('cabilities' instead of 'capabilities') and refers to component names that don't clearly match the actual changes (adding CompatibilityRequirements and ClusterAPI capabilities, not CRD checker and CAPI). Correct the typo and clarify the title to accurately describe the changes, e.g., 'Add CompatibilityRequirements and ClusterAPI capabilities with dependency validation'.
Stable And Deterministic Test Names ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Test Structure And Quality ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Microshift Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Single Node Openshift (Sno) Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Topology-Aware Scheduling Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Ote Binary Stdout Contract ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Ipv6 And Disconnected Network Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
No-Weak-Crypto ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Container-Privileges ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
No-Sensitive-Data-In-Logs ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description is minimalist but does relate to the changeset by mentioning new capability constants, though it lacks detail and includes a machine-generated attribution note.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.12.2)

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 openshift-ci Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 10, 2026
@openshift-ci openshift-ci Bot requested review from JoelSpeed and everettraven June 10, 2026 12:49
@openshift-ci

openshift-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

[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 joelspeed 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

@miyadav miyadav marked this pull request as draft June 10, 2026 12:49
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
config/v1/types_cluster_version.go (1)

22-22: ⚡ Quick win

Add/extend CRD validation tests for the new dependency rule.

Please add explicit create/update tests for ClusterAPI requiring CompatibilityRequirements (both failing and passing paths), mirroring the existing marketplace dependency test style.

As per coding guidelines, “Add validation tests in <group>/<version>/tests/<crd-name>/” for API validation changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@config/v1/types_cluster_version.go` at line 22, Add CRD validation tests for
the new XValidation rule in types_cluster_version.go that enforces ClusterAPI
requires CompatibilityRequirements: create tests under the API group/version
tests directory (following the pattern in existing marketplace dependency tests)
that cover both failing and passing paths for create and update operations; name
tests clearly (e.g.,
TestCreateClusterVersion_ClusterAPIWithoutCompatibilityRequirements_Fails and
TestUpdateClusterVersion_EnableCompatibilityRequirements_Passes) and construct
ClusterVersion objects toggling spec.capabilities.additionalEnabledCapabilities
and status.capabilities.enabledCapabilities to assert validation rejection when
ClusterAPI is present without CompatibilityRequirements and acceptance when
CompatibilityRequirements is present either in spec or in status.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@config/v1/types_cluster_version.go`:
- Line 22: The XValidation rule currently only applies when
spec.capabilities.baselineCapabilitySet == 'None', letting configs with a
non-None baseline (e.g., baselineCapabilitySet: v4.18) enable ClusterAPI without
CompatibilityRequirements; remove the baselineCapabilitySet check so the rule
always enforces the dependency: update the kubebuilder XValidation expression in
types_cluster_version.go to check for the presence of spec.capabilities and
spec.capabilities.additionalEnabledCapabilities, and if 'ClusterAPI' is in
spec.capabilities.additionalEnabledCapabilities require
'CompatibilityRequirements' to be either in
spec.capabilities.additionalEnabledCapabilities or (if present) in
status.capabilities.enabledCapabilities; keep the existing has(...) guards and
the same error message.

---

Nitpick comments:
In `@config/v1/types_cluster_version.go`:
- Line 22: Add CRD validation tests for the new XValidation rule in
types_cluster_version.go that enforces ClusterAPI requires
CompatibilityRequirements: create tests under the API group/version tests
directory (following the pattern in existing marketplace dependency tests) that
cover both failing and passing paths for create and update operations; name
tests clearly (e.g.,
TestCreateClusterVersion_ClusterAPIWithoutCompatibilityRequirements_Fails and
TestUpdateClusterVersion_EnableCompatibilityRequirements_Passes) and construct
ClusterVersion objects toggling spec.capabilities.additionalEnabledCapabilities
and status.capabilities.enabledCapabilities to assert validation rejection when
ClusterAPI is present without CompatibilityRequirements and acceptance when
CompatibilityRequirements is present either in spec or in status.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: afefc07d-7be7-4bb8-a2e8-90622698cd31

📥 Commits

Reviewing files that changed from the base of the PR and between 5ce2c30 and e0a748d.

📒 Files selected for processing (1)
  • config/v1/types_cluster_version.go

Comment thread config/v1/types_cluster_version.go Outdated
@openshift-ci openshift-ci Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant