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
Dualstack downward api #83123
Dualstack downward api #83123
Conversation
3b19ab7
to
7d09498
Compare
ceb3bf0
to
9fe9d4d
Compare
fff4bb3
to
b0e439f
Compare
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/retest |
2e4391b
to
0b451ef
Compare
/test pull-kubernetes-e2e-gce |
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.
Another review, fewer set of comments. Getting close.
add host file write for podIPs update tests remove import alias update type check update type check remove import alias update open api spec add tests update test add tests address review comments update imports remove todo and import alias
d414f48
to
af4d18c
Compare
/test pull-kubernetes-e2e-gce-100-performance |
/lgtm |
/test pull-kubernetes-conformance-kind-ipv6 |
/assign @thockin |
// Kubernetes only mounts on /etc/hosts if: | ||
// - container is not an infrastructure (pause) container | ||
// - container is not already mounting on /etc/hosts | ||
// - OS is not Windows | ||
// Kubernetes will not mount /etc/hosts if: | ||
// - when the Pod sandbox is being created, its IP is still unknown. Hence, PodIP will not have been set. | ||
mountEtcHostsFile := len(podIP) > 0 && runtime.GOOS != "windows" | ||
klog.V(3).Infof("container: %v/%v/%v podIP: %q creating hosts mount: %v", pod.Namespace, pod.Name, container.Name, podIP, mountEtcHostsFile) | ||
mountEtcHostsFile := len(podIPs) > 0 && runtime.GOOS != "windows" |
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 seems scary, is there a reason we can't keep this as len(podIP) > 0
? It ensures existing behavior and has the same result since primary pod IP is guaranteed to be set here anyways.
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.
The podIP
and podIPs
are passed from caller SyncPod
. Here podIP
is set explicitly to the first value of podIPs
- https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kuberuntime/kuberuntime_manager.go#L744-L747. So podIPs
is guaranteed to be set right? If podIPs
is empty, then podIP
is going to be empty here.
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 changing the meaning of the test. Before it was checking whether the podIP was valid (kind of - does it have any bytes). Now it is testing whether the list of podIPs has and values listed.
That is meaningfully different, though I think it will come out the same, since we should never set podIPs[0] if there is not a valid IP. I think. I checked the conversion code and it seems safe.
/milestone v1.17 |
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.
Thanks! Fixes in followups is OK.
/lgtm
/approve
@@ -45,7 +45,7 @@ type HandlerRunner interface { | |||
// RuntimeHelper wraps kubelet to make container runtime | |||
// able to get necessary informations like the RunContainerOptions, DNS settings, Host IP. | |||
type RuntimeHelper interface { | |||
GenerateRunContainerOptions(pod *v1.Pod, container *v1.Container, podIP string) (contOpts *RunContainerOptions, cleanupAction func(), err error) | |||
GenerateRunContainerOptions(pod *v1.Pod, container *v1.Container, podIP string, podIPs []string) (contOpts *RunContainerOptions, cleanupAction func(), err error) |
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.
nit: isn't podIP
always podIPs[0]
? We should not need both. Ok for followup.
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.
@thockin correct, podIP is always podsIPs[0]. Will do a followup PR. Thank you for the review.
// Kubernetes only mounts on /etc/hosts if: | ||
// - container is not an infrastructure (pause) container | ||
// - container is not already mounting on /etc/hosts | ||
// - OS is not Windows | ||
// Kubernetes will not mount /etc/hosts if: | ||
// - when the Pod sandbox is being created, its IP is still unknown. Hence, PodIP will not have been set. | ||
mountEtcHostsFile := len(podIP) > 0 && runtime.GOOS != "windows" | ||
klog.V(3).Infof("container: %v/%v/%v podIP: %q creating hosts mount: %v", pod.Namespace, pod.Name, container.Name, podIP, mountEtcHostsFile) | ||
mountEtcHostsFile := len(podIPs) > 0 && runtime.GOOS != "windows" |
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 changing the meaning of the test. Before it was checking whether the podIP was valid (kind of - does it have any bytes). Now it is testing whether the list of podIPs has and values listed.
That is meaningfully different, though I think it will come out the same, since we should never set podIPs[0] if there is not a valid IP. I think. I checked the conversion code and it seems safe.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aramase, 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 |
/test pull-kubernetes-kubemark-e2e-gce-big |
What type of PR is this?
/kind feature
What this PR does / why we need it:
https://github.com/kubernetes/enhancements/blob/master/keps/sig-network/20180612-ipv4-ipv6-dual-stack.md#container-environment-variables
podIPs
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: