Add Kubernetes tests to validation pipeline

Change-Id: I75f75f178ed1eff0ef2bb617dcde74807a300169
diff --git a/validate-cloud.groovy b/validate-cloud.groovy
index 6c25071..8381d6e 100644
--- a/validate-cloud.groovy
+++ b/validate-cloud.groovy
@@ -11,11 +11,15 @@
  *   TEMPEST_TEST_SET            If not false, run tests matched to pattern only
  *   RUN_TEMPEST_TESTS           If not false, run Tempest tests
  *   RUN_RALLY_TESTS             If not false, run Rally tests
+ *   RUN_K8S_TESTS               If not false, run Kubernetes tests
+ *   TEST_K8S_API_SERVER         Kubernetes API address
+ *   TEST_K8S_CONFORMANCE_IMAGE  Path to docker image with conformance e2e tests
  *
  */
 
 common = new com.mirantis.mk.Common()
 salt = new com.mirantis.mk.Salt()
+test = new com.mirantis.mk.Test()
 validate = new com.mirantis.mcp.Validate()
 
 def saltMaster
@@ -48,6 +52,39 @@
                 common.infoMsg("Skipping Rally tests")
             }
         }
+
+        stage('Run k8s bootstrap tests') {
+            if (RUN_K8S_TESTS.toBoolean() == true) {
+                def image = 'tomkukral/k8s-scripts'
+                def output_file = image.replaceAll('/', '-') + '.output'
+
+                // run image
+                test.runConformanceTests(saltMaster, TEST_K8S_API_SERVER, image)
+
+                // collect output
+                def file_content = salt.getFileContent(saltMaster, 'ctl01*', '/tmp/' + output_file)
+                writeFile file: "${artifacts_dir}${output_file}", text: file_content
+            } else {
+                common.infoMsg("Skipping k8s bootstrap tests")
+            }
+        }
+
+        stage('Run k8s conformance e2e tests') {
+            if (RUN_K8S_TESTS.toBoolean() == true) {
+                def image = TEST_K8S_CONFORMANCE_IMAGE
+                def output_file = image.replaceAll('/', '-') + '.output'
+
+                // run image
+                test.runConformanceTests(saltMaster, TEST_K8S_API_SERVER, image)
+
+                // collect output
+                def file_content = salt.getFileContent(saltMaster, 'ctl01*', '/tmp/' + output_file)
+                writeFile file: "${artifacts_dir}${output_file}", text: file_content
+            } else {
+                common.infoMsg("Skipping k8s conformance e2e tests")
+            }
+        }
+
         stage('Collect results') {
             archiveArtifacts artifacts: "${artifacts_dir}/*"
         }