{{- $top := . }} {{- range $deployments := .Values.deployments }} --- apiVersion: apps/v1 kind: Deployment metadata: name: "{{ $deployments.nodepool }}-xyz" namespace: "{{ $top.Namespace }}" # Add the namespace field labels: type: abcd {{- with $top.Values.extraLabels }} {{ toYaml . | indent 2 }} {{- end }} spec: replicas: {{ $deployments.replicaCount }} selector: matchLabels: type: abcd strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 25% type: RollingUpdate template: metadata: labels: type: abcd {{- with $top.Values.extraLabels }} {{ toYaml . | indent 4 }} {{- end }} spec: serviceAccountName: xyz priorityClassName: {{ $top.Values.priorityClass.name }} {{- if $top.Values.affinity }} affinity: {{ toYaml $top.Values.affinity | indent 4 }} {{- end }} {{- if $top.Values.topologySpreadConstraints }} topologySpreadConstraints: {{ toYaml $top.Values.topologySpreadConstraints | indent 2 }} {{- end }} containers: - name: "{{ $deployments.nodepool }}-{{ $top.Chart.Name }}" imagePullPolicy: {{ $top.Values.image.pullPolicy }} image: "{{ $top.Values.image.repository }}:{{ $top.Values.image.tag | default $top.Chart.AppVersion }}" ports: - name: http containerPort: 80 protocol: TCP livenessProbe: httpGet: path: / port: http readinessProbe: httpGet: path: / port: http resources: requests: cpu: {{ $deployments.cpuRequest | default 2 }} memory: {{ $deployments.memoryRequest | default "4Gi" | quote }} nodeSelector: dedicated: {{ $deployments.nodepool }} tolerations: - effect: NoSchedule key: dedicated operator: Equal value: {{ $deployments.nodepool }} --- {{- end }}