Add node selectors and tolerations for windows

pull/1872/head
Eliyam Levy 2022-04-26 16:01:45 -04:00
parent 7fbdc4e0bd
commit daa518a32d
10 changed files with 123 additions and 15 deletions

View File

@ -1,6 +1,6 @@
--- charts-original/Chart.yaml --- charts-original/Chart.yaml
+++ charts/Chart.yaml +++ charts/Chart.yaml
@@ -1,10 +1,25 @@ @@ -1,10 +1,26 @@
+annotations: +annotations:
+ catalog.cattle.io/auto-install: rancher-gatekeeper-crd=match + catalog.cattle.io/auto-install: rancher-gatekeeper-crd=match
+ catalog.cattle.io/certified: rancher + catalog.cattle.io/certified: rancher
@ -8,6 +8,7 @@
+ catalog.cattle.io/kube-version: '>= 1.16.0-0' + catalog.cattle.io/kube-version: '>= 1.16.0-0'
+ catalog.cattle.io/namespace: cattle-gatekeeper-system + catalog.cattle.io/namespace: cattle-gatekeeper-system
+ catalog.cattle.io/os: linux + catalog.cattle.io/os: linux
+ catalog.cattle.io/permits-os: linux,windows
+ catalog.cattle.io/provides-gvr: config.gatekeeper.sh.config/v1alpha1 + catalog.cattle.io/provides-gvr: config.gatekeeper.sh.config/v1alpha1
+ catalog.cattle.io/rancher-version: '>= 2.6.0-0 <= 2.6.100-0' + catalog.cattle.io/rancher-version: '>= 2.6.0-0 <= 2.6.100-0'
+ catalog.cattle.io/release-name: rancher-gatekeeper + catalog.cattle.io/release-name: rancher-gatekeeper

View File

@ -1,11 +1,9 @@
--- charts-original/templates/_helpers.tpl --- charts-original/templates/_helpers.tpl
+++ charts/templates/_helpers.tpl +++ charts/templates/_helpers.tpl
@@ -38,4 +38,12 @@ @@ -38,4 +38,27 @@
{{- if .Values.podLabels }} {{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 8 }} {{- toYaml .Values.podLabels | nindent 8 }}
{{- end }} {{- end }}
-{{- end -}}
\ No newline at end of file
+{{- end -}} +{{- end -}}
+ +
+{{- define "system_default_registry" -}} +{{- define "system_default_registry" -}}
@ -15,3 +13,19 @@
+{{- "" -}} +{{- "" -}}
+{{- end -}} +{{- end -}}
+{{- end -}} +{{- end -}}
+
+{{/*
+Windows cluster will add default taint for linux nodes,
+add below linux tolerations to workloads could be scheduled to those linux nodes
+*/}}
+{{- define "linux-node-tolerations" -}}
+- key: "cattle.io/os"
+ value: "linux"
+ effect: "NoSchedule"
+ operator: "Equal"
+{{- end -}}
+
+{{- define "linux-node-selector" -}}
+kubernetes.io/os: linux
{{- end -}}
\ No newline at end of file

View File

@ -11,12 +11,30 @@
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz path: /healthz
@@ -102,7 +102,7 @@ @@ -102,16 +102,20 @@
dnsPolicy: {{ .Values.audit.dnsPolicy }} dnsPolicy: {{ .Values.audit.dnsPolicy }}
hostNetwork: {{ .Values.audit.hostNetwork }} hostNetwork: {{ .Values.audit.hostNetwork }}
imagePullSecrets: imagePullSecrets:
- {{- toYaml .Values.image.pullSecrets | nindent 8 }} - {{- toYaml .Values.image.pullSecrets | nindent 8 }}
- nodeSelector:
- {{- toYaml .Values.audit.nodeSelector | nindent 8 }}
- {{- if .Values.audit.priorityClassName }}
+ {{- toYaml .Values.images.pullSecrets | nindent 8 }} + {{- toYaml .Values.images.pullSecrets | nindent 8 }}
nodeSelector: + nodeSelector: {{ include "linux-node-selector" . | nindent 8 }}
{{- toYaml .Values.audit.nodeSelector | nindent 8 }} +{{- if .Values.audit.nodeSelector }}
{{- if .Values.audit.priorityClassName }} +{{ toYaml .Values.audit.nodeSelector | indent 8 }}
+{{- end }}
+ {{- if .Values.audit.priorityClassName }}
priorityClassName: {{ .Values.audit.priorityClassName }}
{{- end }}
serviceAccountName: gatekeeper-admin
terminationGracePeriodSeconds: 60
- tolerations:
- {{- toYaml .Values.audit.tolerations | nindent 8 }}
+ tolerations: {{ include "linux-node-tolerations" . | nindent 8 }}
+{{- if .Values.audit.tolerations }}
+{{ toYaml .Values.audit.tolerations | indent 8 }}
+{{- end }}
volumes:
{{- if .Values.audit.writeToRAMDisk }}
- emptyDir:

View File

