Skip to content

Commit

Permalink
charts/service-deployment add tolerations and topologySpreadConstrain…
Browse files Browse the repository at this point in the history
…ts (closes #165, closes #189)
  • Loading branch information
ianarsenault committed Aug 28, 2024
1 parent 236daa6 commit 164884c
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion charts/service-deployment/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: service-deployment
description: A Helm Chart to setup a generic deployment with optional service/hpa bindings
version: 0.19.1
version: 0.20.0
icon: https://raw.githubusercontent.com/snowplow-devops/helm-charts/master/docs/logo/snowplow.png
home: https://github.com/snowplow-devops/helm-charts
sources:
Expand Down
2 changes: 2 additions & 0 deletions charts/service-deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,5 @@ helm delete service-deployment
| service.protocol | string | `"TCP"` | Protocol that the service leverages (note: TCP or UDP) |
| service.targetPort | int | `80` | The Target Port that the actual application is being exposed on |
| terminationGracePeriodSeconds | int | `60` | Grace period for termination of the service |
| tolerations | list |`[]` | Tolerations labels for pod assignment with matching taints |
| topologySpreadConstraints | object | `{}` | Topology Spread Constraints for pod assignment |
2 changes: 1 addition & 1 deletion charts/service-deployment/templates/certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ kind: Certificate
metadata:
name: {{ required "A valid hostname is required!" .hostname }}
labels:
{{ include "snowplow.labels" $ | nindent 4 }}
{{- include "snowplow.labels" $ | nindent 4 }}
spec:
secretName: {{ .hostname }}-tls
issuerRef:
Expand Down
2 changes: 1 addition & 1 deletion charts/service-deployment/templates/configmaps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: {{ $v.name }}
labels:
{{ include "snowplow.labels" $ | nindent 4 }}
{{- include "snowplow.labels" $ | nindent 4 }}
binaryData:
{{- range $f := $v.files }}
{{- if $f.contentsB64 }}
Expand Down
13 changes: 11 additions & 2 deletions charts/service-deployment/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: {{ .Values.deployment.kind }}
metadata:
name: {{ include "app.fullname" . }}
labels:
{{ include "snowplow.labels" $ | nindent 4 }}
{{- include "snowplow.labels" $ | nindent 4 }}
spec:
{{- if .Values.deployment.scaleToZero }}
replicas: 0
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
labels:
{{ include "snowplow.labels" $ | nindent 8 }}
{{- include "snowplow.labels" $ | nindent 8 }}
{{- if .Values.deployment.podLabels }}
{{- toYaml .Values.deployment.podLabels | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -85,6 +85,15 @@ spec:
{{- toYaml .Values.affinity | nindent 8 }}
{{- end }}

{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}

containers:
- name: "{{ include "app.fullname" . }}"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
Expand Down
2 changes: 1 addition & 1 deletion charts/service-deployment/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: HorizontalPodAutoscaler
metadata:
name: {{ include "app.fullname" . }}
labels:
{{ include "snowplow.labels" $ | nindent 4 }}
{{- include "snowplow.labels" $ | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
Expand Down
2 changes: 1 addition & 1 deletion charts/service-deployment/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: Ingress
metadata:
name: {{ required "A valid hostname is required!" .hostname }}
labels:
{{ include "snowplow.labels" $ | nindent 4 }}
{{- include "snowplow.labels" $ | nindent 4 }}
annotations:
{{- if .annotations }}
{{- toYaml .annotations | nindent 4 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/service-deployment/templates/ipallowlist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Middleware
metadata:
name: {{ include "app.fullname" . }}-ipallowlist
labels:
{{ include "snowplow.labels" $ | nindent 4 }}
{{- include "snowplow.labels" $ | nindent 4 }}
spec:
ipWhiteList:
sourceRange:
Expand Down
2 changes: 1 addition & 1 deletion charts/service-deployment/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
{{ toYaml .Values.persistentVolume.annotations | indent 4 }}
{{- end }}
labels:
{{ include "snowplow.labels" $ | nindent 4 }}
{{- include "snowplow.labels" $ | nindent 4 }}
{{- with .Values.persistentVolume.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/service-deployment/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "app.secret.fullname" . }}
labels:
{{ include "snowplow.labels" $ | nindent 4 }}
{{- include "snowplow.labels" $ | nindent 4 }}
type: Opaque
data:
{{- range $k, $v := .Values.config.secrets }}
Expand Down
2 changes: 1 addition & 1 deletion charts/service-deployment/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:
cloud.google.com/neg: '{"exposed_ports": {"{{ .Values.service.port }}":{"name": "{{ include "service.gcp.networkEndpointGroupName" . }}"}}}'
{{- end }}
labels:
{{ include "snowplow.labels" $ | nindent 4 }}
{{- include "snowplow.labels" $ | nindent 4 }}
spec:
type: NodePort
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: TargetGroupBinding
metadata:
name: {{ include "app.fullname" . }}
labels:
{{ include "snowplow.labels" $ | nindent 4 }}
{{- include "snowplow.labels" $ | nindent 4 }}
spec:
serviceRef:
name: {{ include "app.fullname" . }}
Expand Down
10 changes: 10 additions & 0 deletions charts/service-deployment/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ deployment:
# -- PriorityClassName for pods
priorityClassName: ""

# -- Allow the scheduler to schedule pods with matching taints
#
# more details here: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
tolerations: []

# -- topologySpreadConstraints control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, and other user-defined topology domains.
#
# more details here: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
topologySpreadConstraints: {}

# -- Affinity supports podAffinity, podAntiAffinity, or nodeAffinity
affinity: {}
# podAffinity:
Expand Down

0 comments on commit 164884c

Please sign in to comment.