Updated templates to use default labels and qemu image fix

1) Kubernetes sets a default label for the nodes when the cluster is
created for the architecture. The previous label was using 'arch' which
I was adding to the nodes manually. Made this change so that won't be
needed anymore. To satisfy this the launch script will now update the
ARCH variable to 'amd64' if it was 'x86_64' since that is how the
kubernetes defines amd64 in the label. If ARCH variable is 'ppc64le' no
changes occur. All templates have also been updated to apply this.

2) A small change was done to how the image is passed for the qemu
instances to the template. Since image name that gets passed already
has openbmc without this update the name comes out as
"master.cfc:8500/openbmc/openbmc/qemu-instance" this will fail in the
registry so updated it to get rid of one of the "/openbmc" sections in
the name.

Change-Id: I7d1cba67c4b1dd4e380a81d98731ca2273ee5eec
Signed-off-by: Alanny Lopez <alanny.lopez@ibm.com>
diff --git a/kubernetes/Templates/OpenBMC-build-job.yaml b/kubernetes/Templates/OpenBMC-build-job.yaml
index 30a7a51..87a6b0b 100644
--- a/kubernetes/Templates/OpenBMC-build-job.yaml
+++ b/kubernetes/Templates/OpenBMC-build-job.yaml
@@ -14,8 +14,7 @@
         target: ${target}
     spec:
       nodeSelector:
-        worker: \"true\"
-        arch: ${ARCH}
+        beta.kubernetes.io/arch: ${ARCH}
       volumes:
       - name: home
         persistentVolumeClaim:
@@ -23,9 +22,6 @@
       - name: sscdir
         persistentVolumeClaim:
           claimName: ${sclaim}
-      - name: obmccache
-        persistentVolumeClaim:
-          claimName: ${oclaim}
       restartPolicy: Never
       hostNetwork: True
       containers:
@@ -47,7 +43,5 @@
           mountPath: ${HOME}
         - name: sscdir
           mountPath: ${sscdir}
-        - name: obmccache
-          mountPath: ${obmcext}
       imagePullSecrets:
-      - name: ${imgplsec}
+      - name: ${imgplsec}
\ No newline at end of file
diff --git a/kubernetes/Templates/OpenBMC-build-pod.yaml b/kubernetes/Templates/OpenBMC-build-pod.yaml
index 135547c..9df4488 100644
--- a/kubernetes/Templates/OpenBMC-build-pod.yaml
+++ b/kubernetes/Templates/OpenBMC-build-pod.yaml
@@ -5,8 +5,7 @@
   namespace: ${namespace}
 spec:
   nodeSelector:
-    worker: \"true\"
-    arch: ${ARCH}
+    beta.kubernetes.io/arch: ${ARCH}
   volumes:
   - name: home
     persistentVolumeClaim:
@@ -14,9 +13,6 @@
   - name: sscdir
     persistentVolumeClaim:
       claimName: ${sclaim}
-  - name: obmccache
-    persistentVolumeClaim:
-      claimName: ${oclaim}
   hostNetwork: True
   containers:
   - image: ${imgname}
@@ -37,7 +33,6 @@
       mountPath: ${HOME}
     - name: sscdir
       mountPath: ${sscdir}
-    - name: obmccache
-      mountPath: ${obmcext}
+  restartPolicy: Never
   imagePullSecrets:
   - name: ${imgplsec}
diff --git a/kubernetes/Templates/QEMU-build-job.yaml b/kubernetes/Templates/QEMU-build-job.yaml
index d5da300..0b9ba46 100644
--- a/kubernetes/Templates/QEMU-build-job.yaml
+++ b/kubernetes/Templates/QEMU-build-job.yaml
@@ -12,8 +12,7 @@
       name: ${podname}
     spec:
       nodeSelector:
-        worker: \"true\"
-        arch: ${ARCH}
+        beta.kubernetes.io/arch: ${ARCH}
       volumes:
       - name: home
         persistentVolumeClaim:
diff --git a/kubernetes/Templates/QEMU-build-pod.yaml b/kubernetes/Templates/QEMU-build-pod.yaml
index 70ad756..58491ec 100644
--- a/kubernetes/Templates/QEMU-build-pod.yaml
+++ b/kubernetes/Templates/QEMU-build-pod.yaml
@@ -5,8 +5,7 @@
   namespace: ${namespace}
 spec:
   nodeSelector:
-    worker: \"true\"
-    arch: ${ARCH}
+    beta.kubernetes.io/arch: ${ARCH}
   volumes:
   - name: home
     persistentVolumeClaim:
@@ -14,6 +13,7 @@
   - name: qemudir
     persistentVolumeClaim:
       claimName: ${qclaim}
+  restartPolicy: Never
   hostNetwork: True
   containers:
   - image: ${imgname}
diff --git a/kubernetes/Templates/QEMU-launch-deployment.yaml b/kubernetes/Templates/QEMU-launch-deployment.yaml
index 6016ddf..490beb0 100644
--- a/kubernetes/Templates/QEMU-launch-deployment.yaml
+++ b/kubernetes/Templates/QEMU-launch-deployment.yaml
@@ -18,7 +18,7 @@
         persistentVolumeClaim:
           claimName: ${hclaim}
       nodeSelector:
-        arch: ${ARCH}
+        beta.kubernetes.io/arch: ${ARCH}
       securityContext:
         runAsUser: 0
       containers:
diff --git a/kubernetes/kubernetes-launch.sh b/kubernetes/kubernetes-launch.sh
index 233f83f..f90f4be 100755
--- a/kubernetes/kubernetes-launch.sh
+++ b/kubernetes/kubernetes-launch.sh
@@ -60,7 +60,7 @@
 # Other variables in the template not declared here are expected to be declared by invoker.
 case ${invoker} in
   OpenBMC-build)
-    hclaim=${hclaim:-jenkins}
+    hclaim=${hclaim:-jenkins-slave-space}
     sclaim=${sclaim:-shared-state-cache}
     oclaim=${oclaim:-openbmc-reference-repo}
     newimgname=${newimgname:-${imgrepo}${distro}:${imgtag}-${ARCH}}
@@ -68,7 +68,7 @@
     ;;
   QEMU-build)
     podname=${podname:-qemubuild${BUILD_ID}}
-    hclaim=${hclaim:-jenkins}
+    hclaim=${hclaim:-jenkins-slave-space}
     qclaim=${qclaim:-qemu-repo}
     newimgname="${imgrepo}${imgname}"
     ;;
@@ -76,9 +76,9 @@
     deployname=${deployname:-qemu-launch-deployment}
     podname=${podname:-qemu-instance}
     replicas=${replicas:-5}
-    hclaim=${hclaim:-jenkins}
+    hclaim=${hclaim:-jenkins-slave-space}
     jenkins_subpath=${jenkins_subpath:-workspace/Openbmc-Build/build}
-    newimgname="${imgrepo}${imgname}"
+    newimgname="${imgrepo}qemu-instance"
     ;;
   XCAT-launch)
     ;;
@@ -97,6 +97,9 @@
 # Push the image that was built to the image repository
 docker push ${imgname}
 
+if [[ "$ARCH" == x86_64 ]]; then
+  ARCH=amd64
+fi
 yamlfile=$(eval "echo \"$(<./kubernetes/Templates/${invoker}-${launch}.yaml)\"" )
 kubectl create -f - <<< "${yamlfile}"