Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CONTINT-4545] Fix <missing> docker image layer digests from the docker collector #33384

Merged

Conversation

justin-lesko
Copy link
Contributor

@justin-lesko justin-lesko commented Jan 24, 2025

What does this PR do?

This PR solves the <missing> image layer digests when inspecting an image from the Docker collector.

Before

Image layer digests are missing
Screenshot 2025-01-24 at 4 02 59 PM

After

Image layer digests are populated
Screenshot 2025-01-28 at 4 02 45 PM

Motivation

Achieving consistency across our container runtime image collectors.

Describe how you validated your changes

  1. Start a minikube cluster using docker as the runtime (no additional args needed)
minikube start -p docker-updated
  1. Start a minikube cluster using crio as the runtime
minikube start --container-runtime=crio -p crio
  1. Validate the minikube clusters are deployed properly
|----------------|-----------|---------|--------------|------|---------|--------|-------|----------------|--------------------|
|    Profile     | VM Driver | Runtime |      IP      | Port | Version | Status | Nodes | Active Profile | Active Kubecontext |
|----------------|-----------|---------|--------------|------|---------|--------|-------|----------------|--------------------|
| crio           | docker    | crio    | 192.168.67.2 | 8443 | v1.32.0 | OK     |     1 |                | *                  |
| docker-updated | docker    | docker  | 192.168.58.2 | 8443 | v1.32.0 | OK     |     1 |                |                    |
|----------------|-----------|---------|--------------|------|---------|--------|-------|----------------|--------------------|
  1. Build and deploy this branch to the docker minikube cluster, verify that the deployed agent is correct
❯ k exec datadog-agent-hs6s6 -it --context docker-updated -- agent version

Defaulted container "agent" out of: agent, trace-agent, process-agent, init-volume (init), init-config (init)
Agent 7.64.0-devel - Meta: git.41.81ad9c6 - Commit: 81ad9c6501 - Serialization version: v5.0.141 - Go version: go1.23.5
  1. Deploy a production version of the agent to the crio cluster, verify that the deployed agent is correct
❯ k exec datadog-agent-cqcgs -it --context crio -- agent version

Defaulted container "agent" out of: agent, trace-agent, init-volume (init), init-config (init)
Agent 7.61.0 - Commit: 202f54bcf5 - Serialization version: v5.0.137 - Go version: go1.22.8
  1. Execute the workload-list -v command on both deployed agents targeting a specific image that is affected by the docker misreporting issue (registry.k8s.io/kube-controller-manager@sha256:c8faedf1a5f3981ffade770c696b676d30613681a95be3287c1f7eec50e49b6d)
❯ k exec datadog-agent-hs6s6 -it --context docker-updated -- agent workload-list -v  | grep registry.k8s.io/kube-controller-manager@sha256:c8faedf1a5f3981ffade770c696b676d30613681a95be3287c1f7eec50e49b6d -B 10 -A 180 | tail -190
full docker agent output
❯ k exec datadog-agent-hs6s6 -it --context docker-updated -- agent workload-list -v  | grep registry.k8s.io/kube-controller-manager@sha256:c8faedf1a5f3981ffade770c696b676d30613681a95be3287c1f7eec50e49b6d -B 10 -A 180 | tail -190

Defaulted container "agent" out of: agent, trace-agent, process-agent, init-volume (init), init-config (init)
=== Entity container_image_metadata sources(merged):[runtime] id: sha256:a8d049396f6b8f19df1e3f6b132cb1b9696806ddf19808f97305dd16fce9450c ===
----------- Entity ID -----------
Kind: container_image_metadata ID: sha256:a8d049396f6b8f19df1e3f6b132cb1b9696806ddf19808f97305dd16fce9450c
----------- Entity Meta -----------
Name: registry.k8s.io/kube-controller-manager:v1.32.0
Namespace:
Annotations:
Labels: description:go based runner for distroless scenarios maintainers:Kubernetes Authors
Repo tags: [registry.k8s.io/kube-controller-manager:v1.32.0]
Repo digests: [registry.k8s.io/kube-controller-manager@sha256:c8faedf1a5f3981ffade770c696b676d30613681a95be3287c1f7eec50e49b6d]
Media Type:
Size in bytes: 87184394
OS: linux
OS Version:
Architecture: arm64
Variant:
----------- SBOM -----------
Status: Pending
----------- Layers -----------
Media Type:
Digest: sha256:3621a240af3b62b2a2d63f19493da2952ae7f5cc28a961dce68931945eb7676c
Size in bytes: 270648
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type:
Digest: sha256:8fa10c0194df9b7c054c90dbe482585f768a54428fc90a5b78a0066a123b1bba
Size in bytes: 22888
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type:
Digest: sha256:ddc6e550070ca022d94bd4415de20545ba69954033b4985045a8b05f538bbe5c
Size in bytes: 1459648
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type:
Digest: sha256:4d049f83d9cf21d1f5cc0e11deaf36df02790d0e60c1a3829538fb4b61685368
Size in bytes: 0
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: true

