Improve logging in selectBootstrapKubeConfigs function by replacing index with bootstrapKubeConfig in error and info messages for better clarity. (#896)
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Failing after 2m34s
Post / coverage (push) Failing after 8m1s
Post / images (amd64) (push) Failing after 3m27s
Post / images (arm64) (push) Failing after 5m19s
Post / image manifest (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Close stale issues and PRs / stale (push) Successful in 50s

Signed-off-by: xuezhaojun <zxue@redhat.com>
This commit is contained in:
xuezhao
2025-03-18 16:48:55 +08:00
committed by GitHub
parent c88191f99e
commit b13cb4d4e1

View File

@@ -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