Skip to content

Conversation

@alex-bezek
Copy link
Collaborator

What

We noticed we have some invalid kubebuilder code gen markers. I fixed some in this other branch and made a minimal shell script to lint for things but it wasn't very good https://github.com/ngrok/ngrok-operator/pull/729/files

How

@jonstacks had the suggestion to build a golangci-lint plugin for this. From some research i found the controller-tools package has a way to get the markers.

This:

  • creates a golangci-lint plugin in our repo for now. if we like it, we can pull this out into a public plugin to share with the community
  • implements a regex based "close but not quite" check to offer helpful errors and suggestions for common typos for the kubebuilder namespace
  • creates a registry of markers from the controller-tools packages to lint against
  • does some fancy stuff to try to find the closest matching marker for helpful errors

Breaking Changes

Maybe once we fix the validation issues

Validation

CI will fail as i haven't fixed the issues this found

make lint
make[1]: Entering directory '/workspaces/ngrok-operator'
/workspaces/ngrok-operator/api/ngrok/v1alpha1/agentendpoint_types.go:140:2: unknown kubebuilder marker "+kubebuilder:validation:Items", did you mean "+kubebuilder:validation:MaxItems"?
/workspaces/ngrok-operator/api/ngrok/v1alpha1/agentendpoint_types.go:197:2: unknown kubebuilder marker "+kubebuilder:validation:Nullable"
/workspaces/ngrok-operator/api/ngrok/v1alpha1/cloudendpoint_types.go:82:2: unknown kubebuilder marker "+kubebuilder:validation:Items", did you mean "+kubebuilder:validation:MaxItems"?
/workspaces/ngrok-operator/api/ngrok/v1alpha1/cloudendpoint_types.go:94:2: unknown kubebuilder marker "+kubebuilder:validation:Nullable"
/workspaces/ngrok-operator/api/ngrok/v1alpha1/kubernetesoperator_types.go:67:2: did you mean "+kubebuilder:"? (missing "builder")
/workspaces/ngrok-operator/api/ngrok/v1alpha1/kubernetesoperator_types.go:72:2: did you mean "+kubebuilder:"? (missing "builder")
/workspaces/ngrok-operator/api/bindings/v1alpha1/boundendpoint_types.go:117:2: did you mean "+kubebuilder:"? (missing "builder")
exit status 3
make[1]: *** [tools/make/lint.mk:10: lint-markers] Error 1
make[1]: Leaving directory '/workspaces/ngrok-operator'
make: *** [Makefile:23: _run] Error 2

https://book.kubebuilder.io/reference/markers/crd-validation

@github-actions github-actions bot added area/controller Issues dealing with the controller area/helm-chart Issues dealing with the helm chart size/XL Denotes a PR that changes 500-999 lines labels Dec 16, 2025
@github-actions github-actions bot added documentation Improvements or additions to documentation size/XXL Denotes a PR that changes 1000+ lines and removed area/helm-chart Issues dealing with the helm chart size/XL Denotes a PR that changes 500-999 lines labels 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 documentation Improvements or additions to documentation size/XXL Denotes a PR that changes 1000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants