Skip to content

Commit

Permalink
Add affinity and tolerations to ASOv2 helm chart (#3765)
Browse files Browse the repository at this point in the history
* Add affinity and tolerations

* Add Affinity and Tolerations to ASOv2 helm chart

* use perl instead of sed

* Remove extra line
  • Loading branch information
super-harsh authored Feb 8, 2024
1 parent cf7bc0e commit 314960b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/v2/generate-helm-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ sed -i "s@$LOCAL_REGISTRY_CONTROLLER_DOCKER_IMAGE@{{.Values.image.repository}}@g
# Perl multiline replacements - using this because it's tricky to do these sorts of multiline replacements with sed
perl -0777 -i -pe 's/(template:\n.*metadata:\n.*annotations:\n(\s*))/$1\{\{- if .Values.podAnnotations \}\}\n$2\{\{ toYaml .Values.podAnnotations \}\}\n$2\{\{- end \}\}\n$2/igs' "$GEN_FILES_DIR"/*_deployment_* # Add pod annotations

# Affinity and Toleration
perl -0777 -i -pe 's/(spec:\n.*template:\n.*spec:\n(\s*))/$1\{\{- with .Values.affinity \}\}\n$2affinity:\n$2\{\{- toYaml . | nindent 8 \}\}\n$2\{\{- end \}\}\n$2/igs' "$GEN_FILES_DIR"/*_deployment_* # Add pod annotations
perl -0777 -i -pe 's/(spec:\n.*template:\n.*spec:\n(\s*))/$1\{\{- with .Values.tolerations \}\}\n$2tolerations:\n$2\{\{- toYaml . | nindent 8 \}\}\n$2\{\{- end \}\}\n$2/igs' "$GEN_FILES_DIR"/*_deployment_* # Add pod annotations

# Metrics Configuration
flow_control "metrics-addr" "metrics-addr" "{{- if .Values.metrics.enable}}" "$GEN_FILES_DIR"/*_deployment_*
sed -i "1,/metrics-addr=.*/s/\(metrics-addr=\)\(.*\)/\1{{ tpl .Values.metrics.address . }}/g" "$GEN_FILES_DIR"/*_deployment_*
Expand Down
11 changes: 11 additions & 0 deletions v2/charts/azure-service-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,14 @@ networkPolicies:
mysqlCIDR: 0.0.0.0/0
# Destination CIDR for talking to PostgreSQL servers
postgresqlCIDR: 0.0.0.0/0

# Tolerations are applied to pods. Tolerations allow the scheduler to schedule pods with matching taints. Tolerations allow scheduling but don't guarantee scheduling
# For more information, see https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration.
tolerations: []

# Affinity and anti-affinity expands the types of constraints you can define.
# The affinity feature consists of two types of affinity:
# Node affinity functions like the nodeSelector field but is more expressive and allows you to specify soft rules.
# Inter-pod affinity/anti-affinity allows you to constrain Pods against labels on other Pods.
# For more information, see https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity
affinity: {}

0 comments on commit 314960b

Please sign in to comment.