From 2bcd6a4e8837d14a7b980349281c7508a701e4ab Mon Sep 17 00:00:00 2001 From: Wei Fu Date: Sun, 5 Sep 2021 18:48:26 +0800 Subject: [PATCH] cri: patch update image labels The CRI-plugin subscribes the image event on k8s.io namespace. By default, the image event is created by CRI-API. However, the image can be downloaded by containerd API on k8s.io with the customized labels. The CRI-plugin should use patch update for `io.cri-containerd.image` label in this case. Fixes: #5900 Signed-off-by: Wei Fu --- pkg/cri/server/image_pull.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cri/server/image_pull.go b/pkg/cri/server/image_pull.go index c84a2cd53..2d439e225 100644 --- a/pkg/cri/server/image_pull.go +++ b/pkg/cri/server/image_pull.go @@ -233,7 +233,7 @@ func (c *criService) createImageReference(ctx context.Context, name string, desc if oldImg.Target.Digest == img.Target.Digest && oldImg.Labels[imageLabelKey] == imageLabelValue { return nil } - _, err = c.client.ImageService().Update(ctx, img, "target", "labels") + _, err = c.client.ImageService().Update(ctx, img, "target", "labels."+imageLabelKey) return err }