diff --git a/simple/Chart.yaml b/simple/Chart.yaml index eb3db48..41b9a21 100644 --- a/simple/Chart.yaml +++ b/simple/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 description: Helm chart with simple deployment/service template name: simple -version: 0.21.2 +version: 0.22.0 appVersion: 0.0.1 tillerVersion: ">=2.14.3" diff --git a/simple/templates/deployment.yaml b/simple/templates/deployment.yaml index 1a22a14..93d9ecd 100644 --- a/simple/templates/deployment.yaml +++ b/simple/templates/deployment.yaml @@ -55,12 +55,14 @@ spec: maxSkew: 1 topologyKey: topology.kubernetes.io/zone whenUnsatisfiable: ScheduleAnyway + {{- if eq .Values.EnableTopologySpreadHostname true }} - labelSelector: matchLabels: app: {{ .Values.name }} maxSkew: 1 topologyKey: kubernetes.io/hostname whenUnsatisfiable: ScheduleAnyway + {{- end}} {{- end}} {{- if hasKey .Values "nodeSelector" }} nodeSelector: @@ -74,32 +76,9 @@ spec: {{- if hasKey .Values.affinity "podAffinity" }} podAffinity: {{- toYaml .Values.affinity.podAffinity | nindent 10 }} {{- end }} - podAntiAffinity: - {{- if hasKey .Values.affinity.podAntiAffinity "requiredDuringSchedulingIgnoredDuringExecution" }} - requiredDuringSchedulingIgnoredDuringExecution: {{- toYaml .Values.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution | nindent 12 }} - {{- end }} - preferredDuringSchedulingIgnoredDuringExecution: - {{- if hasKey .Values.affinity.podAntiAffinity "preferredDuringSchedulingIgnoredDuringExecution" }} - {{- toYaml .Values.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution | nindent 12 }} - {{- end }} - - podAffinityTerm: - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - {{ .Values.name }} - topologyKey: topology.kubernetes.io/zone - weight: 100 - - podAffinityTerm: - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - {{ .Values.name }} - topologyKey: kubernetes.io/hostname - weight: 99 + {{- if hasKey .Values.affinity "podAntiAffinity" }} + podAntiAffinity: {{- toYaml .Values.affinity.podAntiAffinity | nindent 10 }} + {{- end }} {{- end }} {{- if hasKey .Values "securityContextForPod" }} securityContext: {{ toYaml .Values.securityContextForPod | nindent 8 }} diff --git a/simple/values.yaml b/simple/values.yaml index 15fbebd..500133b 100644 --- a/simple/values.yaml +++ b/simple/values.yaml @@ -3,7 +3,7 @@ name: app-name replicaCount: 1 # Required: please quote the businessid as string -# businessid: "xxxxxxxxxxxxxxxxxx" +businessid: "xxxxxxxxxxxxxxxxxx" # Note: Please indicate labels of the specific node you willing to place your pods # nodeSelector: @@ -29,6 +29,7 @@ replicaCount: 1 # maxSkew: 1 # topologyKey: topology.kubernetes.io/zone # whenUnsatisfiable: DoNotSchedule +EnableTopologySpreadHostname: true # - labelSelector: # matchLabels: # app: app-name