From b13cb4d4e1875efaab923e399ee71cb87cf7e71a Mon Sep 17 00:00:00 2001 From: xuezhao Date: Tue, 18 Mar 2025 16:48:55 +0800 Subject: [PATCH] Improve logging in selectBootstrapKubeConfigs function by replacing index with bootstrapKubeConfig in error and info messages for better clarity. (#896) Signed-off-by: xuezhaojun --- pkg/registration/spoke/bootstrapkubeconfigs.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/registration/spoke/bootstrapkubeconfigs.go b/pkg/registration/spoke/bootstrapkubeconfigs.go index 33558c78f..b495e9fe9 100644 --- a/pkg/registration/spoke/bootstrapkubeconfigs.go +++ b/pkg/registration/spoke/bootstrapkubeconfigs.go @@ -28,16 +28,16 @@ func selectBootstrapKubeConfigs(ctx context.Context, for index, fp := range bootstrapKubeConfigFilePaths { equal, err := compareServerEndpoint(fp, hubKubeConfigFilePath) if err != nil { - logger.Error(err, "failed to compare hub and bootstrap kubeconfigs", "index", index) + logger.Error(err, "failed to compare hub and bootstrap kubeconfigs", "bootstrapKubeConfig", fp) continue } if equal { err := checkBootstrapKubeConfigValid(ctx, managedCluster, fp) if err != nil { - logger.Error(err, "failed to check matched bootstrap kubeconfig", "index", index) + logger.Error(err, "failed to check matched bootstrap kubeconfig", "bootstrapKubeConfig", fp) break } - logger.Info("found matched bootstrap kubeconfig and it's valid, no need to reselect another one", "index", index) + logger.Info("found matched bootstrap kubeconfig and it's valid, no need to reselect another one", "bootstrapKubeConfig", fp) return index, nil } } @@ -45,7 +45,7 @@ func selectBootstrapKubeConfigs(ctx context.Context, for index, fp := range bootstrapKubeConfigFilePaths { err := checkBootstrapKubeConfigValid(ctx, managedCluster, fp) if err != nil { - logger.Error(err, "failed to check bootstrap kubeconfig", "index", index) + logger.Error(err, "failed to check bootstrap kubeconfig", "bootstrapKubeConfig", fp) continue } return index, nil