Mount etcd data directory to host

pull/6/head
Evgeny L 2016-09-11 13:39:35 +00:00 committed by Ilya Dmitrichenko
parent ac849dab8e
commit a2a807b50d
No known key found for this signature in database
GPG Key ID: E7889175A6C0CEB9
2 changed files with 19 additions and 1 deletions

View File

@ -42,6 +42,7 @@ func getEnvParams() map[string]string {
envParams := map[string]string{ envParams := map[string]string{
"prefix": globalPrefix, "prefix": globalPrefix,
"host_pki_path": path.Join(globalPrefix, "pki"), "host_pki_path": path.Join(globalPrefix, "pki"),
"host_etcd_path": "/var/lib/etcd",
"hyperkube_image": "", "hyperkube_image": "",
"discovery_image": "dgoodwin/kubediscovery:latest", // TODO(phase1): fmt.Sprintf("gcr.io/google_containers/kube-discovery-%s:%s", runtime.GOARCH, "1.0"), "discovery_image": "dgoodwin/kubediscovery:latest", // TODO(phase1): fmt.Sprintf("gcr.io/google_containers/kube-discovery-%s:%s", runtime.GOARCH, "1.0"),
"etcd_image": "", "etcd_image": "",

View File

@ -63,11 +63,12 @@ func WriteStaticPodManifests(s *kubeadmapi.KubeadmConfig) error {
"--advertise-client-urls=http://127.0.0.1:2379", "--advertise-client-urls=http://127.0.0.1:2379",
"--data-dir=/var/etcd/data", "--data-dir=/var/etcd/data",
}, },
VolumeMounts: []api.VolumeMount{etcdVolumeMount()},
Image: images.GetCoreImage(images.KubeEtcdImage, s.EnvParams["etcd_image"]), Image: images.GetCoreImage(images.KubeEtcdImage, s.EnvParams["etcd_image"]),
LivenessProbe: componentProbe(2379, "/health"), LivenessProbe: componentProbe(2379, "/health"),
Name: etcd, Name: etcd,
Resources: componentResources("200m"), Resources: componentResources("200m"),
}), }, etcdVolume(s)),
// TODO bind-mount certs in // TODO bind-mount certs in
kubeAPIServer: componentPod(api.Container{ kubeAPIServer: componentPod(api.Container{
Name: kubeAPIServer, Name: kubeAPIServer,
@ -111,6 +112,22 @@ func WriteStaticPodManifests(s *kubeadmapi.KubeadmConfig) error {
return nil return nil
} }
func etcdVolume(s *kubeadmapi.KubeadmConfig) api.Volume {
return api.Volume{
Name: "etcd",
VolumeSource: api.VolumeSource{
HostPath: &api.HostPathVolumeSource{Path: s.EnvParams["host_etcd_path"]},
},
}
}
func etcdVolumeMount() api.VolumeMount {
return api.VolumeMount{
Name: "etcd",
MountPath: "/var/etcd",
}
}
func pkiVolume(s *kubeadmapi.KubeadmConfig) api.Volume { func pkiVolume(s *kubeadmapi.KubeadmConfig) api.Volume {
return api.Volume{ return api.Volume{
Name: "pki", Name: "pki",