@ -11,12 +11,33 @@
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz path: /healthz
@@ -115,7 +115,7 @@ @@ -115,18 +115,22 @@
dnsPolicy: {{ .Values.controllerManager.dnsPolicy }} dnsPolicy: {{ .Values.controllerManager.dnsPolicy }}
hostNetwork: {{ .Values.controllerManager.hostNetwork }} hostNetwork: {{ .Values.controllerManager.hostNetwork }}
imagePullSecrets: imagePullSecrets:
- {{- toYaml .Values.image.pullSecrets | nindent 8 }} - {{- toYaml .Values.image.pullSecrets | nindent 8 }}
- nodeSelector:
- {{- toYaml .Values.controllerManager.nodeSelector | nindent 8 }}
+ {{- toYaml .Values.images.pullSecrets | nindent 8 }} + {{- toYaml .Values.images.pullSecrets | nindent 8 }}
nodeSelector: + nodeSelector: {{ include "linux-node-selector" . | nindent 8 }}
{{- toYaml .Values.controllerManager.nodeSelector | nindent 8 }} +{{- if .Values.controllerManager.nodeSelector }}
+{{ toYaml .Values.controllerManager.nodeSelector | indent 8 }}
+{{- end }}
{{- if .Values.controllerManager.priorityClassName }} {{- if .Values.controllerManager.priorityClassName }}
priorityClassName: {{ .Values.controllerManager.priorityClassName }}
{{- end }}
serviceAccountName: gatekeeper-admin
terminationGracePeriodSeconds: 60
- tolerations:
- {{- toYaml .Values.controllerManager.tolerations | nindent 8 }}
+ tolerations: {{ include "linux-node-tolerations" . | nindent 8 }}
+{{- if .Values.controllerManager.tolerations }}
+{{ toYaml .Values.controllerManager.tolerations | indent 8 }}
+{{- end }}
volumes:
- name: cert
secret:
defaultMode: 420
- secretName: gatekeeper-webhook-server-cert
+ secretName: gatekeeper-webhook-server-cert
\ No newline at end of file

View File

@ -1,7 +1,13 @@
--- charts-original/templates/namespace-post-install.yaml --- charts-original/templates/namespace-post-install.yaml
+++ charts/templates/namespace-post-install.yaml +++ charts/templates/namespace-post-install.yaml
@@ -30,7 +30,7 @@ @@ -26,11 +26,11 @@
kubernetes.io/os: linux {{- .Values.postInstall.labelNamespace.image.pullSecrets | toYaml | nindent 12 }}
{{- end }}
serviceAccount: gatekeeper-update-namespace-label
- nodeSelector:
- kubernetes.io/os: linux
+ nodeSelector: {{ include "linux-node-selector" . | nindent 8 }}
+ tolerations: {{ include "linux-node-tolerations" . | nindent 8 }}
containers: containers:
- name: kubectl-label - name: kubectl-label
- image: "{{ .Values.postInstall.labelNamespace.image.repository }}:{{ .Values.postInstall.labelNamespace.image.tag }}" - image: "{{ .Values.postInstall.labelNamespace.image.repository }}:{{ .Values.postInstall.labelNamespace.image.tag }}"

View File

@ -19,3 +19,13 @@
args: args:
- apply - apply
- -f - -f
@@ -98,7 +98,6 @@
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
- nodeSelector:
- kubernetes.io/os: linux
-
+ nodeSelector: {{ include "linux-node-selector" . | nindent 8 }}
+ tolerations: {{ include "linux-node-tolerations" . | nindent 8 }}
{{- end }}

View File

@ -31,6 +31,24 @@
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
pullSecrets: [] pullSecrets: []
podAnnotations: podAnnotations:
@@ -59,7 +62,7 @@
topologyKey: kubernetes.io/hostname
weight: 100
tolerations: []
- nodeSelector: { kubernetes.io/os: linux }
+ nodeSelector: {}
resources:
limits:
cpu: 1000m
@@ -75,7 +78,7 @@
priorityClassName: system-cluster-critical
affinity: {}
tolerations: []
- nodeSelector: { kubernetes.io/os: linux }
+ nodeSelector: {}
writeToRAMDisk: false
resources:
limits:
@@ -89,6 +92,12 @@ @@ -89,6 +92,12 @@
pdb: pdb:
controllerManager: controllerManager:

View File

@ -1,5 +1,5 @@
url: https://open-policy-agent.github.io/gatekeeper/charts/gatekeeper-3.7.1.tgz url: https://open-policy-agent.github.io/gatekeeper/charts/gatekeeper-3.7.1.tgz
version: 100.1.0 version: 100.1.1
additionalCharts: additionalCharts:
- workingDir: charts-crd - workingDir: charts-crd
crdOptions: crdOptions:

View File

@ -16,6 +16,14 @@ spec:
app: {{ .Chart.Name }} app: {{ .Chart.Name }}
spec: spec:
serviceAccountName: {{ .Chart.Name }}-manager serviceAccountName: {{ .Chart.Name }}-manager
nodeSelector: {{ include "linux-node-selector" . | nindent 8 }}
{{- if .Values.nodeSelector }}
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
tolerations: {{ include "linux-node-tolerations" . | nindent 8 }}
{{- if .Values.tolerations }}
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsUser: 1000 runAsUser: 1000
@ -56,6 +64,14 @@ spec:
app: {{ .Chart.Name }} app: {{ .Chart.Name }}
spec: spec:
serviceAccountName: {{ .Chart.Name }}-manager serviceAccountName: {{ .Chart.Name }}-manager
nodeSelector: {{ include "linux-node-selector" . | nindent 8 }}
{{- if .Values.nodeSelector }}
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
tolerations: {{ include "linux-node-tolerations" . | nindent 8 }}
{{- if .Values.tolerations }}
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsUser: 1000 runAsUser: 1000

View File

@ -12,3 +12,7 @@ rancher-webhook:
- 1.0.5+up0.2.6-rc3 - 1.0.5+up0.2.6-rc3
system-upgrade-controller: system-upgrade-controller:
- 100.0.3+up0.3.2 - 100.0.3+up0.3.2
rancher-gatekeeper:
- 100.1.1+up3.7.1
rancher-gatekeeper-crd:
- 100.1.1+up3.7.1