treewide: bump to k8s v1.33.2
Update Kubernetes to 1.33 which is already at patch version 2. As part
of K8s gomod dependencies containerd was bumped a minor release to 2.1.3.
The UserNamespacesSupport feature gate is now default-on and was thus
dropped. The netlink patches were upstreamed and can now be dropped as
part of the depenency update. A new klog sink adapter for our logging
interface was introduced as the client-go MutationCache now requires a
logger.
containerd abuses gRPC interfaces for mocking, thus they are not
forward-compatible and need a new patch to be compatible with the
CRI version now being used.
Change-Id: I4feb2ab3bcfca5b83c7ea38ed444b14ade1e9bf0
Reviewed-on: https://review.monogon.dev/c/monogon/+/4433
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/osbase/logtree/BUILD.bazel b/osbase/logtree/BUILD.bazel
index 60e8743..584d22c 100644
--- a/osbase/logtree/BUILD.bazel
+++ b/osbase/logtree/BUILD.bazel
@@ -27,6 +27,7 @@
"//osbase/logbuffer",
"//osbase/logtree/proto",
"@com_github_mitchellh_go_wordwrap//:go-wordwrap",
+ "@io_k8s_klog_v2//:klog",
"@org_golang_google_grpc//grpclog",
"@org_golang_google_protobuf//types/known/timestamppb",
"@org_uber_go_zap//:zap",
diff --git a/osbase/logtree/klog.go b/osbase/logtree/klog.go
index 54e7f68..6dd60e7 100644
--- a/osbase/logtree/klog.go
+++ b/osbase/logtree/klog.go
@@ -11,6 +11,8 @@
"strings"
"time"
+ "k8s.io/klog/v2"
+
"source.monogon.dev/go/logging"
"source.monogon.dev/osbase/logbuffer"
)
@@ -200,3 +202,45 @@
// what we want, but we should formalize this.
return time.Parse(layout, fmt.Sprintf("%d %s %s", year, d, t))
}
+
+// klogSink implements klog.LogSink on a logging.Leveld logger.
+type klogSink struct {
+ logging.Leveled
+}
+
+func (k *klogSink) Enabled(level int) bool {
+ return k.V(logging.VerbosityLevel(level)).Enabled()
+}
+
+func (k *klogSink) Error(err error, msg string, keysAndValues ...any) {
+ if err != nil {
+ k.Errorf("%s: %w - %v", msg, err, keysAndValues)
+ } else {
+ k.Errorf("%s: %v", msg, keysAndValues)
+ }
+}
+
+func (k *klogSink) Info(level int, msg string, keysAndValues ...any) {
+ k.Infof("%s: %v", msg, keysAndValues)
+}
+
+func (k *klogSink) Init(info klog.RuntimeInfo) {
+}
+
+// WithName is only need if we would want to wrap the logger with a new
+// name, but we don't need that.
+func (k *klogSink) WithName(name string) klog.LogSink {
+ k.Warning("logtree.klogSink: WithName() called but not implemented. This is a bug!")
+ return k
+}
+
+// WithValues is only need if we would want to wrap the logger with a list
+// of static keys/values, but we don't need that.
+func (k *klogSink) WithValues(keysAndValues ...any) klog.LogSink {
+ k.Warning("logtree.klogSink: WithValues() called but not implemented. This is a bug!")
+ return k
+}
+
+func NewKlogLogger(logger logging.Leveled) klog.Logger {
+ return klog.New(&klogSink{logger})
+}
diff --git a/osbase/net/dns/kubernetes/object/informer.go b/osbase/net/dns/kubernetes/object/informer.go
index c5158dd..f827631 100644
--- a/osbase/net/dns/kubernetes/object/informer.go
+++ b/osbase/net/dns/kubernetes/object/informer.go
@@ -42,7 +42,6 @@
ListerWatcher: lw,
ObjectType: objType,
FullResyncPeriod: 0,
- RetryOnError: false,
Process: builder(clientState, h),
}
return clientState, cache.New(cfg)