From 5ec9ae0f0498b7366fc85ed1448d36e3c9b6ac35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Wed, 12 Apr 2023 21:13:41 +0200 Subject: [PATCH] kata-deploy: Use readinessProbe to ensure everything is ready MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit readinessProbe will help us to only have the kata-deploy pod marked as Ready when it finishes all the needed configurations in the node. Related: #6649 Signed-off-by: Fabiano FidĂȘncio --- .../packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml | 3 +++ tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml | 3 +++ tools/packaging/kata-deploy/scripts/kata-deploy.sh | 2 ++ 3 files changed, 8 insertions(+) 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 095876b732..23c3efe028 100644 --- a/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml +++ b/tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml @@ -21,6 +21,9 @@ spec: image: quay.io/kata-containers/kata-deploy:latest imagePullPolicy: Always command: [ "bash", "-c", "/opt/kata-artifacts/scripts/kata-deploy.sh reset" ] + readinessProbe: + exec: + command: [ "bash", "-c", "[ -f /opt/kata/kata-deployed ]", "&&", "bash", "-c", "[ $? == 1 ]" ] env: - name: NODE_NAME valueFrom: 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 97e98ee741..5b5d835b6a 100644 --- a/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml +++ b/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml @@ -18,6 +18,9 @@ spec: - name: kube-kata image: quay.io/kata-containers/kata-deploy:latest imagePullPolicy: Always + readinessProbe: + exec: + command: [ "bash", "-c", "[ -f /opt/kata/kata-deployed ]", "&&", "bash", "-c", "[ $? == 0 ]" ] lifecycle: preStop: exec: diff --git a/tools/packaging/kata-deploy/scripts/kata-deploy.sh b/tools/packaging/kata-deploy/scripts/kata-deploy.sh index 8991e04fcf..f6206bc961 100755 --- a/tools/packaging/kata-deploy/scripts/kata-deploy.sh +++ b/tools/packaging/kata-deploy/scripts/kata-deploy.sh @@ -310,11 +310,13 @@ function main() { install_artifacts configure_cri_runtime "$runtime" kubectl label node "$NODE_NAME" --overwrite katacontainers.io/kata-runtime=true + touch /opt/kata/kata-deployed ;; cleanup) cleanup_cri_runtime "$runtime" kubectl label node "$NODE_NAME" --overwrite katacontainers.io/kata-runtime=cleanup remove_artifacts + rm /opt/kata/kata-deployed ;; reset) reset_runtime $runtime