Skip to content

Graduate CompatibilityRequirement API to v1#2905

Open
stefanonardo wants to merge 1 commit into
openshift:masterfrom
stefanonardo:OCPCLOUD-3544
Open

Graduate CompatibilityRequirement API to v1#2905
stefanonardo wants to merge 1 commit into
openshift:masterfrom
stefanonardo:OCPCLOUD-3544

Conversation

@stefanonardo

Copy link
Copy Markdown

Summary

  • Add apiextensions.openshift.io/v1 with compatibility level 1 (stable)
  • API surface unchanged from v1alpha1 — no type, field, or validation changes
  • CRD serves both v1 (storage) and v1alpha1 (backward compat)

Add apiextensions.openshift.io/v1 with compatibility level 1 (stable).
The API surface is unchanged from v1alpha1 — types, fields, validation
markers, and CEL rules are structurally identical. The CRD now serves
both v1 (storage) and v1alpha1 (backward compat, storage=false).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@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

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds the apiextensions.openshift.io/v1 CompatibilityRequirement API, registers it in the runtime scheme, updates the CRD manifests to include v1 as the storage version, adjusts the payload CRD source path, and adds create/update operator tests plus a dedicated test target.

Suggested reviewers

  • everettraven
  • JoelSpeed
🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Microshift Test Compatibility ⚠️ Warning The new generated test suite targets apiextensions.openshift.io/v1 and lacks any MicroShift skip or apigroup tag. Add [apigroup:apiextensions.openshift.io] (preferred) or [Skipped:MicroShift] to the suite/test name, or guard it from MicroShift.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: graduating CompatibilityRequirement to v1.
Description check ✅ Passed The description is directly related to the changeset and accurately describes the v1 graduation.
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.
Stable And Deterministic Test Names ✅ Passed The new test spec names are static, descriptive strings; no titles include generated IDs, dates, UUIDs, or other run-specific data.
Test Structure And Quality ✅ Passed The new YAML test spec matches the repo’s established CRD test style and keeps one behavior per case; Ginkgo-specific cleanup/timeout concerns don’t apply here.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Only CRD schema YAML specs and API registration changed; I գտound no new Ginkgo test code or SNO/HA node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed Touched files are API/CRD definitions only; no deployments, controllers, affinity, node selectors, or other topology-sensitive scheduling rules were added.
Ote Binary Stdout Contract ✅ Passed Touched files are API/type/manifests only; no main/init/TestMain/BeforeSuite or stdout logging was added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PASS: The only new test artifact is a YAML CRD validation spec; it contains no Ginkgo code, IPv4 literals, localhost, or public internet dependencies.
No-Weak-Crypto ✅ Passed No weak crypto, custom crypto, or secret/token comparisons were added; the PR only adds API types, scheme registration, manifests, and tests.
Container-Privileges ✅ Passed No changed file adds pod/container specs or privilege flags; searches of the PR files found no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed No new log statements or sensitive-value emissions were added; matches were only schema/docs text, not runtime logging.
✨ 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.

@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Hello @stefanonardo! 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 openshift-ci Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 26, 2026
@openshift-ci openshift-ci Bot requested review from JoelSpeed and everettraven June 26, 2026 13:10
@openshift-ci

openshift-ci Bot commented Jun 26, 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

@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 (3)
apiextensions/v1/Makefile (1)

2-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use $(MAKE) for the recursive target.

Calling plain make here skips GNU make’s recursive-build handling, so parent flags like -j/-n and the jobserver are not propagated reliably.

Suggested change
 test:
-	make -C ../../tests test GINKGO_EXTRA_ARGS=--focus="apiextensions.openshift.io/v1"
+	$(MAKE) -C ../../tests test GINKGO_EXTRA_ARGS=--focus="apiextensions.openshift.io/v1"
🤖 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 `@apiextensions/v1/Makefile` around lines 2 - 3, The recursive test target in
the Makefile should use $(MAKE) instead of plain make so GNU make can propagate
parent flags and jobserver settings correctly. Update the test recipe in the
test target to invoke the nested build through $(MAKE), keeping the existing -C
../../tests test and GINKGO_EXTRA_ARGS=--focus="apiextensions.openshift.io/v1"
behavior intact.
apiextensions/v1/tests/compatibilityrequirements.apiextensions.openshift.io/CRDCompatibilityRequirementOperator.yaml (1)

