Skip to content

Commit d43b8fd

Browse files
kvapsklinch0
andauthored
fix keycloak secrets drift (#508)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced management of Keycloak credentials by checking for existing passwords stored in Kubernetes Secrets. - Improved password management logic, allowing for the reuse of existing passwords or the generation of new ones as needed. - **Bug Fixes** - Streamlined secret handling to avoid unnecessary random password generation, improving security and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Floppy Disk <[email protected]>
1 parent 3aa5f88 commit d43b8fd

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • packages/system/keycloak/templates

‎packages/system/keycloak/templates/sts.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{{- $cozyConfig := lookup "v1" "ConfigMap" "cozy-system" "cozystack" }}
22
{{- $host := index $cozyConfig.data "root-host" }}
3+
4+
{{- $existingPassword := lookup "v1" "Secret" "cozy-keycloak" "{{ .Release.Name }}-credentials" }}
35
{{- $password := randAlphaNum 16 -}}
6+
{{- if $existingPassword }}
7+
{{- $password = index $existingPassword.data "password" | b64dec }}
8+
{{- end }}
49

510
apiVersion: v1
611
kind: Secret

0 commit comments

Comments
 (0)