Media Type:
Digest: sha256:af5aa97ebe6ce1604747ec1e21af7136ded391bcabe4acef882e718a87c86bcc
Size in bytes: 149
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type:
Digest: sha256:6f1cdceb6a3146f0ccb986521156bef8a422cdbb0863396f7f751f575ba308f4
Size in bytes: 0
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: true

Media Type:
Digest: sha256:bbb6cacb8c82e4da4e8143e03351e939eab5e21ce0ef333c42e637af86c5217b
Size in bytes: 64
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type:
Digest: sha256:2a92d6ac9e4fcc274d5168b217ca4458a9fec6f094ead68d99c77073f08caac1
Size in bytes: 0
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: true

Media Type:
Digest: sha256:1a73b54f556b477f0a8b939d13c504a3b4f4db71f7a09c63afbc10acb3de5849
Size in bytes: 497
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type:
Digest: sha256:f4aee9e53c42a22ed82451218c3ea03d1eea8d6ca8fbe8eb4e950304ba8a8bb3
Size in bytes: 346
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type:
Digest: sha256:b336e209998fa5cf0eec3dabf93a21194198a35f4f75612d8da03693f8c30217
Size in bytes: 232717
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type:
Digest:
Size in bytes: 0
URLs: []
History:
- createdAt: 2024-11-08 08:44:23 +0000 UTC
- createdBy: LABEL maintainers=Kubernetes Authors
- comment: buildkit.dockerfile.v0
- emptyLayer: true

Media Type:
Digest:
Size in bytes: 0
URLs: []
History:
- createdAt: 2024-11-08 08:44:23 +0000 UTC
- createdBy: LABEL description=go based runner for distroless scenarios
- comment: buildkit.dockerfile.v0
- emptyLayer: true

Media Type:
Digest:
Size in bytes: 0
URLs: []
History:
- createdAt: 2024-11-08 08:44:23 +0000 UTC
- createdBy: WORKDIR /
- comment: buildkit.dockerfile.v0
- emptyLayer: true

Media Type:
Digest: sha256:d848fe591e705a6c0b99915cd73dfcae7eb8f7012275b0c001a25a3a1d8676c5
Size in bytes: 1769607
URLs: []
History:
- createdAt: 2024-11-08 08:44:23 +0000 UTC
- createdBy: COPY /workspace/go-runner . # buildkit
- comment: buildkit.dockerfile.v0
- emptyLayer: false

Media Type:
Digest:
Size in bytes: 0
URLs: []
History:
- createdAt: 2024-11-08 08:44:23 +0000 UTC
- createdBy: ENTRYPOINT ["/go-runner"]
- comment: buildkit.dockerfile.v0
- emptyLayer: true

Media Type:
Digest: sha256:30bcdc7b94d8ada217fff73e001a55eea4c882c805523c5ca99f3a77501b2b25
Size in bytes: 83427830
URLs: []
History:
- createdAt: 2024-12-11 18:14:55 +0000 UTC
- createdBy: COPY  /usr/local/bin/ # buildkit
- comment: buildkit.dockerfile.v0
- emptyLayer: false

===

❯ k exec datadog-agent-cqcgs -it --context crio -- agent workload-list -v  | grep registry.k8s.io/kube-controller-manager@sha256:c8faedf1a5f3981ffade770c696b676d30613681a95be3287c1f7eec50e49b6d -B 10 -A 181 | tail -191
full crio output
❯ k exec datadog-agent-cqcgs -it --context crio -- agent workload-list -v  | grep registry.k8s.io/kube-controller-manager@sha256:c8faedf1a5f3981ffade770c696b676d30613681a95be3287c1f7eec50e49b6d -B 10 -A 181 | tail -191

