Skip to content

Commit fd13351

Browse files
committed
chore(passport): use valkey replace redis
1 parent 3340323 commit fd13351

4 files changed

Lines changed: 37 additions & 18 deletions

File tree

charts/passport/templates/_helpers.tpl

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ env:
2828
value: {{ .Values.global.platformDomain }}
2929
- name: CERT_MANAGER_ENABLED
3030
value: "{{ .Values.global.certManagerEnabled }}"
31+
{{- if (.Values.valkeyUrl) }}
32+
- name: DRYCC_VALKEY_URL
33+
valueFrom:
34+
secretKeyRef:
35+
name: passport-creds
36+
key: valkey-url
37+
{{- else if eq .Values.global.valkeyLocation "on-cluster" }}
38+
- name: VALKEY_PASSWORD
39+
valueFrom:
40+
secretKeyRef:
41+
name: valkey-creds
42+
key: password
43+
- name: DRYCC_VALKEY_URL
44+
value: "redis://:$(VALKEY_PASSWORD)@drycc-valkey.{{.Release.Namespace}}.svc.{{.Values.global.clusterDomain}}:16379/1"
45+
{{- end }}
3146
{{- if (.Values.databaseUrl) }}
3247
- name: DRYCC_DATABASE_URL
3348
valueFrom:
@@ -57,16 +72,6 @@ env:
5772
- name: DRYCC_DATABASE_REPLICA_URL
5873
value: "postgres://$(DRYCC_DATABASE_USER):$(DRYCC_DATABASE_PASSWORD)@drycc-database-replica.{{.Release.Namespace}}.svc.{{.Values.global.clusterDomain}}:5432/passport"
5974
{{- end }}
60-
- name: DRYCC_REDIS_ADDRS
61-
valueFrom:
62-
secretKeyRef:
63-
name: redis-creds
64-
key: addrs
65-
- name: DRYCC_REDIS_PASSWORD
66-
valueFrom:
67-
secretKeyRef:
68-
name: redis-creds
69-
key: password
7075
{{- range $key, $value := .Values.environment }}
7176
- name: {{ $key }}
7277
value: {{ $value | quote }}

charts/passport/templates/passport-secret-creds.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ metadata:
66
labels:
77
heritage: drycc
88
data:
9+
{{- if (.Values.valkeyUrl) }}
10+
valkey-url: {{ .Values.valkeyUrl | b64enc }}
11+
{{- end }}
912
{{- if (.Values.databaseUrl) }}
1013
database-url: {{ .Values.databaseUrl | b64enc }}
1114
{{- end }}

charts/passport/values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ podAntiAffinityPreset:
3838
replicas: 1
3939
# limitsCpu: "100m"
4040
# limitsMemory: "50Mi"
41+
42+
## valkeyUrl is will no longer use the built-in valkey component
43+
valkeyUrl: ""
4144
## databaseUrl and databaseReplicaUrl are will no longer use the built-in database component
4245
databaseUrl: ""
4346
databaseReplicaUrl: ""
@@ -103,9 +106,6 @@ service:
103106
# Provide any additional service annotations
104107
annotations: {}
105108

106-
redis:
107-
replicas: 1
108-
109109
global:
110110
# Set the location of Workflow's grafana instance
111111
#

rootfs/api/settings/production.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,22 +324,33 @@
324324
"DEFAULT_CODE_CHALLENGE_METHOD": 'S256',
325325
}
326326
OAUTH2_PROVIDER_APPLICATION_MODEL = 'api.Application'
327-
# Redis Configuration
328-
DRYCC_REDIS_ADDRS = os.environ.get('DRYCC_REDIS_ADDRS', '127.0.0.1:6379').split(",")
329-
DRYCC_REDIS_PASSWORD = os.environ.get('DRYCC_REDIS_PASSWORD', '')
327+
# Valkey Configuration
328+
DRYCC_VALKEY_ADDRS = os.environ.get('DRYCC_VALKEY_ADDRS', '127.0.0.1:6379').split(",")
329+
DRYCC_VALKEY_PASSWORD = os.environ.get('DRYCC_VALKEY_PASSWORD', '')
330330

331331
# Cache Configuration
332332
CACHES = {
333333
"default": {
334334
"BACKEND": "django_redis.cache.RedisCache",
335-
"LOCATION": ['redis://:{}@{}'.format(DRYCC_REDIS_PASSWORD, DRYCC_REDIS_ADDR) \
336-
for DRYCC_REDIS_ADDR in DRYCC_REDIS_ADDRS], # noqa
335+
"LOCATION": ['redis://:{}@{}'.format(DRYCC_VALKEY_PASSWORD, DRYCC_VALKEY_ADDR) \
336+
for DRYCC_VALKEY_ADDR in DRYCC_VALKEY_ADDRS], # noqa
337337
"OPTIONS": {
338338
"CLIENT_CLASS": "django_redis.client.ShardClient",
339339
}
340340
}
341341
}
342342

343+
# Cache Valkey Configuration
344+
CACHES = {
345+
"default": {
346+
"BACKEND": "django_redis.cache.RedisCache",
347+
"LOCATION": os.environ.get('DRYCC_VALKEY_URL', 'redis://:@127.0.0.1:6379'),
348+
"OPTIONS": {
349+
"CLIENT_CLASS": "django_redis.client.DefaultClient",
350+
}
351+
}
352+
}
353+
343354
# LDAP settings taken from environment variables.
344355
LDAP_ENDPOINT = os.environ.get('LDAP_ENDPOINT', '')
345356
LDAP_BIND_DN = os.environ.get('LDAP_BIND_DN', '')

0 commit comments

Comments
 (0)