1332-1431: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Give this case a distinct name.

This scenario is useful coverage for “same UID, same generation is allowed,” but it reuses the exact title from Lines 604-700. A unique name will make failures/reporting unambiguous.

🤖 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
`@apiextensions/v1/tests/compatibilityrequirements.apiextensions.openshift.io/CRDCompatibilityRequirementOperator.yaml`
around lines 1332 - 1431, Rename this test case to a distinct title in
CRDCompatibilityRequirementOperator so it is unique from the earlier “Should be
able to set valid observedCRD uid” scenario. Update the test name in the YAML
case covering the same UID and generation path so failures and reporting clearly
identify this specific “same UID, same generation is allowed” behavior.
apiextensions/v1/types_compatibilityrequirement.go (1)

185-195: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the MinItems constraint in field comments.

Several list fields declare +kubebuilder:validation:MinItems=1 but the comment only documents the upper bound. The coding guidelines require min/max item counts to be documented in the field comment. This affects excludedFields (here, "may contain at most 64 fields"), as well as additionalVersions (line 133), excludedFields[].versions (line 166), and conditions (line 329) — none state the minimum-of-one requirement.

As per coding guidelines: "+kubebuilder:validation:MinItems and +kubebuilder:validation:MaxItems - document item count ranges".

🤖 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 `@apiextensions/v1/types_compatibilityrequirement.go` around lines 185 - 195,
Update the field comments for the list properties that use
+kubebuilder:validation:MinItems=1 so they explicitly document the minimum item
count as well as the maximum. In the affected types, adjust the comments on
ExcludedFields, AdditionalVersions, ExcludedFields[].Versions, and Conditions to
state that the list must contain at least one item and, where applicable, at
most the documented limit. Keep the existing validation annotations unchanged
and make the comment wording match the constraint range for each field.

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 `@apiextensions/v1/types_compatibilityrequirement.go`:
- Around line 128-130: The doc comments for additionalVersions and
excludedFields[].versions contain a duplicated “must must” typo and a repeated
trailing sentence joined into the same line; clean up the wording so each
validation rule appears once and reads correctly. Update the comment text in
types_compatibilityrequirement.go near the additionalVersions and
excludedFields[].versions definitions, then regenerate the derived CRD/manifests
with make update so the propagated descriptions are fixed too.

---

Nitpick comments:
In `@apiextensions/v1/Makefile`:
- Around line 2-3: The recursive test target in the Makefile should use $(MAKE)
instead of plain make so GNU make can propagate parent flags and jobserver
settings correctly. Update the test recipe in the test target to invoke the
nested build through $(MAKE), keeping the existing -C ../../tests test and
GINKGO_EXTRA_ARGS=--focus="apiextensions.openshift.io/v1" behavior intact.

In
`@apiextensions/v1/tests/compatibilityrequirements.apiextensions.openshift.io/CRDCompatibilityRequirementOperator.yaml`:
- Around line 1332-1431: Rename this test case to a distinct title in
CRDCompatibilityRequirementOperator so it is unique from the earlier “Should be
able to set valid observedCRD uid” scenario. Update the test name in the YAML
case covering the same UID and generation path so failures and reporting clearly
identify this specific “same UID, same generation is allowed” behavior.

In `@apiextensions/v1/types_compatibilityrequirement.go`:
- Around line 185-195: Update the field comments for the list properties that
use +kubebuilder:validation:MinItems=1 so they explicitly document the minimum
item count as well as the maximum. In the affected types, adjust the comments on
ExcludedFields, AdditionalVersions, ExcludedFields[].Versions, and Conditions to
state that the list must contain at least one item and, where applicable, at
most the documented limit. Keep the existing validation annotations unchanged
and make the comment wording match the constraint range for each field.
🪄 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: b0c229df-7cce-4de6-9c34-7a398cd0fe93

