only mount volumes if local_volumes_enabled is true. fix mount flags in rkt. (#1923)

pull/1931/head
Spencer Smith 2017-11-03 03:10:37 -04:00 committed by Matthew Mosesohn
parent 66c67dbe73
commit ec1170bd37
2 changed files with 7 additions and 1 deletions

View File

@ -26,7 +26,9 @@
-v /var/run:/var/run:rw \ -v /var/run:/var/run:rw \
-v {{kube_config_dir}}:{{kube_config_dir}}:ro \ -v {{kube_config_dir}}:{{kube_config_dir}}:ro \
-v /etc/os-release:/etc/os-release:ro \ -v /etc/os-release:/etc/os-release:ro \
{% if local_volumes_enabled == true %}
-v {{ local_volume_base_dir }}:{{ local_volume_base_dir }}:shared \ -v {{ local_volume_base_dir }}:{{ local_volume_base_dir }}:shared \
{% endif %}
{{ hyperkube_image_repo }}:{{ hyperkube_image_tag}} \ {{ hyperkube_image_repo }}:{{ hyperkube_image_tag}} \
./hyperkube kubelet \ ./hyperkube kubelet \
"$@" "$@"

View File

@ -28,11 +28,13 @@ ExecStart=/usr/bin/rkt run \
--volume var-lib-docker,kind=host,source={{ docker_daemon_graph }},readOnly=false \ --volume var-lib-docker,kind=host,source={{ docker_daemon_graph }},readOnly=false \
--volume var-lib-kubelet,kind=host,source=/var/lib/kubelet,readOnly=false,recursive=true \ --volume var-lib-kubelet,kind=host,source=/var/lib/kubelet,readOnly=false,recursive=true \
--volume var-log,kind=host,source=/var/log \ --volume var-log,kind=host,source=/var/log \
{% if local_volumes_enabled == true %}
--volume local-volume-base-dir,kind=host,source={{ local_volume_base_dir }},readOnly=false,recursive=true \
{% endif %}
{% if kube_network_plugin in ["calico", "weave", "canal", "flannel"] %} {% if kube_network_plugin in ["calico", "weave", "canal", "flannel"] %}
--volume etc-cni,kind=host,source=/etc/cni,readOnly=true \ --volume etc-cni,kind=host,source=/etc/cni,readOnly=true \
--volume opt-cni,kind=host,source=/opt/cni,readOnly=true \ --volume opt-cni,kind=host,source=/opt/cni,readOnly=true \
--volume var-lib-cni,kind=host,source=/var/lib/cni,readOnly=false \ --volume var-lib-cni,kind=host,source=/var/lib/cni,readOnly=false \
--volume local-volume-base-dir,kind=host,source={{ local_volume_base_dir }},readOnly=false,recursive=true \
--mount volume=etc-cni,target=/etc/cni \ --mount volume=etc-cni,target=/etc/cni \
--mount volume=opt-cni,target=/opt/cni \ --mount volume=opt-cni,target=/opt/cni \
--mount volume=var-lib-cni,target=/var/lib/cni \ --mount volume=var-lib-cni,target=/var/lib/cni \
@ -50,7 +52,9 @@ ExecStart=/usr/bin/rkt run \
--mount volume=var-lib-kubelet,target=/var/lib/kubelet \ --mount volume=var-lib-kubelet,target=/var/lib/kubelet \
--mount volume=var-log,target=/var/log \ --mount volume=var-log,target=/var/log \
--mount volume=hosts,target=/etc/hosts \ --mount volume=hosts,target=/etc/hosts \
{% if local_volumes_enabled == true %}
--mount volume=local-volume-base-dir,target={{ local_volume_base_dir }} \ --mount volume=local-volume-base-dir,target={{ local_volume_base_dir }} \
{% endif %}
--stage1-from-dir=stage1-fly.aci \ --stage1-from-dir=stage1-fly.aci \
{% if kube_hyperkube_image_repo == "docker" %} {% if kube_hyperkube_image_repo == "docker" %}
--insecure-options=image \ --insecure-options=image \