Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add affinity and tolerations to ASOv2 helm chart #3765

Merged
merged 4 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
sed -i '/ spec:/a\ {{- with .Values.affinity }}\n affinity:\n {{- toYaml . | nindent 8 }}\n {{- end }}' "$GEN_FILES_DIR"/*_deployment_*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might wanna steal the (horrible) perl line above as it captures spaces and so deals with variable indentation?

I assume that you've tested and this works have we have it today... we really should probably fix how we generate the Helm template (might be better to just duplicate stuff, I dunno)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with either. Perl looks a bit messy. But good point, it takes care of the spaces.

sed -i '/ spec:/a\ {{- with .Values.tolerations }}\n tolerations:\n {{- toYaml . | nindent 8 }}\n {{- end }}' "$GEN_FILES_DIR"/*_deployment_*

# 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
12 changes: 12 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,15 @@ 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: {}

Loading