Hotfixes to scripts after review

  Related-PROD: PROD-36128

Change-Id: If2d90533cd14d33081d62c48e9096627b0614ec9
diff --git a/k8s/_init_pod.sh b/k8s/_init_pod.sh
index 996880a..50c4da2 100644
--- a/k8s/_init_pod.sh
+++ b/k8s/_init_pod.sh
@@ -2,7 +2,7 @@
 cd /artifacts
 # Installing prerequisites
 apt -y update
-apt -y install python3-pip vim git iperf3 mtr htop iputils-ping traceroute tcpdump
+apt -y install python3-pip vim git iperf3 mtr htop iputils-ping traceroute tcpdump wget iproute2
 pip3 install rally-openstack python-neutronclient pyghmi
 
 # Prepare Rally
diff --git a/k8s/gen_kubespec.sh b/k8s/gen_kubespec.sh
index d4053aa..49b8082 100644
--- a/k8s/gen_kubespec.sh
+++ b/k8s/gen_kubespec.sh
@@ -24,10 +24,11 @@
 fi
 
 # extract data as variables
-declare $(sed -e 's/:[^:\/\/,:4]/=/g;s/ *=/=/g;s/-/_/g' $1 | grep 'certificate\|key\|server' | tr -d ' ')
+declare $(sed -e 's/:[^:\/\/,:443,:6443]/=/g;s/ *=/=/g;s/-/_/g' $1 | grep 'certificate\|key\|server' | tr -d ' ')
+echo "# Declared variable: server=$server"
 
 ### Uncomment if separate files needed
-printf "Creating 'ca.crt', 'client.crt' and 'client.key'\n"
+printf "# Creating 'ca.crt', 'client.crt' and 'client.key'\n"
 echo "# '${ca_crt}'"
 echo $certificate_authority_data | base64 -d >${ca_crt}
 echo "# '${client_crt}'"
diff --git a/k8s/k8s-mos-scn-i1.yaml b/k8s/k8s-mos-scn-i1.yaml
index eaf62dd..c14c94a 100644
--- a/k8s/k8s-mos-scn-i1.yaml
+++ b/k8s/k8s-mos-scn-i1.yaml
@@ -6,6 +6,7 @@
 {% set replicas = 1 %}
 {% set replicas_scaled = 2 %}
 {% set namespaces = 1 %}
+{% set serviceacc_delay = 60 %}
 
 
 ---
@@ -29,7 +30,7 @@
 - title: Run a single workload with create/read/delete job
   scenario:
     Kubernetes.create_and_delete_job:
-      image: {{image_cirros}}
+      image: {{image_box}}
       command:
       - echo
       - "SUCCESS"
@@ -41,10 +42,11 @@
     namespaces:
       count: {{namespaces}}
       with_serviceaccount: true
+      serviceaccount_delay: {{serviceacc_delay}}
 - title: Run a single workload with create/read/delete pod with configMap volume
   scenario:
     Kubernetes.create_and_delete_pod_with_configmap_volume:
-      image: {{image_pause}}
+      image: {{image_box}}
       mount_path: /var/log/check.txt
       subpath: check.txt
       configmap_data:
@@ -58,42 +60,11 @@
     namespaces:
       count: {{namespaces}}
       with_serviceaccount: true
-- title: Run a single workload with create/read/delete pod with local PVC
-  scenario:
-    Kubernetes.create_and_delete_pod_with_local_persistent_volume:
-      persistent_volume:
-        size: 1Gi
-        volume_mode: Block
-        local_path: /var/tmp
-        access_modes:
-        - ReadWriteOnce
-        node_affinity:
-          required:
-            nodeSelectorTerms:
-            - matchExpressions:
-              - key: kubernetes.io/os
-                operator: In
-                values:
-                - linux
-      persistent_volume_claim:
-        size: 250Mi
-        access_modes:
-        - ReadWriteOnce
-      image: {{image_box}}
-      mount_path: /opt/check
-  runner:
-    constant:
-      concurrency: {{concurrency}}
-      times: {{times}}
-  contexts:
-    namespaces:
-      count: {{namespaces}}
-      with_serviceaccount: true
-    local_storageclass: {}
+      serviceaccount_delay: {{serviceacc_delay}}
 - title: Run a single workload with create/delete NodePort service
   scenario:
     Kubernetes.create_and_delete_pod_with_node_port_service:
-      image: {{image_pause}}
+      image: {{image_box}}
       port: 80
       protocol: TCP
   runner:
@@ -104,12 +75,13 @@
     namespaces:
       count: {{namespaces}}
       with_serviceaccount: true
+      serviceaccount_delay: {{serviceacc_delay}}
     kubernetes.cfg:
       prepoll_delay: 1
 - title: Run a single workload with create/read/delete pod
   scenario:
     Kubernetes.create_and_delete_pod:
