Skip to content

Conversation

@camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Dec 19, 2025

Continuation of : #2058

Copilot AI review requested due to automatic review settings December 19, 2025 09:07
@camilamacedo86 camilamacedo86 requested a review from a team as a code owner December 19, 2025 09:07
@netlify
Copy link

netlify bot commented Dec 19, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 5feea3e
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/69452836c127390008fa7b01
😎 Deploy Preview https://deploy-preview-2394--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@openshift-ci
Copy link

openshift-ci bot commented Dec 19, 2025

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

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 19, 2025
@camilamacedo86 camilamacedo86 changed the title Linter check WIP: Fix API k8s API conventions and Kube API linter check Dec 19, 2025
@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 Dec 19, 2025
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 19, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new kube-api-linter plugin to the golangci-lint toolchain to enforce Kubernetes API conventions in the codebase. The changes standardize API marker annotations across Go type definitions and update generated CRD manifests and documentation accordingly.

Key changes:

  • Adds kube-api-linter plugin configuration and custom golangci-lint build setup
  • Replaces +kubebuilder:validation:Required markers with the shorter +required marker
  • Adds +optional markers for optional fields to improve API clarity
  • Fixes validation marker syntax (e.g., minimumMinimum, maximumMaximum)
  • Removes metadata from CRD required field lists (metadata is implicitly required)
  • Fixes a typo: +kubebuilder:validation.Required+required

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.golangci.yaml Adds kubeapilinter to enabled linters with optionalfields configuration preferring pointers only when required
.custom-gcl.yml New configuration file for building custom golangci-lint with kube-api-linter plugin
Makefile Adds build target for custom golangci-lint binary with kubeapilinter plugin and updates lint target to use it
api/v1/clustercatalog_types.go Replaces +kubebuilder:validation:Required with +required, fixes validation marker casing, and adds +optional markers; also makes metadata field optional
api/v1/clusterextension_types.go Replaces +kubebuilder:validation:Required with +required, fixes typo (validation.Required), and adds +optional and +required markers
api/v1/clusterextensionrevision_types.go Adds +optional and +required markers for clarity
hack/tools/crd-generator/testdata/api/v1/clusterextension_types.go Same marker updates as the main clusterextension_types.go file
manifests/*.yaml Updates generated CRD manifests with minimum/maximum validation constraints and removes metadata from required fields
helm/olmv1/base/catalogd/crd/*/*.yaml Updates generated Helm CRD files with minimum/maximum validation constraints and removes metadata from required fields
docs/api-reference/olmv1-api-reference.md Updates generated API documentation to reflect removal of Required validation markers in the validation column
Comments suppressed due to low confidence (1)

api/v1/clustercatalog_types.go:267

  • The field Image is a pointer type but marked with +required. According to Kubernetes API conventions and the configured linter preference (WhenRequired), required fields should not be pointers. Consider either removing the pointer type if the field must always be present when Type is "Image", or removing the +required marker if the field should remain optional. The XValidation rule on the parent ResolvedCatalogSource struct already validates presence conditionally.
} 

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 420 to 421
// When set to "Strict", the CRD Upgrade Safety pre-flight check runs during an upgrade operation.
//
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The field CRDUpgradeSafety is a pointer type but marked with +required. According to Kubernetes API conventions and the configured linter preference (WhenRequired), required fields should not be pointers. Consider either removing the pointer type if the field must always be present, or removing the +required marker if the field should remain optional. The XValidation rule on the parent PreflightConfig struct already validates presence with has(self.crdUpgradeSafety), which suggests the field should be treated as required when PreflightConfig is specified.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.82%. Comparing base (cc8ed2b) to head (5feea3e).

Additional details and impacted files
@@ Coverage Diff @@ ## main #2394 +/- ## ========================================== + Coverage 68.79% 68.82% +0.02%  ========================================== Files 100 100 Lines 7641 7641 ========================================== + Hits 5257 5259 +2  + Misses 1948 1947 -1  + Partials 436 435 -1 
Flag Coverage Δ
e2e 43.93% <ø> (+0.02%) ⬆️
experimental-e2e 13.68% <ø> (ø)
unit 57.11% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Copilot AI review requested due to automatic review settings December 19, 2025 10:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 10 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

conditions:
description: |-
The set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The updated description has a subject-verb agreement error. "conditions represents" should be "conditions represent" since "conditions" is plural. Additionally, the sentence structure is awkward with "which apply...are". Consider rephrasing to: "conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing."

