Skip to content
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

Add redis auth #528

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/apps/redis/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.3.1
version: 0.4.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
1 change: 1 addition & 0 deletions packages/apps/redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ Service utilizes the Spotahome Redis Operator for efficient management and orche
| `size` | Persistent Volume size | `1Gi` |
| `replicas` | Number of Redis replicas | `2` |
| `storageClass` | StorageClass used to store the data | `""` |
| `authEnabled` | Enable password generation | `true` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Warning: Breaking change for existing deployments

Setting authEnabled: true by default will require all existing Redis clients to be updated with authentication credentials. Consider:

  1. Making it opt-in (false) by default for backward compatibility
  2. Adding a migration guide for existing deployments



7 changes: 7 additions & 0 deletions packages/apps/redis/templates/dashboard-resourcemap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ rules:
- rfrs-{{ .Release.Name }}
- "{{ .Release.Name }}-external-lb"
verbs: ["get", "list", "watch"]
- apiGroups:
- ""
resources:
- secrets
resourceNames:
- "{{ .Release.Name }}-auth"
verbs: ["get", "list", "watch"]
21 changes: 21 additions & 0 deletions packages/apps/redis/templates/redisfailover.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
{{- if .Values.authEnabled }}
{{- $existingPassword := lookup "v1" "Secret" .Release.Namespace (printf "%s-auth" .Release.Name) }}
{{- $password := randAlphaNum 32 | b64enc }}
{{- if $existingPassword }}
{{- $password = index $existingPassword.data "password" }}
{{- end }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-auth
data:
password: {{ $password }}
{{- end }}

---

apiVersion: databases.spotahome.com/v1
kind: RedisFailover
metadata:
Expand Down Expand Up @@ -52,3 +69,7 @@ spec:
- appendonly no
- save ""
{{- end }}
{{- if .Values.authEnabled }}
auth:
secretPath: {{ .Release.Name }}-auth
{{- end }}
5 changes: 5 additions & 0 deletions packages/apps/redis/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"type": "string",
"description": "StorageClass used to store the data",
"default": ""
},
"authEnabled": {
"type": "boolean",
"description": "Enable password generation",
"default": true
}
}
}
2 changes: 2 additions & 0 deletions packages/apps/redis/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
## @param size Persistent Volume size
## @param replicas Number of Redis replicas
## @param storageClass StorageClass used to store the data
## @param authEnabled Enable password generation
##
external: false
size: 1Gi
replicas: 2
storageClass: ""
authEnabled: true
3 changes: 2 additions & 1 deletion packages/apps/versions_map
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ rabbitmq 0.4.3 HEAD
redis 0.1.1 f642698
redis 0.2.0 5ca8823
redis 0.3.0 c07c4bbd
redis 0.3.1 HEAD
redis 0.3.1 b7375f73
redis 0.4.0 HEAD
tcp-balancer 0.1.0 f642698
tcp-balancer 0.2.0 HEAD
tenant 0.1.3 3d1b86c
Expand Down