Mount cloud-config files for cloudproviders in kube-apiserver & kube-controllermanager.

This commit is contained in:
CJ Cullen 2015-05-18 10:34:50 -07:00
parent 644e74f5a9
commit 82afaaf31d
2 changed files with 14 additions and 10 deletions

View File

@ -5,21 +5,17 @@
{% set cloud_provider = "" -%} {% set cloud_provider = "" -%}
{% set cloud_config = "" -%} {% set cloud_config = "" -%}
{% set cloud_config_mount = "" -%}
{% set cloud_config_volume = "" -%}
{% if grains.cloud is defined -%} {% if grains.cloud is defined -%}
{% set cloud_provider = "--cloud_provider=" + grains.cloud -%} {% set cloud_provider = "--cloud_provider=" + grains.cloud -%}
{% if grains.cloud == 'gce' -%} {% if grains.cloud in [ 'aws', 'gce' ] and grains.cloud_config is defined -%}
{% if grains.cloud_config is defined -%}
{% set cloud_config = "--cloud_config=" + grains.cloud_config -%} {% set cloud_config = "--cloud_config=" + grains.cloud_config -%}
{% set cloud_config_mount = "{\"name\": \"cloudconfigmount\",\"mountPath\": \"" + grains.cloud_config + "\", \"readOnly\": true}," -%}
{% set cloud_config_volume = "{\"name\": \"cloudconfigmount\",\"hostPath\": {\"path\": \"" + grains.cloud_config + "\"}}," -%}
{% endif -%} {% endif -%}
{% elif grains.cloud == 'aws' -%}
{% if grains.cloud_config is defined -%}
{% set cloud_config = "--cloud_config=" + grains.cloud_config -%}
{% endif -%}
{% endif -%}
{% endif -%} {% endif -%}
{% set advertise_address = "" -%} {% set advertise_address = "" -%}
@ -111,6 +107,7 @@
"hostPort": 8080} "hostPort": 8080}
], ],
"volumeMounts": [ "volumeMounts": [
{{cloud_config_mount}}
{ "name": "srvkube", { "name": "srvkube",
"mountPath": "/srv/kubernetes", "mountPath": "/srv/kubernetes",
"readOnly": true}, "readOnly": true},
@ -145,6 +142,7 @@
} }
], ],
"volumes":[ "volumes":[
{{cloud_config_volume}}
{ "name": "srvkube", { "name": "srvkube",
"hostPath": { "hostPath": {
"path": "/srv/kubernetes"} "path": "/srv/kubernetes"}

View File

@ -14,6 +14,8 @@
{% set cloud_provider = "" -%} {% set cloud_provider = "" -%}
{% set cloud_config = "" -%} {% set cloud_config = "" -%}
{% set cloud_config_mount = "" -%}
{% set cloud_config_volume = "" -%}
{% if grains.cloud is defined -%} {% if grains.cloud is defined -%}
{% set cloud_provider = "--cloud_provider=" + grains.cloud -%} {% set cloud_provider = "--cloud_provider=" + grains.cloud -%}
@ -21,6 +23,8 @@
{% if grains.cloud in [ 'aws', 'gce' ] and grains.cloud_config is defined -%} {% if grains.cloud in [ 'aws', 'gce' ] and grains.cloud_config is defined -%}
{% set cloud_config = "--cloud_config=" + grains.cloud_config -%} {% set cloud_config = "--cloud_config=" + grains.cloud_config -%}
{% set cloud_config_mount = "{\"name\": \"cloudconfigmount\",\"mountPath\": \"" + grains.cloud_config + "\", \"readOnly\": true}," -%}
{% set cloud_config_volume = "{\"name\": \"cloudconfigmount\",\"hostPath\": {\"path\": \"" + grains.cloud_config + "\"}}," -%}
{% endif -%} {% endif -%}
{% endif -%} {% endif -%}
@ -42,6 +46,7 @@
"/usr/local/bin/kube-controller-manager {{params}} 1>>/var/log/kube-controller-manager.log 2>&1" "/usr/local/bin/kube-controller-manager {{params}} 1>>/var/log/kube-controller-manager.log 2>&1"
], ],
"volumeMounts": [ "volumeMounts": [
{{cloud_config_mount}}
{ "name": "srvkube", { "name": "srvkube",
"mountPath": "/srv/kubernetes", "mountPath": "/srv/kubernetes",
"readOnly": true}, "readOnly": true},
@ -76,6 +81,7 @@
} }
], ],
"volumes":[ "volumes":[
{{cloud_config_volume}}
{ "name": "srvkube", { "name": "srvkube",
"hostPath": { "hostPath": {
"path": "/srv/kubernetes"} "path": "/srv/kubernetes"}