📥 Commits

Reviewing files that changed from the base of the PR and between 39631f4 and 9cbc76b.

⛔ Files ignored due to path filters (9)
  • apiextensions/v1/zz_generated.crd-manifests/0000_20_crd-compatibility-checker_01_compatibilityrequirements.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • apiextensions/v1/zz_generated.crd-manifests/doc.go is excluded by !**/zz_generated.crd-manifests/*
  • apiextensions/v1/zz_generated.deepcopy.go is excluded by !**/zz_generated*
  • apiextensions/v1/zz_generated.featuregated-crd-manifests.yaml is excluded by !**/zz_generated*
  • apiextensions/v1/zz_generated.featuregated-crd-manifests/compatibilityrequirements.apiextensions.openshift.io/CRDCompatibilityRequirementOperator.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • apiextensions/v1/zz_generated.model_name.go is excluded by !**/zz_generated*
  • apiextensions/v1/zz_generated.swagger_doc_generated.go is excluded by !**/zz_generated*
  • openapi/generated_openapi/zz_generated.openapi.go is excluded by !openapi/**, !**/zz_generated*
  • openapi/openapi.json is excluded by !openapi/**
📒 Files selected for processing (9)
  • apiextensions/install.go
  • apiextensions/v1/Makefile
  • apiextensions/v1/doc.go
  • apiextensions/v1/manual-override-crd-manifests/compatibilityrequirements.apiextensions.openshift.io/CRDCompatibilityRequirementOperator.yaml
  • apiextensions/v1/register.go
  • apiextensions/v1/tests/compatibilityrequirements.apiextensions.openshift.io/CRDCompatibilityRequirementOperator.yaml
  • apiextensions/v1/types_compatibilityrequirement.go
  • hack/update-payload-crds.sh
  • payload-manifests/crds/0000_20_crd-compatibility-checker_01_compatibilityrequirements.crd.yaml

Comment on lines +128 to +130
// Each item must be at most 63 characters in length, and must must consist
// of only lowercase alphanumeric characters and hyphens, and must start
// with an alphabetic character and end with an alphanumeric character.// with an alphabetic character and end with an alphanumeric character.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix duplicated sentence and must must typo in additionalVersions doc.

Line 130 contains the same sentence twice joined by .//, and line 128 has a doubled "must must". This comment is the source for the generated CRD descriptions, so the artifact propagates into the manual-override and payload manifests (e.g. payload lines 164 and 688). Fix here and regenerate with make update.

📝 Proposed fix
-	// Each item must be at most 63 characters in length, and must must consist
-	// of only lowercase alphanumeric characters and hyphens, and must start
-	// with an alphabetic character and end with an alphanumeric character.// with an alphabetic character and end with an alphanumeric character.
+	// Each item must be at most 63 characters in length, and must consist
+	// of only lowercase alphanumeric characters and hyphens, and must start
+	// with an alphabetic character and end with an alphanumeric character.
The same `must must` doubling appears at line 160 for `excludedFields[].versions`; fix it there as well.
📝 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
// Each item must be at most 63 characters in length, and must must consist
// of only lowercase alphanumeric characters and hyphens, and must start
// with an alphabetic character and end with an alphanumeric character.// with an alphabetic character and end with an alphanumeric character.
// Each item must be at most 63 characters in length, and must consist
// of only lowercase alphanumeric characters and hyphens, and must start
// with an alphabetic character and end with an alphanumeric character.
🤖 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 `@apiextensions/v1/types_compatibilityrequirement.go` around lines 128 - 130,
The doc comments for additionalVersions and excludedFields[].versions contain a
duplicated “must must” typo and a repeated trailing sentence joined into the
same line; clean up the wording so each validation rule appears once and reads
correctly. Update the comment text in types_compatibilityrequirement.go near the
additionalVersions and excludedFields[].versions definitions, then regenerate
the derived CRD/manifests with make update so the propagated descriptions are
fixed too.

@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@stefanonardo: 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

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.

1 participant