feat: add support for using Kubernetes secrets for admin token management

Signed-off-by: Noste <83548733+Noooste@users.noreply.github.com>
This commit is contained in:
Noste
2025-12-21 14:08:33 +01:00
parent 6c6a02bcac
commit d36f8915ac
5 changed files with 749 additions and 249 deletions
+710 -248
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -6,4 +6,6 @@ metadata:
{{- include "garage-ui.labels" . | nindent 4 }}
data:
config.yaml: |
{{- .Values.config | toYaml | nindent 4 }}
{{- $config := deepCopy .Values.config }}
{{- $_ := unset $config.garage "admin_token" }}
{{- $config | toYaml | nindent 4 }}
+11
View File
@@ -35,6 +35,17 @@ spec:
- name: http
containerPort: 8080
protocol: TCP
env:
- name: GARAGE_UI_GARAGE_ADMIN_TOKEN
valueFrom:
secretKeyRef:
{{- if .Values.config.garage.existingSecret.name }}
name: {{ .Values.config.garage.existingSecret.name }}
key: {{ .Values.config.garage.existingSecret.key }}
{{- else }}
name: {{ include "garage-ui.fullname" . }}-admin-token
key: admin-token
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
+11
View File
@@ -0,0 +1,11 @@
{{- if and (not .Values.config.garage.existingSecret.name) .Values.config.garage.admin_token }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "garage-ui.fullname" . }}-admin-token
labels:
{{- include "garage-ui.labels" . | nindent 4 }}
type: Opaque
data:
admin-token: {{ .Values.config.garage.admin_token | b64enc | quote }}
{{- end }}
+14
View File
@@ -87,8 +87,22 @@ config:
# REQUIRED: Obtain this from your Garage server configuration
# This token grants administrative access - keep it secure!
# To generate: See Garage documentation for admin token setup
# NOTE: If existingSecret is configured, this value will be ignored
admin_token: ""
# Use an existing Kubernetes secret for the admin token (recommended for production)
# When configured, this takes precedence over the admin_token value above
# The secret should contain a key with the admin token value
existingSecret:
# Name of the existing secret containing the admin token
# Leave empty to use the admin_token value above instead
# Example: "garage-admin-token"
name: ""
# Key within the secret that contains the admin token value
# Default: "admin-token"
key: "admin-token"
# ========================================
# Authentication Configuration
# ========================================