Metal3 and API groups

18 views
Skip to first unread message

Dmitry Tantsur

unread,
Nov 29, 2024, 6:20:48 AM11/29/24
to Metal3 Development List
Hi all,

When working on a new API in IrSO, I've noticed something unusual. The BMO API resources are generated via Kubebuilder with domain metal3.io and group metal3.io. This produces CRD's with full names like baremetalhosts.metal3.io.metal3.io since group and domain are apparently concatenated. Previously, I would fix this by hand, but after reading more of Kubebuilder docs, I started thinking that using domain in the group is simply not correct.

So, I've researched a few existing operators. The prometheus operator uses monitoring.coreos.com as the group+domain. The postgres operator uses zalando.com, so presumably no group. The CAPI operator uses operator.cluster.x-k8s.io, i.e. group "operator".

To avoid manually fixing Kubebuilder-generated files in the future, I've proposed https://github.com/metal3-io/ironic-standalone-operator/pull/82 that uses ironic.metal3.io for IrSO (so, group "ironic"), although it does produce names like ironics.ironic.metal3.io (which is still better than ironics.metal3.io.metal3.io). I welcome bikeshedding on this topic in the PR.

More importantly, should we change our existing APIs? I'm not sure how breaking it is to change a group (groups seem odd to me, they're rarely mentioned anywhere). But I'm also not sure what group we actually use in BMO. Kubebuilder's PROJECT has group: metal3.io, but the actual groupversion has Group: "metal3.io", so the empty group in reality. Should we settle down on the empty group?

Thoughts?

Dmitry

--
Red Hat GmbH, Registered seat: Werner von Siemens Ring 12, D-85630 Grasbrunn, Germany  
Commercial register: Amtsgericht Muenchen/Munich, HRB 153243,
Managing Directors: Ryan Barnhart, Charles Cachera, Michael O'Neill, Amy Ross

Kashif Khan

unread,
Nov 29, 2024, 8:30:47 AM11/29/24
to Dmitry Tantsur, Metal3 Development List
Hi Dmitry,

I remember adding those while we were migrating from kubebuilder v2 to v3 in this PR https://github.com/metal3-io/baremetal-operator/pull/1011. Since its long ago, I now vaguely remember that the idea back then was to do the migration following guideline from Kubebuilder and avoid any manual change.  Its strange that now it is adding both group and domain in the crd full names. My previous understanding was that it will scaffold to one if we have the same name at both. And honestly it looks wrong now that we used the same for both group and domain but since it didn't reflect back to crd namings, perhaps it went unnoticed. 

I dont know if multigroup has or had anything to do with it.   Anyways, since it is concatenating now , we need to perhaps change it.

In your IrSO PR though it looks still confusing now that I see group: ironic and also +groupName=ironic.metal3.io. So is it now adding domain name and group name in the group name ?  

If we decide to change the API or something perhaps thats one for v1beta API as well? I am also not sure how much breaking would that be.

BR
Kashif 

From: metal...@googlegroups.com <metal...@googlegroups.com> on behalf of Dmitry Tantsur <dtan...@redhat.com>
Sent: Friday, November 29, 2024 4:20 AM
To: Metal3 Development List <metal...@googlegroups.com>
Subject: [metal3-dev] Metal3 and API groups
 
--
You received this message because you are subscribed to the Google Groups "Metal3 Development List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metal3-dev+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/metal3-dev/CACNgkFxkUETfz9O8shGCLrSiC1vTMAYC-wtQqToKzMJvp1YMCA%40mail.gmail.com.

Dmitry Tantsur

unread,
Nov 29, 2024, 8:39:33 AM11/29/24
to Kashif Khan, Metal3 Development List
Hi,

On Fri, Nov 29, 2024 at 2:30 PM Kashif Khan <kashi...@est.tech> wrote:
Hi Dmitry,

I remember adding those while we were migrating from kubebuilder v2 to v3 in this PR https://github.com/metal3-io/baremetal-operator/pull/1011. Since its long ago, I now vaguely remember that the idea back then was to do the migration following guideline from Kubebuilder and avoid any manual change.  Its strange that now it is adding both group and domain in the crd full names. My previous understanding was that it will scaffold to one if we have the same name at both. And honestly it looks wrong now that we used the same for both group and domain but since it didn't reflect back to crd namings, perhaps it went unnoticed. 

I dont know if multigroup has or had anything to do with it.   Anyways, since it is concatenating now , we need to perhaps change it.

In your IrSO PR though it looks still confusing now that I see group: ironic and also +groupName=ironic.metal3.io. So is it now adding domain name and group name in the group name ?  

Yes. To make things confusing, in some places you need to use the group itself, in some - group.domain.

Correct me if I'm wrong, of course. I'm discovering these things by trying. The documentation is... as usual in the Kubernetes world :D

Dmitry
Reply all
Reply to author
Forward
0 new messages