From ca69a80b01907590b5d55a5a888bf3c31bd6ad3b Mon Sep 17 00:00:00 2001 From: Roger Coll Date: Fri, 8 Nov 2024 20:03:52 +0100 Subject: [PATCH] fix: use k8s container image parser --- internal/common/docker/images.go | 25 +++------- internal/common/docker/images_test.go | 50 +++++++++++-------- internal/common/go.mod | 7 ++- internal/common/go.sum | 8 +++ receiver/k8sclusterreceiver/go.mod | 4 +- receiver/k8sclusterreceiver/go.sum | 12 +++-- .../internal/container/containers.go | 4 +- .../internal/pod/testdata/expected.yaml | 3 -- .../pod/testdata/expected_evicted.yaml | 5 +- .../internal/testutils/objects.go | 2 +- 10 files changed, 62 insertions(+), 58 deletions(-) diff --git a/internal/common/docker/images.go b/internal/common/docker/images.go index 8e5b3353f071..a11c4f940b60 100644 --- a/internal/common/docker/images.go +++ b/internal/common/docker/images.go @@ -5,19 +5,15 @@ package docker // import "github.com/open-telemetry/opentelemetry-collector-cont import ( "errors" - "regexp" "go.uber.org/zap" -) - -var ( - extractImageRegexp = regexp.MustCompile(`^(?P([^/\s]+/)?([^:\s]+))(:(?P[^@\s]+))?(@sha256:(?P\d+))?$`) + "k8s.io/kubernetes/pkg/util/parsers" ) type ImageRef struct { Repository string Tag string - SHA256 string + Digest string } // ParseImageName extracts image repository and tag from a combined image reference @@ -27,24 +23,15 @@ func ParseImageName(image string) (ImageRef, error) { return ImageRef{}, errors.New("empty image") } - match := extractImageRegexp.FindStringSubmatch(image) - if len(match) == 0 { - return ImageRef{}, errors.New("failed to match regex against image") - } - - tag := "latest" - if foundTag := match[extractImageRegexp.SubexpIndex("tag")]; foundTag != "" { - tag = foundTag + repository, tag, digest, err := parsers.ParseImageName(image) + if err != nil { + return ImageRef{}, errors.New("failed to parse image") } - repository := match[extractImageRegexp.SubexpIndex("repository")] - - hash := match[extractImageRegexp.SubexpIndex("sha256")] - return ImageRef{ Repository: repository, Tag: tag, - SHA256: hash, + Digest: digest, }, nil } diff --git a/internal/common/docker/images_test.go b/internal/common/docker/images_test.go index 480ad446e35c..eb5e512072ac 100644 --- a/internal/common/docker/images_test.go +++ b/internal/common/docker/images_test.go @@ -16,7 +16,7 @@ func TestDockerImageToElements(t *testing.T) { args args wantRepository string wantTag string - wantSHA256 string + wantDigest string wantErr bool }{ { @@ -26,7 +26,7 @@ func TestDockerImageToElements(t *testing.T) { }, wantRepository: "", wantTag: "", - wantSHA256: "", + wantDigest: "", wantErr: true, }, { @@ -36,17 +36,27 @@ func TestDockerImageToElements(t *testing.T) { }, wantRepository: "", wantTag: "", - wantSHA256: "", + wantDigest: "", wantErr: true, }, { name: "image with sha256 hash", args: args{ - image: "alpine:test@sha256:00000000000000", + image: "alpine:test@sha256:22eeed9e66facc651d4344ef7d9ce912fccff5bb3969e745eed3ab953f309534", }, - wantRepository: "alpine", + wantRepository: "docker.io/library/alpine", wantTag: "test", - wantSHA256: "00000000000000", + wantDigest: "sha256:22eeed9e66facc651d4344ef7d9ce912fccff5bb3969e745eed3ab953f309534", + wantErr: false, + }, + { + name: "image with sha256 hash and no tag", + args: args{ + image: "alpine@sha256:22eeed9e66facc651d4344ef7d9ce912fccff5bb3969e745eed3ab953f309534", + }, + wantRepository: "docker.io/library/alpine", + wantTag: "", + wantDigest: "sha256:22eeed9e66facc651d4344ef7d9ce912fccff5bb3969e745eed3ab953f309534", wantErr: false, }, { @@ -54,9 +64,9 @@ func TestDockerImageToElements(t *testing.T) { args: args{ image: "alpine", }, - wantRepository: "alpine", + wantRepository: "docker.io/library/alpine", wantTag: "latest", - wantSHA256: "", + wantDigest: "", wantErr: false, }, { @@ -64,9 +74,9 @@ func TestDockerImageToElements(t *testing.T) { args: args{ image: "alpine:v1.0.0", }, - wantRepository: "alpine", + wantRepository: "docker.io/library/alpine", wantTag: "v1.0.0", - wantSHA256: "", + wantDigest: "", wantErr: false, }, { @@ -74,9 +84,9 @@ func TestDockerImageToElements(t *testing.T) { args: args{ image: "alpine/alpine", }, - wantRepository: "alpine/alpine", + wantRepository: "docker.io/alpine/alpine", wantTag: "latest", - wantSHA256: "", + wantDigest: "", wantErr: false, }, { @@ -84,9 +94,9 @@ func TestDockerImageToElements(t *testing.T) { args: args{ image: "alpine/alpine:2.0.0", }, - wantRepository: "alpine/alpine", + wantRepository: "docker.io/alpine/alpine", wantTag: "2.0.0", - wantSHA256: "", + wantDigest: "", wantErr: false, }, { @@ -96,7 +106,7 @@ func TestDockerImageToElements(t *testing.T) { }, wantRepository: "example.com/alpine/alpine", wantTag: "latest", - wantSHA256: "", + wantDigest: "", wantErr: false, }, { @@ -106,7 +116,7 @@ func TestDockerImageToElements(t *testing.T) { }, wantRepository: "example.com/alpine/alpine", wantTag: "1", - wantSHA256: "", + wantDigest: "", wantErr: false, }, { @@ -116,7 +126,7 @@ func TestDockerImageToElements(t *testing.T) { }, wantRepository: "example.com:3000/alpine/alpine", wantTag: "latest", - wantSHA256: "", + wantDigest: "", wantErr: false, }, { @@ -126,7 +136,7 @@ func TestDockerImageToElements(t *testing.T) { }, wantRepository: "example.com:3000/alpine/alpine", wantTag: "test", - wantSHA256: "", + wantDigest: "", wantErr: false, }, } @@ -143,8 +153,8 @@ func TestDockerImageToElements(t *testing.T) { if image.Tag != tt.wantTag { t.Errorf("ParseImageName() tag = %v, want %v", image.Tag, tt.wantTag) } - if image.SHA256 != tt.wantSHA256 { - t.Errorf("ParseImageName() hash = %v, want %v", image.SHA256, tt.wantSHA256) + if image.Digest != tt.wantDigest { + t.Errorf("ParseImageName() hash = %v, want %v", image.Digest, tt.wantDigest) } }) } diff --git a/internal/common/go.mod b/internal/common/go.mod index 22de87c9ccef..4d33d10f99fc 100644 --- a/internal/common/go.mod +++ b/internal/common/go.mod @@ -10,11 +10,14 @@ require ( ) require ( - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/distribution/reference v0.5.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.uber.org/multierr v1.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/kubernetes v1.31.2 // indirect ) retract ( diff --git a/internal/common/go.sum b/internal/common/go.sum index 024c26f8fa26..ac0734a819c8 100644 --- a/internal/common/go.sum +++ b/internal/common/go.sum @@ -1,13 +1,19 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= +github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= @@ -25,3 +31,5 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/kubernetes v1.31.2 h1:VNSu4O7Xn5FFRsh9ePXyEPg6ucR21fOftarSdi053Gs= +k8s.io/kubernetes v1.31.2/go.mod h1:9xmT2buyTYj8TRKwRae7FcuY8k5+xlxv7VivvO0KKfs= diff --git a/receiver/k8sclusterreceiver/go.mod b/receiver/k8sclusterreceiver/go.mod index d612ee01874a..de9a9c9b9056 100644 --- a/receiver/k8sclusterreceiver/go.mod +++ b/receiver/k8sclusterreceiver/go.mod @@ -36,9 +36,7 @@ require ( ) require ( - github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/distribution/reference v0.5.0 // indirect @@ -110,7 +108,6 @@ require ( go.opentelemetry.io/otel/sdk v1.31.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.31.0 // indirect go.opentelemetry.io/otel/trace v1.31.0 // indirect - go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.30.0 // indirect @@ -131,6 +128,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect + k8s.io/kubernetes v1.31.2 // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect diff --git a/receiver/k8sclusterreceiver/go.sum b/receiver/k8sclusterreceiver/go.sum index 208c2732bdff..74d5574402ce 100644 --- a/receiver/k8sclusterreceiver/go.sum +++ b/receiver/k8sclusterreceiver/go.sum @@ -171,6 +171,7 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -249,8 +250,8 @@ github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc4 h1:oOxKUJWnFC4YGHCCMNql1x4YaDfYBTS5Y4x/Cgeo1E0= @@ -275,8 +276,8 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -497,7 +498,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -668,6 +668,8 @@ k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= +k8s.io/kubernetes v1.31.2 h1:VNSu4O7Xn5FFRsh9ePXyEPg6ucR21fOftarSdi053Gs= +k8s.io/kubernetes v1.31.2/go.mod h1:9xmT2buyTYj8TRKwRae7FcuY8k5+xlxv7VivvO0KKfs= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= diff --git a/receiver/k8sclusterreceiver/internal/container/containers.go b/receiver/k8sclusterreceiver/internal/container/containers.go index 368f4c73c410..f7c7876a8bb1 100644 --- a/receiver/k8sclusterreceiver/internal/container/containers.go +++ b/receiver/k8sclusterreceiver/internal/container/containers.go @@ -88,7 +88,9 @@ func RecordSpecMetrics(logger *zap.Logger, mb *imetadata.MetricsBuilder, c corev docker.LogParseError(err, imageStr, logger) } else { rb.SetContainerImageName(image.Repository) - rb.SetContainerImageTag(image.Tag) + if image.Tag != "" { + rb.SetContainerImageTag(image.Tag) + } } mb.EmitForResource(imetadata.WithResource(rb.Emit())) } diff --git a/receiver/k8sclusterreceiver/internal/pod/testdata/expected.yaml b/receiver/k8sclusterreceiver/internal/pod/testdata/expected.yaml index abe586c4d395..902e7fb25a66 100644 --- a/receiver/k8sclusterreceiver/internal/pod/testdata/expected.yaml +++ b/receiver/k8sclusterreceiver/internal/pod/testdata/expected.yaml @@ -33,9 +33,6 @@ resourceMetrics: - key: container.image.name value: stringValue: docker.io/otel/test-image - - key: container.image.tag - value: - stringValue: latest - key: k8s.container.name value: stringValue: container-name diff --git a/receiver/k8sclusterreceiver/internal/pod/testdata/expected_evicted.yaml b/receiver/k8sclusterreceiver/internal/pod/testdata/expected_evicted.yaml index 58e142eb3301..34225e94fbf9 100644 --- a/receiver/k8sclusterreceiver/internal/pod/testdata/expected_evicted.yaml +++ b/receiver/k8sclusterreceiver/internal/pod/testdata/expected_evicted.yaml @@ -41,10 +41,7 @@ resourceMetrics: stringValue: container-id - key: container.image.name value: - stringValue: container-image-name - - key: container.image.tag - value: - stringValue: latest + stringValue: docker.io/otel/test-image - key: k8s.container.name value: stringValue: container-name diff --git a/receiver/k8sclusterreceiver/internal/testutils/objects.go b/receiver/k8sclusterreceiver/internal/testutils/objects.go index ac1092a2a988..aa6abd084d56 100644 --- a/receiver/k8sclusterreceiver/internal/testutils/objects.go +++ b/receiver/k8sclusterreceiver/internal/testutils/objects.go @@ -274,7 +274,7 @@ func NewEvictedTerminatedPodStatusWithContainer(containerName, containerID strin Name: containerName, Ready: true, RestartCount: 3, - Image: "container-image-name", + Image: "docker.io/otel/test-image@sha256:22eeed9e66facc651d4344ef7d9ce912fccff5bb3969e745eed3ab953f309534", ContainerID: containerID, State: corev1.ContainerState{ Terminated: &corev1.ContainerStateTerminated{},