-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(helm): add Redis auth support with password bootstrap #41874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sebastianiv21
wants to merge
23
commits into
release
Choose a base branch
from
claude/strange-colden-2a0830
base: release
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+728
−14
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
900756d
feat(helm): add Redis auth support with password bootstrap
sebastianiv21 3b44511
Merge branch 'release' into claude/strange-colden-2a0830
sebastianiv21 86564b9
Merge branch 'release' into claude/strange-colden-2a0830
sebastianiv21 964a971
chore: bump helm chart version to v3.8.2
sebastianiv21 812db5c
chore(client): batch resolution upgrades to fix 22 Dependabot alerts …
subrata71 a1dfc27
chore(plugins): upgrade mssql-jdbc to fix Dependabot alert (#41880)
subrata71 f334e14
chore(widgets): upgrade tinymce from 6.8.5 to 7.9.3 to fix 8 XSS aler…
subrata71 b649f1d
chore(client): add shell-quote 1.8.4 resolution to fix critical alert…
subrata71 dfca3cd
chore(helm): replace README with helm-docs generated file to keep val…
sebastianiv21 2c81821
chore(deps): bump golang from 1.26.3-alpine to 1.26.4-alpine in /depl…
dependabot[bot] ff71415
feat(helm): add Redis auth support with password bootstrap
sebastianiv21 58ffcdc
Merge branch 'release' into claude/strange-colden-2a0830
sebastianiv21 7788231
chore: generate README
sebastianiv21 4e79144
chore: add documentation comments for Redis auth parameters
sebastianiv21 ddf0389
fix(helm): guard against unsupported redis.auth.password configurations
wyattwalter 319b4c7
fix(helm): skip redis-init-container REDISCLI_AUTH on self-managed pa…
wyattwalter d279bea
docs(helm): record redis.auth.password self-managed-path invariants i…
wyattwalter f175f91
Revert "docs(helm): record redis.auth.password self-managed-path inva…
wyattwalter cf9fa0d
Merge pull request #41924 from appsmithorg/fm/redis-pw-guard-v3
wyattwalter c659b7b
fix(helm): derive redis master host from subchart fullname + tests
sebastianiv21 c354051
fix(helm): make redisMasterHost self-contained so unittest CI passes
sebastianiv21 bc002b8
Revert "fix(helm): make redisMasterHost self-contained so unittest CI…
sebastianiv21 9921ef3
Merge branch 'release' into claude/strange-colden-2a0830
sebastianiv21 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| {{/* | ||
| Creates the Redis password secret via a pre-install/pre-upgrade Job when the | ||
| bundled redis subchart is enabled with auth on. | ||
|
|
||
| The Job is idempotent: if the secret already exists, it exits without change. | ||
| This keeps the password stable across Helm upgrades and ArgoCD re-syncs — | ||
| unlike a template-based `randAlphaNum` approach, which changes on every render | ||
| and would either lock clients out or force an ArgoCD ignoreDifferences rule. | ||
|
|
||
| The runtime "secret already exists -> exit 0" check is also the migration and | ||
| bring-your-own-secret guard: an upgrade of an install that already has the | ||
| secret (or a user who pre-created their own) is left untouched. | ||
|
|
||
| The resulting Secret has no Helm release labels/annotations and no | ||
| ownerReferences, so ArgoCD does not track or diff it. | ||
| */}} | ||
| {{/* | ||
| Skip the bootstrap entirely when redis.auth.password is set: on that path the | ||
| operator self-manages the credential (Bitnami uses redis.auth.password directly) | ||
| and there is no chart secret to create. Safe ONLY because appsmith.validateRedisAuth | ||
| (see _helpers.tpl, invoked from configMap.yaml) rejects every redis.auth.password | ||
| configuration except the self-managed one (existingSecret: "" + a matching | ||
| APPSMITH_REDIS_URL) — so this can no longer leave a non-empty existingSecret | ||
| pointing at a secret the hook never creates. | ||
| */}} | ||
| {{- if and .Values.redis.enabled .Values.redis.auth.enabled (not .Values.redis.auth.password) }} | ||
| {{- $secretName := include "appsmith.redisSecretName" . -}} | ||
| {{- $passwordKey := .Values.redis.auth.existingSecretPasswordKey -}} | ||
| {{- $jobName := printf "%s-redis-password-init" (include "appsmith.fullname" .) | trunc 63 | trimSuffix "-" -}} | ||
| {{- $namespace := include "appsmith.namespace" . -}} | ||
| --- | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: {{ $jobName }} | ||
| namespace: {{ $namespace }} | ||
| labels: | ||
| {{- include "appsmith.labels" . | nindent 4 }} | ||
| annotations: | ||
| helm.sh/hook: pre-install,pre-upgrade | ||
| helm.sh/hook-weight: "-5" | ||
| helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: {{ $jobName }} | ||
| namespace: {{ $namespace }} | ||
| labels: | ||
| {{- include "appsmith.labels" . | nindent 4 }} | ||
| annotations: | ||
| helm.sh/hook: pre-install,pre-upgrade | ||
| helm.sh/hook-weight: "-5" | ||
| helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded | ||
| rules: | ||
| # Check whether the password secret already exists (scoped to one name). | ||
| - apiGroups: [""] | ||
| resources: ["secrets"] | ||
| resourceNames: [{{ $secretName | quote }}] | ||
| verbs: ["get"] | ||
| # Create it if it doesn't. resourceNames can't scope `create` (the name | ||
| # is in the request body, not the URL), so this is namespace-scoped. | ||
| - apiGroups: [""] | ||
| resources: ["secrets"] | ||
| verbs: ["create"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: {{ $jobName }} | ||
| namespace: {{ $namespace }} | ||
| labels: | ||
| {{- include "appsmith.labels" . | nindent 4 }} | ||
| annotations: | ||
| helm.sh/hook: pre-install,pre-upgrade | ||
| helm.sh/hook-weight: "-5" | ||
| helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ $jobName }} | ||
| namespace: {{ $namespace }} | ||
| roleRef: | ||
| kind: Role | ||
| name: {{ $jobName }} | ||
| apiGroup: rbac.authorization.k8s.io | ||
| --- | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: {{ $jobName }} | ||
| namespace: {{ $namespace }} | ||
| labels: | ||
| {{- include "appsmith.labels" . | nindent 4 }} | ||
| annotations: | ||
| helm.sh/hook: pre-install,pre-upgrade | ||
| helm.sh/hook-weight: "0" | ||
| helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded | ||
| spec: | ||
| ttlSecondsAfterFinished: 60 | ||
| backoffLimit: 3 | ||
| template: | ||
| metadata: | ||
| labels: | ||
| {{- include "appsmith.labels" . | nindent 8 }} | ||
| spec: | ||
| serviceAccountName: {{ $jobName }} | ||
| restartPolicy: Never | ||
| {{- if .Values.image.pullSecrets }} | ||
| imagePullSecrets: | ||
| - name: {{ .Values.image.pullSecrets }} | ||
| {{- end }} | ||
| containers: | ||
| - name: create-password | ||
| image: {{ include "appsmith.redisPasswordInitImage" . | quote }} | ||
| imagePullPolicy: {{ .Values.redisAuth.passwordInit.image.pullPolicy }} | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - | | ||
| set -eu | ||
| SECRET_NAME={{ $secretName | quote }} | ||
| NAMESPACE={{ $namespace | quote }} | ||
| PASSWORD_KEY={{ $passwordKey | quote }} | ||
| if kubectl -n "$NAMESPACE" get secret "$SECRET_NAME" >/dev/null 2>&1; then | ||
| echo "Secret $SECRET_NAME already exists; leaving it untouched." | ||
| exit 0 | ||
| fi | ||
| PASSWORD=$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 24) | ||
| kubectl -n "$NAMESPACE" create secret generic "$SECRET_NAME" \ | ||
| --from-literal="$PASSWORD_KEY"="$PASSWORD" | ||
| echo "Created secret $SECRET_NAME." | ||
| securityContext: | ||
| allowPrivilegeEscalation: false | ||
| readOnlyRootFilesystem: true | ||
| runAsNonRoot: true | ||
| runAsUser: 1000 | ||
| capabilities: | ||
| drop: ["ALL"] | ||
| {{- end }} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.