-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid leader election ID is generated #3790
Comments
Hi @yaa110, See that the value is generated here: https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/plugins/golang/v4/scaffolds/internal/templates/main.go#L282
So, can you please share with us what values do you use to to create the project? |
This one seems to be a good first issue.
|
Hey @camilamacedo86 I can take a look on this issue |
I need some steps to get started as I am new contributor |
Thank you @camilamacedo86. According to the source code you shared, the issue is connected to the empty domain value I set for the init command: kubebuilder init --domain "" --repo github.com/blah/blah --project-name mykind
kubebuilder create api --group domain.com --version v1 --kind MyKind It would be nice to also take this situation into consideration. |
Great job !!! thank you for check this one
So, the root cause is to empty the domain. Would you like to push a PR so we add validation and do not allow this scenario? |
@camilamacedo86 I intended to use an API group of using: kubebuilder init --domain "domain.com" --repo github.com/blah/blah --project-name mykind
kubebuilder create api --group domain.com --version v1 --kind MyKind generates: apiVersion: domain.com.domain.com/v1
kind: MyKind
spec: {} however, using aforementioned commands (with empty domain), generates: apiVersion: domain.com/v1
kind: MyKind
spec: {} Is it a bad idea to leave the domain blank? Does it cause issues beyond the leader election ID? Wouldn't it be better to allow the domain to be empty and change the templating code accordingly to support it?
|
Maybe I can check and see if I need to submit a PR |
Hi @yaa110, The "domain" and "group" serve different purposes in structuring and naming resources. A "domain" usually refers to the base DNS domain name used for all resources, serving as a namespace to group them under a common name, preventing conflicts across different projects or organizations. A "group", on the other hand, is a subdivision within the domain that categorizes related kinds of resources, allowing for clearer organization and resource management within the domain. Example if your base domain is example.com, you might define a resource in the ships group. The full API Group for a resource named Sloop would be ships.example.com. So, the domain should be filled with the domain of your project. Using empty domains in Kubernetes could bring issues like:
Therefore, I thought in not allow empty domains. However, others might either done the same. I am OK within as well if you want to push this change.` replace: with: LeaderElectionID: "{{ hashFNV .Repo }}", (ONLY when the domain is not informed) |
What broke? What's expected?
generated
LeaderElectionID
ends with a period (.
) which raises the following error:Reproducing this issue
No response
KubeBuilder (CLI) Version
Version: main.version{KubeBuilderVersion:"3.13.0", KubernetesVendor:"1.27.1", GitCommit:"c8a7cc58eeb56586c019cf8845dad37286d077ff", BuildDate:"2023-11-02T20:43:44Z", GoOs:"linux", GoArch:"amd64"}
PROJECT version
3
Plugin versions
- go.kubebuilder.io/v4
Other versions
go version go1.22.0 linux/amd64
kubectl Client Version: v1.29.2
Extra Labels
No response
The text was updated successfully, but these errors were encountered: