Skip to content

Commit

Permalink
Add redis auth (#528)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced `authEnabled` parameter for enabling password generation in
Redis.
	- Added authentication logic for Redis failover configuration.
  
- **Bug Fixes**
	- Updated version of the Redis chart from `0.3.1` to `0.4.0`.

- **Documentation**
- Updated README to include the new `authEnabled` parameter description.

- **Chores**
	- Incremented version numbers for multiple packages in the version map.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
klinch0 authored Dec 18, 2024
1 parent b43c958 commit abc8f08
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 2 deletions.
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` |


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

0 comments on commit abc8f08

Please sign in to comment.