Skip to content

Conversation

@alex-bezek
Copy link
Collaborator

What

We noticed that some of these kubebuilder annotations were incorrect so this fixes them.

We also called out in the issue that we should try to lint for these going forward.

How

Fixing the actual issue is very simple (just updating the annotation name)

Linting for this has proven more difficult. I did not find any well supported libraries that could lint for these values. I worked with amp and it came up with this soluation of hardcoding valid annotations but i'm not a big fan of them.

I'm inclined to just not lint for this.

Breaking Changes

No

@github-actions github-actions bot added area/controller Issues dealing with the controller area/helm-chart Issues dealing with the helm chart size/M Denotes a PR that changes 30-99 lines labels Dec 11, 2025
@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.73%. Comparing base (c9eb45f) to head (95a6d68).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #729      +/-   ##
==========================================
- Coverage   48.99%   48.73%   -0.27%     
==========================================
  Files          95       95              
  Lines       10594    10594              
==========================================
- Hits         5191     5163      -28     
- Misses       5044     5066      +22     
- Partials      359      365       +6     

☔ 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.


// Metadata is a subset of metav1.ObjectMeta that is added to the Service
// +kube:validation:Optional
// +kubebuilder:validation:Optional
Copy link
Collaborator

Choose a reason for hiding this comment

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

Even though it was invalid, it looks like this had no effect on the generated output.

Comment on lines +26 to +37
INVALID_PATTERNS=(
'+kube:validation:' # Should be +kubebuilder:validation:
'+kube:default:' # Should be +kubebuilder:default:
'+kube:object:' # Should be +kubebuilder:object:
'+kube:subresource:' # Should be +kubebuilder:subresource:
'+kube:printcolumn:' # Should be +kubebuilder:printcolumn:
'+kube:resource:' # Should be +kubebuilder:resource:
'+kube:rbac:' # Should be +kubebuilder:rbac:
'+kube:webhook:' # Should be +kubebuilder:webhook:
'+kube:skip' # Should be +kubebuilder:skip
'+kube:storageversion' # Should be +kubebuilder:storageversion
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like it will only catch +kube making the marker invalid. It looks like we aren't handling the case of +kuebuilder:object or any other misspellings. Still feel like an improvement, just noting where it might bite us.

I think long term if we want something more robust, maybe we add a linter to golangci-lint for this? I'm sure others might be interested too.



.PHONY: lint-markers
lint-markers: ## Check for invalid kubebuilder marker prefixes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we add this as a dependency for the lint target so that it gets run in CI automatically?

@alex-bezek alex-bezek closed this Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/controller Issues dealing with the controller area/helm-chart Issues dealing with the helm chart size/M Denotes a PR that changes 30-99 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants