Skip to content

Commit 88b6bdc

Browse files
stensonbkishorj
andauthored
helm chart update ; adding support to set affinity in podSpec to the empty map (#2576)
* adding support to set affinity in podSpec to the empty map * remove typo * updated readme Co-authored-by: Kishor Joshi <[email protected]>
1 parent 81e52ac commit 88b6bdc

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

helm/aws-load-balancer-controller/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ The default values set by the application itself can be confirmed [here](https:/
176176
| `priorityClassName` | Controller pod priority class | system-cluster-critical |
177177
| `nodeSelector` | Node labels for controller pod assignment | `{}` |
178178
| `tolerations` | Controller pod toleration for taints | `{}` |
179-
| `affinity` | Affinity for pod assignment | `{}` |
179+
| `affinity` | Affinity for pod assignment (string or map) (soft affinity if string "default", set explicitly if map) | `default` |
180180
| `topologySpreadConstraints` | Topology Spread Constraints for pod assignment | `{}` |
181181
| `podAnnotations` | Annotations to add to each pod | `{}` |
182182
| `podLabels` | Labels to add to each pod | `{}` |

helm/aws-load-balancer-controller/templates/deployment.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,14 @@ spec:
172172
nodeSelector:
173173
{{- toYaml . | nindent 8 }}
174174
{{- end }}
175-
{{- if .Values.affinity }}
175+
{{- if kindIs "map" .Values.affinity }}
176+
{{- with .Values.affinity }}
176177
affinity:
177-
{{- toYaml .Values.affinity | nindent 8 }}
178-
{{- else }}
178+
{{- toYaml . | nindent 8 }}
179+
{{- end }}
180+
{{- end }}
181+
{{- if kindIs "string" .Values.affinity }}
182+
{{- if eq .Values.affinity "default" }}
179183
affinity:
180184
podAntiAffinity:
181185
preferredDuringSchedulingIgnoredDuringExecution:
@@ -189,6 +193,7 @@ spec:
189193
- {{ include "aws-load-balancer-controller.name" . }}
190194
topologyKey: kubernetes.io/hostname
191195
{{- end }}
196+
{{- end }}
192197
{{- with .Values.tolerations }}
193198
tolerations:
194199
{{- toYaml . | nindent 8 }}

helm/aws-load-balancer-controller/values.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,15 @@ nodeSelector: {}
6565

6666
tolerations: []
6767

68-
affinity: {}
68+
# affinity can be either a string or map.
69+
#
70+
# if affinity is a string, and if that string is "default", set an antiAffinity policy on
71+
# the podSpec to prevent colocation on the same node.
72+
#
73+
# if affinity is a map, set the affinity attribute on the podSpec with this exact value (do NOT
74+
# use the default, as described above).
75+
# affinity: {}
76+
affinity: default
6977

7078
# topologySpreadConstraints is a stable feature of k8s v1.19 which provides the ability to
7179
# control how Pods are spread across your cluster among failure-domains such as regions, zones,

0 commit comments

Comments
 (0)