Update Variable Naming Convention

Variables in qemu-build.sh, build-jenkins.sh, build-setup.sh,
and kubernetes-launch.sh updated to use the same convention across
different scripts.

Change-Id: Ice9ef2f47b0fbf125eadd235f63b79abafdc2dd7
Signed-off-by: Alanny Lopez <alannyglopez@gmail.com>
diff --git a/kubernetes/Templates/OpenBMC-build-job-v2.yaml b/kubernetes/Templates/OpenBMC-build-job-v2.yaml
index f379bff..a6719c7 100644
--- a/kubernetes/Templates/OpenBMC-build-job-v2.yaml
+++ b/kubernetes/Templates/OpenBMC-build-job-v2.yaml
@@ -9,7 +9,7 @@
 spec:
   template:
     metadata:
-      name: ${podname}
+      name: ${pod_name}
       labels:
         target: ${target}
     spec:
@@ -18,14 +18,14 @@
       volumes:
       - name: workspace
         persistentVolumeClaim:
-          claimName: ${wclaim}
-      - name: sscdir
+          claimName: ${w_claim}
+      - name: ssc-dir
         persistentVolumeClaim:
-          claimName: ${sclaim}
+          claimName: ${s_claim}
       restartPolicy: Never
       hostNetwork: True
       containers:
-      - image: ${imgname}
+      - image: ${img_name}
         name: builder
         command: ["/bin/bash","-c"]
         args: ["sleep 2h"]
@@ -33,8 +33,8 @@
         env:
         - name: WORKSPACE
           value: ${WORKSPACE}
-        - name: builddir
-          value: ${builddir}
+        - name: build-dir
+          value: ${build_dir}
         securityContext:
           capabilities:
             add:
@@ -42,7 +42,7 @@
         volumeMounts:
         - name: workspace
           mountPath: ${HOME}/workspace
-        - name: sscdir
-          mountPath: ${sscdir}
+        - name: ssc-dir
+          mountPath: ${ssc_dir}
       imagePullSecrets:
-      - name: ${imgplsec}
+      - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/OpenBMC-build-job.yaml b/kubernetes/Templates/OpenBMC-build-job.yaml
index c035193..7f9c017 100644
--- a/kubernetes/Templates/OpenBMC-build-job.yaml
+++ b/kubernetes/Templates/OpenBMC-build-job.yaml
@@ -9,7 +9,7 @@
 spec:
   template:
     metadata:
-      name: ${podname}
+      name: ${pod_name}
       labels:
         target: ${target}
     spec:
@@ -18,22 +18,22 @@
       volumes:
       - name: workspace
         persistentVolumeClaim:
-          claimName: ${wclaim}
-      - name: sscdir
+          claimName: ${w_claim}
+      - name: ssc-dir
         persistentVolumeClaim:
-          claimName: ${sclaim}
+          claimName: ${s_claim}
       restartPolicy: Never
       hostNetwork: True
       containers:
-      - image: ${imgname}
+      - image: ${img_name}
         name: builder
         command: [\"${WORKSPACE}/build.sh\"]
         workingDir: ${HOME}
         env:
         - name: WORKSPACE
           value: ${WORKSPACE}
-        - name: builddir
-          value: ${builddir}
+        - name: build-dir
+          value: ${build_dir}
         securityContext:
           capabilities:
             add:
@@ -41,7 +41,7 @@
         volumeMounts:
         - name: workspace
           mountPath: ${HOME}/workspace
-        - name: sscdir
-          mountPath: ${sscdir}
+        - name: ssc-dir
+          mountPath: ${ssc_dir}
       imagePullSecrets:
-      - name: ${imgplsec}
+      - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/OpenBMC-build-pod-v2.yaml b/kubernetes/Templates/OpenBMC-build-pod-v2.yaml
index 75adac8..11c4419 100644
--- a/kubernetes/Templates/OpenBMC-build-pod-v2.yaml
+++ b/kubernetes/Templates/OpenBMC-build-pod-v2.yaml
@@ -1,7 +1,7 @@
 apiVersion: v1
 kind: Pod
 metadata:
-  name: ${podname}
+  name: ${pod_name}
   namespace: ${namespace}
 spec:
   nodeSelector:
@@ -9,13 +9,13 @@
   volumes:
   - name: workspace
     persistentVolumeClaim:
-      claimName: ${wclaim}
-  - name: sscdir
+      claimName: ${w_claim}
+  - name: ssc-dir
     persistentVolumeClaim:
-      claimName: ${sclaim}
+      claimName: ${s_claim}
   hostNetwork: True
   containers:
-  - image: ${imgname}
+  - image: ${img_name}
     name: builder
     command: ["/bin/bash","-c"]
     args: ["sleep 2h"]
@@ -23,8 +23,8 @@
     env:
     - name: WORKSPACE
       value: ${WORKSPACE}
-    - name: builddir
-      value: ${builddir}
+    - name: build-dir
+      value: ${build_dir}
     securityContext:
       capabilities:
         add:
@@ -32,8 +32,8 @@
     volumeMounts:
     - name: workspace
       mountPath: ${HOME}/workspace
-    - name: sscdir
-      mountPath: ${sscdir}
+    - name: ssc-dir
+      mountPath: ${ssc_dir}
   restartPolicy: Never
   imagePullSecrets:
-  - name: ${imgplsec}
+  - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/OpenBMC-build-pod.yaml b/kubernetes/Templates/OpenBMC-build-pod.yaml
index 4eb76da..a383367 100644
--- a/kubernetes/Templates/OpenBMC-build-pod.yaml
+++ b/kubernetes/Templates/OpenBMC-build-pod.yaml
@@ -1,7 +1,7 @@
 apiVersion: v1
 kind: Pod
 metadata:
-  name: ${podname}
+  name: ${pod_name}
   namespace: ${namespace}
 spec:
   nodeSelector:
@@ -9,21 +9,21 @@
   volumes:
   - name: workspace
     persistentVolumeClaim:
-      claimName: ${wclaim}
-  - name: sscdir
+      claimName: ${w_claim}
+  - name: ssc-dir
     persistentVolumeClaim:
-      claimName: ${sclaim}
+      claimName: ${s_claim}
   hostNetwork: True
   containers:
-  - image: ${imgname}
+  - image: ${img_name}
     name: builder
     command: [\"${WORKSPACE}/build.sh\"]
     workingDir: ${HOME}
     env:
     - name: WORKSPACE
       value: ${WORKSPACE}
-    - name: builddir
-      value: ${builddir}
+    - name: build-dir
+      value: ${build_dir}
     securityContext:
       capabilities:
         add:
@@ -31,8 +31,8 @@
     volumeMounts:
     - name: workspace
       mountPath: ${HOME}/workspace
-    - name: sscdir
-      mountPath: ${sscdir}
+    - name: ssc-dir
+      mountPath: ${ssc_dir}
   restartPolicy: Never
   imagePullSecrets:
-  - name: ${imgplsec}
+  - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/QEMU-build-job.yaml b/kubernetes/Templates/QEMU-build-job.yaml
index 04a8c4e..1fe635f 100644
--- a/kubernetes/Templates/QEMU-build-job.yaml
+++ b/kubernetes/Templates/QEMU-build-job.yaml
@@ -9,33 +9,33 @@
 spec:
   template:
     metadata:
-      name: ${podname}
+      name: ${pod_name}
     spec:
       nodeSelector:
         beta.kubernetes.io/arch: ${ARCH}
       volumes:
       - name: workspace
         persistentVolumeClaim:
-          claimName: ${wclaim}
-      - name: qemudir
+          claimName: ${w_claim}
+      - name: qemu-dir
         persistentVolumeClaim:
-          claimName: ${qclaim}
+          claimName: ${q_claim}
       restartPolicy: Never
       hostNetwork: True
       containers:
-      - image: ${imgname}
+      - image: ${img_name}
         name: builder
         command: [\"${WORKSPACE}/build.sh\"]
         workingDir: ${HOME}
         env:
         - name: WORKSPACE
           value: ${WORKSPACE}
-        - name: qemudir
-          value: ${qemudir}
+        - name: qemu-dir
+          value: ${qemu_dir}
         volumeMounts:
         - name: workspace
           mountPath: ${HOME}/workspace
-        - name: qemudir
-          mountPath: ${qemudir}
+        - name: qemu-dir
+          mountPath: ${qemu_dir}
       imagePullSecrets:
-      - name: ${imgplsec}
+      - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/QEMU-build-pod.yaml b/kubernetes/Templates/QEMU-build-pod.yaml
index 3a23af7..eb3088d 100644
--- a/kubernetes/Templates/QEMU-build-pod.yaml
+++ b/kubernetes/Templates/QEMU-build-pod.yaml
@@ -1,7 +1,7 @@
 apiVersion: v1
 kind: Pod
 metadata:
-  name: ${podname}
+  name: ${pod_name}
   namespace: ${namespace}
 spec:
   nodeSelector:
@@ -9,26 +9,26 @@
   volumes:
   - name: workspace
     persistentVolumeClaim:
-      claimName: ${wclaim}
-  - name: qemudir
+      claimName: ${w_claim}
+  - name: qemu-dir
     persistentVolumeClaim:
-      claimName: ${qclaim}
+      claimName: ${q_claim}
   restartPolicy: Never
   hostNetwork: True
   containers:
-  - image: ${imgname}
+  - image: ${img_name}
     name: builder
     command: [\"${WORKSPACE}/build.sh\"]
     workingDir: ${HOME}
     env:
     - name: WORKSPACE
       value: ${WORKSPACE}
-    - name: qemudir
-      value: ${qemudir}
+    - name: qemu-dir
+      value: ${qemu_dir}
     volumeMounts:
     - name: workspace
       mountPath: ${HOME}/workspace
-    - name: qemudir
-      mountPath: ${qemudir}
+    - name: qemu-dir
+      mountPath: ${qemu_dir}
   imagePullSecrets:
-  - name: ${imgplsec}
+  - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/QEMU-launch-deployment.yaml b/kubernetes/Templates/QEMU-launch-deployment.yaml
index c17df73..c8bdc9f 100644
--- a/kubernetes/Templates/QEMU-launch-deployment.yaml
+++ b/kubernetes/Templates/QEMU-launch-deployment.yaml
@@ -1,29 +1,29 @@
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
-  name: ${deployname}
+  name: ${deploy_name}
   namespace: ${namespace}
 spec:
   replicas: ${replicas}
   selector:
     matchLabels:
-      app: ${deployname}
+      app: ${deploy_name}
   template:
     metadata:
       labels:
-        app: ${deployname}
+        app: ${deploy_name}
     spec:
       volumes:
       - name: workspace
         persistentVolumeClaim:
-          claimName: ${wclaim}
+          claimName: ${w_claim}
       nodeSelector:
         beta.kubernetes.io/arch: ${ARCH}
       securityContext:
         runAsUser: 0
       containers:
-      - image: ${imgname}
-        name: ${podname}
+      - image: ${img_name}
+        name: ${pod_name}
         command: [\"${OBMC_BUILD_DIR}/boot-qemu.sh\"]
         tty: true
         workingDir: ${OBMC_BUILD_DIR}
@@ -59,4 +59,4 @@
           subPath: ${jenkins_subpath}
           mountPath: ${OBMC_BUILD_DIR}
       imagePullSecrets:
-      - name: ${imgplsec}
+      - name: ${img_pl_sec}
diff --git a/kubernetes/kubernetes-launch.sh b/kubernetes/kubernetes-launch.sh
index 3917a92..fd8e95c 100755
--- a/kubernetes/kubernetes-launch.sh
+++ b/kubernetes/kubernetes-launch.sh
@@ -24,28 +24,28 @@
 #                     Default: The parent directory containing this script
 #
 # Kubernetes Variables:
-#  imgplsec           The image pull secret used to access registry if needed
+#  img_pl_sec         The image pull secret used to access registry if needed
 #                     Default: "regkey"
-#  imgrepo            The registry to use to pull and push images
+#  registry           The registry to use to pull and push images
 #                     Default: "master.cfc:8500/openbmc/""
-#  jobtimeout         The amount of time in seconds that the build will wait for
+#  job_timeout         The amount of time in seconds that the build will wait for
 #                     the job to be created in the api of the cluster.
 #                     Default: "60"
 #  namespace          The namespace to be used within the Kubernetes cluster
 #                     Default: "openbmc"
-#  podtimeout         The amount of time in seconds that the build will wait for
+#  pod_timeout        The amount of time in seconds that the build will wait for
 #                     the pod to start running on the cluster.
 #                     Default: "600"
 #
 # YAML File Variables (No Defaults):
-#  imgname            The name the image that will be passed to the kubernetes
+#  img_name           The name the image that will be passed to the kubernetes
 #                     api to build the containers. The image with the tag
-#                     imgname will be built in the invoker script. This script
+#                     img_name will be built in the invoker script. This script
 #                     will then tag it to include the registry in the name, push
-#                     it, and update the imgname to be what was pushed to the
+#                     it, and update the img_name to be what was pushed to the
 #                     registry. Users should not include the registry in the
-#                     original imgname.
-#  podname            The name of the pod, needed to trace down the logs.
+#                     original img_name.
+#  pod_name           The name of the pod, needed to trace down the logs.
 #
 # Deployment Option Variables (No Defaults):
 #  invoker            Name of what this script is being called by or for, used
@@ -71,10 +71,10 @@
 
 # Kubernetes Variables
 namespace=${namespace:-openbmc}
-imgrepo=${imgrepo:-master.cfc:8500/openbmc/}
-imgplsec=${imgplsec:-regkey}
-jobtimeout=${jobtimeout:-60}
-podtimeout=${podtimeout:-600}
+registry=${registry:-master.cfc:8500/openbmc/}
+img_pl_sec=${img_pl_sec:-regkey}
+job_timeout=${job_timeout:-60}
+pod_timeout=${pod_timeout:-600}
 
 # Options which decide script behavior
 invoker=${invoker:-${1}}
@@ -87,25 +87,25 @@
 # Other variables in the template not declared here are declared by invoker
 case ${invoker} in
   OpenBMC-build)
-    wclaim=${wclaim:-jenkins-slave-space}
-    sclaim=${sclaim:-shared-state-cache}
-    oclaim=${oclaim:-openbmc-reference-repo}
-    newimgname=${newimgname:-${imgrepo}${distro}:${imgtag}-${ARCH}}
-    podname=${podname:-openbmc${BUILD_ID}-${target}-builder}
+    w_claim=${w_claim:-jenkins-slave-space}
+    s_claim=${s_claim:-shared-state-cache}
+    o_claim=${o_claim:-openbmc-reference-repo}
+    new_img_name=${new_img_name:-${registry}${distro}:${img_tag}-${ARCH}}
+    pod_name=${pod_name:-openbmc${BUILD_ID}-${target}-builder}
     ;;
   QEMU-build)
-    podname=${podname:-qemubuild${BUILD_ID}}
-    wclaim=${wclaim:-jenkins-slave-space}
-    qclaim=${qclaim:-qemu-repo}
-    newimgname="${imgrepo}${imgname}"
+    pod_name=${pod_name:-qemubuild${BUILD_ID}}
+    w_claim=${w_claim:-jenkins-slave-space}
+    q_claim=${q_claim:-qemu-repo}
+    new_img_name="${registry}${img_name}"
     ;;
   QEMU-launch)
-    deployname=${deployname:-qemu-launch-deployment}
-    podname=${podname:-qemu-instance}
+    deploy_name=${deploy_name:-qemu-launch-deployment}
+    pod_name=${pod_name:-qemu-instance}
     replicas=${replicas:-5}
-    wclaim=${wclaim:-jenkins-slave-space}
+    w_claim=${w_claim:-jenkins-slave-space}
     jenkins_subpath=${jenkins_subpath:-Openbmc-Build/openbmc/build}
-    newimgname="${imgrepo}qemu-instance"
+    new_img_name="${registry}qemu-instance"
     ;;
   XCAT-launch)
     ;;
@@ -116,12 +116,12 @@
     ;;
 esac
 
-# Tag the image created by the invoker with a name that includes the imgrepo
-docker tag ${imgname} ${newimgname}
-imgname=${newimgname}
+# Tag the image created by the invoker with a name that includes the registry
+docker tag ${img_name} ${new_img_name}
+img_name=${new_img_name}
 
 # Push the image that was built to the image repository
-docker push ${imgname}
+docker push ${img_name}
 
 if [[ "$ARCH" == x86_64 ]]; then
   ARCH=amd64
@@ -132,53 +132,53 @@
   extras+="-v2"
 fi
 
-yamlfile=$(eval "echo \"$(<${build_scripts_dir}/kubernetes/Templates/${invoker}-${launch}${extras}.yaml)\"")
-kubectl create -f - <<< "${yamlfile}"
+yaml_file=$(eval "echo \"$(<${build_scripts_dir}/kubernetes/Templates/${invoker}-${launch}${extras}.yaml)\"")
+kubectl create -f - <<< "${yaml_file}"
 
-# If launch is a job we have to find the podname with identifiers
+# If launch is a job we have to find the pod_name with identifiers
 if [[ "${launch}" == "job" ]]; then
   while [ -z ${replace} ]
   do
-    if [ ${jobtimeout} -lt 0 ]; then
-      kubectl delete -f - <<< "${yamlfile}"
+    if [ ${job_timeout} -lt 0 ]; then
+      kubectl delete -f - <<< "${yaml_file}"
       echo "Timeout occurred before job was present in the API"
       exit 1
     else
       sleep 1
-      let jobtimeout-=1
+      let job_timeout-=1
     fi
-    replace=$(kubectl get pods -n ${namespaces} | grep ${podname} | awk 'print $1')
+    replace=$(kubectl get pods -n ${namespaces} | grep ${pod_name} | awk 'print $1')
   done
-  podname=${replace}
+  pod_name=${replace}
 fi
 
 
 # Once pod is running track logs
 if [[ "${log}" == true ]]; then
   # Wait for Pod to be running
-  checkstatus="kubectl describe pod ${podname} -n ${namespace}"
-  status=$( ${checkstatus} | grep Status: )
+  check_status="kubectl describe pod ${pod_name} -n ${namespace}"
+  status=$( ${check_status} | grep Status: )
   while [ -z "$( echo ${status} | grep Running)" ]
   do
-    if [ ${podtimeout} -lt 0 ]; then
-      kubectl delete -f - <<< "${yamlfile}"
+    if [ ${pod_timeout} -lt 0 ]; then
+      kubectl delete -f - <<< "${yaml_file}"
       echo "Timeout occurred before pod was Running"
       exit 1
     else
       sleep 1
-      let podtimeout-=1
+      let pod_timeout-=1
     fi
-    status=$( ${checkstatus} | grep Status: )
+    status=$( ${check_status} | grep Status: )
   done
   # Tail the logs of the pod, if workaround enabled start executing build script instead.
   if [[ "${workaround}" == "true" ]]; then
-    kubectl exec -it ${podname} -n ${namespace} ${WORKSPACE}/build.sh
+    kubectl exec -it ${pod_name} -n ${namespace} ${WORKSPACE}/build.sh
   else
-    kubectl logs -f ${podname} -n ${namespace}
+    kubectl logs -f ${pod_name} -n ${namespace}
   fi
 fi
 
 # Delete the object if purge is true
 if [[ "${purge}" == true ]]; then
-  kubectl delete -f - <<< "${yamlfile}"
+  kubectl delete -f - <<< "${yaml_file}"
 fi