jellyfin: read LDAP config from vault

This commit is contained in:
Brad Stein 2026-01-14 23:15:19 -03:00
parent d898c71c08
commit 6c8d3b24f2
3 changed files with 62 additions and 10 deletions

View File

@ -20,7 +20,16 @@ spec:
metadata: metadata:
labels: labels:
app: jellyfin app: jellyfin
annotations:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/role: "pegasus"
vault.hashicorp.com/agent-inject-secret-ldap-config.xml: "kv/data/atlas/pegasus/jellyfin-ldap-config"
vault.hashicorp.com/agent-inject-template-ldap-config.xml: |
{{ with secret "kv/data/atlas/pegasus/jellyfin-ldap-config" }}
{{ index .Data.data "ldap-config.xml" }}
{{ end }}
spec: spec:
serviceAccountName: pegasus-vault-sync
# Clean up any lingering OIDC artifacts and strip the injected script tag # Clean up any lingering OIDC artifacts and strip the injected script tag
initContainers: initContainers:
- name: strip-oidc - name: strip-oidc
@ -90,6 +99,10 @@ spec:
- name: jellyfin - name: jellyfin
image: docker.io/jellyfin/jellyfin:10.11.5 image: docker.io/jellyfin/jellyfin:10.11.5
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
command:
- /entrypoint.sh
args:
- /jellyfin/jellyfin
ports: ports:
- name: http - name: http
containerPort: 8096 containerPort: 8096
@ -104,6 +117,8 @@ spec:
value: "65532" value: "65532"
- name: UMASK - name: UMASK
value: "002" value: "002"
- name: VAULT_COPY_FILES
value: /vault/secrets/ldap-config.xml:/config/plugins/configurations/LDAP-Auth.xml
resources: resources:
limits: limits:
nvidia.com/gpu.shared: 1 nvidia.com/gpu.shared: 1
@ -114,12 +129,11 @@ spec:
cpu: "500m" cpu: "500m"
memory: 1Gi memory: 1Gi
volumeMounts: volumeMounts:
- name: jellyfin-vault-entrypoint
mountPath: /entrypoint.sh
subPath: vault-entrypoint.sh
- name: config - name: config
mountPath: /config mountPath: /config
# Override LDAP plugin configuration from a secret to avoid embedding credentials in the PVC.
- name: ldap-config
mountPath: /config/plugins/configurations/LDAP-Auth.xml
subPath: ldap-config.xml
- name: cache - name: cache
mountPath: /cache mountPath: /cache
- name: media - name: media
@ -143,6 +157,10 @@ spec:
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
volumes: volumes:
- name: jellyfin-vault-entrypoint
configMap:
name: jellyfin-vault-entrypoint
defaultMode: 493
- name: web-root - name: web-root
emptyDir: {} emptyDir: {}
- name: config - name: config
@ -154,9 +172,3 @@ spec:
- name: media - name: media
persistentVolumeClaim: persistentVolumeClaim:
claimName: jellyfin-media-asteria-new claimName: jellyfin-media-asteria-new
- name: ldap-config
secret:
secretName: jellyfin-ldap-config
items:
- key: ldap-config.xml
path: ldap-config.xml

View File

@ -7,3 +7,9 @@ resources:
- service.yaml - service.yaml
- deployment.yaml - deployment.yaml
- ingress.yaml - ingress.yaml
generatorOptions:
disableNameSuffixHash: true
configMapGenerator:
- name: jellyfin-vault-entrypoint
files:
- vault-entrypoint.sh=scripts/vault-entrypoint.sh

View File

@ -0,0 +1,34 @@
#!/bin/sh
set -eu
if [ -n "${VAULT_ENV_FILE:-}" ]; then
if [ -f "${VAULT_ENV_FILE}" ]; then
# shellcheck disable=SC1090
. "${VAULT_ENV_FILE}"
else
echo "Vault env file not found: ${VAULT_ENV_FILE}" >&2
exit 1
fi
fi
if [ -n "${VAULT_COPY_FILES:-}" ]; then
old_ifs="$IFS"
IFS=','
for pair in ${VAULT_COPY_FILES}; do
src="${pair%%:*}"
dest="${pair#*:}"
if [ -z "${src}" ] || [ -z "${dest}" ]; then
echo "Vault copy entry malformed: ${pair}" >&2
exit 1
fi
if [ ! -f "${src}" ]; then
echo "Vault file not found: ${src}" >&2
exit 1
fi
mkdir -p "$(dirname "${dest}")"
cp "${src}" "${dest}"
done
IFS="$old_ifs"
fi
exec "$@"