Merge "[CORD-3185]v2"
diff --git a/jjb/defaults.yaml b/jjb/defaults.yaml
index 7c9857f..b991127 100644
--- a/jjb/defaults.yaml
+++ b/jjb/defaults.yaml
@@ -26,7 +26,7 @@
 
     # The most frequently used type of build node
     # see other build node types under "Cloud > Amazon EC2" at
-    #  https://jenkins-new.opencord.org/configure
+    #  https://jenkins.opencord.org/configure
     build-node: ubuntu16.04-basebuild-1c-1g
 
     # CORD Gerrit server definition, set in configuration
diff --git a/jjb/k8install.yaml b/jjb/k8install.yaml
new file mode 100644
index 0000000..b35b41d
--- /dev/null
+++ b/jjb/k8install.yaml
@@ -0,0 +1,60 @@
+---
+# kubespray installation validation job
+
+- project:
+    name: kubespray-install-test
+
+    project-name: '{name}'
+
+    jobs:
+      - 'k8-install'
+
+- job-template:
+    id: 'k8-install'
+    name: 'k8-install'
+
+    description: |
+      <!-- Managed by Jenkins Job Builder -->
+      Created by {id} job-template from ci-management/jjb/k8install.yaml  <br /><br />
+      Validation job for kubespray installation script provided to users/operators
+
+    properties:
+      - cord-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+          artifact-num-to-keep: '{artifact-num-to-keep}'
+
+    wrappers:
+      - lf-infra-wrappers:
+          build-timeout: '{build-timeout}'
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    parameters:
+      - string:
+          name: executorNode
+          default: 'qa-testvm-pod'
+          description: 'Name of the Jenkins node to run the job on'
+
+      - string:
+          name: branch
+          default: 'master'
+          description: 'Name of the repo branch to use'
+
+      - string:
+         name: configRepoUrl
+         default: 'https://gerrit.opencord.org/pod-configs'
+         description: 'The URL of the POD configs repository'
+
+      - string:
+         name: configRepoBaseDir
+         default: 'pod-configs/'
+         description: 'The directory inside the POD configs repository'
+
+      - string:
+         name: configRepoFile
+         default: 'kubernetes-configs/flex-onf-pod1.yml'
+         description: 'The deployment config file'
+
+    project-type: pipeline
+    concurrent: false
+
+    dsl: !include-raw-escape: pipeline/kubespray-install.groovy
diff --git a/jjb/pipeline/kubespray-install.groovy b/jjb/pipeline/kubespray-install.groovy
new file mode 100644
index 0000000..676f514
--- /dev/null
+++ b/jjb/pipeline/kubespray-install.groovy
@@ -0,0 +1,52 @@
+/*kubespray installation script test*/
+
+pipeline {
+
+  /* no label, executor is determined by JJB */
+  agent {
+    label "${params.executorNode}"
+  }
+  stages {
+
+    stage ("Parse deployment configuration file") {
+      steps {
+            sh returnStdout: true, script: 'rm -rf ${configRepoBaseDir}'
+            sh returnStdout: true, script: 'git clone -b ${branch} ${configRepoUrl}'
+            script { deployment_config = readYaml file: "${configRepoBaseDir}${configRepoFile}" }
+          }
+        }
+
+    stage ('Checkout Automation-Tools Repo') {
+      steps {
+        sh '''
+            pushd $WORKSPACE
+            git clone https://gerrit.opencord.org/automation-tools
+            popd
+            '''
+            }
+        }
+
+    stage ('Install Kubespray on Nodes') {
+      steps {
+        sh '''
+            pushd $WORKSPACE/automation-tools/kubespray-installer
+            ./setup.sh -i flex-onf-pod1 ${deployment_config.node1.ip} ${deployment_config.node2.ip} ${deployment_config.node3.ip}
+            popd
+            '''
+            }
+        }
+
+    stage ('Validate Kube Config File') {
+      steps {
+        sh '''
+            pushd $WORKSPACE/automation-tools/kubespray-installer/configs
+            #Validate the conf file
+            export KUBECONFIG=$WORKSPACE/automation-tools/kubespray-installer/configs${deployment_config.pod_config}
+            kubectl get pods
+            popd
+            '''
+            }
+        }
+    }
+
+}
diff --git a/jjb/shell/jflint.sh b/jjb/shell/jflint.sh
index e7b76f0..0972793 100755
--- a/jjb/shell/jflint.sh
+++ b/jjb/shell/jflint.sh
@@ -20,7 +20,7 @@
 
 set -e -u -o pipefail
 
-JENKINS_URL=https://jenkins-new.opencord.org/
+JENKINS_URL=https://jenkins.opencord.org/
 JF_LIST=()
 
 # if no args, and there's a Jenkinsfile in cwd, check it
diff --git a/packer/provision/basebuild.sh b/packer/provision/basebuild.sh
index cfee70e..b933ec4 100644
--- a/packer/provision/basebuild.sh
+++ b/packer/provision/basebuild.sh
@@ -165,10 +165,19 @@
     rm -f minikube.deb
     popd
 
-    # give sudo permissions on minikube to jenkins user, so `minikube init` can be run
-    cat <<EOF >/etc/sudoers.d/88-jenkins-minikube
+    # install protobufs
+    PROTOC_VERSION="3.3.0"
+    PROTOC_SHA256SUM="feb112bbc11ea4e2f7ef89a359b5e1c04428ba6cfa5ee628c410eccbfe0b64c3"
+    curl -L -o /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip
+    echo "$PROTOC_SHA256SUM  /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip" | sha256sum -c -
+    unzip /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip -d protoc3
+    mv /tmp/protoc3/bin/* /usr/local/bin/
+    mv /tmp/protoc3/include/* /usr/local/include/
+    # give sudo permissions on minikube and protoc to jenkins user
+    cat <<EOF >/etc/sudoers.d/88-jenkins-minikube-protoc
+Cmnd_Alias CMDS = /usr/local/bin/protoc, /usr/bin/minikube
 Defaults:jenkins !requiretty
-jenkins ALL=(ALL) NOPASSWD:SETENV: /usr/bin/minikube
+jenkins ALL=(ALL) NOPASSWD:SETENV: CMDS
 EOF
 
     # clean up