fix(kanidm): fix automatic_refresh toml generation in init container
The \n escape in a shell variable wasn't interpreted as a newline when passed as a printf %s argument, causing automatic_refresh to be appended to the partner_cert string on the same line, breaking TOML parsing. Use separate printf calls per peer type instead.
This commit is contained in:
@@ -53,10 +53,13 @@ spec:
|
|||||||
cert_file="/repl-certs/${peer}"
|
cert_file="/repl-certs/${peer}"
|
||||||
[ -s "${cert_file}" ] || continue
|
[ -s "${cert_file}" ] || continue
|
||||||
fqdn="${peer}.kanidm-headless.kanidm.svc.cluster.local"
|
fqdn="${peer}.kanidm-headless.kanidm.svc.cluster.local"
|
||||||
refresh=""
|
if [ "${peer}" = "kanidm-0" ]; then
|
||||||
[ "${peer}" = "kanidm-0" ] && refresh="\nautomatic_refresh = true"
|
printf '\n[replication."repl://%s:8444"]\ntype = "mutual-pull"\npartner_cert = "%s"\nautomatic_refresh = true\n' \
|
||||||
printf '\n[replication."repl://%s:8444"]\ntype = "mutual-pull"\npartner_cert = "%s"%s\n' \
|
"${fqdn}" "$(cat ${cert_file})" >> /config/server.toml
|
||||||
"${fqdn}" "$(cat ${cert_file})" "${refresh}" >> /config/server.toml
|
else
|
||||||
|
printf '\n[replication."repl://%s:8444"]\ntype = "mutual-pull"\npartner_cert = "%s"\n' \
|
||||||
|
"${fqdn}" "$(cat ${cert_file})" >> /config/server.toml
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
env:
|
env:
|
||||||
- name: POD_NAME
|
- name: POD_NAME
|
||||||
|
|||||||
Reference in New Issue
Block a user