added flexvolume mount to kube-controller

This commit is contained in:
Kellan Cummings 2019-05-03 14:45:58 -04:00
parent 78f5b2c06a
commit d0a653b0a5
1 changed files with 12 additions and 0 deletions

View File

@ -151,6 +151,16 @@ func (b *KubeControllerManagerBuilder) buildPod() (*v1.Pod, error) {
},
}
volumePluginDir := b.Cluster.Spec.Kubelet.VolumePluginDirectory
// Ensure the Volume Plugin dir is mounted on the same path as the host machine so DaemonSet deployment is possible
if volumePluginDir == "" {
volumePluginDir = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec"
} else {
// If volume-plugin-dir flag is set in kubelet, match dir in kube-controller
flags = append(flags, "--flex-volume-plugin-dir="+volumePluginDir)
}
container := &v1.Container{
Name: "kube-controller-manager",
Image: b.Cluster.Spec.KubeControllerManager.Image,
@ -195,6 +205,8 @@ func (b *KubeControllerManagerBuilder) buildPod() (*v1.Pod, error) {
addHostPathMapping(pod, container, "logfile", "/var/log/kube-controller-manager.log").ReadOnly = false
addHostPathMapping(pod, container, "varlibkcm", "/var/lib/kube-controller-manager")
addHostPathMapping(pod, container, "volplugins", volumePluginDir).ReadOnly = false
pod.Spec.Containers = append(pod.Spec.Containers, *container)
kubemanifest.MarkPodAsCritical(pod)