| Tim Windelschmidt | ddbb968 | 2025-10-06 21:58:26 +0200 | [diff] [blame^] | 1 | Add unimplemented function for CRI compat. |
| 2 | |
| 3 | diff --git a/internal/cri/server/images/service.go b/internal/cri/server/images/service.go |
| 4 | index cd1f16694f67..ddfd1c610c52 100644 |
| 5 | --- a/internal/cri/server/images/service.go |
| 6 | +++ b/internal/cri/server/images/service.go |
| 7 | @@ -51,6 +51,8 @@ type ImagePlatform struct { |
| 8 | } |
| 9 | |
| 10 | type CRIImageService struct { |
| 11 | + runtime.UnimplementedImageServiceServer |
| 12 | + |
| 13 | // config contains all image configurations. |
| 14 | config criconfig.ImageConfig |
| 15 | // images is the lower level image store used for raw storage, |
| 16 | diff --git a/internal/cri/server/service.go b/internal/cri/server/service.go |
| 17 | index a028794d9611..69482ec37096 100644 |
| 18 | --- a/internal/cri/server/service.go |
| 19 | +++ b/internal/cri/server/service.go |
| 20 | @@ -111,6 +111,9 @@ type ImageService interface { |
| 21 | |
| 22 | // criService implements CRIService. |
| 23 | type criService struct { |
| 24 | + runtime.UnimplementedRuntimeServiceServer |
| 25 | + runtime.UnimplementedImageServiceServer |
| 26 | + |
| 27 | RuntimeService |
| 28 | ImageService |
| 29 | // config contains all configurations. |
| 30 | diff --git a/internal/cri/instrument/instrumented_service.go b/internal/cri/instrument/instrumented_service.go |
| 31 | --- a/internal/cri/instrument/instrumented_service.go |
| 32 | +++ b/internal/cri/instrument/instrumented_service.go |
| 33 | @@ -43,8 +43,11 @@ |
| 34 | } |
| 35 | |
| 36 | // instrumentedService wraps service with containerd namespace and logs. |
| 37 | type instrumentedService struct { |
| 38 | + runtime.UnimplementedRuntimeServiceServer |
| 39 | + runtime.UnimplementedImageServiceServer |
| 40 | + |
| 41 | c criService |
| 42 | } |
| 43 | |
| 44 | func NewService(c criService) GRPCServices { |
| 45 | diff --git a/internal/cri/server/images/image_list_test.go b/internal/cri/server/images/image_list_test.go |
| 46 | index fd046183f82b..701359d33d6f 100644 |
| 47 | --- a/internal/cri/server/images/image_list_test.go |
| 48 | +++ b/internal/cri/server/images/image_list_test.go |
| 49 | @@ -79,21 +79,21 @@ func TestListImages(t *testing.T) { |
| 50 | Id: "sha256:1123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", |
| 51 | RepoTags: []string{"gcr.io/library/busybox:latest"}, |
| 52 | RepoDigests: []string{"gcr.io/library/busybox@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582"}, |
| 53 | - Size_: uint64(1000), |
| 54 | + Size: uint64(1000), |
| 55 | Username: "root", |
| 56 | }, |
| 57 | { |
| 58 | Id: "sha256:2123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", |
| 59 | RepoTags: []string{"gcr.io/library/alpine:latest"}, |
| 60 | RepoDigests: []string{"gcr.io/library/alpine@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582"}, |
| 61 | - Size_: uint64(2000), |
| 62 | + Size: uint64(2000), |
| 63 | Uid: &runtime.Int64Value{Value: 1234}, |
| 64 | }, |
| 65 | { |
| 66 | Id: "sha256:3123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", |
| 67 | RepoTags: []string{"gcr.io/library/ubuntu:latest"}, |
| 68 | RepoDigests: []string{"gcr.io/library/ubuntu@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582"}, |
| 69 | - Size_: uint64(3000), |
| 70 | + Size: uint64(3000), |
| 71 | Username: "nobody", |
| 72 | }, |
| 73 | } |
| 74 | diff --git a/internal/cri/server/images/image_status.go b/internal/cri/server/images/image_status.go |
| 75 | index 4f1ece5b43a7..0b3dc3c21129 100644 |
| 76 | --- a/internal/cri/server/images/image_status.go |
| 77 | +++ b/internal/cri/server/images/image_status.go |
| 78 | @@ -66,7 +66,7 @@ func toCRIImage(image imagestore.Image) *runtime.Image { |
| 79 | Id: image.ID, |
| 80 | RepoTags: repoTags, |
| 81 | RepoDigests: repoDigests, |
| 82 | - Size_: uint64(image.Size), |
| 83 | + Size: uint64(image.Size), |
| 84 | Pinned: image.Pinned, |
| 85 | } |
| 86 | uid, username := getUserFromImage(image.ImageSpec.Config.User) |
| 87 | diff --git a/internal/cri/server/images/image_status_test.go b/internal/cri/server/images/image_status_test.go |
| 88 | index 36779130b8b8..cd9268cb92d3 100644 |
| 89 | --- a/internal/cri/server/images/image_status_test.go |
| 90 | +++ b/internal/cri/server/images/image_status_test.go |
| 91 | @@ -48,7 +48,7 @@ func TestImageStatus(t *testing.T) { |
| 92 | Id: testID, |
| 93 | RepoTags: []string{"gcr.io/library/busybox:latest"}, |
| 94 | RepoDigests: []string{"gcr.io/library/busybox@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582"}, |
| 95 | - Size_: uint64(1234), |
| 96 | + Size: uint64(1234), |
| 97 | Username: "user", |
| 98 | } |
| 99 | |
| 100 | diff --git a/integration/remote/remote_image.go b/integration/remote/remote_image.go |
| 101 | index 0ae6196732ed..e9f1653149b2 100644 |
| 102 | --- a/integration/remote/remote_image.go |
| 103 | +++ b/integration/remote/remote_image.go |
| 104 | @@ -107,7 +107,7 @@ func (r *ImageService) ImageStatus(image *runtimeapi.ImageSpec, opts ...grpc.Cal |
| 105 | } |
| 106 | |
| 107 | if resp.Image != nil { |
| 108 | - if resp.Image.Id == "" || resp.Image.Size() == 0 { |
| 109 | + if resp.Image.Id == "" || resp.Image.Size == 0 { |
| 110 | errorMessage := fmt.Sprintf("Id or size of image %q is not set", image.Image) |
| 111 | log.L.Errorf("ImageStatus failed: %s", errorMessage) |
| 112 | return nil, errors.New(errorMessage) |