-
Notifications
You must be signed in to change notification settings - Fork 11
add ACL authentication support with auto-generated and existing secret options #14
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
base: main
Are you sure you want to change the base?
Conversation
…t options Signed-off-by: David Flanagan <[email protected]>
4196475
to
2787b1e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds ACL authentication support to the Valkey Helm chart with three different configuration methods: auto-generated secrets, existing secrets, and inline configuration. It includes comprehensive validation logic and extensive test coverage to ensure only one authentication method is used at a time.
- Adds three authentication methods with priority-based selection and mutual exclusion validation
- Implements auto-generation of passwords and ACL configurations via Kubernetes secrets
- Provides comprehensive test coverage for all authentication scenarios and edge cases
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
valkey/values.yaml | Added authentication configuration options with detailed comments |
valkey/templates/secret.yaml | New template for generating authentication secrets |
valkey/templates/init_config.yaml | Updated to handle different authentication methods |
valkey/templates/deploy_valkey.yaml | Added auth volume mounts and validation |
valkey/templates/_helpers.tpl | Added authentication configuration validation logic |
valkey/templates/tests/auth.yaml | New test pods for authentication verification |
valkey/tests/*.yaml | Comprehensive test suites for all components |
Justfile | Development task automation |
.github/workflows/test.yml | CI/CD pipeline for testing |
valkey/.helmignore | Updated ignore patterns |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
data: | ||
{{- $password := .Values.auth.generateDefaultUser.password }} | ||
{{- if not $password }} | ||
{{- $password = randAlphaNum 32 }} |
Copilot
AI
Sep 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The random password generation using randAlphaNum
will create a new password on every template rendering, which could cause authentication failures during upgrades. Consider using a lookup function to preserve existing passwords or add a note about this behavior in the documentation.
{{- $password = randAlphaNum 32 }} | |
{{- $existingSecret := (lookup "v1" "Secret" .Release.Namespace (printf "%s-auth" (include "valkey.fullname" .))) }} | |
{{- if and $existingSecret $existingSecret.data $existingSecret.data.password }} | |
{{- $password = ($existingSecret.data.password | b64dec) }} | |
{{- else }} | |
{{- $password = randAlphaNum 32 }} | |
{{- end }} |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The random password generation using randAlphaNum will create a new password on every template rendering, which could cause authentication failures during upgrades.
{{- $hasContent := false }} | ||
{{- range $line := splitList "\n" $trimmed }} | ||
{{- $line = trim $line }} | ||
{{- if and $line (not (hasPrefix "#" $line)) }} | ||
{{- $hasContent = true }} | ||
{{- end }} | ||
{{- end }} |
Copilot
AI
Sep 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nested loop for checking ACL content could be inefficient for large configurations. Consider using a regex-based approach or caching the result to avoid repeated processing during template rendering.
{{- $hasContent := false }} | |
{{- range $line := splitList "\n" $trimmed }} | |
{{- $line = trim $line }} | |
{{- if and $line (not (hasPrefix "#" $line)) }} | |
{{- $hasContent = true }} | |
{{- end }} | |
{{- end }} | |
{{- /* Use regex to check for any non-empty, non-comment line */}} | |
{{- $hasContent := regexMatch "(?m)^(\\s*[^#\\s].*)$" $trimmed }} |
Copilot uses AI. Check for mistakes.
# If password key exists in secret, test with it | ||
if [ -f /valkey-auth/password ]; then | ||
PASSWORD=$(cat /valkey-auth/password) | ||
USERNAME="${USERNAME:-default}" |
Copilot
AI
Sep 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The USERNAME variable is referenced but never defined in this context. This will always default to 'default' since USERNAME is not set anywhere in the test script.
Copilot uses AI. Check for mistakes.
Need to check it firstly |
This adds support for generating passwords or using a pre-existing secret, as well as test coverage for all changes.