-
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
🐛 Use namespace of the reference on external.Get #11361
🐛 Use namespace of the reference on external.Get #11361
Conversation
3a8f8ac
to
a41b03c
Compare
57a16af
to
d970a70
Compare
7672253
to
edbd553
Compare
511364f
to
b03866f
Compare
/test pull-cluster-api-e2e-mink8s-main |
/test pull-cluster-api-e2e-mink8s-main |
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.
Thx, one nit
(if e2e tests work)
/test pull-cluster-api-e2e-main |
b03866f
to
7f1a57e
Compare
/test pull-cluster-api-e2e-main |
Pretty far up in my review TODO list now. @Danil-Grigorev Can you please rebase? |
281ccdf
to
6969124
Compare
/test pull-cluster-api-e2e-main |
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.
Looks good to me
@@ -25,23 +25,24 @@ import ( | |||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
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.
@Danil-Grigorev Did some analysis (sharing here for future-us :))
Ref fields with namespace defaulting before this PR:
- Cluster.Spec.InfrastructureRef
- Cluster.Spec.ControlPlaneRef
- Machine.Spec.InfrastructureRef
- Machine.Spec.Bootstrap.ConfigRef
- MachinePool.Spec.Template.Spec.Bootstrap.ConfigRef
- MachinePool.Spec.Template.Spec.InfrastructureRef
- MHC.Spec.RemediationTemplate
- KCP.spec.machineTemplate.infrastructureRef
- ClusterClass (all refs)
Namespace fields for which we have to add defaulting:
- MachineDeployment (not used anymore for rollout decisions, namespace is set in most cases by Cluster topology controller)
- Defaulting already added with this PR
- DeepCopy ref and set namespace if empty directly before external.Get (in reconcileExternalTemplateReference)
- MachineSet (not used anymore for rollout decisions, namespace is set in most cases by the MD controller)
- Defaulting already added with this PR
- DeepCopy ref and set namespace if empty directly before external.Get (in reconcileExternalTemplateReference)
So I think we're almost good. I think we just can't assume that the defaulting/mutating webhook always run before our controllers (e.g. if a MD/MS is never modified). I think for this case it would be good to add safeguards in the reconcileExternalTemplateReference funcs to set the namespace if it is empty directly before we use it (but after UpdateReferenceAPIContract))
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.
(DeepCopy has been added now, updated the tasks accordingly)
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
6969124
to
de51a24
Compare
@Danil-Grigorev: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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-sigs/prow repository. I understand the commands that are listed here. |
/test pull-cluster-api-e2e-main Thank you very much! /lgtm |
LGTM label has been added. Git tree hash: b688a46b1bcb5744c4ee8aa65c01efc8883d9392
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbueringer 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 |
What this PR does / why we need it:
Using
external.Get
method may be problematic when the resources referenced are located in a different namespace from the originating resource, leading to not found errors on the lookup attempts.Template definitions provide all information, including namespace of the object in the references, so using those instead.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Related to #5673
/area clusterclass
/area api