Merge "Remove redundant logging when building kubeconfig"
This commit is contained in:
commit
9329b9cc21
@ -124,7 +124,7 @@ func (b *Builder) builtSiteKubeconf() (*api.Config, error) {
|
|||||||
// buildOne merges context into site kubeconfig
|
// buildOne merges context into site kubeconfig
|
||||||
_, _, err := b.buildOne(clusterID)
|
_, _, err := b.buildOne(clusterID)
|
||||||
if IsErrAllSourcesFailedErr(err) {
|
if IsErrAllSourcesFailedErr(err) {
|
||||||
log.Printf("All kubeconfig sources failed for cluster '%s', error '%v', skipping it",
|
log.Debugf("All kubeconfig sources failed for cluster '%s', error '%v', skipping it",
|
||||||
clusterID, err)
|
clusterID, err)
|
||||||
continue
|
continue
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
@ -143,7 +143,7 @@ func (b *Builder) buildOne(clusterID string) (string, *api.Config, error) {
|
|||||||
// use already built kubeconfig context, to avoid doing work multiple times
|
// use already built kubeconfig context, to avoid doing work multiple times
|
||||||
built, oneKubeconf := b.alreadyBuilt(destContext)
|
built, oneKubeconf := b.alreadyBuilt(destContext)
|
||||||
if built {
|
if built {
|
||||||
log.Printf("kubeconfig for cluster '%s' is already built, using it", clusterID)
|
log.Debugf("Kubeconfig for cluster '%s' is already built, using it", clusterID)
|
||||||
return destContext, oneKubeconf, nil
|
return destContext, oneKubeconf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ func (b *Builder) buildOne(clusterID string) (string, *api.Config, error) {
|
|||||||
oneKubeconf, sourceErr := b.trySource(clusterID, destContext, source)
|
oneKubeconf, sourceErr := b.trySource(clusterID, destContext, source)
|
||||||
if sourceErr == nil {
|
if sourceErr == nil {
|
||||||
// Merge source context into site kubeconfig
|
// Merge source context into site kubeconfig
|
||||||
log.Printf("Merging kubecontext for cluster '%s', into site kubeconfig", clusterID)
|
log.Debugf("Merging kubecontext for cluster '%s', into site kubeconfig", clusterID)
|
||||||
if err = mergeContextAPI(destContext, destContext, b.siteKubeconf, oneKubeconf); err != nil {
|
if err = mergeContextAPI(destContext, destContext, b.siteKubeconf, oneKubeconf); err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ func (b *Builder) buildOne(clusterID string) (string, *api.Config, error) {
|
|||||||
// effect other clusters, which don't depend on it. If they do depend on it, their calls
|
// effect other clusters, which don't depend on it. If they do depend on it, their calls
|
||||||
// will fail because the context will be missing. Combitation with a log message will make
|
// will fail because the context will be missing. Combitation with a log message will make
|
||||||
// it clear where the problem is.
|
// it clear where the problem is.
|
||||||
log.Printf("received error while trying kubeconfig source for cluster '%s', source type '%s', error '%v'",
|
log.Debugf("Received error while trying kubeconfig source for cluster '%s', source type '%s', error '%v'",
|
||||||
clusterID, source.Type, sourceErr)
|
clusterID, source.Type, sourceErr)
|
||||||
}
|
}
|
||||||
// return empty not nil kubeconfig without error.
|
// return empty not nil kubeconfig without error.
|
||||||
@ -199,7 +199,7 @@ func (b *Builder) trySource(clusterID, dstContext string, source v1alpha1.Kubeco
|
|||||||
|
|
||||||
func (b *Builder) fromClusterAPI(clusterName string, ref v1alpha1.KubeconfigSourceClusterAPI) KubeSourceFunc {
|
func (b *Builder) fromClusterAPI(clusterName string, ref v1alpha1.KubeconfigSourceClusterAPI) KubeSourceFunc {
|
||||||
return func() ([]byte, error) {
|
return func() ([]byte, error) {
|
||||||
log.Printf("Getting kubeconfig from cluster API for cluster '%s'", clusterName)
|
log.Debugf("Getting kubeconfig from cluster API for cluster '%s'", clusterName)
|
||||||
parentCluster, err := b.clusterMap.ParentCluster(clusterName)
|
parentCluster, err := b.clusterMap.ParentCluster(clusterName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -225,7 +225,7 @@ func (b *Builder) fromClusterAPI(clusterName string, ref v1alpha1.KubeconfigSour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Getting child kubeconfig from parent, parent context '%s', parent kubeconfing '%s'",
|
log.Debugf("Getting child kubeconfig from parent, parent context '%s', parent kubeconfing '%s'",
|
||||||
parentContext, f)
|
parentContext, f)
|
||||||
return FromSecret(b.clusterctlClient, &client.GetKubeconfigOptions{
|
return FromSecret(b.clusterctlClient, &client.GetKubeconfigOptions{
|
||||||
ParentKubeconfigPath: f,
|
ParentKubeconfigPath: f,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user