Skip to content
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

Feature Request: support "empty" group for API resources, i.e. with group == domain #1404

Closed
hypnoglow opened this issue Mar 3, 2020 · 15 comments · Fixed by #1679
Closed
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@hypnoglow
Copy link
Contributor

I would like to see kubebuilder support creating APIs with empty groups. By that I mean that the actual apiVersion of CRD to be domain/version without additional group prefix.

I think this can be very helpful for controllers/operators with a very narrow scope and a small number of Kind-s fitting into single "root" group.

Consider popular examples, such as cert-manager or jaeger-operator:

apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
  name: example-com
apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
  name: simplest

In this examples there is no "groups" in terms of kubebuilder, and one group in terms of Kubernetes resource (for kubebuilder it isgroup == domain). And for many such cases it would be desirable to design APIs in a similar simple way.

/kind feature

@hypnoglow hypnoglow added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 3, 2020
@Adirio
Copy link
Contributor

Adirio commented Mar 4, 2020

@DirectXMan12 @mengqiy @droot @camilamacedo86 what do you think about this? Should we implement this feature.

@camilamacedo86
Copy link
Member

camilamacedo86 commented Mar 4, 2020

Hi @hypnoglow,

Let's see if I understood your RFE.
Currently, we do:

kubebuilder init --domain my.domain
kubebuilder create api --group webapp --version v1 --kind Guestbook

Then, what you are asking here is the tool allows:

kubebuilder init --domain my.domain
kubebuilder create api --version v1 --kind Guestbook

Which means that if len(group) < 0 then group= project domain
Then, in this example, it would be the same result of:

kubebuilder create api --group my.domain --version v1 --kind Guestbook

However, the above command would gen:

apiVersion: my.domain.my.domain/v1
kind: Guestbook

Which shows not the expected result and you are looking for :

apiVersion: my.domain/v1
kind: Guestbook

Then, IMO it means allow Kubebuilder gen API without a group.
Please, let me know if I misunderstand something here.

Shows that k8s API allows we enable and disable Groups. See https://kubernetes.io/docs/concepts/overview/kubernetes-api/#enabling-api-groups
So, wdyt @mengqiy and @DirectXMan12? It also would block the project for the MultiGroup option as well. Then, IMO in this scenario, we would need to save in the Project file that GVK is group=empty and never allowed MultiGroup for the project.

PS.: tks @Adirio tks for your help to understand what @hypnoglow is looking for here too.

@Adirio
Copy link
Contributor

Adirio commented Mar 4, 2020

Regarding multi-group, we just would need to use a well-known directory name, such as "core" (following k8s). Would be nice if we could make my.domain/v1 and core.my.domain be synonyms, but I'm not sure if this is feasible.

Regarding the GVK stored in the config file, I would just not store it as that will be clar enough and reading and writting will be easy to implement, just requiring a json:"group,omitmepty" field annotation.

@DirectXMan12
Copy link
Contributor

/approve on what @Adirio said

@Adirio
Copy link
Contributor

Adirio commented Mar 14, 2020

I don't know about the feasability of the core.my.domain and my.domain being the same though. Any clue on that?

@DirectXMan12
Copy link
Contributor

␀.my.domain clearly is the superior answer, with ∅.my.domain being a close second

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 20, 2020
@jpkrohling
Copy link

jpkrohling commented Jul 21, 2020

Wanted to show my support for this issue. As one of the developers behind the Jaeger and OpenTelemetry Operators, we are stuck with the Operator SDK 0.18.x until a guidance is provided for this issue here.

EDIT: the group seems to be required only for the initial generation. Generating it as, say, core.opentelemetry.io and replacing it by opentelemetry.io seems to actually work.

@joelanford
Copy link
Member

There is a messy workaround for this though, right?

Something like:

kubebuilder init --domain=io
kubebuilder create api --group=jaegertracing --version=v1 --kind=Metric`

Does that break something? Maybe it precludes a "core" group AND APIs under subdomain groups?

@jpkrohling
Copy link

I ended up doing something similar: I generated it with --domain=jaegertracing.io and the API as --group=core. I then proceeded to replace all core.jaegertracing.io entries with jaegertracing.io. This seems to be working, but not sure it will cause me problems later on.

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 21, 2020
@camilamacedo86
Copy link
Member

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Aug 21, 2020
@DirectXMan12
Copy link
Contributor

FYI, I think this is largely just waiting for someone to implement.

/good-first-issue

@k8s-ci-robot
Copy link
Contributor

@DirectXMan12:
This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

FYI, I think this is largely just waiting for someone to implement.

/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Sep 10, 2020
@prafull01
Copy link
Contributor

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants