Added MOS 24.2: different bug fixes

List of changes:
- use fresh heat image as a base for toolset image
- added cacert secret for public endpoints at rally and toolset
- rally creates env with public endpoints
- fixed rally openstack dry-run scenario typo
- added setting ext gw info for heat-router in prepare.sh
- added label to set image tag in dockerfile

Related-PROD: PROD-37187

Change-Id: I83c91c8ab20f39087f7db7b32f67dd7b2130d5e7
diff --git a/k8s/docker-mos-toolset-full b/k8s/docker-mos-toolset-full
index f279d8f..4204699 100644
--- a/k8s/docker-mos-toolset-full
+++ b/k8s/docker-mos-toolset-full
@@ -4,7 +4,7 @@
     apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances iperf3 iperf fio | grep "^\w" | sort -u) || true && \
     rm -rf /var/lib/apt/lists/*
 
-FROM mirantis.azurecr.io/openstack/heat:antelope-jammy-20231204144213
+FROM mirantis.azurecr.io/openstack/heat:antelope-jammy-20240717071031
 
 LABEL maintainer="qa-ps@mirantis.com"
 
@@ -35,7 +35,7 @@
 
 RUN pip3 install --no-cache-dir pyghmi tempestparser
 
-RUN git clone https://gerrit.mcp.mirantis.com/mcp/cvp-configuration -b 23.3-antelope /opt/res-files && \
+RUN git clone https://gerrit.mcp.mirantis.com/mcp/cvp-configuration -b 24.2-antelope /opt/res-files && \
     cd /opt/cfg-checker && \
     python3 -m venv .checkervenv && \
     . .checkervenv/bin/activate && \
@@ -76,5 +76,7 @@
     cp /opt/res-files/scripts/prepare-refapp.sh /opt/density/openstack-refapp/ && \
     cp /opt/res-files/scripts/run-refapp-density.sh /opt/density/openstack-refapp/
 
+RUN printf "LABELS:\n  IMAGE_TAG: 24.2-antelope" > /dockerimage_metadata
+
 ENTRYPOINT ["sleep infinite"]
 
diff --git a/k8s/rally-files/init-rally-openstack.sh b/k8s/rally-files/init-rally-openstack.sh
index 7f640a5..e1f5c77 100644
--- a/k8s/rally-files/init-rally-openstack.sh
+++ b/k8s/rally-files/init-rally-openstack.sh
@@ -1,6 +1,10 @@
 #!/bin/bash
 cd /artifacts
 
+# create an openstack env from the public endpoints since Heat API is available only via public ep
+export OS_ENDPOINT_TYPE=public
+export OS_INTERFACE=public
+
 # Create openstack env
 rally env create --from-sysenv --name openstack
 rally env check
diff --git a/k8s/rally-files/openstack-mos-scn-i1.json b/k8s/rally-files/openstack-mos-scn-i1.json
index 05f6847..ef64ec9 100644
--- a/k8s/rally-files/openstack-mos-scn-i1.json
+++ b/k8s/rally-files/openstack-mos-scn-i1.json
@@ -8,7 +8,7 @@
 {% set tenants = 1 %}
 {% set rbd_image = "https://download.cirros-cloud.net/0.6.2/cirros-0.6.2-x86_64-disk.img" %}
 {% set heat_template = "/rally/rally-files/default.yaml.template" %}
-{% set fixed_net = "id" %}
+{% set fixed_net = "fixed-net-id" %}
 
 {
   "KeystoneBasic.authenticate_user_and_validate_token": [
diff --git a/k8s/workspace/init-resources.sh b/k8s/workspace/init-resources.sh
index 95e1880..5a87470 100644
--- a/k8s/workspace/init-resources.sh
+++ b/k8s/workspace/init-resources.sh
@@ -20,6 +20,10 @@
     echo "# Copy keystone vars"
     kubectl get secret keystone-keystone-admin -n openstack -o yaml | sed 's/namespace: openstack/namespace: qa-space/g' | kubectl apply -n qa-space -f -
 fi
+if [ -z $(kubectl -n qa-space get secret keystone-ca-bundle --no-headers | cut -d' ' -f1) ]; then
+    echo "# Copy keystone vars"
+    kubectl get secret keystone-ca-bundle -n openstack -o yaml | sed 's/namespace: openstack/namespace: qa-space/g' | kubectl apply -n qa-space -f -
+fi
 # start toolset
 echo "# Starting toolset pod"
 kubectl apply -f ${MY_PROJFOLDER}/yamls/qa-toolset.yaml
diff --git a/k8s/yamls/qa-rally.yaml b/k8s/yamls/qa-rally.yaml
index c889c95..86ec4e4 100644
--- a/k8s/yamls/qa-rally.yaml
+++ b/k8s/yamls/qa-rally.yaml
@@ -63,12 +63,18 @@
         secretKeyRef:
           key: OS_DEFAULT_DOMAIN
           name: keystone-keystone-admin
+    - name: OS_CACERT
+      value: /etc/ssl/certs/openstack-ca-bundle.pem
     imagePullPolicy: IfNotPresent
     name: rally
     image: registry.mirantis.com/professional-services-qa/xrally-kube:latest
     volumeMounts:
     - mountPath: /artifacts
       name: qa-pv-r
+    - mountPath: /etc/ssl/certs/openstack-ca-bundle.pem
+      name: ca-cert-bundle
+      readOnly: true
+      subPath: ca_bundle
   dnsPolicy: ClusterFirst
   volumes:
   - emptyDir: {}
@@ -76,3 +82,7 @@
   - name: qa-pv-r
     persistentVolumeClaim:
       claimName: qa-pvc-r
+  - name: ca-cert-bundle
+    secret:
+      defaultMode: 420
+      secretName: keystone-ca-bundle
diff --git a/k8s/yamls/qa-toolset-bare.yaml b/k8s/yamls/qa-toolset-bare.yaml
index 4146d93..679882f 100644
--- a/k8s/yamls/qa-toolset-bare.yaml
+++ b/k8s/yamls/qa-toolset-bare.yaml
@@ -10,10 +10,7 @@
     - infinity
     imagePullPolicy: IfNotPresent
     name: toolset
-    #image: savex13/toolset:latest
-    #image: registry.mirantis.com/osavatieiev/toolset:latest
-    #image: registry.mirantis.com/professional-services-qa/toolset:latest
-    image: registry.mirantis.com/professional-services-qa/toolset:23.3-antelope
+    image: registry.mirantis.com/professional-services-qa/toolset:24.2-antelope
   dnsPolicy: ClusterFirst
   volumes:
   - emptyDir: {}
diff --git a/k8s/yamls/qa-toolset.yaml b/k8s/yamls/qa-toolset.yaml
index 831dcac..3c4b421 100644
--- a/k8s/yamls/qa-toolset.yaml
+++ b/k8s/yamls/qa-toolset.yaml
@@ -63,15 +63,18 @@
         secretKeyRef:
           key: OS_DEFAULT_DOMAIN
           name: keystone-keystone-admin
+    - name: OS_CACERT
+      value: /etc/ssl/certs/openstack-ca-bundle.pem
     imagePullPolicy: IfNotPresent
     name: toolset
-    #image: 127.0.0.1:44301/general/external/docker.io/library/ubuntu:bionic-20201119
-    #image: savex13/toolset:latest
-    #image: registry.mirantis.com/professional-services-qa/toolset:latest
-    image: registry.mirantis.com/professional-services-qa/toolset:23.3-antelope
+    image: registry.mirantis.com/professional-services-qa/toolset:24.2-antelope
     volumeMounts:
     - mountPath: /artifacts
       name: qa-pv-a
+    - mountPath: /etc/ssl/certs/openstack-ca-bundle.pem
+      name: ca-cert-bundle
+      readOnly: true
+      subPath: ca_bundle
   dnsPolicy: ClusterFirst
   volumes:
   - emptyDir: {}
@@ -79,3 +82,7 @@
   - name: qa-pv-a
     persistentVolumeClaim:
       claimName: qa-pvc-a
+  - name: ca-cert-bundle
+    secret:
+      defaultMode: 420
+      secretName: keystone-ca-bundle
\ No newline at end of file
diff --git a/scripts/prepare.sh b/scripts/prepare.sh
index b190f5b..cdf6b12 100644
--- a/scripts/prepare.sh
+++ b/scripts/prepare.sh
@@ -302,6 +302,7 @@
       echo "# Checking that the external network ${CUSTOM_PUBLIC_NET_NAME} is present on the cloud"
       network_exists=$(openstack network show "$CUSTOM_PUBLIC_NET_NAME" -c id -f value 2>/dev/null)
       if [ -n "$network_exists" ]; then
+        TEST_PUBLIC_NET=${CUSTOM_PUBLIC_NET_NAME}
         echo router set ${router} --external-gateway ${CUSTOM_PUBLIC_NET_NAME} >>${cmds}
         process_cmds
       else
@@ -313,9 +314,26 @@
       echo "# Selecting a random external network as an external gateway for the router"
       # if the custom network is not set or is empty, select the first external network
       external=$(openstack network list --external -c Name -f value | head -n1)
+      TEST_PUBLIC_NET=${external}
       echo router set ${router} --external-gateway ${external} >>${cmds}
       process_cmds
     fi
+
+    # set external gateway info for the Heat router if it is not set (required for Heat Tempest tests)
+    external_gateway_info=$(openstack router show heat-router -f json -c external_gateway_info | jq -r '.external_gateway_info')
+    if [[ "$external_gateway_info" == "null" ]]; then
+      echo "# Setting external gw info for heat-router using ${TEST_PUBLIC_NET}"
+      openstack router set --external-gateway ${TEST_PUBLIC_NET} heat-router
+      if [[ $? -eq 0 ]]; then
+        echo "# External gateway set successfully for heat-router"
+        openstack router show heat-router -c external_gateway_info
+      else
+        echo "# Failed to set external gateway for heat-router"
+      fi
+    else
+      echo "# Router heat-router already has an external gateway"
+      openstack router show heat-router -c external_gateway_info
+    fi
 }
 
 function _get_image() {