mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
Feat(Helm chart): Add env vars into pods (#4196)
* feat: update pod template Signed-off-by: andreibe <95860450+andreibe24@users.noreply.github.com> * fix: remove duplicate Signed-off-by: andreibe <95860450+andreibe24@users.noreply.github.com> * feat: update chart values.yaml Signed-off-by: andreibe <95860450+andreibe24@users.noreply.github.com> * feat: update README.md Signed-off-by: andreibe <95860450+andreibe24@users.noreply.github.com> * fix: change template behaviour on env Signed-off-by: andreibe <andreibe24@users.noreply.github.com> * chore: add helm ci tests Signed-off-by: andreibe <andreibe24@users.noreply.github.com> * fix: rerun go test Signed-off-by: andreibe <andreibe24@users.noreply.github.com> * test: add extra manifests Signed-off-by: andreibe <andreibe24@users.noreply.github.com> * fix: ci tests Signed-off-by: andreibe <andreibe24@users.noreply.github.com> --------- Signed-off-by: andreibe <95860450+andreibe24@users.noreply.github.com> Signed-off-by: andreibe <andreibe24@users.noreply.github.com> Co-authored-by: andreibe <andreibe24@users.noreply.github.com> Co-authored-by: Tarun Pothulapati <tarun@dragonflydb.io>
This commit is contained in:
parent
c857ff98ad
commit
ada96d9041
7 changed files with 345 additions and 1 deletions
|
@ -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 |
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
---
|
||||
# Source: dragonfly/templates/serviceaccount.yaml
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: test-dragonfly
|
||||
namespace: default
|
||||
labels:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
app.kubernetes.io/version: "v1.25.4"
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
---
|
||||
# Source: dragonfly/templates/extra-manifests.yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: dfly-password
|
||||
stringData:
|
||||
password: foobar
|
||||
---
|
||||
# Source: dragonfly/templates/extra-manifests.yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: my-secret
|
||||
stringData:
|
||||
password: password
|
||||
username: username
|
||||
type: Opaque
|
||||
---
|
||||
# Source: dragonfly/templates/extra-manifests.yaml
|
||||
apiVersion: v1
|
||||
data:
|
||||
configKey1: configValue1
|
||||
configKey2: configValue2
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: my-configmap
|
||||
---
|
||||
# Source: dragonfly/templates/service.yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: test-dragonfly
|
||||
namespace: default
|
||||
labels:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
app.kubernetes.io/version: "v1.25.4"
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 6379
|
||||
targetPort: dragonfly
|
||||
protocol: TCP
|
||||
name: dragonfly
|
||||
selector:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
---
|
||||
# Source: dragonfly/templates/deployment.yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test-dragonfly
|
||||
namespace: default
|
||||
labels:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
app.kubernetes.io/version: "v1.25.4"
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
labels:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
spec:
|
||||
serviceAccountName: test-dragonfly
|
||||
containers:
|
||||
- name: dragonfly
|
||||
image: "docker.dragonflydb.io/dragonflydb/dragonfly:v1.25.4"
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: dragonfly
|
||||
containerPort: 6379
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- /usr/local/bin/healthcheck.sh
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- /usr/local/bin/healthcheck.sh
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
args:
|
||||
- "--alsologtostderr"
|
||||
resources:
|
||||
limits: {}
|
||||
requests: {}
|
||||
|
||||
env:
|
||||
- name: DFLY_requirepass
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: dfly-password
|
||||
key: password
|
||||
- name: ENV_VAR43
|
||||
value: value1
|
||||
- name: ENV_VAR323
|
||||
value: value2
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: my-configmap
|
||||
- secretRef:
|
||||
name: my-secret
|
|
@ -0,0 +1,40 @@
|
|||
extraObjects:
|
||||
- apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: dfly-password
|
||||
stringData:
|
||||
password: foobar
|
||||
- apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: my-configmap
|
||||
data:
|
||||
configKey1: configValue1
|
||||
configKey2: configValue2
|
||||
- apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: my-secret
|
||||
type: Opaque
|
||||
stringData:
|
||||
username: username
|
||||
password: password
|
||||
|
||||
env:
|
||||
- name: ENV_VAR43
|
||||
value: value1
|
||||
- name: ENV_VAR323
|
||||
value: value2
|
||||
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: my-configmap
|
||||
- secretRef:
|
||||
name: my-secret
|
||||
|
||||
passwordFromSecret:
|
||||
enable: true
|
||||
existingSecret:
|
||||
name: dfly-password
|
||||
key: password
|
123
contrib/charts/dragonfly/ci/extraenv-values.golden.yaml
Normal file
123
contrib/charts/dragonfly/ci/extraenv-values.golden.yaml
Normal file
|
@ -0,0 +1,123 @@
|
|||
---
|
||||
# Source: dragonfly/templates/serviceaccount.yaml
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: test-dragonfly
|
||||
namespace: default
|
||||
labels:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
app.kubernetes.io/version: "v1.25.4"
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
---
|
||||
# Source: dragonfly/templates/extra-manifests.yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: my-secret
|
||||
stringData:
|
||||
password: password
|
||||
username: username
|
||||
type: Opaque
|
||||
---
|
||||
# Source: dragonfly/templates/extra-manifests.yaml
|
||||
apiVersion: v1
|
||||
data:
|
||||
configKey1: configValue1
|
||||
configKey2: configValue2
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: my-configmap
|
||||
---
|
||||
# Source: dragonfly/templates/service.yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: test-dragonfly
|
||||
namespace: default
|
||||
labels:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
app.kubernetes.io/version: "v1.25.4"
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 6379
|
||||
targetPort: dragonfly
|
||||
protocol: TCP
|
||||
name: dragonfly
|
||||
selector:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
---
|
||||
# Source: dragonfly/templates/deployment.yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test-dragonfly
|
||||
namespace: default
|
||||
labels:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
app.kubernetes.io/version: "v1.25.4"
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
labels:
|
||||
app.kubernetes.io/name: dragonfly
|
||||
app.kubernetes.io/instance: test
|
||||
spec:
|
||||
serviceAccountName: test-dragonfly
|
||||
containers:
|
||||
- name: dragonfly
|
||||
image: "docker.dragonflydb.io/dragonflydb/dragonfly:v1.25.4"
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: dragonfly
|
||||
containerPort: 6379
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- /usr/local/bin/healthcheck.sh
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- /usr/local/bin/healthcheck.sh
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
args:
|
||||
- "--alsologtostderr"
|
||||
resources:
|
||||
limits: {}
|
||||
requests: {}
|
||||
|
||||
env:
|
||||
- name: ENV_VAR43
|
||||
value: value1
|
||||
- name: ENV_VAR323
|
||||
value: value2
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: my-configmap
|
||||
- secretRef:
|
||||
name: my-secret
|
28
contrib/charts/dragonfly/ci/extraenv-values.yaml
Normal file
28
contrib/charts/dragonfly/ci/extraenv-values.yaml
Normal file
|
@ -0,0 +1,28 @@
|
|||
extraObjects:
|
||||
- apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: my-configmap
|
||||
data:
|
||||
configKey1: configValue1
|
||||
configKey2: configValue2
|
||||
- apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: my-secret
|
||||
type: Opaque
|
||||
stringData:
|
||||
username: username
|
||||
password: password
|
||||
|
||||
env:
|
||||
- name: ENV_VAR43
|
||||
value: value1
|
||||
- name: ENV_VAR323
|
||||
value: value2
|
||||
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: my-configmap
|
||||
- secretRef:
|
||||
name: my-secret
|
|
@ -96,6 +96,8 @@ 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" }}
|
||||
|
@ -103,7 +105,6 @@ containers:
|
|||
{{- if and $imageTag (ne $imageTag "") }}
|
||||
{{- $effectiveVersion = $imageTag }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if semverCompare ">=1.14.0" $effectiveVersion }}
|
||||
- name: DFLY_requirepass
|
||||
{{- else }}
|
||||
|
@ -114,6 +115,14 @@ containers:
|
|||
name: {{ tpl .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:
|
||||
|
|
|
@ -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: ""
|
||||
|
||||
|
|
Loading…
Reference in a new issue