diff --git a/cmd/preflight/cli/serviceaccount.go b/cmd/preflight/cli/serviceaccount.go index 8d7164b5b..4b4b07b10 100644 --- a/cmd/preflight/cli/serviceaccount.go +++ b/cmd/preflight/cli/serviceaccount.go @@ -126,6 +126,5 @@ func removeServiceAccount(name string, namespace string, clientset *kubernetes.C return err } - return nil } diff --git a/cmd/troubleshoot/cli/run_nocrd.go b/cmd/troubleshoot/cli/run_nocrd.go index c55f48fb5..4cffed0aa 100644 --- a/cmd/troubleshoot/cli/run_nocrd.go +++ b/cmd/troubleshoot/cli/run_nocrd.go @@ -222,7 +222,6 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector) (str s := runtime.NewScheme() s.AddKnownTypes(schema.GroupVersion{Group: "", Version: "v1"}, &corev1.ConfigMap{}) for _, collect := range desiredCollectors { - fmt.Printf("creating collector\n") _, pod, err := collectrunner.CreateCollector(client, s, &owner, collector.Name, v.GetString("namespace"), serviceAccountName, "troubleshoot", collect, v.GetString("image"), v.GetString("pullpolicy")) if err != nil { fmt.Printf("A collector pod cannot be created: %v\n", err) diff --git a/pkg/collect/util.go b/pkg/collect/util.go index 19e9892f5..3b8aa8c6e 100644 --- a/pkg/collect/util.go +++ b/pkg/collect/util.go @@ -30,11 +30,17 @@ func DeterministicIDForCollector(collector *troubleshootv1beta1.Collect) string } if collector.Run != nil { - unsafeID = fmt.Sprintf("run-%s", strings.ToLower(collector.Run.CollectorName)) + unsafeID = "run" + if collector.Run.CollectorName != "" { + unsafeID = fmt.Sprintf("%s-%s", unsafeID, strings.ToLower(collector.Run.CollectorName)) + } } if collector.Exec != nil { - unsafeID = fmt.Sprintf("exec-%s", strings.ToLower(collector.Exec.CollectorName)) + unsafeID = "exec" + if collector.Exec.CollectorName != "" { + unsafeID = fmt.Sprintf("%s-%s", unsafeID, strings.ToLower(collector.Exec.CollectorName)) + } } if collector.Copy != nil { @@ -42,7 +48,10 @@ func DeterministicIDForCollector(collector *troubleshootv1beta1.Collect) string } if collector.HTTP != nil { - unsafeID = fmt.Sprintf("http-%s", strings.ToLower(collector.HTTP.CollectorName)) + unsafeID = "http" + if collector.HTTP.CollectorName != "" { + unsafeID = fmt.Sprintf("%s-%s", unsafeID, strings.ToLower(collector.HTTP.CollectorName)) + } } return rfc1035(unsafeID)