fix: cluster-res collector fixed to one namespace

This commit is contained in:
Dan Stough
2021-09-03 19:23:44 +00:00
parent 5b157381fe
commit 0478a7a60f
3 changed files with 11 additions and 16 deletions

View File

@@ -220,14 +220,8 @@ func collectInCluster(preflightSpec *troubleshootv1beta2.Preflight, progressCh c
return nil, errors.Wrap(err, "failed to convert kube flags to rest config")
}
namespace := v.GetString("namespace")
if namespace == "" {
kubeconfig := k8sutil.GetKubeconfig()
namespace, _, _ = kubeconfig.Namespace()
}
collectOpts := preflight.CollectOpts{
Namespace: namespace,
Namespace: v.GetString("namespace"),
IgnorePermissionErrors: v.GetBool("collect-without-permissions"),
ProgressChan: progressCh,
KubernetesRestConfig: restConfig,

View File

@@ -47,12 +47,6 @@ func runTroubleshoot(v *viper.Viper, arg string) error {
return errors.Wrap(err, "failed to convert kube flags to rest config")
}
namespace := v.GetString("namespace")
if namespace == "" {
kubeconfig := k8sutil.GetKubeconfig()
namespace, _, _ = kubeconfig.Namespace()
}
var sinceTime *time.Time
if v.GetString("since-time") != "" || v.GetString("since") != "" {
sinceTime, err = parseTimeFlags(v)
@@ -156,7 +150,7 @@ func runTroubleshoot(v *viper.Viper, arg string) error {
CollectorProgressCallback: collectorCB,
CollectWithoutPermissions: v.GetBool("collect-without-permissions"),
KubernetesRestConfig: restConfig,
Namespace: namespace,
Namespace: v.GetString("namespace"),
ProgressChan: progressChan,
SinceTime: sinceTime,
}