From 797bfd85b0a43b399dba4211a50cb180f9b53fda Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20Kr=C3=BCger?= <ak@patientsky.com>
Date: Wed, 5 Jun 2019 10:27:53 +0200
Subject: [PATCH] Only create kubeadm compat cert dir link if it does not exist
 (#4840)

---
 .../preinstall/tasks/0050-create_directories.yml         | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/roles/kubernetes/preinstall/tasks/0050-create_directories.yml b/roles/kubernetes/preinstall/tasks/0050-create_directories.yml
index 1e28d1785..2e2c46184 100644
--- a/roles/kubernetes/preinstall/tasks/0050-create_directories.yml
+++ b/roles/kubernetes/preinstall/tasks/0050-create_directories.yml
@@ -23,6 +23,14 @@
     - "{{ kube_manifest_dir }}"
     - "{{ kube_script_dir }}"
 
+- name: Check if kubernetes kubeadm compat cert dir exists
+  stat:
+    path: "{{ kube_cert_compat_dir }}"
+  register: kube_cert_compat_dir_check
+  when:
+    - inventory_hostname in groups['k8s-cluster']
+    - kube_cert_dir != kube_cert_compat_dir
+
 - name: Create kubernetes kubeadm compat cert dir (kubernetes/kubeadm issue 1498)
   file:
     src: "{{ kube_cert_dir }}"
@@ -31,6 +39,7 @@
   when:
     - inventory_hostname in groups['k8s-cluster']
     - kube_cert_dir != kube_cert_compat_dir
+    - not kube_cert_compat_dir_check.stat.exists
 
 - name: Create cni directories
   file:
-- 
GitLab