Fix init-config container to use busybox with shell expansion

Changed from alpine+envsubst to busybox with simple shell-based
variable expansion using sed. This avoids permission issues with
apk and works with non-root security context.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
CTO Agent 2026-07-05 13:40:23 +00:00
parent 09acb2347c
commit 6f8e50c455

View file

@ -70,22 +70,25 @@ spec:
runAsGroup: 1000
runAsNonRoot: true
- name: init-config
image: alpine:3.18
image: busybox:1.36
command:
- sh
- -c
- |
# Install envsubst
apk add --no-cache gettext
# Create output directory
mkdir -p /etc/opencloud-processed
# Process the config template, expanding environment variables
envsubst < /etc/opencloud-template/opencloud.yaml > /etc/opencloud-processed/opencloud.yaml
# Simple variable expansion using shell
# Read template and expand ${VAR} patterns
while IFS= read -r line; do
# Expand ${OPENLDAP_ADMIN_PASSWORD}
line=$(echo "$line" | sed "s|\${OPENLDAP_ADMIN_PASSWORD}|$OPENLDAP_ADMIN_PASSWORD|g")
echo "$line"
done < /etc/opencloud-template/opencloud.yaml > /etc/opencloud-processed/opencloud.yaml
echo "Config file processed successfully"
cat /etc/opencloud-processed/opencloud.yaml | head -20
echo "First 20 lines:"
head -20 /etc/opencloud-processed/opencloud.yaml
env:
# Pass all environment variables needed for substitution
- name: OC_GRAPH_LDAP_BIND_PASSWORD