Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 66f9a20

Browse files
authored
Merge pull request #5676 from surajssd/support-running-parallel-e2e
k8s-conformance: Add support to run tests in parallel
2 parents 765c67b + 98cf5b9 commit 66f9a20

File tree

4 files changed

+41
-20
lines changed

4 files changed

+41
-20
lines changed

integration/kubernetes/e2e_conformance/run.sh

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@ RUNTIME="${RUNTIME:-containerd-shim-kata-v2}"
2727
CRI_RUNTIME="${CRI_RUNTIME:-containerd}"
2828
MINIMAL_K8S_E2E="${MINIMAL_K8S_E2E:-false}"
2929
KATA_HYPERVISOR="${KATA_HYPERVISOR:-}"
30+
RUNTIME_CLASS="${RUNTIME_CLASS:-kata}"
31+
E2E_PARALLEL="${E2E_PARALLEL:-false}"
3032

3133
# Overall Sonobuoy timeout in minutes.
3234
WAIT_TIME=${WAIT_TIME:-180}
3335

3436
JOBS_FILE="${SCRIPT_PATH}/e2e_k8s_jobs.yaml"
3537

3638
create_kata_webhook() {
37-
pushd "${SCRIPT_PATH}/../../../kata-webhook" >> /dev/null
39+
pushd "${SCRIPT_PATH}/../../../kata-webhook" >>/dev/null
3840
# Create certificates for the kata webhook
3941
./create-certs.sh
4042

@@ -46,6 +48,15 @@ create_kata_webhook() {
4648
popd
4749
}
4850

51+
delete_kata_webhook() {
52+
pushd "${SCRIPT_PATH}/../../../kata-webhook" >>/dev/null
53+
54+
# Apply kata-webhook deployment
55+
kubectl delete -f deploy/
56+
57+
popd
58+
}
59+
4960
get_sonobuoy() {
5061
sonobuoy_repo=$(get_test_version "externals.sonobuoy.url")
5162
version=$(get_test_version "externals.sonobuoy.version")
@@ -84,12 +95,12 @@ run_sonobuoy() {
8495
skip_options="Alpha|\[(Disruptive|Feature:[^\]]+|Flaky)\]"
8596
local skip_list
8697
skip_list=$(yaml_list_to_str_regex "\"${CRI_RUNTIME}\"" "${skipped_tests_file}")
87-
if [ "${skip_list}" != "" ];then
98+
if [ "${skip_list}" != "" ]; then
8899
skip_options+="|${skip_list}"
89100
fi
90101

91102
skip_list=$(yaml_list_to_str_regex "hypervisor.\"${KATA_HYPERVISOR}\"" "${skipped_tests_file}")
92-
if [ "${skip_list}" != "" ];then
103+
if [ "${skip_list}" != "" ]; then
93104
skip_options+="|${skip_list}"
94105
fi
95106

@@ -111,6 +122,9 @@ run_sonobuoy() {
111122
cmd+=" --e2e-skip=\"${skip_options}\""
112123
fi
113124
fi
125+
126+
cmd+=" --plugin-env e2e.E2E_PARALLEL=${E2E_PARALLEL}"
127+
114128
echo "running: ${cmd}"
115129
eval "${cmd}"
116130

@@ -140,18 +154,18 @@ run_sonobuoy() {
140154
fi
141155
local expected_passed_query="jobs.${CI_JOB:-}.passed"
142156
local expected_passed=$("${GOPATH}/bin/yq" read "${JOBS_FILE}" "${expected_passed_query}")
143-
if [ "${expected_passed}" != "" ];then
157+
if [ "${expected_passed}" != "" ]; then
144158
passed_query='.plugins | [ .[]."result-counts".passed] | add'
145159
passed=$(sonobuoy status --json | jq "${passed_query}")
146-
if [ "${expected_passed}" != "${passed}" ];then
160+
if [ "${expected_passed}" != "${passed}" ]; then
147161
die "expected ${expected_passed} tests to pass, but ${passed} passed"
148162
else
149163
info "All ${passed} tests passed as expected"
150164
fi
151165
else
152166
info "Not found ${expected_passed_query} for job ${CI_JOB:-} in ${JOBS_FILE}"
153167
fi
154-
} | tee "${e2e_result_dir}/summary"
168+
} | tee "${e2e_result_dir}/summary"
155169
}
156170

157171
cleanup() {
@@ -174,6 +188,10 @@ cleanup() {
174188
fi
175189
} || true
176190

191+
if [ "$RUNTIME" == "containerd-shim-kata-v2" ]; then
192+
delete_kata_webhook
193+
fi
194+
177195
# Revert the changes applied by the integration/kubernetes/init.sh
178196
# script when it was called in our setup.sh.
179197
info "Clean up the environment"

kata-webhook/README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Kata Admission controller webhook
22

3-
Implement a simple admission controller webhook to annotate pods with the
3+
Implement a simple admission controller webhook to annotate pods with the
44
Kata runtime class.
55

66
## How to build the admission controller
@@ -14,10 +14,10 @@ Kubernetes YAML files required to instantiate the admission
1414
controller.
1515

1616
```bash
17-
$ docker build -t quay.io/kata-containers/kata-webhook-example:latest -f Dockerfile .
17+
docker build -t quay.io/kata-containers/kata-webhook-example:latest -f Dockerfile .
1818
```
1919

20-
> **Note:**
20+
> **Note**
2121
> Image needs to be published for the webhook needs to work. Alternately
2222
> on a single machine cluster change the `imagePullPolicy` to use the locally
2323
> built image.
@@ -30,29 +30,31 @@ by default, except for workloads we know for sure will not work with Kata, use
3030
the [admission webhook](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#admission-webhooks)
3131
and sample admission controller we created by running the commands below:
3232

33-
> **Note:**
33+
> **Note**
34+
>
3435
> By default, the `runtimeClass` name used in this webhook is `kata`. If your
3536
> cluster is configured with another `runtimeClass`, you'll need to change the
3637
> value of the `RUNTIME_CLASS` environment variable defined in the
37-
> [webhook file](deploy/webhook.yaml). You can manually edit the file or use
38-
> the `yq` tool. E.g:
39-
> `~/go/bin/yq w -i webhook.yaml spec.template.spec.containers[0].env[0].value "kata-clh"`
38+
> [webhook file](deploy/webhook.yaml). You can manually edit the file or run:
39+
>
40+
> `export RUNTIME_CLASS=<>`
41+
>
42+
> `kubectl create cm kata-webhook --from-literal runtime_class=$RUNTIME_CLASS`
4043
4144
```bash
42-
$ ./create_certs.sh
43-
$ kubectl apply -f deploy/
45+
./create-certs.sh
46+
kubectl apply -f deploy/
4447
```
4548

4649
Afterwards you can run the `webhook-check.sh` script to check the webhook was
4750
deployed correctly and is working:
4851

4952
```bash
50-
$ ./webhook-check.sh
53+
./webhook-check.sh
5154
```
5255

5356
The webhook mutates pods to use the Kata runtime class for all pods except
54-
those with
57+
those with
5558

56-
* `hostNetwork: true`
59+
* `hostNetwork: true`
5760
* namespace: `rook-ceph` and `rook-ceph-system`
58-

kata-webhook/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ func annotatePodMutator(_ context.Context, ar *kwhmodel.AdmissionReview, obj met
5454

5555
if pod.GetNamespace() == "sonobuoy" {
5656
fmt.Println("sonobuoy pods will not be changed to kata", pod.GetNamespace(), pod.GetName())
57+
return &kwhmutating.MutatorResult{}, nil
5758
}
5859

5960
for i := range pod.Spec.Containers {

versions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ externals:
7272
sonobuoy:
7373
description: "Tool to run kubernetes e2e conformance tests"
7474
url: "https://github.com/vmware-tanzu/sonobuoy"
75-
version: "0.50.0"
75+
version: "0.56.16"
7676

7777
# This section contains versions used by the OpenShift CI jobs scripts.
7878
openshift-ci:

0 commit comments

Comments
 (0)