Add conformance execution for containerD cases
Change-Id: I48dd104776e36c4a176e1364150660cf255ac190
Related-PROD: PROD-24954
diff --git a/k8s-upgrade-pipeline.groovy b/k8s-upgrade-pipeline.groovy
index 980aa2f..46a846e 100644
--- a/k8s-upgrade-pipeline.groovy
+++ b/k8s-upgrade-pipeline.groovy
@@ -27,6 +27,7 @@
def common = new com.mirantis.mk.Common()
def salt = new com.mirantis.mk.Salt()
def python = new com.mirantis.mk.Python()
+def test = new com.mirantis.mk.Test()
def updates = TARGET_UPDATES.tokenize(",").collect{it -> it.trim()}
def pepperEnv = "pepperEnv"
@@ -258,6 +259,24 @@
}
}
+def containerDinstalled(pepperEnv, target) {
+ def salt = new com.mirantis.mk.Salt()
+ return salt.cmdRun(pepperEnv, target, "containerd --version 2>1 1>/dev/null && echo 'true' || echo 'false'"
+ )['return'][0].values()[0].replaceAll('Salt command execution success','').trim().toBoolean()
+}
+
+def containerDenabled(pepperEnv, target) {
+ def salt = new com.mirantis.mk.Salt()
+ return salt.getPillar(venvPepper, target, "kubernetes:common:containerd:enabled"
+ )["return"][0].values()[0].toBoolean()
+}
+
+def conformancePodDefExists(pepperEnv, target) {
+ def salt = new com.mirantis.mk.Salt()
+ return salt.cmdRun(pepperEnv, target, "test -e /srv/kubernetes/conformance.yml && echo 'true' || echo 'false'"
+ )['return'][0].values()[0].replaceAll('Salt command execution success','').trim().toBoolean()
+}
+
def checkCalicoUpgradeSuccessful(pepperEnv, target) {
def salt = new com.mirantis.mk.Salt()
@@ -336,7 +355,18 @@
def mcp_repo = ARTIFACTORY_URL
def k8s_api = TEST_K8S_API_SERVER
firstTarget = salt.getFirstMinion(pepperEnv, target)
- executeConformance(pepperEnv, firstTarget, k8s_api, mcp_repo)
+ def containerd_enabled = containerDenabled(pepperEnv, firstTarget)
+ def containerd_installed = containerDinstalled(pepperEnv, firstTarget)
+ def conformance_pod_ready = conformancePodDefExists(pepperEnv, firstTarget)
+ if (containerd_enabled && containerd_installed && conformance_pod_ready) {
+ def config = ['master': pepperEnv,
+ 'target': firstTarget,
+ 'junitResults': false,
+ 'autodetect': true]
+ test.executeConformance(config)
+ } else {
+ executeConformance(pepperEnv, firstTarget, k8s_api, mcp_repo)
+ }
}
if ((common.validInputParam('KUBERNETES_HYPERKUBE_IMAGE')) && (common.validInputParam('KUBERNETES_PAUSE_IMAGE'))) {
@@ -452,7 +482,18 @@
def mcp_repo = ARTIFACTORY_URL
def k8s_api = TEST_K8S_API_SERVER
firstTarget = salt.getFirstMinion(pepperEnv, target)
- executeConformance(pepperEnv, firstTarget, k8s_api, mcp_repo)
+ def containerd_enabled = containerDenabled(pepperEnv, firstTarget)
+ def containerd_installed = containerDinstalled(pepperEnv, firstTarget)
+ def conformance_pod_ready = conformancePodDefExists(pepperEnv, firstTarget)
+ if (containerd_enabled && containerd_installed && conformance_pod_ready) {
+ def config = ['master': pepperEnv,
+ 'target': firstTarget,
+ 'junitResults': false,
+ 'autodetect': true]
+ test.executeConformance(config)
+ } else {
+ executeConformance(pepperEnv, firstTarget, k8s_api, mcp_repo)
+ }
}
} catch (Throwable e) {
// If there was an error or exception thrown, the build failed