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:
parent
09acb2347c
commit
6f8e50c455
1 changed files with 10 additions and 7 deletions
|
|
@ -70,22 +70,25 @@ spec:
|
||||||
runAsGroup: 1000
|
runAsGroup: 1000
|
||||||
runAsNonRoot: true
|
runAsNonRoot: true
|
||||||
- name: init-config
|
- name: init-config
|
||||||
image: alpine:3.18
|
image: busybox:1.36
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
# Install envsubst
|
|
||||||
apk add --no-cache gettext
|
|
||||||
|
|
||||||
# Create output directory
|
# Create output directory
|
||||||
mkdir -p /etc/opencloud-processed
|
mkdir -p /etc/opencloud-processed
|
||||||
|
|
||||||
# Process the config template, expanding environment variables
|
# Simple variable expansion using shell
|
||||||
envsubst < /etc/opencloud-template/opencloud.yaml > /etc/opencloud-processed/opencloud.yaml
|
# 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"
|
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:
|
env:
|
||||||
# Pass all environment variables needed for substitution
|
# Pass all environment variables needed for substitution
|
||||||
- name: OC_GRAPH_LDAP_BIND_PASSWORD
|
- name: OC_GRAPH_LDAP_BIND_PASSWORD
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue