mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
Add host path type in kubeadm config
Signed-off-by: Xianglin Gao <xianglin.gxl@alibaba-inc.com>
This commit is contained in:
parent
bc56947e8d
commit
5d55f28662
@ -300,6 +300,8 @@ type HostPathMount struct {
|
|||||||
MountPath string
|
MountPath string
|
||||||
// Writable controls write access to the volume
|
// Writable controls write access to the volume
|
||||||
Writable bool
|
Writable bool
|
||||||
|
// PathType is the type of the HostPath.
|
||||||
|
PathType string
|
||||||
}
|
}
|
||||||
|
|
||||||
// KubeProxy contains elements describing the proxy configuration.
|
// KubeProxy contains elements describing the proxy configuration.
|
||||||
|
@ -107,9 +107,9 @@ func getHostPathVolumesForTheControlPlane(cfg *kubeadmapi.MasterConfiguration) c
|
|||||||
|
|
||||||
// Merge user defined mounts and ensure unique volume and volume mount
|
// Merge user defined mounts and ensure unique volume and volume mount
|
||||||
// names
|
// names
|
||||||
mounts.AddExtraHostPathMounts(kubeadmconstants.KubeAPIServer, cfg.APIServerExtraVolumes, &hostPathDirectoryOrCreate)
|
mounts.AddExtraHostPathMounts(kubeadmconstants.KubeAPIServer, cfg.APIServerExtraVolumes)
|
||||||
mounts.AddExtraHostPathMounts(kubeadmconstants.KubeControllerManager, cfg.ControllerManagerExtraVolumes, &hostPathDirectoryOrCreate)
|
mounts.AddExtraHostPathMounts(kubeadmconstants.KubeControllerManager, cfg.ControllerManagerExtraVolumes)
|
||||||
mounts.AddExtraHostPathMounts(kubeadmconstants.KubeScheduler, cfg.SchedulerExtraVolumes, &hostPathDirectoryOrCreate)
|
mounts.AddExtraHostPathMounts(kubeadmconstants.KubeScheduler, cfg.SchedulerExtraVolumes)
|
||||||
|
|
||||||
return mounts
|
return mounts
|
||||||
}
|
}
|
||||||
@ -155,10 +155,11 @@ func (c *controlPlaneHostPathMounts) AddHostPathMounts(component string, vols []
|
|||||||
|
|
||||||
// AddExtraHostPathMounts adds host path mounts and overwrites the default
|
// AddExtraHostPathMounts adds host path mounts and overwrites the default
|
||||||
// paths in the case that a user specifies the same volume/volume mount name.
|
// paths in the case that a user specifies the same volume/volume mount name.
|
||||||
func (c *controlPlaneHostPathMounts) AddExtraHostPathMounts(component string, extraVols []kubeadmapi.HostPathMount, hostPathType *v1.HostPathType) {
|
func (c *controlPlaneHostPathMounts) AddExtraHostPathMounts(component string, extraVols []kubeadmapi.HostPathMount) {
|
||||||
for _, extraVol := range extraVols {
|
for _, extraVol := range extraVols {
|
||||||
fmt.Printf("[controlplane] Adding extra host path mount %q to %q\n", extraVol.Name, component)
|
fmt.Printf("[controlplane] Adding extra host path mount %q to %q\n", extraVol.Name, component)
|
||||||
c.NewHostPathMount(component, extraVol.Name, extraVol.HostPath, extraVol.MountPath, !extraVol.Writable, hostPathType)
|
hostPathType := v1.HostPathType(extraVol.PathType)
|
||||||
|
c.NewHostPathMount(component, extraVol.Name, extraVol.HostPath, extraVol.MountPath, !extraVol.Writable, &hostPathType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user