From 58fb5d9e80ccf5065165eba410ebe71e8629a22c Mon Sep 17 00:00:00 2001 From: Amit Schendel Date: Mon, 16 Dec 2024 08:12:21 +0000 Subject: [PATCH 1/2] Adding support for old k8s versions by not throwing an error when configz in unavailable Signed-off-by: Amit Schendel --- pkg/utils/utils.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 2fe7dde9..d063e3c6 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -702,9 +702,11 @@ func DetectContainerRuntimeViaK8sAPI(ctx context.Context, k8sClient *k8sinterfac // override the socket path realSocketPath, err := getContainerRuntimeSocketPath(k8sClient, nodeName) if err != nil { - return nil, fmt.Errorf("failed to get container runtime socket path from Kubelet configz: %v", err) + // return nil, fmt.Errorf("failed to get container runtime socket path from Kubelet configz: %v", err) + logger.L().Warning("failed to get container runtime socket path from Kubelet configz", helpers.String("error", err.Error())) + } else { + runtimeConfig.SocketPath = realSocketPath } - runtimeConfig.SocketPath = realSocketPath // unset the runtime protocol runtimeConfig.RuntimeProtocol = "" return runtimeConfig, nil From 5a40f2a86a12e3f4cdd4472234817ac26a2eda6e Mon Sep 17 00:00:00 2001 From: Amit Schendel Date: Mon, 16 Dec 2024 08:14:01 +0000 Subject: [PATCH 2/2] Removing comment Signed-off-by: Amit Schendel --- pkg/utils/utils.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index d063e3c6..374f779b 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -702,7 +702,6 @@ func DetectContainerRuntimeViaK8sAPI(ctx context.Context, k8sClient *k8sinterfac // override the socket path realSocketPath, err := getContainerRuntimeSocketPath(k8sClient, nodeName) if err != nil { - // return nil, fmt.Errorf("failed to get container runtime socket path from Kubelet configz: %v", err) logger.L().Warning("failed to get container runtime socket path from Kubelet configz", helpers.String("error", err.Error())) } else { runtimeConfig.SocketPath = realSocketPath