From 4f6990f80dc4d870b741169c6c1b8f4a412b89fb Mon Sep 17 00:00:00 2001 From: JarredOlson Date: Wed, 11 Jul 2018 14:57:40 -0400 Subject: [PATCH] SMRT-216 Conditionally setting up tiller to handle it already being setup co-authored-by: Brandon Cromer --- Jenkinsfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 079cadc2..12d4cd03 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,8 +55,16 @@ node('master') { stage('Deploy Tiller') { dir('env') { - sh("kubectl --namespace kube-system create serviceaccount tiller") - sh("kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller") + sh(""" + if [ $(kubectl get serviceaccount --namespace kube-system | grep -wc tiller) -eq 0 ]; then + kubectl --namespace kube-system create serviceaccount tiller + fi + """) + sh(""" + if [ $(kubectl get clusterrolebinding --namespace kube-system | grep -wc tiller) -eq 0 ]; then + kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller + fi + """) } } }