Skip to content

build(k8s): Pin the third-party images of k8s by digest #6067

Description

@dan-petty

Update 2026-11-26 (infra move): the images to pin are in dan-petty/homelab.

The third-party images of k8s/devops/ already have a digest. This issue keeps the devops k8s image-pins refusal. .github/renovate/base.json is gone: set pinDigests for kubernetes, helm-values and argocd in renovate/k8s.json of dan-petty/infra. The gateway, Valkey, PostgreSQL and Qdrant pins are homelab work.

Follow-up: dan-petty/homelab#307.


Problem

Row SEC-4 of the production readiness guideline pins an image by digest. The third-party images of k8s/llm/ name a tag only: the LiteLLM gateway, Portkey, the three Valkey instances and their redis_exporter, the PostgreSQL image of the CloudNativePG cluster llm-gateway-db, and the Qdrant image that its Helm chart sets. A registry can move a tag, so two pulls of one tag can give two images.

devops k8s image-pins (CI job image-pins) refuses only an image with no digest and the tag latest or no tag, so a fixed tag passes. Renovate sets pinDigests only for the managers github-actions and dockerfile (.github/renovate/base.json), so it writes no digest into a manifest or a Helm value.

Expected behavior

  • Each third-party image of k8s/devops/ names a tag and a digest (<image>:<tag>@sha256:<digest>), and Renovate updates both, for example with pinDigests for the managers kubernetes, helm-values and argocd.
  • devops k8s image-pins refuses a third-party image with no digest, and names the exceptions that Argo CD Image Updater moves.
  • No test repeats a digest (test(k8s): Drop the tests that repeat third-party version pins #6060).

Related

Alternatives check of 2026-11-24: in-use.
The repository already uses this tool.
Tool: renovatebot/renovate (https://github.com/renovatebot/renovate), AGPL-3.0, last activity 2026-11-24, maintained.
Reason: Searches found Renovate as the maintained dependency automator that pins and updates image tags and digests in manifests and Helm values; it covers the automated pinning half, but the in-repo refusal check and the Argo CD Image Updater exceptions remain project code.

Covers:

  • Sets pinDigests for the kubernetes, helm-values and argocd managers
  • Updates tag and digest together in one pull request
  • Rewrites Helm values and Argo CD image references

Lacks:

  • No in-repo refusal of a digestless third-party image
  • No named Argo CD Image Updater exceptions
  • No rule that tests avoid repeating a digest

Proposed design

Problem statement

devops k8s image-pins must refuse a third-party image with no digest and name the images that Argo CD Image Updater moves. A registry can move a tag, so two pulls of one tag can give two images. The current check refuses only the latest tag or no tag, so a fixed tag passes. The homelab images are follow-up dan-petty/homelab#307. The Renovate pin rules of dan-petty/infra are deferred.

Acceptance criteria

Requirement: A fixed tag with no digest fails

devops k8s image-pins SHALL fail when a third-party image names a tag and no digest.

Scenario: A fixed tag with no digest fails

  • WHEN uv run pytest tests/k8s/test_image_pins.py -q runs its case with a tree whose Deployment names example.com/team/app:1.2.3 and no digest.
  • THEN The test passes, the command exits 1, and its output names the image, its Application and the missing digest.

Requirement: A tag with a digest passes

devops k8s image-pins SHALL accept a third-party image that names a tag and a sha256 digest.

Scenario: A tag with a digest passes

  • WHEN uv run pytest tests/k8s/test_image_pins.py -q runs its case with a tree whose Deployment names example.com/team/app:1.2.3 and the digest that tests/fixtures/image_pins/digests.yaml gives for app.
  • THEN The test passes, the command exits 0, and its output names the image as a pin.

Requirement: An updater image is named, not refused

devops k8s image-pins SHALL name each image that Argo CD Image Updater moves and SHALL not fail it for a missing digest.

Scenario: An updater image is named

  • WHEN uv run pytest tests/k8s/test_image_pins.py -q runs its case with --managed ghcr.io/example/service and a tree whose image ghcr.io/example/service has no tag.
  • THEN The test passes, the command exits 0, and its output lists the image under the Argo CD Image Updater exceptions.

Requirement: A cluster-only registry image is named, not refused

devops k8s image-pins SHALL not fail an image of a cluster-only registry for a missing digest and SHALL name it.

Scenario: A cluster-only image is named

  • WHEN uv run pytest tests/k8s/test_image_pins.py -q runs its case with a tree whose image is registry.example.svc:5000/team/tool:1.0.
  • THEN The test passes, the command exits 0, and its output names the image as a cluster-only registry image.

Requirement: One copy of each test digest

The image-pins tests SHALL read each sha256 digest from tests/fixtures/image_pins/digests.yaml and SHALL hold no digest literal.

Scenario: The test sources hold no digest literal

  • WHEN uv run pytest tests/invariants/test_image_pin_digests.py -q scans tests/k8s/test_image_pins.py for the pattern sha256:[0-9a-f]{64}.
  • THEN The test passes and reports no match.

Requirement: The image-pins CI job passes

The image-pins CI job SHALL pass and SHALL name each Argo CD Image Updater exception of k8s/devops.

Scenario: The image-pins CI job passes

  • WHEN The image-pins CI job runs on the repository.
  • THEN The job passes and its log names each Argo CD Image Updater exception of k8s/devops.

Existing Tool Considered

Renovate (renovatebot/renovate), verdict in-use. The alternatives check in the issue body gives what the tool covers and lacks. The proposal uses Renovate for the tag and digest updates. It adds what Renovate lacks: the in-repo refusal in devops k8s image-pins, the named Argo CD Image Updater exceptions, and the single copy of each test digest.

Key questions

  • Which images must name a digest?: A third-party image must name a tag and a sha256 digest. The check does not require a digest of an image of a cluster-only registry, because no runner reads that registry. The check does not require a digest of an image that Argo CD Image Updater moves, and it names that image. (best practice) [sources: src/devops_cli/k8s/image_pins.py, tests/k8s/test_image_pins.py]
    • Rejected: Require a digest of each third-party image except the updater images. It fails an image of a cluster-only registry that no runner can resolve.
    • Chosen: Require a digest of each third-party image, except the cluster-only and updater images. It pins each image that a public registry holds, and it keeps the two sets that the check already reads.
    • Rejected: Keep the current rule and refuse only the latest tag or no tag. A fixed tag can move, which is the problem that the issue states.
  • How does the check learn which images Argo CD Image Updater moves?: The check keeps its two sources: an ImageUpdater object in the render and the --managed <repository> option. It reports each image from those sources as an exception with no error. (best practice) [sources: src/devops_cli/k8s/image_pins.py, tests/k8s/test_image_pins.py, tests/fixtures/image_pins/chart_render.yaml]
    • Chosen: Reuse the ImageUpdater objects and the --managed option. The check already reads both, and a test shows each source.
    • Rejected: An explicit exception set in the check. It duplicates the sources that the render and the option already give.
    • Rejected: A separate config file. It adds a file and a loader for a list that the check already builds.
  • What does the refusal message say?: The message names each image with no digest, its Applications, and the missing digest. It does not say that the image uses the latest tag. (best practice) [sources: tests/k8s/test_image_pins.py]
    • Chosen: A new message that names the missing digest. It states the defect of a fixed tag and of a latest tag.
    • Rejected: Reuse the latest message. It says the image uses the latest tag, which is false for a fixed tag.
    • Rejected: One message for the two cases with no image name. The reader cannot find the image that fails.
  • Where do the tests get each digest?: The tests read each digest from tests/fixtures/image_pins/digests.yaml, which holds it once. No test holds a sha256 literal, as test(k8s): Drop the tests that repeat third-party version pins #6060 asks. (best practice) [sources: tests/k8s/test_image_pins.py, tests/fixtures/image_pins/chart_render.yaml]
    • Chosen: One fixture that holds each digest once. One copy, and an image update changes one line.
    • Rejected: A literal in each test. It repeats a digest, which test(k8s): Drop the tests that repeat third-party version pins #6060 forbids.
    • Rejected: Read the digests from the committed k8s/devops manifests. It couples a unit test to the product base.
  • How does the chart render fixture give a pinned image?: _chart_answers adds the digest from tests/fixtures/image_pins/digests.yaml to the Alertmanager image of the render. The chart render fixture keeps the tag only, so the digest has one copy. (best practice) [sources: tests/k8s/test_image_pins.py, tests/fixtures/image_pins/chart_render.yaml]
    • Chosen: Add the digest in the test from the digest fixture. The digest stays in one file.
    • Rejected: Write the digest into chart_render.yaml. It makes a second copy of the digest.
    • Rejected: Keep the tag only and let the render fail. The chart tests would fail on a valid chart.
  • Which images does the check scan?: The check keeps its scope: the rendered Applications of the environment tree, or the kustomization folder that the argument names. The new refusal applies to each image in that scope. (best practice) [sources: src/devops_cli/k8s/image_pins.py, tests/k8s/test_image_pins.py]
    • Chosen: Keep the rendered scope. It reads the Helm values and the Argo CD references that a raw file scan misses.
    • Rejected: Scan the raw files of k8s/. It misses a tag that a chart value file sets.
    • Rejected: Scan only k8s/devops. The check serves each environment tree, not only the product base.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Moved to new items

#7439

Activity

  1. added
    type/infra
    scope/k8s
    source/agent
    status/new
    value/medium
    on Nov 16, 2026
  2. dan-petty commented on Nov 16, 2026

    @dan-petty
    OwnerAuthor
  3. added
    effort/medium
    priority/p2-medium
    on Nov 16, 2026
  4. dan-petty commented on Nov 17, 2026

    @dan-petty
    OwnerAuthor

    Pull request #6112 (for #6068) runs kube-linter in CI. Today 7 third-party images of the path sources name no digest: cloudflare/cloudflared, ghcr.io/berriai/litellm, ghcr.io/oliver006/redis_exporter, mattermost/mattermost-team-edition, nvcr.io/nvidia/k8s-device-plugin, portkeyai/gateway and valkey/valkey. After this item pins them, a custom check of .kube-linter.yaml from the template latest-tag with an allowList of .*@sha256:[0-9a-f]{64}$ keeps each new image pinned. The 3 images that Argo CD Image Updater sets then need the annotation of that check too, as they hold ignore-check.kube-linter.io/latest-tag now.

  5. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (5)

    Tools considered:

    Searches run:

    • Renovate pinDigests kubernetes helm-values argocd manager digest pinning, results: 5
    • docs.renovatebot.com kubernetes manager pinDigests image tag digest, results: 5
    • renovatebot kubernetes manager pinDigests helm-values argocd managers support, results: 5
    • renovate kubernetes manager pinDigests values.yaml image digest pull request, results: 5
    • "docs.renovatebot.com" modules manager kubernetes, results: 5

    Sources:

  6. added
    status/ready
    and removed
    status/new
    on Nov 18, 2026
  7. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 4ddf77e (see proposed design in issue body).

  8. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  9. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 29, 2026
  10. removed
    status/in-review
    on Nov 29, 2026
  11. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 18:59 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/k8ssource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions