Skip to content

build: use scratch runtime images - #8815

Open
SidheshwarSarangal wants to merge 1 commit into
prometheus-operator:mainfrom
SidheshwarSarangal:contributor/minimal-runtime-images
Open

SidheshwarSarangal wants to merge 1 commit into
prometheus-operator:mainfrom
SidheshwarSarangal:contributor/minimal-runtime-images

Conversation

@SidheshwarSarangal

@SidheshwarSarangal SidheshwarSarangal commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Description

Replace the BusyBox runtime stages for the operator, Prometheus config reloader, and admission webhook with gcr.io/distroless/static-debian12:nonroot.

The Go binaries are built with CGO_ENABLED=0. The distroless base keeps the containers non-root while providing CA certificates and timezone data.

Relates to #8748

Testing

  • Built all three images with Docker:
    • operator
    • prometheus-config-reloader
    • admission-webhook
  • Ran each image with --help
  • git diff --check

AI assistance

AI assistance was used to inspect the build configuration and draft this focused change. I reviewed the diff and can explain it.

@SidheshwarSarangal
SidheshwarSarangal requested a review from a team as a code owner September 12, 2026 06:47
@jkroepke

Copy link
Copy Markdown
Contributor

We should keep in mind that some end users prefer logging in their own timezone. Only the operator binary embeds timezone data, while the admission and reloader binaries do not include tzdata.

Distroless provides tzdata and CA certificates out of the box, while scratch does not. The size difference might be only around 2 MB.

Prometheus may have chosen distroless for similar reasons, and Grafana uses distroless as well. Since much of the surrounding ecosystem already uses distroless as a base image, I personally recommend following the same approach.

@SidheshwarSarangal
SidheshwarSarangal force-pushed the contributor/minimal-runtime-images branch from 1caf896 to 93fba23 Compare September 13, 2026 05:05
@SidheshwarSarangal

Copy link
Copy Markdown
Contributor Author

Thanks for the guidance. I updated all three runtime stages to gcr.io/distroless/static-debian12:nonroot, which preserves a non-root runtime while providing CA certificates and timezone data. I rebuilt each image and verified each binary with --help.

@SidheshwarSarangal
SidheshwarSarangal force-pushed the contributor/minimal-runtime-images branch from 93fba23 to 393006c Compare September 13, 2026 08:25
@jkroepke

Copy link
Copy Markdown
Contributor

May use gcr.io/distroless/static-debian13. I guess your AI agent was not aware of latest version.

@simonpasquier simonpasquier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plan discussed in #8748 was to have distroless variants as moving away from busybox images is a major (potentially breaking) change for users.

Keep BusyBox images as the default while adding separately tagged distroless variants for the operator, config reloader, and admission webhook.

Build, publish, sign, and validate the variants in CI.

Relates to prometheus-operator#8748

Signed-off-by: Sidheshwar Sarangal <sidheshwar.sarangal@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants