-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Create volumeMount and hostPath for cloud config file #56535
Create volumeMount and hostPath for cloud config file #56535
Conversation
/kind bug |
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.
just one nit. otherwise LGTM.
// Read-only mount of the cloud config file if present | ||
if cfg.CloudProvider != "" { | ||
if _, err := os.Stat(DefaultCloudConfigPath); err == nil { | ||
mounts.NewHostPathMount(kubeadmconstants.KubeAPIServer, kubeadmconstants.KubeCloudConfigVolumeName, DefaultCloudConfigPath, DefaultCloudConfigPath, true, &hostPathFileOrCreate) |
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.
Should hostPathFileOrCreate
be hostPathDirectoryOrCreate
?
or, if we use hostPathFileOrCreate
, we should mount the cloud config file, not the directory.
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.
After taking another looking at the code, seems like DefaultCloudConfigPath = "/etc/kubernetes/cloud-config"
is a file? Hmm, the file name is a bit confusing...
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.
should be FileOrCreate yes
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 this REALLY needed for the API server? Is there actually anything in the API server that can consume cloud code anymore...? I don't think so
Oh, just find that this overlaps with https://github.com/kubernetes/kubernetes/pull/56513/files#diff-d4a6251d485cc68027cd68acd4398701R80. (But this PR is more reasonable than the overlapped part in that one.) |
/cc @luxas |
Ah thanks for the pointer @xiangpengzhao yes, i'd prefer a focused PR like this get in first as it targets a fresh deployment which we need to support better as well. I have to update the docs too |
@luxas would you consider this PR for 1.9 as it is clearly a bug for fresh installs? |
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.
Please make sure the unit test always passes and copy over the change in #56513 touching volumes_test.go
Small nits only, I approve this bug fix for v1.9
// Read-only mount of the cloud config file if present | ||
if cfg.CloudProvider != "" { | ||
if _, err := os.Stat(DefaultCloudConfigPath); err == nil { | ||
mounts.NewHostPathMount(kubeadmconstants.KubeAPIServer, kubeadmconstants.KubeCloudConfigVolumeName, DefaultCloudConfigPath, DefaultCloudConfigPath, true, &hostPathFileOrCreate) |
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.
should be FileOrCreate yes
// Read-only mount of the cloud config file if present | ||
if cfg.CloudProvider != "" { | ||
if _, err := os.Stat(DefaultCloudConfigPath); err == nil { | ||
mounts.NewHostPathMount(kubeadmconstants.KubeAPIServer, kubeadmconstants.KubeCloudConfigVolumeName, DefaultCloudConfigPath, DefaultCloudConfigPath, true, &hostPathFileOrCreate) |
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 this REALLY needed for the API server? Is there actually anything in the API server that can consume cloud code anymore...? I don't think so
@@ -189,6 +189,9 @@ const ( | |||
// KubeConfigVolumeName specifies the name for the Volume that is used for injecting the kubeconfig to talk securely to the api server for a control plane component if applicable | |||
KubeConfigVolumeName = "kubeconfig" | |||
|
|||
// KubeCloudConfigVolumeName specifies the name for the Volume that is used to inject the cloud configuration for kube-apiserver and kube-controller-manager component | |||
KubeCloudConfigVolumeName = "kube-cloud-config" |
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.
please define the constant in the same volumes.go
file as I did in #56513
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.
Ack on it
[MILESTONENOTIFIER] Milestone Pull Request Current Note: This pull request is marked as Example update:
Pull Request Labels
|
32fe44a
to
971deaf
Compare
971deaf
to
a11f984
Compare
We have a way to specify the cloudProvider in kubeadm.conf. We also add `--cloud-config /etc/kubernetes/cloud-config` to both the kubernetes api server and controller manager yaml files if one exists on the box. However we fail to make that file available to the process running in the container. We need to make this `cloud-config` file available to both processes similar to how controller-manager.conf is passed to controller manager.
/test pull-kubernetes-e2e-kubeadm-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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, luxas Associated issue: 576 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue (batch tested with PRs 56400, 56535). If you want to cherry-pick this change to another branch, please follow the instructions here. |
We have a way to specify the cloudProvider in kubeadm.conf. We also
add
--cloud-config /etc/kubernetes/cloud-config
to both thekubernetes api server and controller manager yaml files if one exists
on the box. However we fail to make that file available to the
process running in the container. We need to make this
cloud-config
file available to both processes similar to how controller-manager.conf
is passed to controller manager.
What this PR does / why we need it:
Fixes kubernetes/kubeadm#576
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Release note: