Prepare conformance pods
- Prebuilding conformance pods objects to make possible to
run tests on ContainerD setups
Change-Id: I85d956336b74653fae0d96dd611a9fca56dcc471
Related-PROD: PROD-24954
diff --git a/kubernetes/files/conformance/conformance.yml b/kubernetes/files/conformance/conformance.yml
new file mode 100644
index 0000000..3e6a424
--- /dev/null
+++ b/kubernetes/files/conformance/conformance.yml
@@ -0,0 +1,86 @@
+{%- from "kubernetes/map.jinja" import full_version -%}
+---
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: conformance
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: conformance
+ namespace: conformance
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: conformance
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: conformance
+subjects:
+- kind: ServiceAccount
+ name: conformance
+ namespace: conformance
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRole
+metadata:
+ name: conformance
+ namespace: conformance
+rules:
+- apiGroups:
+ - '*'
+ resources:
+ - '*'
+ verbs:
+ - '*'
+---
+apiVersion: v1
+kind: Pod
+metadata:
+ name: conformance
+ namespace: conformance
+spec:
+ hostNetwork: true
+ restartPolicy: Never
+ serviceAccountName: conformance
+ affinity:
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: node-role.kubernetes.io/master
+ operator: In
+ values:
+ - "true"
+ tolerations:
+ - key: node-role.kubernetes.io/master
+ effect: NoSchedule
+ containers:
+ - command:
+ - /bin/bash
+ - -c
+ - set -o pipefail && /entrypoint.sh | tee /report/conformance.log
+ name: conformance
+ imagePullPolicy: Always
+ securityContext:
+ privileged: true
+ env:
+ - name: API_SERVER
+ value: http://localhost:8080
+# Uncomment to use FOCUS for conformance runs
+# - name: FOCUS
+# value: "Conformance"
+# - name: CONCURRENCY
+# value: 25
+ image: docker-prod-local.artifactory.mirantis.com/mirantis/kubernetes/k8s-conformance:v{{ full_version }}
+ volumeMounts:
+ - mountPath: /report
+ name: output-volume
+ mountPropagation: Bidirectional
+ volumes:
+ - hostPath:
+ path: /tmp/conformance
+ name: output-volume
\ No newline at end of file
diff --git a/kubernetes/files/conformance/virtlet_conformance.yml b/kubernetes/files/conformance/virtlet_conformance.yml
new file mode 100644
index 0000000..6e928e1
--- /dev/null
+++ b/kubernetes/files/conformance/virtlet_conformance.yml
@@ -0,0 +1,81 @@
+{%- from "kubernetes/map.jinja" import common -%}
+---
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: virtlet-conformance
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: virtlet-conformance
+ namespace: virtlet-conformance
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: virtlet-conformance
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: virtlet-conformance
+subjects:
+- kind: ServiceAccount
+ name: virtlet-conformance
+ namespace: virtlet-conformance
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRole
+metadata:
+ name: virtlet-conformance
+ namespace: virtlet-conformance
+rules:
+- apiGroups:
+ - '*'
+ resources:
+ - '*'
+ verbs:
+ - '*'
+---
+apiVersion: v1
+kind: Pod
+metadata:
+ name: virtlet-conformance
+ namespace: virtlet-conformance
+spec:
+ hostNetwork: true
+ restartPolicy: Never
+ serviceAccountName: virtlet-conformance
+ affinity:
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: node-role.kubernetes.io/master
+ operator: In
+ values:
+ - "true"
+ tolerations:
+ - key: node-role.kubernetes.io/master
+ effect: NoSchedule
+ containers:
+ - command:
+ - /bin/bash
+ - -c
+ - set -o pipefail && /virtlet-e2e-tests -include-cloud-init-tests -junitOutput /report/report.xml
+ -image cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
+ -sshuser ubuntu -memoryLimit 1024 -alsologtostderr -cluster-url http://127.0.0.1:8080
+ -ginkgo.focus '\[Conformance\]' | tee /report/virtlet_conformance.log
+ name: virtlet-conformance
+ imagePullPolicy: Always
+ securityContext:
+ privileged: true
+ image: {{ common.addons.virtlet.image }}
+ volumeMounts:
+ - mountPath: /report
+ name: output-volume
+ mountPropagation: Bidirectional
+ volumes:
+ - hostPath:
+ path: /tmp/virtlet-conformance
+ name: output-volume
\ No newline at end of file
diff --git a/kubernetes/map.jinja b/kubernetes/map.jinja
index 8181b6d..5d1f39f 100644
--- a/kubernetes/map.jinja
+++ b/kubernetes/map.jinja
@@ -1,5 +1,5 @@
{% set version = salt['cmd.shell']("(hyperkube --version kubelet 2> /dev/null || echo '0.0') | sed -e 's/-.*//g' -e 's/v//g' -e 's/Kubernetes //g' | awk -F'.' '{print $1 \".\" $2}'") %}
-{% set full_version = salt['cmd.shell']("(hyperkube --version kubelet 2> /dev/null || echo '0.0') | sed -e 's/-.*//g' -e 's/v//g' -e 's/Kubernetes //g'") %}
+{% set full_version = salt['cmd.shell']("(hyperkube --version kubelet 2> /dev/null || echo '0.0') | sed -e 's/+.*//g' -e 's/v//g' -e 's/Kubernetes //g'") %}
{% set common = salt['grains.filter_by']({
'Debian': {
diff --git a/kubernetes/master/setup.sls b/kubernetes/master/setup.sls
index 54a98c2..7eff28d 100644
--- a/kubernetes/master/setup.sls
+++ b/kubernetes/master/setup.sls
@@ -61,6 +61,28 @@
- onlyif: /bin/false
{%- endif %}
+/srv/kubernetes/conformance.yml:
+ file.managed:
+ - source: salt://kubernetes/files/conformance/conformance.yml
+ - template: jinja
+ - user: root
+ - group: root
+ - mode: 644
+ - makedirs: True
+
+{%- if common.addons.get('virtlet', {}).get('enabled') %}
+
+/srv/kubernetes/virtlet_conformance.yml:
+ file.managed:
+ - source: salt://kubernetes/files/conformance/virtlet_conformance.yml
+ - template: jinja
+ - user: root
+ - group: root
+ - mode: 644
+ - makedirs: True
+
+{%- endif %}
+
{%- if master.label is defined %}
{%- for name,label in master.label.items() %}