[bitnami/clickhouse] add support for etc/config.d (#76236)

etc/conf.d is obselete, etc/config.d should be used.
etc/conf.d is still supported for backward compatibility.

Signed-off-by: Paweł Szynkiewicz <pawel.szynkiewicz@nask.pl>
Co-authored-by: Paweł Szynkiewicz <pawel.szynkiewicz@nask.pl>
This commit is contained in:
pszynk
2025-01-17 10:07:47 +01:00
committed by GitHub
parent 61cf8dc224
commit e2ad43c484
3 changed files with 13 additions and 13 deletions

View File

@@ -20,7 +20,7 @@ set -o pipefail
ensure_user_exists "$CLICKHOUSE_DAEMON_USER" --group "$CLICKHOUSE_DAEMON_GROUP" --system
# Create directories
for dir in "$CLICKHOUSE_DATA_DIR" "$CLICKHOUSE_CONF_DIR" "${CLICKHOUSE_CONF_DIR}/conf.d" "${CLICKHOUSE_CONF_DIR}/users.d" "$CLICKHOUSE_DEFAULT_CONF_DIR" "$CLICKHOUSE_LOG_DIR" "$CLICKHOUSE_TMP_DIR" "$CLICKHOUSE_MOUNTED_CONF_DIR" "/docker-entrypoint-startdb.d" "/docker-entrypoint-initdb.d"; do
for dir in "$CLICKHOUSE_DATA_DIR" "$CLICKHOUSE_CONF_DIR" "${CLICKHOUSE_CONF_DIR}/conf.d" "${CLICKHOUSE_CONF_DIR}/config.d" "${CLICKHOUSE_CONF_DIR}/users.d" "$CLICKHOUSE_DEFAULT_CONF_DIR" "$CLICKHOUSE_LOG_DIR" "$CLICKHOUSE_TMP_DIR" "$CLICKHOUSE_MOUNTED_CONF_DIR" "/docker-entrypoint-startdb.d" "/docker-entrypoint-initdb.d"; do
ensure_dir_exists "$dir"
configure_permissions_ownership "$dir" -d "775" -f "664" -u "$CLICKHOUSE_DAEMON_USER" -g "root"
done
@@ -88,4 +88,4 @@ clickhouse_conf_set "/clickhouse/logger/console" "1"
# Copy all initially generated configuration files to the default directory
# (this is to avoid breaking when entrypoint is being overridden)
cp -r "${CLICKHOUSE_CONF_DIR}/"* "$CLICKHOUSE_DEFAULT_CONF_DIR"
cp -r "${CLICKHOUSE_CONF_DIR}/"* "$CLICKHOUSE_DEFAULT_CONF_DIR"

View File

@@ -82,15 +82,15 @@ clickhouse_copy_mounted_configuration() {
# base etc folder
find "$CLICKHOUSE_MOUNTED_CONF_DIR" -maxdepth 1 \( -type f -o -type l \) -exec cp -L -r {} "$CLICKHOUSE_CONF_DIR" \;
# The ClickHouse override directories (etc/conf.d and etc/users.d) do not support subfolders. That means we cannot
# The ClickHouse override directories (etc/conf.d, etc/config.d and etc/users.d) do not support subfolders. That means we cannot
# copy directly with cp -RL because we need all override xml files to have at the root of these subfolders. In the helm
# chart we want to allow overrides from different ConfigMaps and Secrets so we need to use the find command
if [[ -d "${CLICKHOUSE_MOUNTED_CONF_DIR}/conf.d" ]]; then
find "${CLICKHOUSE_MOUNTED_CONF_DIR}/conf.d" \( -type f -o -type l \) -exec cp -L -r {} "${CLICKHOUSE_CONF_DIR}/conf.d" \;
fi
if [[ -d "${CLICKHOUSE_MOUNTED_CONF_DIR}/users.d" ]]; then
find "${CLICKHOUSE_MOUNTED_CONF_DIR}/users.d" \( -type f -o -type l \) -exec cp -L -r {} "${CLICKHOUSE_CONF_DIR}/users.d" \;
fi
# chart we want to allow overrides from different ConfigMaps and Secrets so we need to use the find command.
# etc/conf.d is now obselete but still supported.
for dir in conf.d config.d users.d; do
if [[ -d "${CLICKHOUSE_MOUNTED_CONF_DIR}/${dir}" ]]; then
find "${CLICKHOUSE_MOUNTED_CONF_DIR}/${dir}" \( -type f -o -type l \) -exec cp -L -r {} "${CLICKHOUSE_CONF_DIR}/${dir}" \;
fi
done
fi
else
warn "The folder $CLICKHOUSE_CONF_DIR is not writable. This is likely because a read-only filesystem was mounted in that folder. Using $CLICKHOUSE_MOUNTED_DIR is recommended"