Defaulted container "agent" out of: agent, trace-agent, init-volume (init), init-config (init)
=== Entity container_image_metadata source:runtime id: sha256:c8faedf1a5f3981ffade770c696b676d30613681a95be3287c1f7eec50e49b6d ===
----------- Entity ID -----------
Kind: container_image_metadata ID: sha256:c8faedf1a5f3981ffade770c696b676d30613681a95be3287c1f7eec50e49b6d
----------- Entity Meta -----------
Name: registry.k8s.io/kube-controller-manager:v1.32.0
Namespace: kube-system
Annotations:
Labels: description:go based runner for distroless scenarios maintainers:Kubernetes Authors
Repo tags: [registry.k8s.io/kube-controller-manager:v1.32.0]
Repo digests: [registry.k8s.io/kube-controller-manager@sha256:c8faedf1a5f3981ffade770c696b676d30613681a95be3287c1f7eec50e49b6d registry.k8s.io/kube-controller-manager@sha256:d58a480743a6a86609c7733286a8f900edf784908794f8af62c04e4c128d7049]
Media Type:
Size in bytes: 23957859
OS: linux
OS Version:
Architecture: arm64
Variant:
----------- SBOM -----------
SBOM is nil
----------- Layers -----------
Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:3621a240af3b62b2a2d63f19493da2952ae7f5cc28a961dce68931945eb7676c
Size in bytes: 84604
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:8fa10c0194df9b7c054c90dbe482585f768a54428fc90a5b78a0066a123b1bba
Size in bytes: 12579
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:ddc6e550070ca022d94bd4415de20545ba69954033b4985045a8b05f538bbe5c
Size in bytes: 452510
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:4d049f83d9cf21d1f5cc0e11deaf36df02790d0e60c1a3829538fb4b61685368
Size in bytes: 67
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:af5aa97ebe6ce1604747ec1e21af7136ded391bcabe4acef882e718a87c86bcc
Size in bytes: 188
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:6f1cdceb6a3146f0ccb986521156bef8a422cdbb0863396f7f751f575ba308f4
Size in bytes: 130
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:bbb6cacb8c82e4da4e8143e03351e939eab5e21ce0ef333c42e637af86c5217b
Size in bytes: 168
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:2a92d6ac9e4fcc274d5168b217ca4458a9fec6f094ead68d99c77073f08caac1
Size in bytes: 93
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:1a73b54f556b477f0a8b939d13c504a3b4f4db71f7a09c63afbc10acb3de5849
Size in bytes: 385
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:f4aee9e53c42a22ed82451218c3ea03d1eea8d6ca8fbe8eb4e950304ba8a8bb3
Size in bytes: 326
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:b336e209998fa5cf0eec3dabf93a21194198a35f4f75612d8da03693f8c30217
Size in bytes: 130495
URLs: []
History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:
- comment:
- emptyLayer: false

Media Type:
Digest:
Size in bytes: 0
URLs: []
History:
- createdAt: 2024-11-08 08:44:23.821614518 +0000 UTC
- createdBy: LABEL maintainers=Kubernetes Authors
- comment: buildkit.dockerfile.v0
- emptyLayer: true

Media Type:
Digest:
Size in bytes: 0
URLs: []
History:
- createdAt: 2024-11-08 08:44:23.821614518 +0000 UTC
- createdBy: LABEL description=go based runner for distroless scenarios
- comment: buildkit.dockerfile.v0
- emptyLayer: true

Media Type:
Digest:
Size in bytes: 0
URLs: []
History:
- createdAt: 2024-11-08 08:44:23.821614518 +0000 UTC
- createdBy: WORKDIR /
- comment: buildkit.dockerfile.v0
- emptyLayer: true

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:d848fe591e705a6c0b99915cd73dfcae7eb8f7012275b0c001a25a3a1d8676c5
Size in bytes: 758652
URLs: []
History:
- createdAt: 2024-11-08 08:44:23.821614518 +0000 UTC
- createdBy: COPY /workspace/go-runner . # buildkit
- comment: buildkit.dockerfile.v0
- emptyLayer: false

Media Type:
Digest:
Size in bytes: 0
URLs: []
History:
- createdAt: 2024-11-08 08:44:23.821614518 +0000 UTC
- createdBy: ENTRYPOINT ["/go-runner"]
- comment: buildkit.dockerfile.v0
- emptyLayer: true

Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:30bcdc7b94d8ada217fff73e001a55eea4c882c805523c5ca99f3a77501b2b25
Size in bytes: 22517662
URLs: []
History:
- createdAt: 2024-12-11 18:14:55.694034987 +0000 UTC
- createdBy: COPY  /usr/local/bin/ # buildkit
- comment: buildkit.dockerfile.v0
- emptyLayer: false

