-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🌱 ipam: add spec.clusterName to IPAddressClaim #10182
🌱 ipam: add spec.clusterName to IPAddressClaim #10182
Conversation
exp/ipam/api/v1alpha1/conversion.go
Outdated
if _, ok := dst.ObjectMeta.Labels["cluster.x-k8s.io/cluster-name"]; !ok { | ||
if dst.ObjectMeta.Annotations == nil { | ||
dst.ObjectMeta.Annotations = map[string]string{} | ||
} | ||
dst.ObjectMeta.Annotations["conversion.cluster.x-k8s.io/cluster-name-label-set"] = "false" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is done to make the fuzzy conversion tests happy. I preferred this over an annotation with a json representation of the old object, but can switch to that "standard" approach as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if we use the standard approach here for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is it a use case that we intentionally want to cover that controllers written against v1alpha1 might be able to get the cluster-name from the annotation? (which would only work if the spec.clusterName field is set)
Wondering if these controllers can simply upgrade to v1beta1 instead? Or does somebody already rely on the label?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess if we don't have to support some use cases around this I would prefer to just go with the standard conversion approach and avoid additional complexity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the idea was to support old providers. If we don't want that we can also just be forward-compatible instead. I'd be fine with just keeping the annotation when converting old to new, but fuzzy testing is unhappy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep it this way? Since this is still considered experimental API we can probably remove v1alpha1 rather soon anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I'll get back to it to take another look.
The way the apiserver is working today we'll never going to be able to actually drop v1alpha1 & the corresponding conversion (just set served: false)
(xref: #10051 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, ok. Well, then let me know if you're fine with this approach or whether I should switch to the regular one. I guess once we've set it to served: false
we no longer need to update conversion for newer changes?
Maybe we can also just always set it and adapt the tests so they're fine with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed this with Jakob here: https://kubernetes.slack.com/archives/C8TSNPY4T/p1714405639788599
Overall we will go the way with the additional annotation. The problem is that the annotation and the funcs we usually use doesn't cover metadata. So we can't use it to backup/restore the cluster-name. But even if we could use it to backup/restore the cluster-name label, we wouldn't want to do it. If someone modifies the cluster-name label on the v1alpha1 type we don't want to preserve the value that that label might have had before the conversion on the v1beta1 type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is okay,
but I don't see the part where the claim pauses the reconciliation if the cluster is paused
my bad, I got confused sometimes.
after this is merged and released, we need to support this field in the ipam providers.
/ok-to-test |
0cb1e43
to
b54469d
Compare
b54469d
to
dbc96ca
Compare
dbc96ca
to
0498a29
Compare
Co-authored-by: Stefan Bueringer <[email protected]>
0498a29
to
bb75a9f
Compare
Thank you very much! /lgtm |
LGTM label has been added. Git tree hash: cb301a63ac3fb264c7b93042a0eaac5b32d5e9dc
|
/assign @chrischdi For a sanity check |
/approve Looks good, thanks |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chrischdi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm Accidentally dropped it when adding the squash label |
LGTM label has been added. Git tree hash: cb301a63ac3fb264c7b93042a0eaac5b32d5e9dc
|
What this PR does / why we need it:
Adds a
spec.clusterName
property toIPAddressClaims
to allow properly referencing the Cluster to which the claim belongs. This is required for pausing claim reconciliation when the cluster is paused, which in turn is necessary forclusterctl move
support.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Discussed in #9883
/area ipam