Adjust logic to delete k8s namespace
Related-prod: #PROD-27350 (PROD:27350)
Related-prod: #PROD-27534 (PROD:27534)
Change-Id: I8b1a53e682363100dbe90db52fb446c8bfeef76d
diff --git a/kubernetes/master/controller.sls b/kubernetes/master/controller.sls
index ce31e34..90de94d 100644
--- a/kubernetes/master/controller.sls
+++ b/kubernetes/master/controller.sls
@@ -353,7 +353,12 @@
kubernetes_namespace_delete_{{ name }}:
cmd.run:
- - name: kubectl get ns -o=custom-columns=NAME:.metadata.name | grep -v NAME | grep "{{ name }}" > /dev/null && kubectl delete ns "{{ name }} || true"
+ - name: kubectl delete ns "{{ name }}"
+ - onlyif:
+ - kubectl get ns -o=custom-columns=NAME:.metadata.name | grep -v NAME | grep "{{ name }}" > /dev/null
+ {%- if grains.get('noservices') %}
+ - /bin/false
+ {%- endif %}
{%- endif %}