Can't create an API with Kind named DNS
Bug Report
What did you do?
- Installed operator-sdk v1.33.0 for macOS via homebrew
- Followed the "quickstart" instructions https://sdk.operatorframework.io/docs/building-operators/golang/quickstart/
mkdir memcached-operator
cd memcached-operator
operator-sdk init --domain example.com --repo github.com/example/memcached-operator
- Created an API as per the quickstart guide
operator-sdk create api --group cache --version v1alpha1 --kind Memcached --resource --controller
- Tried to create an API with a Kind of
DNSvia:
operator-sdk create api --group cache --version v1alpha1 --kind DNS --resource --controller
which fails with:
Error: failed to create API: unable to inject the resource to "base.go.kubebuilder.io/v4": invalid Plural: []string{"a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z](?:[-a-z0-9]*[a-z0-9])?')"}
However CNS and ENS work just fine ;-)
What did you expect to see?
I expected to see the output:
Next: implement your new API and generate the manifests (e.g. CRDs,CRs) with:
$ make manifests
When making my "DNS" api, just like my "CNS" and "ENS" api
What did you see instead? Under which circumstances?
This is what I get when v1.33.0 (which uses go.kubebuilder.io/v4)
Error: failed to create API: unable to inject the resource to "base.go.kubebuilder.io/v4": invalid Plural: []string{"a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z](?:[-a-z0-9]*[a-z0-9])?')"}
It seems to work in v1.31.0 (which uses go.kubebuilder.io/v4-alpha)
Environment
Operator type:
go
Kubernetes cluster type: minikube (but I never get to using it)
$ operator-sdk version
operator-sdk version: "v1.33.0", commit: "542966812906456a8d67cf7284fc6410b104e118", kubernetes version: "v1.27.0", go version: "go1.21.5", GOOS: "darwin", GOARCH: "arm64"
$ go version (if language is Go)
go version go1.21.6 darwin/arm64
$ kubectl version
Client Version: v1.29.1 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.28.3
Possible Solution
Additional context
I can reproduce this on 2 different machines with clean installs of the operator sdk.
Could you please open a corresponding issue in kubebuilder? this needs to be fixed over there and then get pulled into Operator SDK.
I can certainly do that, do I need to figure out how to cause the bug using just Kubebuilder before filing a Kubebuilder bug, or will my reproducer instructions with Operator SDK be sufficient?
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.
If this issue is safe to close now please do so with /close.
/lifecycle stale
This comes form k8's itself, going to close this issue.