summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2021-02-09 12:59:23 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2021-02-09 12:59:23 +0100
commit6578753dffe0f2c0828df345ec371945cdc03cb0 (patch)
tree708b7429cdd22bbc7da570d25284967d98b501c2
parent3e8ac4b4ca407f5185dfa4becc22f56dc750afe7 (diff)
Ensure k8s namespace for ONAP exists
Helm v3 does not automatically create namespace when either of "install" or "upgrade" subcommand is called even with "--namespace" option. Change-Id: I8595d8d9cdcb904b6c032695bae4d945fd07176c Issue-ID: OOM-2665 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
-rw-r--r--ansible/roles/application/tasks/install.yml6
1 files changed, 6 insertions, 0 deletions
diff --git a/ansible/roles/application/tasks/install.yml b/ansible/roles/application/tasks/install.yml
index fdb74af6..883e2aa6 100644
--- a/ansible/roles/application/tasks/install.yml
+++ b/ansible/roles/application/tasks/install.yml
@@ -36,6 +36,12 @@
debug:
var: helm_override_files
+- name: "Ensure kubernetes namespace for {{ app_name }} exists"
+ command: kubectl create namespace {{ app_kubernetes_namespace }}
+ register: kubectl_out
+ changed_when: kubectl_out.rc == 0
+ failed_when: kubectl_out.rc == 1 and "AlreadyExists" not in kubectl_out.stderr
+
- name: "Helm Install application {{ app_name }}"
command: >
{{ helm_bin_dir }}/helm