From 6767167ff8ee26771c16c98363314e0cdbe53c34 Mon Sep 17 00:00:00 2001 From: xuezhao Date: Mon, 24 Jun 2024 15:39:14 +0800 Subject: [PATCH] Fix: should use `klog.FromContext` instead of `log.FromContext` (#537) Signed-off-by: GitHub --- pkg/registration/spoke/bootstrapkubeconfigs.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/registration/spoke/bootstrapkubeconfigs.go b/pkg/registration/spoke/bootstrapkubeconfigs.go index 94287b6cb..0362ad963 100644 --- a/pkg/registration/spoke/bootstrapkubeconfigs.go +++ b/pkg/registration/spoke/bootstrapkubeconfigs.go @@ -9,7 +9,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" - "sigs.k8s.io/controller-runtime/pkg/log" + "k8s.io/klog/v2" clusterv1client "open-cluster-management.io/api/client/cluster/clientset/versioned" @@ -23,7 +23,7 @@ import ( // If no suitable kubeconfig is found, it returns -1 and an error indicating that no bootstrap kubeconfig is available for the specified managed cluster. func selectBootstrapKubeConfigs(ctx context.Context, managedCluster, hubKubeConfigFilePath string, bootstrapKubeConfigFilePaths []string) (int, error) { - logger := log.FromContext(ctx) + logger := klog.FromContext(ctx) for index, fp := range bootstrapKubeConfigFilePaths { equal, err := compareServerEndpoint(fp, hubKubeConfigFilePath) @@ -52,7 +52,7 @@ func selectBootstrapKubeConfigs(ctx context.Context, } // TODO: return index because some legacy code depends on the file type. Change to return *rest.Config in the future. @xuezhaojun - return -1, fmt.Errorf("no bootstrap kubeconfig is available for managed cluster %s", managedCluster) + return -1, fmt.Errorf("no bootstrap kubeconfig in %v is available for managed cluster %s", bootstrapKubeConfigFilePaths, managedCluster) } func compareServerEndpoint(bootstrapKubeConfigFilePath, hubKubeConfigFilePath string) (bool, error) {