From a330b281e827d7acbe7d55f359e1a96a3f2b04ec Mon Sep 17 00:00:00 2001 From: Jan Wozniak Date: Mon, 10 Sep 2018 17:43:35 +0200 Subject: [PATCH] Check `openstack_cacert` for empty string --- .../master/templates/kubeadm-config.v1alpha1.yaml.j2 | 2 +- .../master/templates/kubeadm-config.v1alpha2.yaml.j2 | 2 +- .../templates/manifests/kube-controller-manager.manifest.j2 | 4 ++-- roles/kubernetes/node/tasks/main.yml | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 index d2a0d2db2..ffcd63630 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 @@ -118,7 +118,7 @@ controllerManagerExtraArgs: {% for key in kube_kubeadm_controller_extra_args %} {{ key }}: "{{ kube_kubeadm_controller_extra_args[key] }}" {% endfor %} -{% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined %} +{% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined and openstack_cacert != "" %} controllerManagerExtraVolumes: - name: openstackcacert hostPath: "{{ kube_config_dir }}/openstack-cacert.pem" diff --git a/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 index f7d7e9bc2..b1e3db96a 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 @@ -117,7 +117,7 @@ controllerManagerExtraArgs: {% for key in kube_kubeadm_controller_extra_args %} {{ key }}: "{{ kube_kubeadm_controller_extra_args[key] }}" {% endfor %} -{% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined %} +{% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined and openstack_cacert != "" %} controllerManagerExtraVolumes: - name: openstackcacert hostPath: "{{ kube_config_dir }}/openstack-cacert.pem" diff --git a/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 b/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 index 848a65a59..ac7dbd2ec 100644 --- a/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 +++ b/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 @@ -97,7 +97,7 @@ spec: name: cloudconfig readOnly: true {% endif %} -{% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined %} +{% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined and openstack_cacert != "" %} - mountPath: "{{ kube_config_dir }}/openstack-cacert.pem" name: openstackcacert readOnly: true @@ -122,7 +122,7 @@ spec: path: "{{ kube_config_dir }}/cloud_config" name: cloudconfig {% endif %} -{% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined %} +{% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined and openstack_cacert != "" %} - hostPath: path: "{{ kube_config_dir }}/openstack-cacert.pem" name: openstackcacert diff --git a/roles/kubernetes/node/tasks/main.yml b/roles/kubernetes/node/tasks/main.yml index 03d08bb1a..db9cbd309 100644 --- a/roles/kubernetes/node/tasks/main.yml +++ b/roles/kubernetes/node/tasks/main.yml @@ -177,6 +177,7 @@ - cloud_provider is defined - cloud_provider == 'openstack' - openstack_cacert is defined + - openstack_cacert != "" tags: - cloud-provider