Skip to content

api: activate kubebuilder Enum markers on Policy and Provider#81

Merged
tamalsaha merged 1 commit into
masterfrom
fix/kubebuilder-markers
Jun 6, 2026
Merged

api: activate kubebuilder Enum markers on Policy and Provider#81
tamalsaha merged 1 commit into
masterfrom
fix/kubebuilder-markers

Conversation

@tamalsaha

Copy link
Copy Markdown
Contributor

Summary

Both `kubebuilder:validation:Enum` lines on `Policy` and `Provider` were missing the leading `+`, so `controller-gen` treated them as plain comments. The generated CRD has `type: string` with no enum constraint on either field — which is why an arbitrary `spec.provider` string makes it past the API server today.

Add the `+` and drop the spurious `:=` (correct syntax is `Enum=v1;v2;...`).

Note: `make manifests` (which runs in Docker) needs to be re-run to regenerate `crds/external-dns.appscode.com_externaldnses.yaml` with the enum constraint. Intentionally not bundled with this Go-source-only PR.

Test plan

  • `go build ./...`
  • Run `make manifests` in CI / locally with Docker and inspect the regenerated CRD enum on `policy` and `provider`

Both kubebuilder:validation:Enum lines were missing the leading '+',
so controller-gen treated them as plain comments. The generated CRD
yaml has 'type: string' with no enum constraint on either field —
which is why an arbitrary spec.provider string makes it through to
the reconciler today.

Add the '+' and drop the spurious ':=' (the correct syntax is
'Enum=v1;v2;...'). After this, 'make manifests' will regenerate the
CRD yaml with the enum constraint; that regeneration runs in Docker
and is intentionally not bundled with this PR.

Signed-off-by: Tamal Saha <tamal@appscode.com>
@tamalsaha tamalsaha merged commit d6186a3 into master Jun 6, 2026
4 checks passed
@tamalsaha tamalsaha deleted the fix/kubebuilder-markers branch June 6, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant