Use control-plane label for Tolerations

Upstream has deprecated 'node-role.kubernetes.io/master'
to use 'node-role.kubernetes.io/control-plane' in k8s 1.24.

Platform and applications need to be updated to use 'control-plane'
with nodeSelector/Tolerations so we may move away from 'master'.

This updates pod Tolerations to support both:
- 'node-role.kubernetes.io/master'
- 'node-role.kubernetes.io/control-plane'

Created new patch file to add Tolerations for deployment and jobs

Note: Portieris is not supported in the current release so we just
need the code inspection for now.

Story: 2010301
Task: 46676

Signed-off-by: Boovan Rajendran <boovan.rajendran@windriver.com>
Change-Id: Ic41f7702c3b017ad2dc5c8666184970c94ccee41
This commit is contained in:
Boovan Rajendran 2022-10-28 13:43:57 -04:00
parent c89631891d
commit 88ee0c59df
3 changed files with 239 additions and 0 deletions

@ -0,0 +1,119 @@
From ed8b4b884a2a73b07934461206db66adf8da8218 Mon Sep 17 00:00:00 2001
From: Boovan Rajendran <boovan.rajendran@windriver.com>
Date: Fri, 28 Oct 2022 10:37:56 -0400
Subject: [PATCH] Add toleration to deployment and jobs
The tolerations address the nodeselectors for kubernetes versions 1.24 and earlier.
Signed-off-by: Rafael Camargos <RafaelLucas.Camargos@windriver.com>
---
.../admission-webhooks/create-admission-webhooks.yaml | 3 +++
.../admission-webhooks/delete-admission-webhooks.yaml | 3 +++
helm/portieris/templates/crd-creation/create-crds.yaml | 3 +++
helm/portieris/templates/crd-creation/delete-crds.yaml | 3 +++
.../templates/crd-creation/validate-crd-creation.yaml | 3 +++
helm/portieris/templates/default/create-default-policies.yaml | 3 +++
helm/portieris/templates/deployment.yaml | 3 +++
7 files changed, 21 insertions(+)
diff --git a/helm/portieris/templates/admission-webhooks/create-admission-webhooks.yaml b/helm/portieris/templates/admission-webhooks/create-admission-webhooks.yaml
index fe3e5c2..6674602 100644
--- a/helm/portieris/templates/admission-webhooks/create-admission-webhooks.yaml
+++ b/helm/portieris/templates/admission-webhooks/create-admission-webhooks.yaml
@@ -31,6 +31,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/admission-webhooks/delete-admission-webhooks.yaml b/helm/portieris/templates/admission-webhooks/delete-admission-webhooks.yaml
index e8edc3d..abd1538 100644
--- a/helm/portieris/templates/admission-webhooks/delete-admission-webhooks.yaml
+++ b/helm/portieris/templates/admission-webhooks/delete-admission-webhooks.yaml
@@ -27,6 +27,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/crd-creation/create-crds.yaml b/helm/portieris/templates/crd-creation/create-crds.yaml
index 2033ee6..1237920 100644
--- a/helm/portieris/templates/crd-creation/create-crds.yaml
+++ b/helm/portieris/templates/crd-creation/create-crds.yaml
@@ -27,6 +27,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/crd-creation/delete-crds.yaml b/helm/portieris/templates/crd-creation/delete-crds.yaml
index 894598a..b0a3c0a 100644
--- a/helm/portieris/templates/crd-creation/delete-crds.yaml
+++ b/helm/portieris/templates/crd-creation/delete-crds.yaml
@@ -27,6 +27,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/crd-creation/validate-crd-creation.yaml b/helm/portieris/templates/crd-creation/validate-crd-creation.yaml
index 58e501e..430c1ab 100644
--- a/helm/portieris/templates/crd-creation/validate-crd-creation.yaml
+++ b/helm/portieris/templates/crd-creation/validate-crd-creation.yaml
@@ -27,6 +27,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/default/create-default-policies.yaml b/helm/portieris/templates/default/create-default-policies.yaml
index fae1597..6f55ccc 100644
--- a/helm/portieris/templates/default/create-default-policies.yaml
+++ b/helm/portieris/templates/default/create-default-policies.yaml
@@ -27,6 +27,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/deployment.yaml b/helm/portieris/templates/deployment.yaml
index e6c4184..7835f29 100644
--- a/helm/portieris/templates/deployment.yaml
+++ b/helm/portieris/templates/deployment.yaml
@@ -29,6 +29,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.host | default "docker.io/ibmcom" }}/{{ .Values.image.image }}:{{ .Values.image.tag }}"
--
2.25.1

@ -3,3 +3,4 @@
0003-add-toggle-to-reinstall-the-admission-webhook.patch
0004-run-admission-webhooks-as-non-root.patch
0005-add-toleration.patch
0006-Add-toleration-to-deployment-and-jobs.patch

@ -0,0 +1,119 @@
From ed8b4b884a2a73b07934461206db66adf8da8218 Mon Sep 17 00:00:00 2001
From: Boovan Rajendran <boovan.rajendran@windriver.com>
Date: Fri, 28 Oct 2022 10:37:56 -0400
Subject: [PATCH] Add toleration to deployment and jobs
The tolerations address the nodeselectors for kubernetes versions 1.24 and earlier.
Signed-off-by: Rafael Camargos <RafaelLucas.Camargos@windriver.com>
---
.../admission-webhooks/create-admission-webhooks.yaml | 3 +++
.../admission-webhooks/delete-admission-webhooks.yaml | 3 +++
helm/portieris/templates/crd-creation/create-crds.yaml | 3 +++
helm/portieris/templates/crd-creation/delete-crds.yaml | 3 +++
.../templates/crd-creation/validate-crd-creation.yaml | 3 +++
helm/portieris/templates/default/create-default-policies.yaml | 3 +++
helm/portieris/templates/deployment.yaml | 3 +++
7 files changed, 21 insertions(+)
diff --git a/helm/portieris/templates/admission-webhooks/create-admission-webhooks.yaml b/helm/portieris/templates/admission-webhooks/create-admission-webhooks.yaml
index fe3e5c2..6674602 100644
--- a/helm/portieris/templates/admission-webhooks/create-admission-webhooks.yaml
+++ b/helm/portieris/templates/admission-webhooks/create-admission-webhooks.yaml
@@ -31,6 +31,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/admission-webhooks/delete-admission-webhooks.yaml b/helm/portieris/templates/admission-webhooks/delete-admission-webhooks.yaml
index e8edc3d..abd1538 100644
--- a/helm/portieris/templates/admission-webhooks/delete-admission-webhooks.yaml
+++ b/helm/portieris/templates/admission-webhooks/delete-admission-webhooks.yaml
@@ -27,6 +27,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/crd-creation/create-crds.yaml b/helm/portieris/templates/crd-creation/create-crds.yaml
index 2033ee6..1237920 100644
--- a/helm/portieris/templates/crd-creation/create-crds.yaml
+++ b/helm/portieris/templates/crd-creation/create-crds.yaml
@@ -27,6 +27,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/crd-creation/delete-crds.yaml b/helm/portieris/templates/crd-creation/delete-crds.yaml
index 894598a..b0a3c0a 100644
--- a/helm/portieris/templates/crd-creation/delete-crds.yaml
+++ b/helm/portieris/templates/crd-creation/delete-crds.yaml
@@ -27,6 +27,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/crd-creation/validate-crd-creation.yaml b/helm/portieris/templates/crd-creation/validate-crd-creation.yaml
index 58e501e..430c1ab 100644
--- a/helm/portieris/templates/crd-creation/validate-crd-creation.yaml
+++ b/helm/portieris/templates/crd-creation/validate-crd-creation.yaml
@@ -27,6 +27,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/default/create-default-policies.yaml b/helm/portieris/templates/default/create-default-policies.yaml
index fae1597..6f55ccc 100644
--- a/helm/portieris/templates/default/create-default-policies.yaml
+++ b/helm/portieris/templates/default/create-default-policies.yaml
@@ -27,6 +27,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: hyperkube
image: "{{ .Values.hyperkube.repository }}:{{ .Values.hyperkube.tag }}"
diff --git a/helm/portieris/templates/deployment.yaml b/helm/portieris/templates/deployment.yaml
index e6c4184..7835f29 100644
--- a/helm/portieris/templates/deployment.yaml
+++ b/helm/portieris/templates/deployment.yaml
@@ -29,6 +29,9 @@ spec:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
+ - key: "node-role.kubernetes.io/control-plane"
+ operator: "Exists"
+ effect: "NoSchedule"
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.host | default "docker.io/ibmcom" }}/{{ .Values.image.image }}:{{ .Values.image.tag }}"
--
2.25.1