Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
Deprecate additionalAffinities. Use dynamically rendered affinity opt…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
Antiarchitect committed Jan 6, 2022
1 parent 1bea47b commit 10840d6
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion keydb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: keydb
description: A Helm chart for KeyDB multimaster setup
type: application
version: 0.29.0
version: 0.30.0
keywords:
- keydb
- redis
Expand Down
7 changes: 6 additions & 1 deletion keydb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ helm install keydb enapter/keydb

This chart bootstraps a [KeyDB](https://keydb.dev) highly available multi-master statefulset in a [Kubernetes](http://kubernetes.io) cluster using the Helm package manager.

## 0.30.0 Upgrade notice

As the chart is not yet production ready (0.x) backward incompatible changes can be introduced in minor releases.
Since 0.30.0 `additionalAffinities` option is completely obsolete and `affinity` replace it. `affinity` is rendered dynamically (approach is taken from Bitnami charts) so you can set dynamic things like `'{{ .Release.Name }}'` right inside the `affinity:` key in `values.yaml`. Will extend this approach in other places in the future.

## 0.29.0 Upgrade notice

As the chart is not yet production ready (0.x) backward incompatible changes can be introduced in minor releases.
Expand Down Expand Up @@ -83,7 +88,7 @@ The following table lists the configurable parameters of the KeyDB chart and the
| `podAnnotations` | KeyDB pods annotations | `{}` |
| `tolerations` | KeyDB tolerations setting | `{}` |
| `nodeSelector` | KeyDB nodeSelector setting | `{}` |
| `additionalAffinities` | Additional affinities for StatefulSet | `{}` |
| `affinity` | StatefulSet Affinity rules | Look values.yaml |
| `extraInitContainers` | Additional init containers for StatefulSet | `[]` |
| `extraContainers` | Additional sidecar containers for StatefulSet | `[]` |
| `extraVolumes` | Additional volumes for init and sidecar containers | `[]` |
Expand Down
8 changes: 8 additions & 0 deletions keydb/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ Create the name of the service account to use
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{- define "common.tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
19 changes: 1 addition & 18 deletions keydb/templates/sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,7 @@ spec:
{{ include "keydb.labels" . | nindent 8 }}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- {{ include "keydb.name" . }}
- key: app.kubernetes.io/instance
operator: In
values:
- {{ .Release.Name }}
topologyKey: "kubernetes.io/hostname"
{{- if .Values.additionalAffinities }}
{{- toYaml .Values.additionalAffinities | nindent 8 }}
{{- end }}
{{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
{{- if .Values.extraInitContainers }}
initContainers:
{{- toYaml .Values.extraInitContainers | nindent 6 }}
Expand Down
17 changes: 17 additions & 0 deletions keydb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ tolerations: {}
nodeSelector: {}
# topology.kubernetes.io/region: some-region

affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- '{{ include "keydb.name" . }}'
- key: app.kubernetes.io/instance
operator: In
values:
- '{{ .Release.Name }}'
topologyKey: "kubernetes.io/hostname"

additionalAffinities: {}
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
Expand Down

0 comments on commit 10840d6

Please sign in to comment.