Feature/image volume support#857
Open
efiguti wants to merge 2 commits into
Open
Conversation
Adds opt-in support for Kubernetes image volume sources (spec.volumes[].image.reference, available since Kubernetes 1.31 with the ImageVolume feature gate). Behaves like init container tracking: enabled per-resource via the keel.sh/imageVolumes: "true" annotation, off by default. Volume names are matched against the existing keel.sh/monitorContainers regex so a single annotation governs all image references on a resource. Covers Deployments, StatefulSets, DaemonSets and CronJobs through the GenericResource abstraction, with unit tests for both TrackedImages discovery and the checkForUpdate path.
Adds the new annotation to the ARCHITECTURE.md table and a brief configuration example to readme.md so users can discover image volume tracking without reading the source.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #849 — adds opt-in support for tracking and updating
OCI image volume sources
(
spec.volumes[].image.reference, Kubernetes 1.31+ with theImageVolumefeature gate).keel.sh/imageVolumes: "true"— mirrors the existingkeel.sh/initContainersannotation (off by default, set per-resource).keel.sh/monitorContainersregex, so one annotation governs all imagereferences on the resource (containers + init containers + image
volumes).
the existing
GenericResourceabstraction.Example
Files changed
types/types.go— newKeelImageVolumeAnnotationconstantinternal/k8s/{resource,converter}.go—VolumeFiltertype plusVolumes(),GetImageVolumeReferences(),UpdateImageVolume()onGenericResource, wired through all four supported kindsprovider/kubernetes/kubernetes.go—getImageVolumeTrackingFromMetaGetMonitorVolumesFromMeta;TrackedImages()andupdateDeployments()include image-volume references when theannotation is set
provider/kubernetes/updates.go— new loop incheckForUpdatethatparses each image volume reference, applies the policy, and rewrites
it in place
ARCHITECTURE.md+readme.md— documentation for the newannotation
Test plan
go build ./...cleango vet ./...clean (no new warnings)go test ./internal/k8s/... ./provider/kubernetes/...passesTrackedImagesdiscovery and thecheckForUpdaterewrite path for image volumes (resource_test.go,kubernetes_test.go)
ImageVolumefeature gate enabledCloses #849