diff --git a/CHANGELOG.md b/CHANGELOG.md index 968e32bbbd..73013e942a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ For more information and how-to, see [RFC: Keep A Changelog](https://github.com/ - Support for deploying chaos-dashboard with sidecar containers in helm chart [#4164](https://github.com/chaos-mesh/chaos-mesh/pull/4164) - Add `values.schema.json` [#4205](https://github.com/chaos-mesh/chaos-mesh/pull/4205) - Add [`GreptimeDB`](https://greptime.com) to ADOPTERS.md [#4245](https://github.com/chaos-mesh/chaos-mesh/pull/4245) +- Support configurable chaos-dns-server pod affinities[#4260](https://github.com/chaos-mesh/chaos-mesh/pull/4260) ### Changed diff --git a/helm/chaos-mesh/templates/dns-deployment.yaml b/helm/chaos-mesh/templates/dns-deployment.yaml index 8d9739432f..2580c6c52f 100644 --- a/helm/chaos-mesh/templates/dns-deployment.yaml +++ b/helm/chaos-mesh/templates/dns-deployment.yaml @@ -42,17 +42,10 @@ spec: {{- end }} spec: serviceAccountName: {{ .Values.dnsServer.serviceAccount }} + {{- with .Values.dnsServer.affinity }} affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: k8s-app - operator: In - values: ["chaos-dns"] - topologyKey: kubernetes.io/hostname +{{ toYaml . | indent 8 }} + {{- end }} {{- with .Values.dnsServer.tolerations }} tolerations: {{ toYaml . | indent 8 }} diff --git a/helm/chaos-mesh/values.yaml b/helm/chaos-mesh/values.yaml index 4fdf282b3e..d69fde5b1f 100644 --- a/helm/chaos-mesh/values.yaml +++ b/helm/chaos-mesh/values.yaml @@ -452,6 +452,18 @@ dnsServer: LISTEN_HOST: "0.0.0.0" # The port of chaos-dns-server listen on LISTEN_PORT: 53 + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app.kubernetes.io/component + operator: In + values: + - chaos-dns-server + topologyKey: kubernetes.io/hostname + weight: 100 prometheus: # Enable prometheus diff --git a/install.sh b/install.sh index 7ddb476e9a..4ebacada9c 100755 --- a/install.sh +++ b/install.sh @@ -1963,14 +1963,15 @@ spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: + - podAffinityTerm: labelSelector: matchExpressions: - - key: k8s-app - operator: In - values: ["chaos-dns"] + - key: app.kubernetes.io/component + operator: In + values: + - chaos-dns-server topologyKey: kubernetes.io/hostname + weight: 100 priorityClassName: containers: - name: chaos-dns-server