Suggested change
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing.
Copilot uses AI. Check for mistakes.
conditions:
description: |-
The set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The updated description has a subject-verb agreement error. "conditions represents" should be "conditions represent" since "conditions" is plural. Additionally, the sentence structure is awkward with "which apply...are". Consider rephrasing to: "conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing."

Suggested change
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing.
Copilot uses AI. Check for mistakes.
conditions:
description: |-
The set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The updated description has a subject-verb agreement error. "conditions represents" should be "conditions represent" since "conditions" is plural. Additionally, the sentence structure is awkward with "which apply...are". Consider rephrasing to: "conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing."

Suggested change
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing.
Copilot uses AI. Check for mistakes.
// metadata is the standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
metav1.ListMeta `json:"metadata"`
metav1.ListMeta `json:"metadata,omitempty"`
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

According to Kubernetes API conventions, the metadata field in List types should not have the omitempty tag. The ListMeta contains important pagination and versioning information (like resourceVersion and continue tokens) that should always be present in list responses, even when empty. The metadata field should be json:"metadata" without omitempty.

Suggested change
metav1.ListMeta `json:"metadata,omitempty"`
metav1.ListMeta `json:"metadata"`
Copilot uses AI. Check for mistakes.
type ClusterExtensionStatus struct {
// The set of condition types which apply to all spec.source variations are Installed and Progressing.
// conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
//
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The updated description has a subject-verb agreement error. "conditions represents" should be "conditions represent" since "conditions" is plural. Additionally, the sentence structure is awkward with "which apply...are". Consider rephrasing to: "conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing."

Suggested change
//
// conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing.
Copilot uses AI. Check for mistakes.
conditions:
description: |-
The set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The updated description has a subject-verb agreement error. "conditions represents" should be "conditions represent" since "conditions" is plural. Additionally, the sentence structure is awkward with "which apply...are". Consider rephrasing to: "conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing."

Suggested change
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing.
Copilot uses AI. Check for mistakes.
conditions:
description: |-
The set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The updated description has a subject-verb agreement error. "conditions represents" should be "conditions represent" since "conditions" is plural. Additionally, the sentence structure is awkward with "which apply...are". Consider rephrasing to: "conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing."

Suggested change
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing.
Copilot uses AI. Check for mistakes.
conditions:
description: |-
The set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The updated description has a subject-verb agreement error. "conditions represents" should be "conditions represent" since "conditions" is plural. Additionally, the sentence structure is awkward with "which apply...are". Consider rephrasing to: "conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing."

Suggested change
conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.
conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing.
Copilot uses AI. Check for mistakes.
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | The set of condition types which apply to all spec.source variations are Installed and Progressing.<br />The Installed condition represents whether the bundle has been installed for this ClusterExtension:<br /> - When Installed is True and the Reason is Succeeded, the bundle has been successfully installed.<br /> - When Installed is False and the Reason is Failed, the bundle has failed to install.<br />The Progressing condition represents whether or not the ClusterExtension is advancing towards a new state.<br />When Progressing is True and the Reason is Succeeded, the ClusterExtension is making progress towards a new state.<br />When Progressing is True and the Reason is Retrying, the ClusterExtension has encountered an error that could be resolved on subsequent reconciliation attempts.<br />When Progressing is False and the Reason is Blocked, the ClusterExtension has encountered an error that requires manual intervention for recovery.<br /><opcon:experimental:description><br />When Progressing is True and Reason is RollingOut, the ClusterExtension has one or more ClusterExtensionRevisions in active roll out.<br /></opcon:experimental:description><br />When the ClusterExtension is sourced from a catalog, it may also communicate a deprecation condition.<br />These are indications from a package owner to guide users away from a particular package, channel, or bundle:<br /> - BundleDeprecated is set if the requested bundle version is marked deprecated in the catalog.<br /> - ChannelDeprecated is set if the requested channel is marked deprecated in the catalog.<br /> - PackageDeprecated is set if the requested package is marked deprecated in the catalog.<br /> - Deprecated is a rollup condition that is present when any of the deprecated conditions are present. | | |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.<br />The Installed condition represents whether the bundle has been installed for this ClusterExtension:<br /> - When Installed is True and the Reason is Succeeded, the bundle has been successfully installed.<br /> - When Installed is False and the Reason is Failed, the bundle has failed to install.<br />The Progressing condition represents whether or not the ClusterExtension is advancing towards a new state.<br />When Progressing is True and the Reason is Succeeded, the ClusterExtension is making progress towards a new state.<br />When Progressing is True and the Reason is Retrying, the ClusterExtension has encountered an error that could be resolved on subsequent reconciliation attempts.<br />When Progressing is False and the Reason is Blocked, the ClusterExtension has encountered an error that requires manual intervention for recovery.<br /><opcon:experimental:description><br />When Progressing is True and Reason is RollingOut, the ClusterExtension has one or more ClusterExtensionRevisions in active roll out.<br /></opcon:experimental:description><br />When the ClusterExtension is sourced from a catalog, it may also communicate a deprecation condition.<br />These are indications from a package owner to guide users away from a particular package, channel, or bundle:<br /> - BundleDeprecated is set if the requested bundle version is marked deprecated in the catalog.<br /> - ChannelDeprecated is set if the requested channel is marked deprecated in the catalog.<br /> - PackageDeprecated is set if the requested package is marked deprecated in the catalog.<br /> - Deprecated is a rollup condition that is present when any of the deprecated conditions are present. | | |
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The updated description has a subject-verb agreement error. "conditions represents" should be "conditions represent" since "conditions" is plural. Additionally, the sentence structure is awkward with "which apply...are". Consider rephrasing to: "conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing."

Suggested change
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | conditions represents the set of condition types which apply to all spec.source variations are Installed and Progressing.<br />The Installed condition represents whether the bundle has been installed for this ClusterExtension:<br /> - When Installed is True and the Reason is Succeeded, the bundle has been successfully installed.<br /> - When Installed is False and the Reason is Failed, the bundle has failed to install.<br />The Progressing condition represents whether or not the ClusterExtension is advancing towards a new state.<br />When Progressing is True and the Reason is Succeeded, the ClusterExtension is making progress towards a new state.<br />When Progressing is True and the Reason is Retrying, the ClusterExtension has encountered an error that could be resolved on subsequent reconciliation attempts.<br />When Progressing is False and the Reason is Blocked, the ClusterExtension has encountered an error that requires manual intervention for recovery.<br /><opcon:experimental:description><br />When Progressing is True and Reason is RollingOut, the ClusterExtension has one or more ClusterExtensionRevisions in active roll out.<br /></opcon:experimental:description><br />When the ClusterExtension is sourced from a catalog, it may also communicate a deprecation condition.<br />These are indications from a package owner to guide users away from a particular package, channel, or bundle:<br /> - BundleDeprecated is set if the requested bundle version is marked deprecated in the catalog.<br /> - ChannelDeprecated is set if the requested channel is marked deprecated in the catalog.<br /> - PackageDeprecated is set if the requested package is marked deprecated in the catalog.<br /> - Deprecated is a rollup condition that is present when any of the deprecated conditions are present. | | |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | conditions represent the set of condition types that apply to all spec.source variations: Installed and Progressing.<br />The Installed condition represents whether the bundle has been installed for this ClusterExtension:<br /> - When Installed is True and the Reason is Succeeded, the bundle has been successfully installed.<br /> - When Installed is False and the Reason is Failed, the bundle has failed to install.<br />The Progressing condition represents whether or not the ClusterExtension is advancing towards a new state.<br />When Progressing is True and the Reason is Succeeded, the ClusterExtension is making progress towards a new state.<br />When Progressing is True and the Reason is Retrying, the ClusterExtension has encountered an error that could be resolved on subsequent reconciliation attempts.<br />When Progressing is False and the Reason is Blocked, the ClusterExtension has encountered an error that requires manual intervention for recovery.<br /><opcon:experimental:description><br />When Progressing is True and Reason is RollingOut, the ClusterExtension has one or more ClusterExtensionRevisions in active roll out.<br /></opcon:experimental:description><br />When the ClusterExtension is sourced from a catalog, it may also communicate a deprecation condition.<br />These are indications from a package owner to guide users away from a particular package, channel, or bundle:<br /> - BundleDeprecated is set if the requested bundle version is marked deprecated in the catalog.<br /> - ChannelDeprecated is set if the requested channel is marked deprecated in the catalog.<br /> - PackageDeprecated is set if the requested package is marked deprecated in the catalog.<br /> - Deprecated is a rollup condition that is present when any of the deprecated conditions are present. | | |
Copilot uses AI. Check for mistakes.
Comment on lines +68 to +71
rules:
- path-except: "^api/"
linters:
- kubeapilinter
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The exclusion rule appears to be inverted. The configuration "path-except: ^api/" with "linters: - kubeapilinter" means the kubeapilinter will be excluded from running on paths matching ^api/, which is the opposite of what's intended. The kubeapilinter should specifically check the api/ directory for Kubernetes API conventions. Consider using a positive path filter instead, or use the issues exclusion syntax to only run kubeapilinter on api/ paths.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

2 participants