1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

feat(contrib/helm): evaluate the provided passwordSecretName value as a template (#4046)

* feat(contrib/helm): evaluate the provided passwordSecretName value as a template

Useful to reuse some defined variables or functions directly to compute the value
(external chart for instance, that depends on this one)

example:
'{{ include "something.defined.elsewhere" $ }}-secrets'

Signed-off-by: Raphael Glon <oOraph@users.noreply.github.com>

* update golden tests

---------

Signed-off-by: Raphael Glon <oOraph@users.noreply.github.com>
Co-authored-by: Raphael Glon <oOraph@users.noreply.github.com>
Co-authored-by: Tarun Pothulapati <tarun@dragonflydb.io>
This commit is contained in:
oOraph 2024-11-27 13:03:18 +01:00 committed by GitHub
parent a87d6aecef
commit 1ceca471be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 126 additions and 3 deletions

View file

@ -0,0 +1,108 @@
---
# 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.3"
app.kubernetes.io/managed-by: Helm
---
# Source: dragonfly/templates/extra-manifests.yaml
apiVersion: v1
kind: Secret
metadata:
name: dragonfly-password
stringData:
password: foobar
---
# 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.3"
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.3"
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.3"
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: dragonfly-password
key: password

View file

@ -0,0 +1,13 @@
extraObjects:
- apiVersion: v1
kind: Secret
metadata:
name: dragonfly-password
stringData:
password: foobar
passwordFromSecret:
enable: true
existingSecret:
name: '{{ include "dragonfly.name" $ }}-password'
key: password

View file

@ -111,7 +111,7 @@ containers:
{{- end }} {{- end }}
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: {{ .Values.passwordFromSecret.existingSecret.name }} name: {{ tpl .Values.passwordFromSecret.existingSecret.name $ }}
key: {{ .Values.passwordFromSecret.existingSecret.key }} key: {{ .Values.passwordFromSecret.existingSecret.key }}
{{- end }} {{- end }}

View file

@ -1,2 +1,4 @@
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=