diff --git a/bitnami/kong/3/debian-12/Dockerfile b/bitnami/kong/3/debian-12/Dockerfile index 3bd67ae0cf01..973ab7e552d3 100644 --- a/bitnami/kong/3/debian-12/Dockerfile +++ b/bitnami/kong/3/debian-12/Dockerfile @@ -7,7 +7,7 @@ ARG DOWNLOADS_URL="https://downloads.bitnami.com/files/stacksmith" ARG TARGETARCH LABEL org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2026-07-19T12:24:56Z" \ + org.opencontainers.image.created="2026-08-04T12:03:40Z" \ org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/kong/README.md" \ org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/kong" \ @@ -48,7 +48,7 @@ COPY rootfs / RUN /opt/bitnami/scripts/kong/postunpack.sh ENV APP_VERSION="3.9.3" \ BITNAMI_APP_NAME="kong" \ - IMAGE_REVISION="4" \ + IMAGE_REVISION="5" \ PATH="/opt/bitnami/kong/bin:/opt/bitnami/kong/openresty/bin:/opt/bitnami/kong/openresty/luajit/bin:/opt/bitnami/kong/openresty/nginx/sbin:/opt/bitnami/kong/luarocks/bin:$PATH" EXPOSE 8000 8001 8443 8444 diff --git a/bitnami/kong/3/debian-12/rootfs/opt/bitnami/scripts/kong-env.sh b/bitnami/kong/3/debian-12/rootfs/opt/bitnami/scripts/kong-env.sh index 5dabbe20d37b..96587af27492 100644 --- a/bitnami/kong/3/debian-12/rootfs/opt/bitnami/scripts/kong-env.sh +++ b/bitnami/kong/3/debian-12/rootfs/opt/bitnami/scripts/kong-env.sh @@ -24,6 +24,7 @@ export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" # By setting an environment variable matching *_FILE to a file path, the prefixed environment # variable will be overridden with the value specified in that file kong_env_vars=( + KONG_PREFIX KONG_MIGRATE KONG_EXIT_AFTER_MIGRATE KONG_PROXY_LISTEN_ADDRESS @@ -61,7 +62,7 @@ export KONG_CONF_FILE="${KONG_CONF_DIR}/kong.conf" export KONG_DEFAULT_CONF_FILE="${KONG_CONF_DIR}/kong.conf.default" export KONG_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" export KONG_SERVER_DIR="${KONG_BASE_DIR}/server" -export KONG_PREFIX="${KONG_SERVER_DIR}" +export KONG_PREFIX="${KONG_PREFIX:-${KONG_SERVER_DIR}}" export KONG_DEFAULT_SERVER_DIR="${KONG_BASE_DIR}/server.default" export KONG_LOGS_DIR="${KONG_SERVER_DIR}/logs" export PATH="${KONG_BASE_DIR}/bin:${KONG_BASE_DIR}/openresty/bin:${KONG_BASE_DIR}/openresty/nginx/sbin:${KONG_BASE_DIR}/luarocks/bin:${PATH}" diff --git a/bitnami/kong/3/debian-12/rootfs/opt/bitnami/scripts/kong/setup.sh b/bitnami/kong/3/debian-12/rootfs/opt/bitnami/scripts/kong/setup.sh index f4ef4c90361d..154a38908b9d 100755 --- a/bitnami/kong/3/debian-12/rootfs/opt/bitnami/scripts/kong/setup.sh +++ b/bitnami/kong/3/debian-12/rootfs/opt/bitnami/scripts/kong/setup.sh @@ -16,11 +16,19 @@ set -o pipefail # Load Kong environment variables . /opt/bitnami/scripts/kong-env.sh -# Ensure Kong environment variables are valid -kong_validate -# Ensure file ownership is correct -am_i_root && chown -R "$KONG_DAEMON_USER":"$KONG_DAEMON_GROUP" "$KONG_SERVER_DIR" "$KONG_CONF_DIR" -# Ensure Kong is initialized -kong_initialize -# Allow running custom initialization scripts -kong_custom_init_scripts +# Check whether we are deployed by the Kong Operator. This can be done by checking whether +# the operator's cluster certificate volume is mounted and KONG_PREFIX points at its writable +# volume (only set by the operator in hardened mode) +# https://github.com/kong/kong-operator/blob/main/pkg/utils/kubernetes/resources/deployments.go +if [[ -d "/var/cluster-certificate" && "${KONG_PREFIX:-}" == "/var/kong" ]]; then + info "Container deployed by the Kong Operator. Skipping setup" +else + # Ensure Kong environment variables are valid + kong_validate + # Ensure file ownership is correct + am_i_root && chown -R "$KONG_DAEMON_USER":"$KONG_DAEMON_GROUP" "$KONG_SERVER_DIR" "$KONG_CONF_DIR" + # Ensure Kong is initialized + kong_initialize + # Allow running custom initialization scripts + kong_custom_init_scripts +fi diff --git a/bitnami/kong/README.md b/bitnami/kong/README.md index 94bc2d264ef2..a79141ba73f3 100644 --- a/bitnami/kong/README.md +++ b/bitnami/kong/README.md @@ -86,6 +86,7 @@ The following tables list the main variables you can set. | Name | Description | Default Value | |--------------------------------|----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------| +| `KONG_PREFIX` | Kong installation directory. | `${KONG_SERVER_DIR}` | | `KONG_MIGRATE` | Perform Kong database migration. | `no` | | `KONG_EXIT_AFTER_MIGRATE` | Exit Kong after performing the database migration. | `no` | | `KONG_PROXY_LISTEN_ADDRESS` | Listen address for Kong proxy daemon. | `0.0.0.0` | @@ -113,7 +114,6 @@ The following tables list the main variables you can set. | `KONG_DEFAULT_CONF_FILE` | Kong default configuration file. | `${KONG_CONF_DIR}/kong.conf.default` | | `KONG_INITSCRIPTS_DIR` | Kong directory for init scripts. | `/docker-entrypoint-initdb.d` | | `KONG_SERVER_DIR` | Directory where Kong Openresty instance is created. | `${KONG_BASE_DIR}/server` | -| `KONG_PREFIX` | Kong installation directory. | `${KONG_SERVER_DIR}` | | `KONG_DEFAULT_SERVER_DIR` | Directory with default Kong Openresty instance files. | `${KONG_BASE_DIR}/server.default` | | `KONG_LOGS_DIR` | Directory where Kong logs are stored. | `${KONG_SERVER_DIR}/logs` | | `KONG_DAEMON_USER` | Kong system user. | `kong` |