-      image: {{image_pause}}
+      image: {{image_box}}
   runner:
     constant:
       concurrency: {{concurrency}}
@@ -118,3 +90,5 @@
     namespaces:
       count: {{namespaces}}
       with_serviceaccount: true
+      serviceaccount_delay: {{serviceacc_delay}}
+
diff --git a/k8s/k8s-mos-scn-i100.yaml b/k8s/k8s-mos-scn-i100c5.yaml
similarity index 67%
rename from k8s/k8s-mos-scn-i100.yaml
rename to k8s/k8s-mos-scn-i100c5.yaml
index da9448a..da897ef 100644
--- a/k8s/k8s-mos-scn-i100.yaml
+++ b/k8s/k8s-mos-scn-i100c5.yaml
@@ -3,9 +3,10 @@
 {% set image_cirros = "virtlet/download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img" %}
 {% set concurrency = 5 %}
 {% set times = 100 %}
-{% set replicas = 3 %}
-{% set replicas_scaled = 4 %}
-{% set namespaces = 10 %}
+{% set replicas = 1 %}
+{% set replicas_scaled = 2 %}
+{% set namespaces = 2 %}
+{% set serviceacc_delay = 60 %}
 
 
 ---
@@ -29,7 +30,7 @@
 - title: Run a single workload with create/read/delete job
   scenario:
     Kubernetes.create_and_delete_job:
-      image: {{image_cirros}}
+      image: {{image_box}}
       command:
       - echo
       - "SUCCESS"
@@ -41,10 +42,11 @@
     namespaces:
       count: {{namespaces}}
       with_serviceaccount: true
+      serviceaccount_delay: {{serviceacc_delay}}
 - title: Run a single workload with create/read/delete pod with configMap volume
   scenario:
     Kubernetes.create_and_delete_pod_with_configmap_volume:
-      image: {{image_pause}}
+      image: {{image_box}}
       mount_path: /var/log/check.txt
       subpath: check.txt
       configmap_data:
@@ -58,42 +60,11 @@
     namespaces:
       count: {{namespaces}}
       with_serviceaccount: true
-- title: Run a single workload with create/read/delete pod with local PVC
-  scenario:
-    Kubernetes.create_and_delete_pod_with_local_persistent_volume:
-      persistent_volume:
-        size: 1Gi
-        volume_mode: Block
-        local_path: /var/tmp
-        access_modes:
-        - ReadWriteOnce
-        node_affinity:
-          required:
-            nodeSelectorTerms:
-            - matchExpressions:
-              - key: kubernetes.io/os
-                operator: In
-                values:
-                - linux
-      persistent_volume_claim:
-        size: 250Mi
-        access_modes:
-        - ReadWriteOnce
-      image: {{image_box}}
-      mount_path: /opt/check
-  runner:
-    constant:
-      concurrency: {{concurrency}}
-      times: {{times}}
-  contexts:
-    namespaces:
-      count: {{namespaces}}
-      with_serviceaccount: true
-    local_storageclass: {}
+      serviceaccount_delay: {{serviceacc_delay}}
 - title: Run a single workload with create/delete NodePort service
   scenario:
     Kubernetes.create_and_delete_pod_with_node_port_service:
-      image: {{image_pause}}
+      image: {{image_box}}
       port: 80
       protocol: TCP
   runner:
@@ -104,12 +75,13 @@
     namespaces:
       count: {{namespaces}}
       with_serviceaccount: true
+      serviceaccount_delay: {{serviceacc_delay}}
     kubernetes.cfg:
       prepoll_delay: 1
 - title: Run a single workload with create/read/delete pod
   scenario:
     Kubernetes.create_and_delete_pod:
-      image: {{image_pause}}
+      image: {{image_box}}
   runner:
     constant:
       concurrency: {{concurrency}}
@@ -118,3 +90,5 @@
     namespaces:
       count: {{namespaces}}
       with_serviceaccount: true
+      serviceaccount_delay: {{serviceacc_delay}}
+
diff --git a/k8s/tempest_logs.sh b/k8s/tempest_logs.sh
new file mode 100644
index 0000000..21bb0b2
--- /dev/null
+++ b/k8s/tempest_logs.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+function get_name() {
+  while [[ $pod_name = "none" ]]; do
+    name=$(kubectl get pods -n openstack --no-headers -o custom-columns=":metadata.name" | grep openstack-tempest-run-tests || echo none)
+    if [[ ${name} != "none" ]]; then
+      echo $name
+      break
+    else
+      echo "# Pod not found, waiting"
+      sleep 5
+    fi
+  done
+}
+
+pod_name="none"
+pod_name=$(get_name)
+watch -n 1 "kubectl logs ${pod_name} -c tempest-run-tests -n openstack | tail -40"