Re: [kubernetes/kubernetes] downwardapi volumes FieldPath bug fix (#64186)

9 views
Skip to first unread message

Jordan Liggitt

unread,
May 23, 2018, 10:47:33 AM5/23/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@liggitt commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,24 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: unify with Kubelet.podFieldSelectorRuntimeValue

volume setup and container start are done in separate work queues. it is possible the information you are looking for is sometimes present when the volume setup is done, and sometimes not. need feedback from @kubernetes/sig-storage-pr-reviews and @kubernetes/sig-node-pr-reviews on whether we can depend on the pod object status at this point. see discussion at #42717 (comment) for the types of issues encountered


You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

Zhonghu Xu

unread,
May 23, 2018, 10:51:14 AM5/23/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,24 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: unify with Kubelet.podFieldSelectorRuntimeValue

also have a concern about cycle import if using Kubelet.podFieldSelectorRuntimeValue

Jordan Liggitt

unread,
May 23, 2018, 10:58:32 AM5/23/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@liggitt commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,24 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: unify with Kubelet.podFieldSelectorRuntimeValue

I wouldn't call it there, I would move the function to a common location and pass in the podIP/hostIP

Michelle Au

unread,
May 23, 2018, 4:35:00 PM5/23/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@msau42 commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,24 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: unify with Kubelet.podFieldSelectorRuntimeValue

I spoke with @Random-Liu, he says that Pod IP is allocated when we create the PodSandbox. This happens well after volume setup.

I suspect what is happening here is the initial volume setup gets an empty IP, but sometime afterwards we periodically resync/remount the downward api volume, and it gets the updated IPs from the pod status. If my theory is correct, then a simple test could be to mount your pod ip file as a subpath volume, which does not get remounted. Then you would see the file contents are empty.

Zhonghu Xu

unread,
May 23, 2018, 10:04:45 PM5/23/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,24 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: unify with Kubelet.podFieldSelectorRuntimeValue

Thanks @msau42 , I have tried, that's correct I suspect what is happening here is the initial volume setup gets an empty IP, but sometime afterwards we periodically resync/remount the downward api volume, and it gets the updated IPs from the pod status.

Zhonghu Xu

unread,
May 23, 2018, 10:23:04 PM5/23/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,24 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: unify with Kubelet.podFieldSelectorRuntimeValue

@liggitt @msau42 Then what do you suggest: 1. periodically resync/remount the downward api volume , users have to check it before use.
2. do not support "status.podIP" .

Jordan Liggitt

unread,
May 23, 2018, 10:25:52 PM5/23/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@liggitt commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,24 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: unify with Kubelet.podFieldSelectorRuntimeValue

if we can't provide it on first setup, we don't support it

Zhonghu Xu

unread,
May 23, 2018, 11:13:21 PM5/23/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,24 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: unify with Kubelet.podFieldSelectorRuntimeValue

ok

k8s-ci-robot

unread,
May 23, 2018, 11:52:34 PM5/23/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hzxuzhonghu
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: thockin

Assign the PR to them by writing /assign @thockin in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot

unread,
May 23, 2018, 11:56:00 PM5/23/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-bazel-test 72d7a38 link /test pull-kubernetes-bazel-test

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/test-infra repository. I understand the commands that are listed here.

k8s-ci-robot

unread,
May 24, 2018, 12:29:45 AM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-bazel-test 72d7a38 link /test pull-kubernetes-bazel-test
pull-kubernetes-verify 72d7a38 link /test pull-kubernetes-verify

k8s-ci-robot

unread,
May 24, 2018, 12:35:15 AM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-bazel-test 72d7a38 link /test pull-kubernetes-bazel-test
pull-kubernetes-verify 72d7a38 link /test pull-kubernetes-verify
pull-kubernetes-e2e-kops-aws 72d7a38 link /test pull-kubernetes-e2e-kops-aws

k8s-ci-robot

unread,
May 24, 2018, 12:58:17 AM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-bazel-test 72d7a38 link /test pull-kubernetes-bazel-test
pull-kubernetes-verify 72d7a38 link /test pull-kubernetes-verify
pull-kubernetes-e2e-kops-aws 72d7a38 link /test pull-kubernetes-e2e-kops-aws
pull-kubernetes-e2e-gce 72d7a38 link /test pull-kubernetes-e2e-gce

Zhonghu Xu

unread,
May 24, 2018, 2:25:28 AM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Push

@hzxuzhonghu pushed 1 commit.

  • 8e3a0df add e2e case for dowardapi volume


You are receiving this because you are subscribed to this thread.
View it on GitHub or mute the thread.

k8s-ci-robot

unread,
May 24, 2018, 2:26:28 AM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hzxuzhonghu
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: thockin

Assign the PR to them by writing /assign @thockin in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment


You are receiving this because you are on a team that was mentioned.

Reply to this email directly, view it on GitHub, or mute the thread.

k8s-ci-robot

unread,
May 24, 2018, 2:34:52 AM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-e2e-gce 72d7a38 link /test pull-kubernetes-e2e-gce
pull-kubernetes-bazel-test 8e3a0df link /test pull-kubernetes-bazel-test

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/test-infra repository. I understand the commands that are listed here.

k8s-ci-robot

unread,
May 24, 2018, 4:37:12 AM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hzxuzhonghu
To fully approve this pull request, please assign additional approvers.

We suggest the following additional approver: smarterclayton

Assign the PR to them by writing /assign @smarterclayton in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot

unread,
May 24, 2018, 4:57:18 AM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-node-e2e 33c4acd link /test pull-kubernetes-node-e2e

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/test-infra repository. I understand the commands that are listed here.

Zhonghu Xu

unread,
May 24, 2018, 5:20:41 AM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/test pull-kubernetes-node-e2e

Michelle Au

unread,
May 24, 2018, 2:10:12 PM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@msau42 commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,24 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: unify with Kubelet.podFieldSelectorRuntimeValue

Did you check that hostIP doesn't have the same issue?

Michelle Au

unread,
May 24, 2018, 2:11:02 PM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@msau42 commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,24 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: unify with Kubelet.podFieldSelectorRuntimeValue

Is there somewhere in the code and/or docs we can document the reason why we can't support podIP in downward api volume?

Zhonghu Xu

unread,
May 24, 2018, 9:33:27 PM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,24 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: unify with Kubelet.podFieldSelectorRuntimeValue

Did you check that hostIP doesn't have the same issue?

Yes, podstatus generate before volume, pkg/kubelet/kubelet.go#L1433

Is there somewhere in the code and/or docs we can document the reason why we can't support podIP in downward api volume?

No, I will add comment now.

k8s-ci-robot

unread,
May 24, 2018, 11:29:10 PM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-kubemark-e2e-gce-big 97feaf2 link /test pull-kubernetes-kubemark-e2e-gce-big

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/test-infra repository. I understand the commands that are listed here.

Zhonghu Xu

unread,
May 24, 2018, 11:34:11 PM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/retest

k8s-ci-robot

unread,
May 24, 2018, 11:48:46 PM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-kubemark-e2e-gce-big 97feaf2 link /test pull-kubernetes-kubemark-e2e-gce-big

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/test-infra repository. I understand the commands that are listed here.

k8s-ci-robot

unread,
May 24, 2018, 11:58:19 PM5/24/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-kubemark-e2e-gce-big 97feaf2 link /test pull-kubernetes-kubemark-e2e-gce-big
pull-kubernetes-e2e-kops-aws 97feaf2 link /test pull-kubernetes-e2e-kops-aws

k8s-ci-robot

unread,
May 25, 2018, 1:55:47 AM5/25/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-e2e-kops-aws 97feaf2 link /test pull-kubernetes-e2e-kops-aws
pull-kubernetes-kubemark-e2e-gce-big 392b2a9 link /test pull-kubernetes-kubemark-e2e-gce-big

k8s-ci-robot

unread,
May 25, 2018, 2:43:20 AM5/25/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-kubemark-e2e-gce-big 392b2a9 link /test pull-kubernetes-kubemark-e2e-gce-big
pull-kubernetes-e2e-gce 392b2a9 link /test pull-kubernetes-e2e-gce

Zhonghu Xu

unread,
May 25, 2018, 3:47:23 AM5/25/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/retest

Zhonghu Xu

unread,
May 28, 2018, 6:07:05 AM5/28/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

Jan Šafránek

unread,
May 28, 2018, 11:28:19 AM5/28/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/approve
the volume plugin changes

k8s-ci-robot

unread,
May 28, 2018, 11:29:20 AM5/28/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hzxuzhonghu, jsafrane


To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: smarterclayton

Assign the PR to them by writing /assign @smarterclayton in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Zhonghu Xu

unread,
May 29, 2018, 11:34:02 PM5/29/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/assign @smarterclayton for the api part(fix comments)

Zhonghu Xu

unread,
May 31, 2018, 3:04:50 AM5/31/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/assign @lavalamp

Zhonghu Xu

unread,
Jun 1, 2018, 1:53:50 AM6/1/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

Daniel Smith

unread,
Jun 8, 2018, 4:56:19 PM6/8/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

API machinery doesn't own this API. This is for node and the api reviewers.

Zhonghu Xu

unread,
Jun 8, 2018, 10:01:09 PM6/8/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

Zhonghu Xu

unread,
Jul 9, 2018, 11:45:17 PM7/9/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

ping @kubernetes/api-reviewers @kubernetes/sig-node-bugs Since this mostly for volume and this part has been approved.

Could you review small parts and approve it?

Zhonghu Xu

unread,
Jul 9, 2018, 11:45:43 PM7/9/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/assign @thockin

Pengfei Ni

unread,
Jul 10, 2018, 1:14:38 AM7/10/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@feiskyer commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,29 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: support "status.podIP" once we can get pod ip before first setup volume.

Are there any use cases for status.podIP? I think containers could get its IP easily with any networking tools or library if required.

Tim Hockin

unread,
Jul 10, 2018, 1:35:03 AM7/10/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/lgtm
/approve

k8s-ci-robot

unread,
Jul 10, 2018, 1:35:32 AM7/10/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hzxuzhonghu, jsafrane, thockin


To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: smarterclayton

If they are not already assigned, you can assign the PR to them by writing /assign @smarterclayton in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Kubernetes Submit Queue

unread,
Jul 10, 2018, 1:36:01 AM7/10/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/test all

Tests are more than 96 hours old. Re-running tests.

k8s-ci-robot

unread,
Jul 10, 2018, 2:21:14 AM7/10/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-e2e-kops-aws 392b2a9 link /test pull-kubernetes-e2e-kops-aws

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/test-infra repository. I understand the commands that are listed here.

Zhonghu Xu

unread,
Jul 10, 2018, 2:45:46 AM7/10/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/assign @smarterclayton

Zhonghu Xu

unread,
Jul 10, 2018, 2:46:42 AM7/10/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/test pull-kubernetes-e2e-kops-aws

k8s-ci-robot

unread,
Jul 11, 2018, 1:43:03 PM7/11/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: PR needs rebase.

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.

Zhonghu Xu

unread,
Jul 16, 2018, 9:21:47 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,29 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: support "status.podIP" once we can get pod ip before first setup volume.

yes, I can remove this TODO

Zhonghu Xu

unread,
Jul 16, 2018, 9:30:42 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

rebased

k8s-ci-robot

unread,
Jul 16, 2018, 9:31:35 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

New changes are detected. LGTM label has been removed.

Zhonghu Xu

unread,
Jul 16, 2018, 9:34:02 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

ping @cheftako @mml @smarterclayton Since all other parts are approved and lgtmed, can anyone of you approve the test part?

k8s-ci-robot

unread,
Jul 16, 2018, 9:36:29 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-bazel-build d63bd17 link /test pull-kubernetes-bazel-build
pull-kubernetes-e2e-gce d63bd17 link /test pull-kubernetes-e2e-gce

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/test-infra repository. I understand the commands that are listed here.

k8s-ci-robot

unread,
Jul 16, 2018, 9:36:38 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-bazel-build d63bd17 link /test pull-kubernetes-bazel-build

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.

k8s-ci-robot

unread,
Jul 16, 2018, 9:36:39 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-bazel-build d63bd17 link /test pull-kubernetes-bazel-build
pull-kubernetes-e2e-gce d63bd17 link /test pull-kubernetes-e2e-gce
pull-kubernetes-e2e-gce-device-plugin-gpu d63bd17 link /test pull-kubernetes-e2e-gce-device-plugin-gpu

k8s-ci-robot

unread,
Jul 16, 2018, 9:36:42 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e-containerized e004da7 link /test pull-kubernetes-local-e2e-containerized
pull-kubernetes-bazel-build d63bd17 link /test pull-kubernetes-bazel-build
pull-kubernetes-e2e-gce d63bd17 link /test pull-kubernetes-e2e-gce
pull-kubernetes-e2e-gce-device-plugin-gpu d63bd17 link /test pull-kubernetes-e2e-gce-device-plugin-gpu
pull-kubernetes-node-e2e d63bd17 link /test pull-kubernetes-node-e2e

k8s-ci-robot

unread,
Jul 16, 2018, 9:37:02 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention
pull-kubernetes-e2e-kops-aws d63bd17 link /test pull-kubernetes-e2e-kops-aws
pull-kubernetes-typecheck d63bd17 link /test pull-kubernetes-typecheck

k8s-ci-robot

unread,
Jul 16, 2018, 9:37:18 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

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.

k8s-ci-robot

unread,
Jul 16, 2018, 9:39:27 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention
pull-kubernetes-typecheck d63bd17 link /test pull-kubernetes-typecheck
pull-kubernetes-integration d63bd17 link /test pull-kubernetes-integration

k8s-ci-robot

unread,
Jul 16, 2018, 9:39:58 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention
pull-kubernetes-e2e-gce-100-performance d63bd17 link /test pull-kubernetes-e2e-gce-100-performance

k8s-ci-robot

unread,
Jul 16, 2018, 9:41:04 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention
pull-kubernetes-kubemark-e2e-gce-big d63bd17 link /test pull-kubernetes-kubemark-e2e-gce-big

k8s-ci-robot

unread,
Jul 16, 2018, 9:43:56 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention
pull-kubernetes-bazel-test d63bd17 link /test pull-kubernetes-bazel-test

k8s-ci-robot

unread,
Jul 16, 2018, 10:06:43 PM7/16/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention
pull-kubernetes-verify d63bd17 link /test pull-kubernetes-verify

Clayton Coleman

unread,
Jul 17, 2018, 1:43:13 AM7/17/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@smarterclayton commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,28 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// podFieldSelectorRuntimeValue extracts the field from the pod
+// and returns it as a string.
+func podFieldSelectorRuntimeValue(pod *v1.Pod, fieldPath string, host volume.VolumeHost) (string, error) {
+	switch fieldPath {
+	case "spec.nodeName":
+		return pod.Spec.NodeName, nil
+	case "spec.serviceAccountName":
+		return pod.Spec.ServiceAccountName, nil
+	case "status.hostIP":

This is a security leak for many users. Do we expose this for env vars?

Clayton Coleman

unread,
Jul 17, 2018, 1:45:39 AM7/17/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@smarterclayton requested changes on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -237,8 +237,7 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 			fileProjection.Mode = *defaultMode
 		}
 		if fileInfo.FieldRef != nil {
-			// TODO: unify with Kubelet.podFieldSelectorRuntimeValue
-			if values, err := fieldpath.ExtractFieldPathAsString(pod, fileInfo.FieldRef.FieldPath); err != nil {
+			if values, err := podFieldSelectorRuntimeValue(pod, fileInfo.FieldRef.FieldPath, host); err != nil {

You removed this comment, but you didn't unify the behavior. This method doesn't report status.podIP like environment variables.


In pkg/apis/core/validation/validation.go:

> @@ -923,7 +923,10 @@ var validVolumeDownwardAPIFieldPathExpressions = sets.NewString(
 	"metadata.namespace",
 	"metadata.labels",
 	"metadata.annotations",
-	"metadata.uid")
+	"metadata.uid",
+	"spec.nodeName",
+	"spec.serviceAccountName",
+	"status.hostIP")

I expected to see status.podIP here.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -237,8 +237,7 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 			fileProjection.Mode = *defaultMode
 		}
 		if fileInfo.FieldRef != nil {
-			// TODO: unify with Kubelet.podFieldSelectorRuntimeValue
-			if values, err := fieldpath.ExtractFieldPathAsString(pod, fileInfo.FieldRef.FieldPath); err != nil {
+			if values, err := podFieldSelectorRuntimeValue(pod, fileInfo.FieldRef.FieldPath, host); err != nil {

I would expect this code to actually become consistent with env vars.

Clayton Coleman

unread,
Jul 17, 2018, 1:46:18 AM7/17/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@smarterclayton commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,29 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: support "status.podIP" once we can get pod ip before first setup volume.

We support podIP on env vars, and we do it explicitly because networking tools and libraries are terrible at telling callers what the "correct IP" is. Having it in the downward API makes the behavior predictable and consistent with how the pod will be exposed by services.

I assume, looking at the PR, that you didn't fix the behavior. The TODO should remain until it's fixed.

Zhonghu Xu

unread,
Jul 17, 2018, 2:29:11 AM7/17/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -237,8 +237,7 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 			fileProjection.Mode = *defaultMode
 		}
 		if fileInfo.FieldRef != nil {
-			// TODO: unify with Kubelet.podFieldSelectorRuntimeValue
-			if values, err := fieldpath.ExtractFieldPathAsString(pod, fileInfo.FieldRef.FieldPath); err != nil {
+			if values, err := podFieldSelectorRuntimeValue(pod, fileInfo.FieldRef.FieldPath, host); err != nil {

Ok, will revert this. And try to fix it in another pr.

Zhonghu Xu

unread,
Jul 17, 2018, 2:32:52 AM7/17/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,29 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// TODO: support "status.podIP" once we can get pod ip before first setup volume.

OK

Zhonghu Xu

unread,
Jul 17, 2018, 2:33:49 AM7/17/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@smarterclayton addressed, ptal.

Zhonghu Xu

unread,
Jul 17, 2018, 2:35:37 AM7/17/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu commented on this pull request.


In pkg/volume/downwardapi/downwardapi.go:

> @@ -262,6 +261,28 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
 	return data, utilerrors.NewAggregate(errlist)
 }
 
+// podFieldSelectorRuntimeValue extracts the field from the pod
+// and returns it as a string.
+func podFieldSelectorRuntimeValue(pod *v1.Pod, fieldPath string, host volume.VolumeHost) (string, error) {
+	switch fieldPath {
+	case "spec.nodeName":
+		return pod.Spec.NodeName, nil
+	case "spec.serviceAccountName":
+		return pod.Spec.ServiceAccountName, nil
+	case "status.hostIP":

Yes, exposed in env vars

Zhonghu Xu

unread,
Jul 17, 2018, 2:39:35 AM7/17/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu commented on this pull request.


In pkg/apis/core/validation/validation.go:

> @@ -923,7 +923,10 @@ var validVolumeDownwardAPIFieldPathExpressions = sets.NewString(
 	"metadata.namespace",
 	"metadata.labels",
 	"metadata.annotations",
-	"metadata.uid")
+	"metadata.uid",
+	"spec.nodeName",
+	"spec.serviceAccountName",
+	"status.hostIP")

// TODO: support "status.podIP" once we can get pod ip before first setup volume.

Zhonghu Xu

unread,
Jul 20, 2018, 5:10:29 AM7/20/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

/retest

kindly ping @smarterclayton

Zhonghu Xu

unread,
Jul 27, 2018, 3:56:54 AM7/27/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

kindly ping @smarterclayton Any other comments?

k8s-ci-robot

unread,
Aug 4, 2018, 7:04:35 PM8/4/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

@hzxuzhonghu: PR needs rebase.

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.

Zhonghu Xu

unread,
Aug 21, 2018, 2:44:40 AM8/21/18
to kubernetes/kubernetes, k8s-mirror-storage-pr-reviews, Team mention

Closed #64186.

Reply all
Reply to author
Forward
0 new messages