treewide: bump k8s to v0.34.1

Change-Id: Ie3b1296ac4788aa27aaa2985c72da6c56ea3d281
Reviewed-on: https://review.monogon.dev/c/monogon/+/4626
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/third_party/com_github_containerd_containerd_v2/add-unimplemented-functions.patch b/third_party/com_github_containerd_containerd_v2/add-unimplemented-functions.patch
deleted file mode 100644
index d182968..0000000
--- a/third_party/com_github_containerd_containerd_v2/add-unimplemented-functions.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-Add unimplemented function for CRI compat.
-
-
-diff --git a/internal/cri/instrument/instrumented_service.go b/internal/cri/instrument/instrumented_service.go
---- a/internal/cri/instrument/instrumented_service.go
-+++ b/internal/cri/instrument/instrumented_service.go
-@@ -17,8 +17,9 @@
- package instrument
- 
- import (
- 	"context"
-+	"errors"
- 
- 	"github.com/containerd/errdefs"
- 	"github.com/containerd/errdefs/pkg/errgrpc"
- 	"github.com/containerd/log"
-@@ -641,4 +642,8 @@
- 	}()
- 	res, err = in.c.RuntimeConfig(ctx, r)
- 	return res, errgrpc.ToGRPC(err)
- }
-+
-+func (in *instrumentedService) UpdatePodSandboxResources(ctx context.Context, r *runtime.UpdatePodSandboxResourcesRequest) (res *runtime.UpdatePodSandboxResourcesResponse, err error) {
-+	return nil, errors.New("not implemented yet")
-+}
-diff --git a/internal/cri/server/sandbox_update_resources.go b/internal/cri/server/sandbox_update_resources.go
-new file mode 100644
-index 000000000000..0fcd2c7c566c
---- /dev/null
-+++ b/internal/cri/server/sandbox_update_resources.go
-@@ -0,0 +1,28 @@
-+/*
-+   Copyright The containerd Authors.
-+
-+   Licensed under the Apache License, Version 2.0 (the "License");
-+   you may not use this file except in compliance with the License.
-+   You may obtain a copy of the License at
-+
-+       http://www.apache.org/licenses/LICENSE-2.0
-+
-+   Unless required by applicable law or agreed to in writing, software
-+   distributed under the License is distributed on an "AS IS" BASIS,
-+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-+   See the License for the specific language governing permissions and
-+   limitations under the License.
-+*/
-+
-+package server
-+
-+import (
-+	"context"
-+	"errors"
-+
-+	runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
-+)
-+
-+func (c *criService) UpdatePodSandboxResources(ctx context.Context, r *runtime.UpdatePodSandboxResourcesRequest) (*runtime.UpdatePodSandboxResourcesResponse, error) {
-+	return nil, errors.New("not implemented yet")
-+}
diff --git a/third_party/com_github_containerd_containerd_v2/client-go-0-34-compat.patch b/third_party/com_github_containerd_containerd_v2/client-go-0-34-compat.patch
new file mode 100644
index 0000000..421e07a
--- /dev/null
+++ b/third_party/com_github_containerd_containerd_v2/client-go-0-34-compat.patch
@@ -0,0 +1,112 @@
+Add unimplemented function for CRI compat.
+
+diff --git a/internal/cri/server/images/service.go b/internal/cri/server/images/service.go
+index cd1f16694f67..ddfd1c610c52 100644
+--- a/internal/cri/server/images/service.go
++++ b/internal/cri/server/images/service.go
+@@ -51,6 +51,8 @@ type ImagePlatform struct {
+ }
+
+ type CRIImageService struct {
++	runtime.UnimplementedImageServiceServer
++
+ 	// config contains all image configurations.
+ 	config criconfig.ImageConfig
+ 	// images is the lower level image store used for raw storage,
+diff --git a/internal/cri/server/service.go b/internal/cri/server/service.go
+index a028794d9611..69482ec37096 100644
+--- a/internal/cri/server/service.go
++++ b/internal/cri/server/service.go
+@@ -111,6 +111,9 @@ type ImageService interface {
+
+ // criService implements CRIService.
+ type criService struct {
++	runtime.UnimplementedRuntimeServiceServer
++	runtime.UnimplementedImageServiceServer
++
+ 	RuntimeService
+ 	ImageService
+ 	// config contains all configurations.
+diff --git a/internal/cri/instrument/instrumented_service.go b/internal/cri/instrument/instrumented_service.go
+--- a/internal/cri/instrument/instrumented_service.go
++++ b/internal/cri/instrument/instrumented_service.go
+@@ -43,8 +43,11 @@
+ }
+
+ // instrumentedService wraps service with containerd namespace and logs.
+ type instrumentedService struct {
++	runtime.UnimplementedRuntimeServiceServer
++	runtime.UnimplementedImageServiceServer
++
+ 	c criService
+ }
+
+ func NewService(c criService) GRPCServices {
+diff --git a/internal/cri/server/images/image_list_test.go b/internal/cri/server/images/image_list_test.go
+index fd046183f82b..701359d33d6f 100644
+--- a/internal/cri/server/images/image_list_test.go
++++ b/internal/cri/server/images/image_list_test.go
+@@ -79,21 +79,21 @@ func TestListImages(t *testing.T) {
+ 			Id:          "sha256:1123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
+ 			RepoTags:    []string{"gcr.io/library/busybox:latest"},
+ 			RepoDigests: []string{"gcr.io/library/busybox@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582"},
+-			Size_:       uint64(1000),
++			Size:        uint64(1000),
+ 			Username:    "root",
+ 		},
+ 		{
+ 			Id:          "sha256:2123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
+ 			RepoTags:    []string{"gcr.io/library/alpine:latest"},
+ 			RepoDigests: []string{"gcr.io/library/alpine@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582"},
+-			Size_:       uint64(2000),
++			Size:        uint64(2000),
+ 			Uid:         &runtime.Int64Value{Value: 1234},
+ 		},
+ 		{
+ 			Id:          "sha256:3123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
+ 			RepoTags:    []string{"gcr.io/library/ubuntu:latest"},
+ 			RepoDigests: []string{"gcr.io/library/ubuntu@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582"},
+-			Size_:       uint64(3000),
++			Size:        uint64(3000),
+ 			Username:    "nobody",
+ 		},
+ 	}
+diff --git a/internal/cri/server/images/image_status.go b/internal/cri/server/images/image_status.go
+index 4f1ece5b43a7..0b3dc3c21129 100644
+--- a/internal/cri/server/images/image_status.go
++++ b/internal/cri/server/images/image_status.go
+@@ -66,7 +66,7 @@ func toCRIImage(image imagestore.Image) *runtime.Image {
+ 		Id:          image.ID,
+ 		RepoTags:    repoTags,
+ 		RepoDigests: repoDigests,
+-		Size_:       uint64(image.Size),
++		Size:        uint64(image.Size),
+ 		Pinned:      image.Pinned,
+ 	}
+ 	uid, username := getUserFromImage(image.ImageSpec.Config.User)
+diff --git a/internal/cri/server/images/image_status_test.go b/internal/cri/server/images/image_status_test.go
+index 36779130b8b8..cd9268cb92d3 100644
+--- a/internal/cri/server/images/image_status_test.go
++++ b/internal/cri/server/images/image_status_test.go
+@@ -48,7 +48,7 @@ func TestImageStatus(t *testing.T) {
+ 		Id:          testID,
+ 		RepoTags:    []string{"gcr.io/library/busybox:latest"},
+ 		RepoDigests: []string{"gcr.io/library/busybox@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582"},
+-		Size_:       uint64(1234),
++		Size:        uint64(1234),
+ 		Username:    "user",
+ 	}
+
+diff --git a/integration/remote/remote_image.go b/integration/remote/remote_image.go
+index 0ae6196732ed..e9f1653149b2 100644
+--- a/integration/remote/remote_image.go
++++ b/integration/remote/remote_image.go
+@@ -107,7 +107,7 @@ func (r *ImageService) ImageStatus(image *runtimeapi.ImageSpec, opts ...grpc.Cal
+ 	}
+
+ 	if resp.Image != nil {
+-		if resp.Image.Id == "" || resp.Image.Size() == 0 {
++		if resp.Image.Id == "" || resp.Image.Size == 0 {
+ 			errorMessage := fmt.Sprintf("Id or size of image %q is not set", image.Image)
+ 			log.L.Errorf("ImageStatus failed: %s", errorMessage)
+ 			return nil, errors.New(errorMessage)
\ No newline at end of file
diff --git a/third_party/com_k8s_io_kubernetes/k8s-drop-legacy-log-path.patch b/third_party/com_k8s_io_kubernetes/k8s-drop-legacy-log-path.patch
index 44fb6aa..41ed364 100644
--- a/third_party/com_k8s_io_kubernetes/k8s-drop-legacy-log-path.patch
+++ b/third_party/com_k8s_io_kubernetes/k8s-drop-legacy-log-path.patch
@@ -1,4 +1,4 @@
-From 7844c9ec1cdef485731a4858a48b854986387591 Mon Sep 17 00:00:00 2001
+From 5fa4cde761ff1b7cbd0e47966992d07927e06882 Mon Sep 17 00:00:00 2001
 From: Lorenz Brun <lorenz@monogon.tech>
 Date: Wed, 16 Mar 2022 18:10:09 +0100
 Subject: [PATCH] Drop legacy log path
@@ -11,13 +11,13 @@
  4 files changed, 107 deletions(-)
 
 diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go
-index b8bbfece860..e6aa5e8359b 100644
+index 600a006f054..93d1e2735bd 100644
 --- a/pkg/kubelet/kubelet.go
 +++ b/pkg/kubelet/kubelet.go
-@@ -1589,13 +1589,6 @@ func (kl *Kubelet) initializeModules() error {
+@@ -1643,13 +1643,6 @@ func (kl *Kubelet) initializeModules(ctx context.Context) error {
  		return err
  	}
- 
+
 -	// If the container logs directory does not exist, create it.
 -	if _, err := os.Stat(ContainerLogsDir); err != nil {
 -		if err := kl.os.MkdirAll(ContainerLogsDir, 0755); err != nil {
@@ -29,13 +29,13 @@
  		// On Windows we should not allow other users to read the logs directory
  		// to avoid allowing non-root containers from reading the logs of other containers.
 diff --git a/pkg/kubelet/kuberuntime/kuberuntime_container.go b/pkg/kubelet/kuberuntime/kuberuntime_container.go
-index a154754d285..df87ff82f7d 100644
+index a1d9453f891..b07d3698b9f 100644
 --- a/pkg/kubelet/kuberuntime/kuberuntime_container.go
 +++ b/pkg/kubelet/kuberuntime/kuberuntime_container.go
-@@ -286,25 +286,6 @@ func (m *kubeGenericRuntimeManager) startContainer(ctx context.Context, podSandb
+@@ -296,25 +296,6 @@ func (m *kubeGenericRuntimeManager) startContainer(ctx context.Context, podSandb
  	}
- 	m.recordContainerEvent(pod, container, containerID, v1.EventTypeNormal, events.StartedContainer, "Started container %v", container.Name)
- 
+ 	m.recordContainerEvent(ctx, pod, container, containerID, v1.EventTypeNormal, events.StartedContainer, "Started container %v", container.Name)
+
 -	// Symlink container logs to the legacy container log location for cluster logging
 -	// support.
 -	// TODO(random-liu): Remove this after cluster logging supports CRI container log path.
@@ -50,7 +50,7 @@
 -	// to create it in the first place. it happens when journald logging driver is used with docker.
 -	if _, err := m.osInterface.Stat(containerLog); !os.IsNotExist(err) {
 -		if err := m.osInterface.Symlink(containerLog, legacySymlink); err != nil {
--			klog.ErrorS(err, "Failed to create legacy symbolic link", "path", legacySymlink,
+-			logger.Error(err, "Failed to create legacy symbolic link", "path", legacySymlink,
 -				"containerID", containerID, "containerLogPath", containerLog)
 -		}
 -	}
@@ -58,10 +58,10 @@
  	// Step 4: execute the post start hook.
  	if container.Lifecycle != nil && container.Lifecycle.PostStart != nil {
  		kubeContainerID := kubecontainer.ContainerID{
-@@ -1335,23 +1316,6 @@ func (m *kubeGenericRuntimeManager) removeContainerLog(ctx context.Context, cont
+@@ -1360,23 +1341,6 @@ func (m *kubeGenericRuntimeManager) removeContainerLog(ctx context.Context, cont
  		return err
  	}
- 
+
 -	resp, err := m.runtimeService.ContainerStatus(ctx, containerID, false)
 -	if err != nil {
 -		return fmt.Errorf("failed to get container status %q: %v", containerID, err)
@@ -72,7 +72,7 @@
 -	}
 -	// Remove the legacy container log symlink.
 -	// TODO(random-liu): Remove this after cluster logging supports CRI container log path.
--	labeledInfo := getContainerInfoFromLabels(status.Labels)
+-	labeledInfo := getContainerInfoFromLabels(ctx, status.Labels)
 -	legacySymlink := legacyLogSymlink(containerID, labeledInfo.ContainerName, labeledInfo.PodName,
 -		labeledInfo.PodNamespace)
 -	if err := m.osInterface.Remove(legacySymlink); err != nil && !os.IsNotExist(err) {
@@ -81,9 +81,9 @@
 -	}
  	return nil
  }
- 
+
 diff --git a/pkg/kubelet/kuberuntime/kuberuntime_gc.go b/pkg/kubelet/kuberuntime/kuberuntime_gc.go
-index 6189b1f07ca..3cd3daa5a6c 100644
+index 2691f64d5c3..d766c618db3 100644
 --- a/pkg/kubelet/kuberuntime/kuberuntime_gc.go
 +++ b/pkg/kubelet/kuberuntime/kuberuntime_gc.go
 @@ -19,7 +19,6 @@ package kuberuntime
@@ -94,7 +94,7 @@
  	"path/filepath"
  	"sort"
  	"time"
-@@ -347,51 +346,6 @@ func (cgc *containerGC) evictPodLogsDirectories(ctx context.Context, allSourcesR
+@@ -350,51 +349,6 @@ func (cgc *containerGC) evictPodLogsDirectories(ctx context.Context, allSourcesR
  			}
  		}
  	}
@@ -109,11 +109,11 @@
 -				if err != nil {
 -					// TODO: we should handle container not found (i.e. container was deleted) case differently
 -					// once https://github.com/kubernetes/kubernetes/issues/63336 is resolved
--					klog.InfoS("Error getting ContainerStatus for containerID", "containerID", containerID, "err", err)
+-					logger.Info("Error getting ContainerStatus for containerID", "containerID", containerID, "err", err)
 -				} else {
 -					status := resp.GetStatus()
 -					if status == nil {
--						klog.V(4).InfoS("Container status is nil")
+-						logger.V(4).Info("Container status is nil")
 -						continue
 -					}
 -					if status.State != runtimeapi.ContainerState_CONTAINER_EXITED {
@@ -128,24 +128,24 @@
 -						// See https://github.com/kubernetes/kubernetes/issues/52172
 -						//
 -						// We only remove unhealthy symlink for dead containers
--						klog.V(5).InfoS("Container is still running, not removing symlink", "containerID", containerID, "path", logSymlink)
+-						logger.V(5).Info("Container is still running, not removing symlink", "containerID", containerID, "path", logSymlink)
 -						continue
 -					}
 -				}
 -			} else {
--				klog.V(4).InfoS("Unable to obtain container ID", "err", err)
+-				logger.V(4).Info("Unable to obtain container ID", "err", err)
 -			}
 -			err := osInterface.Remove(logSymlink)
 -			if err != nil {
--				klog.ErrorS(err, "Failed to remove container log dead symlink", "path", logSymlink)
+-				logger.Error(err, "Failed to remove container log dead symlink", "path", logSymlink)
 -			} else {
--				klog.V(4).InfoS("Removed symlink", "path", logSymlink)
+-				logger.V(4).Info("Removed symlink", "path", logSymlink)
 -			}
 -		}
 -	}
  	return nil
  }
- 
+
 diff --git a/test/e2e_node/log_path_test.go b/test/e2e_node/log_path_test.go
 index a1589e6d91e..179206eb1dd 100644
 --- a/test/e2e_node/log_path_test.go
@@ -179,9 +179,9 @@
 -				err = createAndWaitPod(ctx, makeLogCheckPod(logCheckPodName, logString, expectedlogFile))
 -				framework.ExpectNoError(err, "Failed waiting for pod: %s to enter success state", logCheckPodName)
 -			})
- 
+
  			ginkgo.It("should print log to correct cri log path", func(ctx context.Context) {
- 
--- 
-2.47.0
+
+--
+2.50.1