===
  1. Compare the outputs and observe that the digests match between both runtime collectors
sdiff output
❯ sdiff qa-docker-updated.txt qa-crio.txt
❯ k exec datadog-agent-hs6s6 -it --context docker-updated --  | ❯ k exec datadog-agent-cqcgs -it --context crio -- agent work
Defaulted container "agent" out of: agent, trace-agent, proce | Defaulted container "agent" out of: agent, trace-agent, init-
=== Entity container_image_metadata sources(merged):[runtime] | === Entity container_image_metadata sources(merged):[runtime
----------- Entity ID -----------                               ----------- Entity ID -----------
Kind: container_image_metadata ID: sha256:a8d049396f6b8f19df1 | Kind: container_image_metadata ID: sha256:c8faedf1a5f3981ffad
----------- Entity Meta -----------                             ----------- Entity Meta -----------
Name: registry.k8s.io/kube-controller-manager:v1.32.0           Name: registry.k8s.io/kube-controller-manager:v1.32.0
Namespace:                                                    | Namespace: kube-system
Annotations:                                                    Annotations:
Labels: description:go based runner for distroless scenarios    Labels: description:go based runner for distroless scenarios
Repo tags: [registry.k8s.io/kube-controller-manager:v1.32.0]    Repo tags: [registry.k8s.io/kube-controller-manager:v1.32.0]
Repo digests: [registry.k8s.io/kube-controller-manager@sha256 | Repo digests: [registry.k8s.io/kube-controller-manager@sha256
Media Type:                                                     Media Type:
Size in bytes: 87184394                                       | Size in bytes: 23957859
OS: linux                                                       OS: linux
OS Version:                                                     OS Version:
Architecture: arm64                                             Architecture: arm64
Variant:                                                        Variant:
----------- SBOM -----------                                    ----------- SBOM -----------
Status: Pending                                               | Status: Success
                                                              > Generated in: 0.00 seconds
----------- Layers -----------                                  ----------- Layers -----------
Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:3621a240af3b62b2a2d63f19493da2952ae7f5cc28a961   Digest: sha256:3621a240af3b62b2a2d63f19493da2952ae7f5cc28a961
Size in bytes: 270648                                         | Size in bytes: 84604
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC                      - createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:                                                    - createdBy:
- comment:                                                      - comment:
- emptyLayer: false                                             - emptyLayer: false

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:8fa10c0194df9b7c054c90dbe482585f768a54428fc90a   Digest: sha256:8fa10c0194df9b7c054c90dbe482585f768a54428fc90a
Size in bytes: 22888                                          | Size in bytes: 12579
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC                      - createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:                                                    - createdBy:
- comment:                                                      - comment:
- emptyLayer: false                                             - emptyLayer: false

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:ddc6e550070ca022d94bd4415de20545ba69954033b498   Digest: sha256:ddc6e550070ca022d94bd4415de20545ba69954033b498
Size in bytes: 1459648                                        | Size in bytes: 452510
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC                      - createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:                                                    - createdBy:
- comment:                                                      - comment:
- emptyLayer: false                                             - emptyLayer: false

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:4d049f83d9cf21d1f5cc0e11deaf36df02790d0e60c1a3   Digest: sha256:4d049f83d9cf21d1f5cc0e11deaf36df02790d0e60c1a3
Size in bytes: 0                                              | Size in bytes: 67
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC                      - createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:                                                    - createdBy:
- comment:                                                      - comment:
- emptyLayer: true                                            | - emptyLayer: false

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:af5aa97ebe6ce1604747ec1e21af7136ded391bcabe4ac   Digest: sha256:af5aa97ebe6ce1604747ec1e21af7136ded391bcabe4ac
Size in bytes: 149                                            | Size in bytes: 188
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC                      - createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:                                                    - createdBy:
- comment:                                                      - comment:
- emptyLayer: false                                             - emptyLayer: false

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:6f1cdceb6a3146f0ccb986521156bef8a422cdbb086339   Digest: sha256:6f1cdceb6a3146f0ccb986521156bef8a422cdbb086339
Size in bytes: 0                                              | Size in bytes: 130
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC                      - createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:                                                    - createdBy:
- comment:                                                      - comment:
- emptyLayer: true                                            | - emptyLayer: false

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:bbb6cacb8c82e4da4e8143e03351e939eab5e21ce0ef33   Digest: sha256:bbb6cacb8c82e4da4e8143e03351e939eab5e21ce0ef33
Size in bytes: 64                                             | Size in bytes: 168
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC                      - createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:                                                    - createdBy:
- comment:                                                      - comment:
- emptyLayer: false                                             - emptyLayer: false

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:2a92d6ac9e4fcc274d5168b217ca4458a9fec6f094ead6   Digest: sha256:2a92d6ac9e4fcc274d5168b217ca4458a9fec6f094ead6
Size in bytes: 0                                              | Size in bytes: 93
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC                      - createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:                                                    - createdBy:
- comment:                                                      - comment:
- emptyLayer: true                                            | - emptyLayer: false

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:1a73b54f556b477f0a8b939d13c504a3b4f4db71f7a09c   Digest: sha256:1a73b54f556b477f0a8b939d13c504a3b4f4db71f7a09c
Size in bytes: 497                                            | Size in bytes: 385
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC                      - createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:                                                    - createdBy:
- comment:                                                      - comment:
- emptyLayer: false                                             - emptyLayer: false

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:f4aee9e53c42a22ed82451218c3ea03d1eea8d6ca8fbe8   Digest: sha256:f4aee9e53c42a22ed82451218c3ea03d1eea8d6ca8fbe8
Size in bytes: 346                                            | Size in bytes: 326
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC                      - createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:                                                    - createdBy:
- comment:                                                      - comment:
- emptyLayer: false                                             - emptyLayer: false

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:b336e209998fa5cf0eec3dabf93a21194198a35f4f7561   Digest: sha256:b336e209998fa5cf0eec3dabf93a21194198a35f4f7561
Size in bytes: 232717                                         | Size in bytes: 130495
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 0001-01-01 00:00:00 +0000 UTC                      - createdAt: 0001-01-01 00:00:00 +0000 UTC
- createdBy:                                                    - createdBy:
- comment:                                                      - comment:
- emptyLayer: false                                             - emptyLayer: false

Media Type:                                                     Media Type:
Digest:                                                         Digest:
Size in bytes: 0                                                Size in bytes: 0
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 2024-11-08 08:44:23 +0000 UTC                    | - createdAt: 2024-11-08 08:44:23.821614518 +0000 UTC
- createdBy: LABEL maintainers=Kubernetes Authors               - createdBy: LABEL maintainers=Kubernetes Authors
- comment: buildkit.dockerfile.v0                               - comment: buildkit.dockerfile.v0
- emptyLayer: true                                              - emptyLayer: true

Media Type:                                                     Media Type:
Digest:                                                         Digest:
Size in bytes: 0                                                Size in bytes: 0
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 2024-11-08 08:44:23 +0000 UTC                    | - createdAt: 2024-11-08 08:44:23.821614518 +0000 UTC
- createdBy: LABEL description=go based runner for distroless   - createdBy: LABEL description=go based runner for distroless
- comment: buildkit.dockerfile.v0                               - comment: buildkit.dockerfile.v0
- emptyLayer: true                                              - emptyLayer: true

Media Type:                                                     Media Type:
Digest:                                                         Digest:
Size in bytes: 0                                                Size in bytes: 0
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 2024-11-08 08:44:23 +0000 UTC                    | - createdAt: 2024-11-08 08:44:23.821614518 +0000 UTC
- createdBy: WORKDIR /                                          - createdBy: WORKDIR /
- comment: buildkit.dockerfile.v0                               - comment: buildkit.dockerfile.v0
- emptyLayer: true                                              - emptyLayer: true

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:d848fe591e705a6c0b99915cd73dfcae7eb8f7012275b0   Digest: sha256:d848fe591e705a6c0b99915cd73dfcae7eb8f7012275b0
Size in bytes: 1769607                                        | Size in bytes: 758652
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 2024-11-08 08:44:23 +0000 UTC                    | - createdAt: 2024-11-08 08:44:23.821614518 +0000 UTC
- createdBy: COPY /workspace/go-runner . # buildkit             - createdBy: COPY /workspace/go-runner . # buildkit
- comment: buildkit.dockerfile.v0                               - comment: buildkit.dockerfile.v0
- emptyLayer: false                                             - emptyLayer: false

Media Type:                                                     Media Type:
Digest:                                                         Digest:
Size in bytes: 0                                                Size in bytes: 0
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 2024-11-08 08:44:23 +0000 UTC                    | - createdAt: 2024-11-08 08:44:23.821614518 +0000 UTC
- createdBy: ENTRYPOINT ["/go-runner"]                          - createdBy: ENTRYPOINT ["/go-runner"]
- comment: buildkit.dockerfile.v0                               - comment: buildkit.dockerfile.v0
- emptyLayer: true                                              - emptyLayer: true

Media Type:                                                   | Media Type: application/vnd.docker.image.rootfs.diff.tar.gzip
Digest: sha256:30bcdc7b94d8ada217fff73e001a55eea4c882c805523c   Digest: sha256:30bcdc7b94d8ada217fff73e001a55eea4c882c805523c
Size in bytes: 83427830                                       | Size in bytes: 22517662
URLs: []                                                        URLs: []
History:                                                        History:
- createdAt: 2024-12-11 18:14:55 +0000 UTC                    | - createdAt: 2024-12-11 18:14:55.694034987 +0000 UTC
- createdBy: COPY  /usr/local/bin/ # buildkit                   - createdBy: COPY  /usr/local/bin/ # buildkit
- comment: buildkit.dockerfile.v0                               - comment: buildkit.dockerfile.v0
- emptyLayer: false                                             - emptyLayer: false

===                                                             ===

Possible Drawbacks / Trade-offs

docker history is unreliable - see below

docker history generated by docker
❯ docker history registry.k8s.io/kube-controller-manager:v1.32.0
IMAGE          CREATED        CREATED BY                                      SIZE      COMMENT
a8d049396f6b   6 weeks ago    COPY  /usr/local/bin/ # buildkit                83.4MB    buildkit.dockerfile.v0
<missing>      2 months ago   ENTRYPOINT ["/go-runner"]                       0B        buildkit.dockerfile.v0
<missing>      2 months ago   COPY /workspace/go-runner . # buildkit          1.77MB    buildkit.dockerfile.v0
<missing>      2 months ago   WORKDIR /                                       0B        buildkit.dockerfile.v0
<missing>      2 months ago   LABEL description=go based runner for distro…   0B        buildkit.dockerfile.v0
<missing>      2 months ago   LABEL maintainers=Kubernetes Authors            0B        buildkit.dockerfile.v0
<missing>      N/A                                                            233kB
<missing>      N/A                                                            346B
<missing>      N/A                                                            497B
<missing>      N/A                                                            0B # Incorrectly reported as 0B
<missing>      N/A                                                            64B
<missing>      N/A                                                            0B # Incorrectly reported as 0B
<missing>      N/A                                                            149B
<missing>      N/A                                                            0B # Incorrectly reported as 0B
<missing>      N/A                                                            1.46MB
<missing>      N/A                                                            22.9kB
<missing>      N/A                                                            271kB
docker history generated by containerd
❯ docker history registry.k8s.io/kube-controller-manager:v1.32.0
IMAGE          CREATED        CREATED BY                                      SIZE      COMMENT
c8faedf1a5f3   6 weeks ago    COPY  /usr/local/bin/ # buildkit                83.5MB    buildkit.dockerfile.v0
<missing>      2 months ago   ENTRYPOINT ["/go-runner"]                       0B        buildkit.dockerfile.v0
<missing>      2 months ago   COPY /workspace/go-runner . # buildkit          1.78MB    buildkit.dockerfile.v0
<missing>      2 months ago   WORKDIR /                                       0B        buildkit.dockerfile.v0
<missing>      2 months ago   LABEL description=go based runner for distro…   0B        buildkit.dockerfile.v0
<missing>      2 months ago   LABEL maintainers=Kubernetes Authors            0B        buildkit.dockerfile.v0
<missing>      N/A                                                            270kB
<missing>      N/A                                                            16.4kB
<missing>      N/A                                                            12.3kB
<missing>      N/A                                                            8.19kB # correctly identified as non-empty
<missing>      N/A                                                            12.3kB
<missing>      N/A                                                            16.4kB # Correctly identified as non-empty
<missing>      N/A                                                            12.3kB
<missing>      N/A                                                            4.1kB # Correct identify as non-empty
<missing>      N/A                                                            4.23MB
<missing>      N/A                                                            86kB
<missing>      N/A                                                            582kB

Comparing the above outputs you can see that docker incorrectly reports multiple layers as being empty, this is a known issue.

This PR attempts to identify these incorrectly reported layers and assigns them their appropriate digest. There is a log.Debug() message printed for observability.

Additional Notes

@github-actions github-actions bot added medium review PR review might take time team/container-platform The Container Platform Team labels Jan 24, 2025
@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Jan 24, 2025

Uncompressed package size comparison

Comparison with ancestor 7d4d74fd93ed6708daf37216f8e5df2110e35de6

Diff per package
package diff status size ancestor threshold
datadog-agent-amd64-deb 0.00MB 882.18MB 882.18MB 0.50MB
datadog-agent-x86_64-rpm 0.00MB 891.92MB 891.92MB 0.50MB
datadog-agent-x86_64-suse 0.00MB 891.92MB 891.92MB 0.50MB
datadog-dogstatsd-amd64-deb 0.00MB 59.02MB 59.02MB 0.50MB
datadog-dogstatsd-x86_64-rpm 0.00MB 59.10MB 59.10MB 0.50MB
datadog-dogstatsd-x86_64-suse 0.00MB 59.10MB 59.10MB 0.50MB
datadog-agent-arm64-deb 0.00MB 869.97MB 869.97MB 0.50MB
datadog-agent-aarch64-rpm 0.00MB 879.69MB 879.69MB 0.50MB
datadog-dogstatsd-arm64-deb 0.00MB 56.50MB 56.50MB 0.50MB
datadog-heroku-agent-amd64-deb 0.00MB 461.46MB 461.46MB 0.50MB
datadog-iot-agent-amd64-deb 0.00MB 93.81MB 93.81MB 0.50MB
datadog-iot-agent-x86_64-rpm 0.00MB 93.88MB 93.88MB 0.50MB
datadog-iot-agent-x86_64-suse 0.00MB 93.88MB 93.88MB 0.50MB
datadog-iot-agent-arm64-deb 0.00MB 89.87MB 89.87MB 0.50MB
datadog-iot-agent-aarch64-rpm 0.00MB 89.94MB 89.94MB 0.50MB

Decision

✅ Passed

@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Jan 24, 2025

Test changes on VM

Use this command from test-infra-definitions to manually test this PR changes on a VM:

inv aws.create-vm --pipeline-id=54529230 --os-family=ubuntu

Note: This applies to commit b792781

Copy link

cit-pr-commenter bot commented Jan 24, 2025

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Run ID: 05799b38-994b-4219-85a8-bf28f1abdf5c

Baseline: 6136737
Comparison: b792781
Diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
quality_gate_idle_all_features memory utilization +0.34 [+0.28, +0.40] 1 Logs bounds checks dashboard
uds_dogstatsd_to_api_cpu % cpu utilization +0.30 [-0.58, +1.18] 1 Logs
file_to_blackhole_1000ms_latency_linear_load egress throughput +0.06 [-0.41, +0.52] 1 Logs
file_to_blackhole_100ms_latency egress throughput +0.04 [-0.69, +0.76] 1 Logs
file_to_blackhole_500ms_latency egress throughput +0.03 [-0.76, +0.82] 1 Logs
uds_dogstatsd_to_api ingress throughput +0.01 [-0.27, +0.30] 1 Logs
file_to_blackhole_300ms_latency egress throughput +0.01 [-0.62, +0.64] 1 Logs
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.02, +0.02] 1 Logs
file_to_blackhole_0ms_latency egress throughput -0.04 [-0.88, +0.80] 1 Logs
file_to_blackhole_0ms_latency_http2 egress throughput -0.05 [-0.82, +0.72] 1 Logs
file_to_blackhole_0ms_latency_http1 egress throughput -0.08 [-0.97, +0.80] 1 Logs
file_to_blackhole_1000ms_latency egress throughput -0.48 [-1.25, +0.28] 1 Logs
file_tree memory utilization -0.60 [-0.67, -0.53] 1 Logs
quality_gate_idle memory utilization -0.62 [-0.68, -0.57] 1 Logs bounds checks dashboard
quality_gate_logs % cpu utilization -1.33 [-4.39, +1.73] 1 Logs
tcp_syslog_to_blackhole ingress throughput -1.88 [-1.97, -1.80] 1 Logs

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed links
file_to_blackhole_0ms_latency lost_bytes 10/10
file_to_blackhole_0ms_latency memory_usage 10/10
file_to_blackhole_0ms_latency_http1 lost_bytes 10/10
file_to_blackhole_0ms_latency_http1 memory_usage 10/10
file_to_blackhole_0ms_latency_http2 lost_bytes 10/10
file_to_blackhole_0ms_latency_http2 memory_usage 10/10
file_to_blackhole_1000ms_latency memory_usage 10/10
file_to_blackhole_1000ms_latency_linear_load memory_usage 10/10
file_to_blackhole_100ms_latency lost_bytes 10/10
file_to_blackhole_100ms_latency memory_usage 10/10
file_to_blackhole_300ms_latency lost_bytes 10/10
file_to_blackhole_300ms_latency memory_usage 10/10
file_to_blackhole_500ms_latency lost_bytes 10/10
file_to_blackhole_500ms_latency memory_usage 10/10
quality_gate_idle intake_connections 10/10 bounds checks dashboard
quality_gate_idle memory_usage 10/10 bounds checks dashboard
quality_gate_idle_all_features intake_connections 10/10 bounds checks dashboard
quality_gate_idle_all_features memory_usage 10/10 bounds checks dashboard
quality_gate_logs intake_connections 10/10
quality_gate_logs lost_bytes 10/10
quality_gate_logs memory_usage 10/10

Explanation

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

CI Pass/Fail Decision

Passed. All Quality Gates passed.

  • quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check lost_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.

Docker history can incorrectly report layers inherited from base containers as having no created_by and no size;
this commit attempts to accurately identify these falsely reported layers and assign them the appropriate digest.
@justin-lesko justin-lesko added qa/done QA done before merge and regressions are covered by tests team/container-integrations labels Jan 28, 2025
@justin-lesko justin-lesko added this to the 7.64.0 milestone Jan 28, 2025
@justin-lesko justin-lesko marked this pull request as ready for review January 28, 2025 20:00
@justin-lesko justin-lesko requested review from a team as code owners January 28, 2025 20:00
@justin-lesko justin-lesko changed the title Justin/contint 4545 fix missing docker image layer digests Fix <missing> docker image layer digests from the docker collector Jan 28, 2025
@justin-lesko justin-lesko changed the title Fix <missing> docker image layer digests from the docker collector [CONTINT-4545] Fix <missing> docker image layer digests from the docker collector Jan 28, 2025
digest := ""
if isInheritedLayer || !isEmptyLayer {
if isInheritedLayer {
log.Debugf("detected an inherited layer for image ID: \"%s\", assigning it digest: \"%s\"", inspect.ID, inspect.RootFS.Layers[inspectIdx])
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it better to use trace level if it is not frequently used?

@justin-lesko
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Jan 30, 2025

Devflow running: /merge

View all feedbacks in Devflow UI.


2025-01-30 16:25:14 UTC ℹ️ MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-01-30 20:26:04 UTC ⚠️ MergeQueue: This merge request was unqueued

devflow unqueued this merge request: It did not become mergeable within the expected time

@justin-lesko
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Jan 30, 2025

Devflow running: /merge

View all feedbacks in Devflow UI.


2025-01-30 22:51:32 UTC ℹ️ MergeQueue: pull request added to the queue

The median merge time in main is 27m.


2025-01-31 00:38:09 UTC ⚠️ MergeQueue: This merge request build was cancelled

[email protected] cancelled this merge request build

@justin-lesko
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Jan 31, 2025

Devflow running: /merge

View all feedbacks in Devflow UI.


2025-01-31 00:37:26 UTC ❌ MergeQueue

PR already in the queue with status in_progress

@justin-lesko
Copy link
Contributor Author

/remove

@dd-devflow
Copy link

dd-devflow bot commented Jan 31, 2025

Devflow running: /remove

View all feedbacks in Devflow UI.


2025-01-31 00:38:08 UTC ℹ️ Devflow: /remove

@justin-lesko
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Jan 31, 2025

Devflow running: /merge

View all feedbacks in Devflow UI.


2025-01-31 00:57:58 UTC ℹ️ MergeQueue: pull request added to the queue

The median merge time in main is 26m.


2025-01-31 00:59:07 UTCMergeQueue: This merge request was updated

This PR is rejected because it was updated

@justin-lesko
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Jan 31, 2025

Devflow running: /merge

View all feedbacks in Devflow UI.


2025-01-31 13:36:27 UTC ℹ️ MergeQueue: pull request added to the queue

The median merge time in main is 27m.


2025-01-31 14:00:44 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue dd-mergequeue bot merged commit 8b33915 into main Jan 31, 2025
236 checks passed
@dd-mergequeue dd-mergequeue bot deleted the justin/CONTINT-4545_fix_missing_docker_image_layer_digests branch January 31, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium review PR review might take time qa/done QA done before merge and regressions are covered by tests team/container-platform The Container Platform Team team/containers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants