Offline procedure preparations, p2
Related-PROD: PROD-36856
Change-Id: I9228941dfbc84451abf803ab3a4b3e9e5579b70f
diff --git a/k8s/workspace/create-rally-deployments.sh b/k8s/workspace/create-rally-deployments.sh
new file mode 100644
index 0000000..942c81f
--- /dev/null
+++ b/k8s/workspace/create-rally-deployments.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+##
+echo "### Checking rally environments"
+status=$(kubectl -n qa-space get pod | grep rally | tr -s " " | cut -d' ' -f3)
+if [ ${status} != "Running" ]; then
+ echo "# 'rally' container is not Running"
+ exit 1
+fi
+
+###
+if [ ! -z $(kubectl exec -n qa-space --stdin rally -- rally env list | grep openstack | cut -d' ' -f2) ]; then
+ echo "# Openstack env already created"
+ kubectl exec -n qa-space --stdin rally -- rally env list
+else
+ echo "# Creating openstack env"
+ kubectl exec -n qa-space --stdin rally -- bash -c "bash /rally/rally-files/init-rally-openstack.sh"
+fi
+echo " "
+###
+if [ ! -z $(kubectl exec -n qa-space --stdin rally -- rally env list | grep kubernetes | cut -d' ' -f2) ]; then
+ echo "# Kubernetes env already created"
+ kubectl exec -n qa-space --stdin rally -- rally env list
+else
+ echo "# Creating kubernetes env"
+ kubectl exec -n qa-space --stdin rally -- sudo chown rally /artifacts
+ kubectl cp $MY_PROJFOLDER/envs/mos-kubeconfig.yaml qa-space/rally:/artifacts/mos-kubeconfig.yaml
+ kubectl exec -n qa-space --stdin rally -- bash -c "bash /rally/rally-files/init-rally-kube.sh"
+fi