-
Notifications
You must be signed in to change notification settings - Fork 40k
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
podIPs order match node IP family preference (Downward API) #103307
Conversation
@aojea: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
/sig network |
/retest Kubernetes e2e suite: [sig-node] RuntimeClass should reject a Pod requesting a deleted RuntimeClass [NodeFeature:RuntimeHandler] |
/priority important-soon /test pull-kubernetes-integration |
/test pull-kubernetes-e2e-gce-ubuntu-containerd Kubernetes e2e suite: [sig-storage] CSI Volumes [Driver: csi-hostpath] [Testpattern: Dynamic PV (filesystem volmode)] volumeLimits should verify that all csinodes have volume limits expand_less |
runtimes may return an arbitrary number of Pod IPs, however, kubernetes only takes into consideration the first one of each IP family. The order of the IPs are the one defined by the Kubelet: - default prefer IPv4 - if NodeIPs are defined, matching the first nodeIP family PodIP is always the first IP of PodIPs. The downward API must expose the same IPs and in the same order than the pod.Status API object.
} | ||
|
||
// make podIPs order match node IP family preference #97979 | ||
podIPs = kl.sortPodIPs(podIPs) |
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.
is there some subtle golang thing that disallow this?
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 don't know - is something not working?
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.
it does work, I just pass the slice as argument and override the same variable with the output, I think is fine, but I just wanted to double check
No, that;s fine :)
…On Tue, Jul 6, 2021 at 4:49 PM Antonio Ojea ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pkg/kubelet/kubelet_pods.go
<#103307 (comment)>
:
> +}
+
+// convertStatusToAPIStatus creates an api PodStatus for the given pod from
+// the given internal pod status. It is purely transformative and does not
+// alter the kubelet state at all.
+func (kl *Kubelet) convertStatusToAPIStatus(pod *v1.Pod, podStatus *kubecontainer.PodStatus) *v1.PodStatus {
+ var apiPodStatus v1.PodStatus
+
+ // copy pod status IPs to avoid race conditions with PodStatus #102806
+ podIPs := make([]string, len(podStatus.IPs))
+ for j, ip := range podStatus.IPs {
+ podIPs[j] = ip
+ }
+
+ // make podIPs order match node IP family preference #97979
+ podIPs = kl.sortPodIPs(podIPs)
it does work, I just pass the slice as argument and override the same
variable with the output, I think is fine, but I just wanted to double check
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#103307 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKWAVHT2VFXQSE6ZNRZJ73TWOI7JANCNFSM47Q4EVLQ>
.
|
This whole sorting things makes me a little uneasy, not going to lie. But it's already being done elsewhere, so .... /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aojea, thockin 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 |
I think that this is one of the things that goes to the bucket of "needs a refactor", the
|
Following up on #97979,
we should implement the same logic for the exposed PodIPs in the downward API, so
both values are identical.
In addition, it also fixes a bug that causes panic in the kubelet, because the podIPs object was mutated meanwhile the code was parsing the IP addresses.
xref: #102817
Additional information
I've tried different approaches, also to filter directly the podIPs in
kubernetes/pkg/kubelet/kuberuntime/kuberuntime_sandbox.go
Line 231 in 5f8f5ab
but I've discarded that approach because it has to add a dependeny to the runtimeManager on the kubelet nodeIPs.
Another alternative that I started and stopped because it is toooo disruptive, is to refactor all code to stop plumbing
podIP
andpodIPs
What type of PR is this?
/kind bug
Fixes #103263, #102806