From 9ce7fc9b2c5f75e1d42b89f8422434d44e14a2e2 Mon Sep 17 00:00:00 2001 From: petruha <5363545+p37ruh4@users.noreply.github.com> Date: Sun, 10 May 2020 20:38:02 +0200 Subject: [PATCH] Create namespace when dashboard deployment uses customized namespace. (#6107) * Create namespace when dashboard deployment uses customized namespace. * Fix syntax. --- .../ansible/templates/dashboard.yml.j2 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/roles/kubernetes-apps/ansible/templates/dashboard.yml.j2 b/roles/kubernetes-apps/ansible/templates/dashboard.yml.j2 index e7eb010e9..dae836262 100644 --- a/roles/kubernetes-apps/ansible/templates/dashboard.yml.j2 +++ b/roles/kubernetes-apps/ansible/templates/dashboard.yml.j2 @@ -17,9 +17,18 @@ # # Example usage: kubectl create -f +{% if dashboard_namespace != "kube-system" %} +--- +apiVersion: v1 +kind: Namespace +metadata: + name: {{ dashboard_namespace }} + labels: + name: {{ dashboard_namespace }} +{% endif %} + --- # ------------------- Dashboard Secrets ------------------- # - apiVersion: v1 kind: Secret metadata: