mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
bug: DFLY_PASSWORD environment variable deprecation (#2539)
* If the image.tag version is equal to 14.0.0 or greater then specify the DFLY_requirepass environment variable. Otherwise use the DFLY_PASSWORD environment variable. Signed-off-by: Michael Primeaux <michael.primeaux@mac.com> * Corrected version logic and added golden test Signed-off-by: Michael Primeaux <michael.primeaux@mac.com> * Updated golden file for TLS + image.tag Signed-off-by: Michael Primeaux <michael.primeaux@mac.com> * fix CI for chart linting test * rename new test specific to password * use v1.13.0 * update golden chart --------- Signed-off-by: Michael Primeaux <michael.primeaux@mac.com> Signed-off-by: Michael Primeaux <mprimeaux@users.noreply.github.com> Co-authored-by: Tarun Pothulapati <tarun@dragonflydb.io>
This commit is contained in:
parent
eaca66b02f
commit
951b0897e6
7 changed files with 139 additions and 3 deletions
108
contrib/charts/dragonfly/ci/password-old-env-values.golden.yaml
Normal file
108
contrib/charts/dragonfly/ci/password-old-env-values.golden.yaml
Normal 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.14.2"
|
||||
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/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.14.2"
|
||||
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.14.2"
|
||||
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.13.0"
|
||||
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_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: dfly-password
|
||||
key: password
|
16
contrib/charts/dragonfly/ci/password-old-env-values.yaml
Normal file
16
contrib/charts/dragonfly/ci/password-old-env-values.yaml
Normal file
|
@ -0,0 +1,16 @@
|
|||
image:
|
||||
tag: "v1.13.0"
|
||||
|
||||
extraObjects:
|
||||
- apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: dfly-password
|
||||
stringData:
|
||||
password: foobar
|
||||
|
||||
passwordFromSecret:
|
||||
enable: true
|
||||
existingSecret:
|
||||
name: dfly-password
|
||||
key: password
|
|
@ -101,7 +101,7 @@ spec:
|
|||
requests: {}
|
||||
|
||||
env:
|
||||
- name: DFLY_PASSWORD
|
||||
- name: DFLY_requirepass
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: dfly-password
|
||||
|
|
|
@ -104,7 +104,7 @@ spec:
|
|||
- mountPath: /data
|
||||
name: "test-data"
|
||||
env:
|
||||
- name: DFLY_PASSWORD
|
||||
- name: DFLY_requirepass
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: dfly-password
|
||||
|
|
|
@ -123,7 +123,7 @@ spec:
|
|||
- mountPath: /etc/dragonfly/tls
|
||||
name: tls
|
||||
env:
|
||||
- name: DFLY_PASSWORD
|
||||
- name: DFLY_requirepass
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: dfly-password
|
||||
|
|
|
@ -90,8 +90,18 @@ containers:
|
|||
{{- end }}
|
||||
{{- include "dragonfly.volumemounts" . | trim | nindent 4 }}
|
||||
{{- 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 }}
|
||||
- name: DFLY_PASSWORD
|
||||
{{- end }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.passwordFromSecret.existingSecret.name }}
|
||||
|
|
2
go.work.sum
Normal file
2
go.work.sum
Normal file
|
@ -0,0 +1,2 @@
|
|||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
Loading…
Add table
Add a link
Reference in a new issue