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

Feat(Helm chart): Add env vars into pods #4196

Merged
merged 13 commits into from
Dec 2, 2024
2 changes: 2 additions & 0 deletions contrib/charts/dragonfly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ helm upgrade --install dragonfly oci://ghcr.io/dragonflydb/dragonfly/helm/dragon
| replicaCount | int | `1` | Number of replicas to deploy |
| resources.limits | object | `{}` | The resource limits for the containers |
| resources.requests | object | `{}` | The requested resources for the containers |
| env | list | `[]` | Extra environment variables |
| envFrom | list | `[]` | Extra environment variables from K8s objects |
| securityContext | object | `{}` | Set securityContext for containers |
| service.annotations | object | `{}` | Extra annotations for the service |
| service.lablels | object | `{}` | Extra labels for the service |
Expand Down
11 changes: 10 additions & 1 deletion contrib/charts/dragonfly/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,15 @@ containers:
{{- toYaml . | trim | nindent 6 }}
{{- end }}
{{- include "dragonfly.volumemounts" . | trim | nindent 4 }}
{{- if or .Values.passwordFromSecret.enable .Values.env }}
env:
{{- if .Values.passwordFromSecret.enable }}
{{- $appVersion := .Chart.AppVersion | trimPrefix "v" }}
{{- $imageTag := .Values.image.tag | trimPrefix "v" }}
{{- $effectiveVersion := $appVersion }}
{{- if and $imageTag (ne $imageTag "") }}
{{- $effectiveVersion = $imageTag }}
{{- end }}
env:
{{- if semverCompare ">=1.14.0" $effectiveVersion }}
- name: DFLY_requirepass
{{- else }}
Expand All @@ -114,6 +115,14 @@ containers:
name: {{ .Values.passwordFromSecret.existingSecret.name }}
key: {{ .Values.passwordFromSecret.existingSecret.key }}
{{- end }}
{{- with .Values.env }}
{{- toYaml . | trim | nindent 6 }}
{{- end }}
{{- end }}
{{- with .Values.envFrom }}
envFrom:
{{- toYaml . | trim | nindent 6 }}
{{- end }}

{{- if or (.Values.tls.enabled) (.Values.extraVolumes) }}
volumes:
Expand Down
6 changes: 6 additions & 0 deletions contrib/charts/dragonfly/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ resources:
# cpu: 100m
# memory: 128Mi

# -- extra environment variables
env: []

# -- extra environment variables from K8s objects
envFrom: []

# -- Priority class name for pod assignment
priorityClassName: ""

Expand Down
Loading