diff --git a/roles/kubernetes/master/defaults/main.yml b/roles/kubernetes/master/defaults/main.yml index 8bd1a13cf..2d8af345c 100644 --- a/roles/kubernetes/master/defaults/main.yml +++ b/roles/kubernetes/master/defaults/main.yml @@ -129,6 +129,17 @@ kube_kubeadm_apiserver_extra_args: {} kube_kubeadm_controller_extra_args: {} kube_kubeadm_scheduler_extra_args: {} +## Extra control plane host volume mounts +## Example: +#apiserver_extra_volumes: +# - name: name +# hostPath: /host/path +# mountPath: /mount/path +# writable: false +apiserver_extra_volumes: {} +controller_manager_extra_volumes: {} +scheduler_extra_volumes: {} + ## Encrypting Secret Data at Rest kube_encrypt_secret_data: false kube_encrypt_token: "{{ lookup('password', credentials_dir + '/kube_encrypt_token.creds length=32 chars=ascii_letters,digits') }}" diff --git a/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 index b9430c5a7..adedb850d 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 @@ -147,7 +147,7 @@ schedulerExtraArgs: {{ key }}: "{{ kube_kubeadm_scheduler_extra_args[key] }}" {% endfor %} {% endif %} -{% if kubernetes_audit or kube_basic_auth|default(true) or kube_token_auth|default(true) or ( cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] ) %} +{% if kubernetes_audit or kube_basic_auth|default(true) or kube_token_auth|default(true) or ( cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] ) or apiserver_extra_volumes %} apiServerExtraVolumes: {% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws", "external"] %} - name: cloud-config @@ -175,8 +175,14 @@ apiServerExtraVolumes: writable: true {% endif %} {% endif %} +{% for volume in apiserver_extra_volumes %} +- name: {{ volume.name }} + hostPath: {{ volume.hostPath }} + mountPath: {{ volume.mountPath }} + writable: {{ volume.writable | default(false)}} +{% endfor %} {% endif %} -{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws", "external"] %} +{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws", "external"] or controller_manager_extra_volumes %} controllerManagerExtraVolumes: {% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined %} - name: openstackcacert @@ -188,6 +194,21 @@ controllerManagerExtraVolumes: hostPath: {{ kube_config_dir }}/cloud_config mountPath: {{ kube_config_dir }}/cloud_config {% endif %} +{% for volume in controller_manager_extra_volumes %} +- name: {{ volume.name }} + hostPath: {{ volume.hostPath }} + mountPath: {{ volume.mountPath }} + writable: {{ volume.writable | default(false)}} +{% endfor %} +{% endif %} +{% if scheduler_extra_volumes %} +schedulerExtraVolumes: +{% for volume in scheduler_extra_volumes %} +- name: {{ volume.name }} + hostPath: {{ volume.hostPath }} + mountPath: {{ volume.mountPath }} + writable: {{ volume.writable | default(false)}} +{% endfor %} {% endif %} --- apiVersion: kubeproxy.config.k8s.io/v1alpha1