diff --git a/tinkerbell/hegel/templates/deployment.yaml b/tinkerbell/hegel/templates/deployment.yaml index 73af5ed6..1673e8cc 100644 --- a/tinkerbell/hegel/templates/deployment.yaml +++ b/tinkerbell/hegel/templates/deployment.yaml @@ -1,8 +1,10 @@ {{- if .Values.deploy }} {{- $trustedProxies := .Values.trustedProxies }} {{- $roleType := .Values.rbac.type }} +{{- $nodeSelector := .Values.nodeSelector }} {{- if .Values.global }} {{- $trustedProxies = coalesce .Values.trustedProxies .Values.global.trustedProxies }} +{{- $nodeSelector = coalesce .Values.nodeSelector .Values.global.nodeSelector }} {{- $roleType = coalesce .Values.global.rbac.type .Values.rbac.type }} {{- end }} apiVersion: apps/v1 @@ -30,10 +32,6 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} containers: - args: - --backend=kubernetes @@ -65,6 +63,10 @@ spec: cpu: {{ .Values.resources.requests.cpu }} memory: {{ .Values.resources.requests.memory }} serviceAccountName: {{ .Values.name }} + {{- with $nodeSelector }} + nodeSelector: + {{ toYaml . | nindent 8 }} + {{- end }} {{- if .Values.singleNodeClusterConfig.controlPlaneTolerationsEnabled }} tolerations: {{- include "singleNodeClusterConfig" . | indent 6 }} diff --git a/tinkerbell/rufio/templates/deployment.yaml b/tinkerbell/rufio/templates/deployment.yaml index af59fc41..2073fa39 100644 --- a/tinkerbell/rufio/templates/deployment.yaml +++ b/tinkerbell/rufio/templates/deployment.yaml @@ -1,7 +1,9 @@ {{- if .Values.deploy }} {{- $roleType := .Values.rbac.type }} +{{- $nodeSelector := .Values.nodeSelector }} {{- if .Values.global }} {{- $roleType = coalesce .Values.global.rbac.type .Values.rbac.type }} +{{- $nodeSelector = coalesce .Values.nodeSelector .Values.global.nodeSelector }} {{- end }} apiVersion: apps/v1 kind: Deployment @@ -31,10 +33,6 @@ spec: hostNetwork: true dnsPolicy: ClusterFirstWithHostNet {{- end }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} securityContext: runAsNonRoot: true containers: @@ -74,6 +72,10 @@ spec: memory: {{ .Values.resources.requests.memory }} serviceAccountName: {{ .Values.serviceAccountName }} terminationGracePeriodSeconds: 10 + {{- with $nodeSelector }} + nodeSelector: + {{ toYaml . | nindent 8 }} + {{- end }} {{- if .Values.singleNodeClusterConfig.controlPlaneTolerationsEnabled }} tolerations: {{- include "singleNodeClusterConfig" . | indent 6 }} diff --git a/tinkerbell/smee/templates/deployment.yaml b/tinkerbell/smee/templates/deployment.yaml index bccd495a..e0a481af 100644 --- a/tinkerbell/smee/templates/deployment.yaml +++ b/tinkerbell/smee/templates/deployment.yaml @@ -2,10 +2,12 @@ {{- $publicIP := .Values.publicIP }} {{- $trustedProxies := .Values.trustedProxies }} {{- $roleType := .Values.rbac.type }} +{{- $nodeSelector := .Values.nodeSelector }} {{- if .Values.global }} {{- $publicIP = coalesce .Values.publicIP .Values.global.publicIP }} {{- $trustedProxies = coalesce .Values.trustedProxies .Values.global.trustedProxies }} {{- $roleType = coalesce .Values.global.rbac.type .Values.rbac.type }} +{{- $nodeSelector = coalesce .Values.nodeSelector .Values.global.nodeSelector }} {{- end }} {{- $_ := set .Values.dhcp "syslogIp" (default $publicIP .Values.dhcp.syslogIp) }} {{- $_ := set .Values.dhcp "ipForPacket" (default $publicIP .Values.dhcp.ipForPacket) }} @@ -41,10 +43,6 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} containers: - image: {{ .Values.image }} imagePullPolicy: {{ .Values.imagePullPolicy }} @@ -118,6 +116,10 @@ spec: {{- if .Values.hostNetwork }} hostNetwork: true {{- end }} + {{- with $nodeSelector }} + nodeSelector: + {{ toYaml . | nindent 8 }} + {{- end }} {{- if or .Values.deployment.tolerations .Values.singleNodeClusterConfig.controlPlaneTolerationsEnabled }} tolerations: {{- .Values.deployment.tolerations | toYaml | nindent 8 }} diff --git a/tinkerbell/stack/templates/nginx.yaml b/tinkerbell/stack/templates/nginx.yaml index e9b2316c..68fe930e 100644 --- a/tinkerbell/stack/templates/nginx.yaml +++ b/tinkerbell/stack/templates/nginx.yaml @@ -2,6 +2,7 @@ {{- $sourceInterface := .Values.stack.relay.sourceInterface -}} {{- $ifaceModes := dict "ipvlan" "" "macvlan" "" -}} {{- $dhcpInterfaceType := .Values.stack.relay.interfaceMode -}} +{{- $nodeSelector := .Values.stack.nodeSelector }} {{- if not (hasKey $ifaceModes $dhcpInterfaceType) -}} {{- fail "invalid value at .stack.relay.interfaceMode: valid modes include ipvlan and macvlan" -}} {{- end -}} @@ -13,6 +14,9 @@ {{- if not $listenBroadcast -}} {{- $dhcpInterfaceName = "eth0" -}} {{- end -}} +{{- if .Values.global }} +{{- $nodeSelector = coalesce .Values.stack.nodeSelector .Values.global.nodeSelector }} +{{- end -}} {{- $claimName := coalesce .Values.stack.hook.persistence.existingClaim .Values.stack.hook.persistence.localPersistentVolume.name }} apiVersion: apps/v1 kind: Deployment @@ -153,6 +157,10 @@ spec: securityContext: privileged: true {{- end }} + {{- with $nodeSelector }} + nodeSelector: + {{ toYaml . | nindent 8 }} + {{- end }} {{- if .Values.stack.singleNodeClusterConfig.controlPlaneTolerationsEnabled }} tolerations: {{- include "singleNodeClusterConfig" . | indent 6 }} diff --git a/tinkerbell/stack/values.yaml b/tinkerbell/stack/values.yaml index 34d8c6ad..230f6e67 100644 --- a/tinkerbell/stack/values.yaml +++ b/tinkerbell/stack/values.yaml @@ -119,3 +119,4 @@ global: trustedProxies: [] rbac: type: Role + nodeSelector: {} diff --git a/tinkerbell/tink/templates/tink-controller/deployment.yaml b/tinkerbell/tink/templates/tink-controller/deployment.yaml index eb28db57..ffefa8e9 100644 --- a/tinkerbell/tink/templates/tink-controller/deployment.yaml +++ b/tinkerbell/tink/templates/tink-controller/deployment.yaml @@ -1,7 +1,9 @@ {{- if .Values.controller.deploy }} {{- $roleType := .Values.controller.rbac.type }} +{{- $nodeSelector := .Values.controller.nodeSelector }} {{- if .Values.global }} {{- $roleType = coalesce .Values.global.rbac.type .Values.controller.rbac.type }} +{{- $nodeSelector = coalesce .Values.controller.nodeSelector .Values.global.nodeSelector }} {{- end }} apiVersion: apps/v1 kind: Deployment @@ -20,10 +22,6 @@ spec: labels: app: {{ .Values.controller.name }} spec: - {{- with .Values.controller.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} containers: - image: {{ .Values.controller.image }} imagePullPolicy: {{ .Values.controller.imagePullPolicy }} @@ -43,6 +41,10 @@ spec: cpu: {{ .Values.controller.resources.requests.cpu }} memory: {{ .Values.controller.resources.requests.memory }} serviceAccountName: {{ .Values.controller.name }} + {{- with $nodeSelector }} + nodeSelector: + {{ toYaml . | nindent 8 }} + {{- end }} {{- if .Values.controller.singleNodeClusterConfig.controlPlaneTolerationsEnabled }} tolerations: {{- include "singleNodeClusterConfig" . | indent 6 }} diff --git a/tinkerbell/tink/templates/tink-server/deployment.yaml b/tinkerbell/tink/templates/tink-server/deployment.yaml index ff0dc6d0..fec9e6cb 100644 --- a/tinkerbell/tink/templates/tink-server/deployment.yaml +++ b/tinkerbell/tink/templates/tink-server/deployment.yaml @@ -1,7 +1,9 @@ {{- if .Values.server.deploy }} {{- $roleType := .Values.server.rbac.type }} +{{- $nodeSelector := .Values.server.nodeSelector }} {{- if .Values.global }} {{- $roleType = coalesce .Values.global.rbac.type .Values.server.rbac.type }} +{{- $nodeSelector = coalesce .Values.server.nodeSelector .Values.global.nodeSelector }} {{- end }} apiVersion: apps/v1 kind: Deployment @@ -28,10 +30,6 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: - {{- with .Values.server.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} containers: - args: - --backend=kubernetes @@ -55,6 +53,10 @@ spec: cpu: {{ .Values.server.resources.requests.cpu }} memory: {{ .Values.server.resources.requests.memory }} serviceAccountName: {{ .Values.server.name }} + {{- with $nodeSelector }} + nodeSelector: + {{ toYaml . | nindent 8 }} + {{- end }} {{- if .Values.server.singleNodeClusterConfig.controlPlaneTolerationsEnabled }} tolerations: {{- include "singleNodeClusterConfig" . | indent 6 }}