From ba138c86beae52026bb3a368e66caf91fbc40a3d Mon Sep 17 00:00:00 2001 From: Evans Mungai Date: Thu, 24 Aug 2023 19:01:11 +0100 Subject: [PATCH] Use sigs.k8s.io/yaml since it respects omitempty --- cmd/internal/util/dump_spec.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/internal/util/dump_spec.go b/cmd/internal/util/dump_spec.go index 85c1a108e..64a0ab69a 100644 --- a/cmd/internal/util/dump_spec.go +++ b/cmd/internal/util/dump_spec.go @@ -7,10 +7,11 @@ import ( "github.com/pkg/errors" "github.com/replicatedhq/troubleshoot/internal/specs" "github.com/replicatedhq/troubleshoot/pkg/k8sutil" + "github.com/replicatedhq/troubleshoot/pkg/logger" "github.com/spf13/cobra" "github.com/spf13/viper" - "gopkg.in/yaml.v2" "k8s.io/client-go/kubernetes" + "sigs.k8s.io/yaml" ) func DumpSpecCmd() *cobra.Command { @@ -22,6 +23,15 @@ func DumpSpecCmd() *cobra.Command { return printSpecs(args) }, } + + cmd.Flags().StringSliceP("selector", "l", []string{"troubleshoot.sh/kind=support-bundle"}, "selector to filter on for loading additional support bundle specs found in secrets within the cluster") + cmd.Flags().Bool("load-cluster-specs", false, "enable/disable loading additional troubleshoot specs found within the cluster. required when no specs are provided on the command line") + + // Initialize klog flags + logger.InitKlogFlags(cmd) + + k8sutil.AddFlags(cmd.Flags()) + return cmd }