Skip to content

Commit

Permalink
feat(): remove antiaffinity and modify topologyspread optioanl
Browse files Browse the repository at this point in the history
  • Loading branch information
Devin Lin committed Nov 18, 2024
1 parent fdb8a88 commit e2f2078
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 28 deletions.
2 changes: 1 addition & 1 deletion simple/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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"
31 changes: 5 additions & 26 deletions simple/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
3 changes: 2 additions & 1 deletion simple/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -29,6 +29,7 @@ replicaCount: 1
# maxSkew: 1
# topologyKey: topology.kubernetes.io/zone
# whenUnsatisfiable: DoNotSchedule
EnableTopologySpreadHostname: true
# - labelSelector:
# matchLabels:
# app: app-name
Expand Down

0 comments on commit e2f2078

Please sign in to comment.