feat: expose image digest on Application#457
Open
ybelMekk wants to merge 10 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes container image digests through the existing ContainerImage GraphQL type and wires digest population into workload image fields by extracting digests from pod ImageID values via the shared pod watcher cache.
Changes:
- Add
digest: StringtoContainerImagein the GraphQL schema and generated code. - Extend workload image parsing/modeling to support digests and more robust tag parsing (incl. registry host:port).
- Populate image digests for
Application,InstanceGroup, andJobRunimages using pod watcher-backed lookups; add unit + integration tests.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/workload/queries.go | Switch image node lookup to use the new ContainerImage constructor. |
| internal/workload/models.go | Add digest support to ContainerImage, implement image splitting + digest extraction helpers. |
| internal/workload/models_test.go | Add unit tests for image splitting/digest extraction and container image construction. |
| internal/workload/job/queries.go | Attach per-run image digests (single + batch) by correlating runs to pods. |
| internal/workload/job/models.go | Store/run digest on JobRun and include it in JobRun.Image(). |
| internal/workload/job/dataloader.go | Extend job loader context to include the pod watcher. |
| internal/workload/instancegroup/queries.go | Populate instance group image digests by selecting pods for a ReplicaSet. |
| internal/workload/instancegroup/queries_test.go | Add unit test coverage for ReplicaSet pod selector behavior. |
| internal/workload/instancegroup/models.go | Thread imageDigest through InstanceGroup and use it when building ContainerImage. |
| internal/workload/application/queries.go | Populate application image digest by selecting pods via app=<name> label. |
| internal/workload/application/models.go | Improve instance image selection to use the application container (by name) and include digest in Image(). |
| internal/workload/application/models_test.go | Add unit test ensuring instance image/digest comes from the application container, not a sidecar. |
| internal/workload/application/dataloader.go | Extend application loader context to include the pod watcher. |
| internal/thirdparty/promclient/fake/fake_test.go | Update test wiring for the new application loader context signature. |
| internal/issue/checker/workload_lastfailed.go | Update ToGraphJobRun call sites to match the new signature. |
| internal/graph/schema/workloads.graphqls | Add digest field to ContainerImage with description. |
| internal/graph/gengql/workloads.generated.go | Generated resolver wiring for ContainerImage.digest. |
| internal/graph/gengql/root_.generated.go | Generated schema/complexity updates to include digest. |
| internal/cmd/api/http.go | Wire pod watcher into application/job loader contexts. |
| integration_tests/k8s_resources/application_image_digest/dev/myteam/app.yaml | Add fixtures for an application pod with an imageID containing a digest. |
| integration_tests/application_image_digest.lua | Add integration test asserting application.image.digest is populated. |
Files not reviewed (1)
- internal/graph/gengql/workloads.generated.go: Language not supported
…RunFailed Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…via podWatcher Digest is now available directly on app.image.digest without going via instances.nodes.image. Source is ContainerStatus.ImageID from the running pod, resolved through an in-memory podWatcher cache. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…text Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pdate Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
DigestFromPodStatus used containers[0] which could be a Nais-injected sidecar (e.g. Linkerd), causing the sidecar digest to surface on Application.image and InstanceGroup.image instead of the app's digest. Add DigestFromPodStatusByAppName that matches by appName first (per Nais convention: container name == app/RS name), falling back to any available digest. Update imageDigestForApplication and imageDigestForInstanceGroup to use the new function. Also removes the unnecessary Spec.Containers guard from imageDigestForInstanceGroup since the function no longer needs the container spec. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ReplicaSet names include a hash suffix (e.g. myapp-7d9f8b6c5) and do not match the container name. Use the 'app' label instead, which per Nais convention matches the container name. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…g rollouts During rollouts, multiple pods with the same app label exist with different digests. Sorting newest-first ensures Application.image.digest reflects the target image being rolled out, not an arbitrary pod's digest. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ecb1ce9 to
00ef8fa
Compare
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.
Exposes
ContainerImage.digestdirectly onApplication.imageandInstanceGroup.imageby readingContainerStatus.ImageIDfrom running pods via the existingpodWatchercache.Changes
digestfield toContainerImageGraphQL typeApplication.imagevia newimageDigestForApplicationusingpodWatcherInstanceGroup.imageviaimageDigestForInstanceGroupctxfromToGraphJobRunandlastRunFailedgo-cmpapplication.image