Skip to content

Commit

Permalink
feat!(mirrorbits) 💥 allow specifying custom affinities per deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
smerle33 committed Oct 2, 2023
1 parent a2dc819 commit 6d7b78a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
11 changes: 9 additions & 2 deletions charts/mirrorbits/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "mirrorbits.selectorLabels" -}}
app.kubernetes.io/name: {{ include "mirrorbits.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "mirrorbits.labels" -}}
app.kubernetes.io/name: {{ include "mirrorbits.name" . }}
{{ include "mirrorbits.selectorLabels" . }}
helm.sh/chart: {{ include "mirrorbits.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand Down
43 changes: 43 additions & 0 deletions charts/mirrorbits/tests/custom_values_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,46 @@ set:
volume:
persistentVolumeClaim:
claimName: foobar
affinity:
mirrorbits:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app.kubernetes.io/name"
operator: In
values:
- mirrorbits
topologyKey: "kubernetes.io/hostname"
files:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app.kubernetes.io/name"
operator: In
values:
- mirrorbits-files
topologyKey: "kubernetes.io/hostname"
rsyncd:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app.kubernetes.io/name"
operator: In
values:
- mirrorbits-rsyncd
topologyKey: "kubernetes.io/hostname"
poddisruptionbudget:
mirrorbits:
minAvailable: 1
mirrorbitsFiles:
minAvailable: 1
mirrorbitsRsyncd:
minAvailable: 1


templates:
- deployment.yaml
- deployment.files.yaml
Expand Down Expand Up @@ -94,6 +134,9 @@ tests:
- equal:
path: spec.template.spec.containers[0].volumeMounts[2].mountPath
value: /var/log/mirrorbits
- equal:
path: spec.template.spec.affinity.mirrorbits.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution[0].topologyKey
value: "kubernetes.io/hostname"
- it: should create ingress with pathType set to the specified custom value by default
template: ingress.yaml
asserts:
Expand Down
2 changes: 2 additions & 0 deletions charts/mirrorbits/tests/defaults_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ tests:
- equal:
path: spec.template.spec.containers[0].volumeMounts[2].mountPath
value: /var/log/mirrorbits
- notExists:
path: spec.template.spec.affinity

0 comments on commit 6d7b78a

Please sign in to comment.