From a156288c1f8251bdd3231ec765d324f95a3da33e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 17 Aug 2021 14:26:12 +0200 Subject: [PATCH 1/9] workflows: Add "stable" & "latest" tags to kata-deploy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When releasing a tarball, let's *also* add the "stable" & "latest" tags to the kata-deploy image. The "stable" tag refers to any official release, while the "latest" tag refers to any pre-release / release candidate. Fixes: #2302 Signed-off-by: Fabiano Fidêncio --- .github/workflows/release.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 16799bda4e..418e74a9d8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -100,10 +100,14 @@ jobs: run: | # tag the container image we created and push to DockerHub tag=$(echo $GITHUB_REF | cut -d/ -f3-) - docker tag katadocker/kata-deploy-ci:${{steps.build-and-push-kata-deploy-ci.outputs.PKG_SHA}} katadocker/kata-deploy:${tag} - docker tag quay.io/kata-containers/kata-deploy-ci:${{steps.build-and-push-kata-deploy-ci.outputs.PKG_SHA}} quay.io/kata-containers/kata-deploy:${tag} - docker push katadocker/kata-deploy:${tag} - docker push quay.io/kata-containers/kata-deploy:${tag} + tags=$(tag) + tags+=$([[ "$tag" =~ "alpha"|"rc" ]] && echo "latest" || echo "stable") + for tag in ${tags[@]}; do \ + docker tag katadocker/kata-deploy-ci:${{steps.build-and-push-kata-deploy-ci.outputs.PKG_SHA}} katadocker/kata-deploy:${tag} && \ + docker tag quay.io/kata-containers/kata-deploy-ci:${{steps.build-and-push-kata-deploy-ci.outputs.PKG_SHA}} quay.io/kata-containers/kata-deploy:${tag} && \ + docker push katadocker/kata-deploy:${tag} && \ + docker push quay.io/kata-containers/kata-deploy:${tag}; \ + done upload-static-tarball: needs: kata-deploy From a86babe0d04c2cf5b382ed5806c0f40e2fbfb946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 17 Aug 2021 14:28:36 +0200 Subject: [PATCH 2/9] kata-deploy: Point to the `latest` release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of point to a specific release number, let's point to the `latest` tag on the main branch. There's still some work needed in order to point to the `stable` tag on the stable-x.y branches, as this is something that should be done automagically as part of the release process. Signed-off-by: Fabiano Fidêncio --- tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml | 2 +- tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml b/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml index d4aa6d8f23..851e958a4c 100644 --- a/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml +++ b/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml @@ -18,7 +18,7 @@ spec: katacontainers.io/kata-runtime: cleanup containers: - name: kube-kata-cleanup - image: quay.io/kata-containers/kata-deploy:2.3.0-alpha0 + image: quay.io/kata-containers/kata-deploy:latest imagePullPolicy: Always command: [ "bash", "-c", "/opt/kata-artifacts/scripts/kata-deploy.sh reset" ] env: diff --git a/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml b/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml index 7a396f0e4d..a03a56b84e 100644 --- a/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml +++ b/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml @@ -16,7 +16,7 @@ spec: serviceAccountName: kata-label-node containers: - name: kube-kata - image: quay.io/kata-containers/kata-deploy:2.3.0-alpha0 + image: quay.io/kata-containers/kata-deploy:latest imagePullPolicy: Always lifecycle: preStop: From 9acf4e5d32373ae8b0dd171fe87550df2fbd979c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 19 Aug 2021 18:13:40 +0200 Subject: [PATCH 3/9] kata-deploy: Add `stable` yaml files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is **not** the nicest patch of my career, and I know it adds code duplication. However, I've decided to take this approach in order to have easier / better instructions for users who're consuming kata-deploy. Having both stable & latest yaml on `main` will let us point to just one place, without having to update the instructions. I know, would be better to have those generated from a .in file, wouldn't it? For sure, but then we'd lose the ability to just point to those files from kata-deploy pages (either on dockerhub or quay.io). Signed-off-by: Fabiano Fidêncio --- .../base/kata-cleanup-stable.yaml | 46 +++++++++++++ .../kata-deploy/base/kata-deploy-stable.yaml | 69 +++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup-stable.yaml create mode 100644 tools/packaging/kata-deploy/kata-deploy/base/kata-deploy-stable.yaml diff --git a/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup-stable.yaml b/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup-stable.yaml new file mode 100644 index 0000000000..f1d9d0a2f9 --- /dev/null +++ b/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup-stable.yaml @@ -0,0 +1,46 @@ +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: kubelet-kata-cleanup + namespace: kube-system +spec: + selector: + matchLabels: + name: kubelet-kata-cleanup + template: + metadata: + labels: + name: kubelet-kata-cleanup + spec: + serviceAccountName: kata-label-node + nodeSelector: + katacontainers.io/kata-runtime: cleanup + containers: + - name: kube-kata-cleanup + image: quay.io/kata-containers/kata-deploy:stable + imagePullPolicy: Always + command: [ "bash", "-c", "/opt/kata-artifacts/scripts/kata-deploy.sh reset" ] + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + securityContext: + privileged: false + volumeMounts: + - name: dbus + mountPath: /var/run/dbus + - name: systemd + mountPath: /run/systemd + volumes: + - name: dbus + hostPath: + path: /var/run/dbus + - name: systemd + hostPath: + path: /run/systemd + updateStrategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate diff --git a/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy-stable.yaml b/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy-stable.yaml new file mode 100644 index 0000000000..346e4c0ee2 --- /dev/null +++ b/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy-stable.yaml @@ -0,0 +1,69 @@ +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: kata-deploy + namespace: kube-system +spec: + selector: + matchLabels: + name: kata-deploy + template: + metadata: + labels: + name: kata-deploy + spec: + serviceAccountName: kata-label-node + containers: + - name: kube-kata + image: quay.io/kata-containers/kata-deploy:stable + imagePullPolicy: Always + lifecycle: + preStop: + exec: + command: ["bash", "-c", "/opt/kata-artifacts/scripts/kata-deploy.sh cleanup"] + command: [ "bash", "-c", "/opt/kata-artifacts/scripts/kata-deploy.sh install" ] + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + securityContext: + privileged: false + volumeMounts: + - name: crio-conf + mountPath: /etc/crio/ + - name: containerd-conf + mountPath: /etc/containerd/ + - name: kata-artifacts + mountPath: /opt/kata/ + - name: dbus + mountPath: /var/run/dbus + - name: systemd + mountPath: /run/systemd + - name: local-bin + mountPath: /usr/local/bin/ + volumes: + - name: crio-conf + hostPath: + path: /etc/crio/ + - name: containerd-conf + hostPath: + path: /etc/containerd/ + - name: kata-artifacts + hostPath: + path: /opt/kata/ + type: DirectoryOrCreate + - name: dbus + hostPath: + path: /var/run/dbus + - name: systemd + hostPath: + path: /run/systemd + - name: local-bin + hostPath: + path: /usr/local/bin/ + updateStrategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate From e54110568072e99c22efdc7178dcf82e4b747669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 19 Aug 2021 18:54:30 +0200 Subject: [PATCH 4/9] kata-deploy: Update the README MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's just point to our repo URLs rather than assume users using kata-deploy will have our repo cloned. Signed-off-by: Fabiano Fidêncio --- tools/packaging/kata-deploy/README.md | 39 ++++++++++++--------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/tools/packaging/kata-deploy/README.md b/tools/packaging/kata-deploy/README.md index e33fab314f..e749541d6e 100644 --- a/tools/packaging/kata-deploy/README.md +++ b/tools/packaging/kata-deploy/README.md @@ -11,15 +11,16 @@ a node only if it uses either containerd or CRI-O CRI-shims. ### Install Kata on a running Kubernetes cluster + ```sh -$ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy -$ kubectl apply -f kata-rbac/base/kata-rbac.yaml -$ kubectl apply -f kata-deploy/base/kata-deploy.yaml +$ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml +$ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml ``` -or on a [k3s](https://k3s.io/) cluster: +### For your [k3s](https://k3s.io/) cluster, do: ```sh +$ GO111MODULE=auto go get github.com/kata-containers/kata-containers $ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy $ kubectl apply -k kata-deploy/overlays/k3s ``` @@ -32,8 +33,7 @@ which will ensure the workload is only scheduled on a node that has Kata Contain `runtimeClass` is a built-in type in Kubernetes. To apply each Kata Containers `runtimeClass`: ```sh - $ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/runtimeclasses - $ kubectl apply -f kata-runtimeClasses.yaml + $ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml ``` The following YAML snippet shows how to specify a workload should use Kata with Cloud Hypervisor: @@ -66,42 +66,37 @@ spec: To run an example with `kata-clh`: ```sh -$ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/examples -$ kubectl apply -f test-deploy-kata-clh.yaml +$ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/examples/test-deploy-kata-clh.yaml ``` To run an example with `kata-fc`: ```sh -$ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/examples -$ kubectl apply -f test-deploy-kata-fc.yaml +$ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/examples/test-deploy-kata-fc.yaml ``` To run an example with `kata-qemu`: ```sh -$ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/examples -$ kubectl apply -f test-deploy-kata-qemu.yaml +$ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/examples/test-deploy-kata-qemu.yaml ``` The following removes the test pods: ```sh -$ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/examples -$ kubectl delete -f test-deploy-kata-clh.yaml -$ kubectl delete -f test-deploy-kata-fc.yaml -$ kubectl delete -f test-deploy-kata-qemu.yaml +$ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/examples/test-deploy-kata-clh.yaml +$ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/examples/test-deploy-kata-fc.yaml +$ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/examples/test-deploy-kata-qemu.yaml ``` ### Remove Kata from the Kubernetes cluster ```sh -$ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy -$ kubectl delete -f kata-deploy/base/kata-deploy.yaml -$ kubectl apply -f kata-cleanup/base/kata-cleanup.yaml -$ kubectl delete -f kata-cleanup/base/kata-cleanup.yaml -$ kubectl delete -f kata-rbac/base/kata-rbac.yaml -$ kubectl delete -f runtimeclasses/kata-runtimeClasses.yaml +$ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml +$ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml +$ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml +$ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml +$ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml ``` ## `kata-deploy` details From ea9b2f9c92597ee9aca2252d208775d7fa79ca3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 19 Aug 2021 19:00:23 +0200 Subject: [PATCH 5/9] kata-deploy: Add "stable" info to the README MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to the instructions we have for the "latest" images, let's also add instructions about the "stable" images. Signed-off-by: Fabiano Fidêncio --- tools/packaging/kata-deploy/README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tools/packaging/kata-deploy/README.md b/tools/packaging/kata-deploy/README.md index e749541d6e..63ca63616f 100644 --- a/tools/packaging/kata-deploy/README.md +++ b/tools/packaging/kata-deploy/README.md @@ -11,13 +11,25 @@ a node only if it uses either containerd or CRI-O CRI-shims. ### Install Kata on a running Kubernetes cluster +#### Installing the latest image + +The latest image refers to pre-release and release candidate content. For stable releases, please, use the "stable" instructions. ```sh $ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml $ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml ``` -### For your [k3s](https://k3s.io/) cluster, do: +#### Installing the stable image + +The stable image refers to the last stable releases content. + +```sh +$ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml +$ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy-stable.yaml +``` + +#### For your [k3s](https://k3s.io/) cluster, do: ```sh $ GO111MODULE=auto go get github.com/kata-containers/kata-containers @@ -91,6 +103,8 @@ $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-conta ### Remove Kata from the Kubernetes cluster +#### Removing the latest image + ```sh $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml $ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml @@ -99,6 +113,16 @@ $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-conta $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml ``` +#### Removing the stable image + +```sh +$ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy-stable.yaml +$ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup-stabe.yaml +$ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup-stable.yaml +$ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml +$ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml +``` + ## `kata-deploy` details ### Dockerfile From 43a72d76e2520ae044335b9f1dbf54c12363f54b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Mon, 20 Sep 2021 14:06:15 +0200 Subject: [PATCH 6/9] release: update the kata-deploy yaml files accordingly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's teach our `update-repository-version.sh` script to properly update the kata-deploy tags on both kata-deploy and kata-cleanup yaml files. The 3 scenarios that we're dealing with, based on which branch we're targetting, are: ``` 1) [main] ------> [main] NO-OP "alpha0" "alpha1" +----------------+----------------+ | from | to | -----------------+----------------+----------------+ kata-deploy | "latest" | "latest" | -----------------+----------------+----------------+ kata-deploy-base | "stable | "stable" | -----------------+----------------+----------------+ 2) [main] ------> [stable] Update kata-deploy and "alpha2" "rc0" get rid of kata-deploy-base +----------------+----------------+ | from | to | -----------------+----------------+----------------+ kata-deploy | "latest" | "rc0" | -----------------+----------------+----------------+ kata-deploy-base | "stable" | REMOVED | -----------------+----------------+----------------+ 3) [stable] ------> [stable] Update kata-deploy "x.y.z" "x.y.(z+1)" +----------------+----------------+ | from | to | -----------------+----------------+----------------+ kata-deploy | "x.y.z" | "x.y.(z+1)" | -----------------+----------------+----------------+ kata-deploy-base | NON-EXISTENT | NON-EXISTENT | -----------------+----------------+----------------+ ``` And we can easily cover those 3 cases only with the information about the "${target_branch}" and the "${new_version}", where: * case 1) if "${target_branch}" is "main" *and* "${new_version}" contains "alpha", do nothing * case 2) if "${target_branch}" is "main" *and* "${new_version}" contains "rc": * change the kata-deploy & kata-cleanup tags from "latest" to "${new_version}". * delete the kata-deploy-stable & kata-cleanup-stable files. * case 3) if the "${target_branch}" contains "stable": * change the kata-deploy & kata-cleanup tags from "${current_version}" to "${new_version}". Signed-off-by: Fabiano Fidêncio --- .../release/update-repository-version.sh | 67 +++++++++++++++++-- 1 file changed, 61 insertions(+), 6 deletions(-) diff --git a/tools/packaging/release/update-repository-version.sh b/tools/packaging/release/update-repository-version.sh index d00c623a03..cded448cc0 100755 --- a/tools/packaging/release/update-repository-version.sh +++ b/tools/packaging/release/update-repository-version.sh @@ -111,13 +111,68 @@ bump_repo() { fi if [ "${repo}" == "kata-containers" ]; then - info "Updating kata-deploy / kata-cleanup image tags" - sed -i "s#quay.io/kata-containers/kata-deploy:${current_version}#quay.io/kata-containers/kata-deploy:${new_version}#g" tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml - sed -i "s#quay.io/kata-containers/kata-deploy:${current_version}#quay.io/kata-containers/kata-deploy:${new_version}#g" tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml - git diff + # Here there are 3 scenarios of what we can do, based on + # which branch we're targetting: + # + # 1) [main] ------> [main] NO-OP + # "alpha0" "alpha1" + # + # +----------------+----------------+ + # | from | to | + # -----------------+----------------+----------------+ + # kata-deploy | "latest" | "latest" | + # -----------------+----------------+----------------+ + # kata-deploy-base | "stable | "stable" | + # -----------------+----------------+----------------+ + # + # + # 2) [main] ------> [stable] Update kata-deploy and + # "alpha2" "rc0" get rid of kata-deploy-base + # + # +----------------+----------------+ + # | from | to | + # -----------------+----------------+----------------+ + # kata-deploy | "latest" | "rc0" | + # -----------------+----------------+----------------+ + # kata-deploy-base | "stable" | REMOVED | + # -----------------+----------------+----------------+ + # + # + # 3) [stable] ------> [stable] Update kata-deploy + # "x.y.z" "x.y.(z+1)" + # + # +----------------+----------------+ + # | from | to | + # -----------------+----------------+----------------+ + # kata-deploy | "x.y.z" | "x.y.(z+1)" | + # -----------------+----------------+----------------+ + # kata-deploy-base | NON-EXISTENT | NON-EXISTENT | + # -----------------+----------------+----------------+ - git add tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml - git add tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml + info "Updating kata-deploy / kata-cleanup image tags" + if [ "${target_branch}" == "main" ] && [[ "${new_version}" =~ "rc" ]]; then + # case 2) + ## change the "latest" tag to the "#{new_version}" one + sed -i "s#quay.io/kata-containers/kata-deploy:latest#quay.io/kata-containers/kata-deploy:${new_version}#g" tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml + sed -i "s#quay.io/kata-containers/kata-deploy:latest#quay.io/kata-containers/kata-deploy:${new_version}#g" tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml + + git diff + + git add tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml + git add tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml + + ## and remove the kata-deploy & kata-cleanup stable yaml files + git rm tools/packaging/kata-deploy/kata-deploy/base/kata-deploy-stable.yaml + git rm tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup-stable.yaml + elif [[ "${target_branch}" =~ "stable" ]]; then + # case 3) + sed -i "s#quay.io/kata-containers/kata-deploy:${current_version}#quay.io/kata-containers/kata-deploy:${new_version}#g" tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml + sed -i "s#quay.io/kata-containers/kata-deploy:${current_version}#quay.io/kata-containers/kata-deploy:${new_version}#g" tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml + git diff + + git add tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml + git add tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml + fi fi info "Creating PR message" From debf3c9fe920f16a4cd51ba83aedba6bf560b058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 21 Sep 2021 14:55:55 +0200 Subject: [PATCH 7/9] kata-deploy: Remove qemu-virtiofs runtime class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's only one QEMU runtime class deployed as part of kata-deploy, and that includes virtiofs support (which is the default for quite some time already). Knowing this, let's just remove the `qemu-virtiofs` runtime class definition. Signed-off-by: Fabiano Fidêncio --- .../runtimeclasses/kata-runtimeClasses.yaml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml b/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml index fd8bc858be..9695ba6572 100644 --- a/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml +++ b/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml @@ -1,19 +1,6 @@ --- kind: RuntimeClass apiVersion: node.k8s.io/v1beta1 -metadata: - name: kata-qemu-virtiofs -handler: kata-qemu-virtiofs -overhead: - podFixed: - memory: "160Mi" - cpu: "250m" -scheduling: - nodeSelector: - katacontainers.io/kata-runtime: "true" ---- -kind: RuntimeClass -apiVersion: node.k8s.io/v1beta1 metadata: name: kata-qemu handler: kata-qemu From 41c590fa0a03ca79db0e7cf96717922f3415a7d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 21 Sep 2021 22:12:24 +0200 Subject: [PATCH 8/9] kata-deploy: Improve README MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's add more instructions in the README in order to make clear to the reader what they can do to check whether kata-deploy is ready, or whether they have to wait till proceeding with the next instruction. Suggested-by: Eric Adams Signed-off-by: Fabiano Fidêncio --- tools/packaging/kata-deploy/README.md | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/packaging/kata-deploy/README.md b/tools/packaging/kata-deploy/README.md index 63ca63616f..cff1a831a1 100644 --- a/tools/packaging/kata-deploy/README.md +++ b/tools/packaging/kata-deploy/README.md @@ -37,6 +37,11 @@ $ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata $ kubectl apply -k kata-deploy/overlays/k3s ``` +#### Ensure kata-deploy is ready +```sh +kubectl -n kube-system wait --timeout=10m --for=condition=Ready -l name=kata-deploy pod +``` + ### Run a sample workload Workloads specify the runtime they'd like to utilize by setting the appropriate `runtimeClass` object within @@ -107,7 +112,20 @@ $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-conta ```sh $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml +$ kubectl -n kube-system wait --timeout=10m --for=delete -l name=kata-deploy pod +``` + +After ensuring kata-deploy has been deleted, cleanup the cluster: +```sh $ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml +``` + +The cleanup daemon-set will run a single time, cleaning up the node-label, which makes it difficult to check in an automated fashion. +This process should take, at most, 5 minutes. + +After that, let's delete the cleanup daemon-set, the added RBAC and runtime classes: + +```sh $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml @@ -117,7 +135,19 @@ $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-conta ```sh $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy-stable.yaml +$ kubectl -n kube-system wait --timeout=10m --for=delete -l name=kata-deploy pod +``` + +After ensuring kata-deploy has been deleted, cleanup the cluster: +```sh $ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup-stabe.yaml +``` + +The cleanup daemon-set will run a single time, cleaning up the node-label, which makes it difficult to check in an automated fashion. +This process should take, at most, 5 minutes. + +After that, let's delete the cleanup daemon-set, the added RBAC and runtime classes: +```sh $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup-stable.yaml $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml $ kubectl delete -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml From 3bdcfaa6583025c4d37521d0e681827e886f1ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 21 Sep 2021 22:18:12 +0200 Subject: [PATCH 9/9] kata-deploy: Add more info about the stable tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's make it as clear as possible for the user that if they go for a tagged version of kata-deploy, eg, 2.2.1, they'll have the kata runtime 2.2.1 deployed on their cluster. Suggested-by: Eric Adams Signed-off-by: Fabiano Fidêncio --- tools/packaging/kata-deploy/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/packaging/kata-deploy/README.md b/tools/packaging/kata-deploy/README.md index cff1a831a1..9f54f0a728 100644 --- a/tools/packaging/kata-deploy/README.md +++ b/tools/packaging/kata-deploy/README.md @@ -24,6 +24,9 @@ $ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-contai The stable image refers to the last stable releases content. +Note that if you use a tagged version of the repo, the stable image does match that version. +For instance, if you use the 2.2.1 tagged version of the kata-deploy.yaml file, then the version 2.2.1 of the kata runtime will be deployed. + ```sh $ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml $ kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy-stable.yaml