Add toleration to ansible-api deployment

A toleration needs to be added to all resources that create pods since
the node-role.kubernetes.io/master taint will be restored to all master
nodes. This ensures that the pods will run on the master node.

Test plan:

- Building and installing a new iso with this patch and the taint
applied. The armada-api pod was able to run on the tainted node.
- Confirmed that toleration is present when describing the armada pod.

Story: 2009232
Task: 43482
Change-Id: I7ec3a3753b49099279450d6228cce8915bc77cd2
This commit is contained in:
Enzo Candotti 2021-09-29 17:53:03 -03:00
parent 030f277a16
commit b97f3ebade
2 changed files with 59 additions and 0 deletions

View File

@ -19,6 +19,7 @@ Patch1: 0001-Add-Helm-v2-client-initialization-using-tiller-postS.patch
Patch2: 0002-Tiller-wait-for-postgres-database-ping.patch
Patch3: 0003-Update-the-liveness-probe-to-verify-postgres-connect.patch
Patch4: 0004-Update-postgres-liveness-check-to-support-IPv6-addre.patch
Patch5: 0005-Add-toleration-to-armada-api.patch
BuildArch: noarch
@ -35,6 +36,7 @@ BuildRequires: chartmuseum
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
# Package the armada chart tarball using methodology derived from:

View File

@ -0,0 +1,57 @@
From 8f38dcdc7ba6448487283d14a745b8c299c47a13 Mon Sep 17 00:00:00 2001
From: Enzo Candotti <enzo.candotti@windriver.com>
Date: Wed, 6 Oct 2021 18:25:10 -0300
Subject: [PATCH] Add toleration to armada-api
---
charts/armada/templates/deployment-api.yaml | 4 ++++
charts/armada/templates/tests/test-armada-api.yaml | 4 ++++
charts/armada/values.yaml | 2 ++
3 files changed, 10 insertions(+)
diff --git a/charts/armada/templates/deployment-api.yaml b/charts/armada/templates/deployment-api.yaml
index d4eff7a..1859d99 100644
--- a/charts/armada/templates/deployment-api.yaml
+++ b/charts/armada/templates/deployment-api.yaml
@@ -108,6 +108,10 @@ spec:
initContainers:
{{ tuple $envAll "api" $mounts_armada_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
{{ dict "envAll" $envAll "application" "armada" "container" "armada_api_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
+{{- with .Values.pod.tolerations.api }}
+ tolerations:
+{{ toYaml . | indent 8 }}
+{{- end }}
containers:
- name: armada-api
{{ tuple $envAll "api" | include "helm-toolkit.snippets.image" | indent 10 }}
diff --git a/charts/armada/templates/tests/test-armada-api.yaml b/charts/armada/templates/tests/test-armada-api.yaml
index a467fc9..2733cfe 100644
--- a/charts/armada/templates/tests/test-armada-api.yaml
+++ b/charts/armada/templates/tests/test-armada-api.yaml
@@ -32,6 +32,10 @@ metadata:
spec:
{{ dict "envAll" $envAll "application" "api_test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
restartPolicy: Never
+{{- with .Values.pod.tolerations.api }}
+ tolerations:
+{{ toYaml . | indent 4 }}
+{{- end }}
nodeSelector:
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
containers:
diff --git a/charts/armada/values.yaml b/charts/armada/values.yaml
index e583947..247b15e 100644
--- a/charts/armada/values.yaml
+++ b/charts/armada/values.yaml
@@ -206,6 +206,8 @@ monitoring:
port: 8000
pod:
+ tolerations:
+ api: []
mandatory_access_control:
type: apparmor
armada-api:
--
2.25.1