@@ -47,16 +47,18 @@ func runTroubleshoot(v *viper.Viper, arg string) error {
4747 return errors .Wrap (err , "failed to load collector spec" )
4848 }
4949
50+ multidocs := strings .Split (string (collectorContent ), "---" )
51+
5052 troubleshootclientsetscheme .AddToScheme (scheme .Scheme )
5153 decode := scheme .Codecs .UniversalDeserializer ().Decode
52- obj , _ , err := decode ([]byte (collectorContent ), nil , nil )
54+ obj , _ , err := decode ([]byte (multidocs [ 0 ] ), nil , nil )
5355 if err != nil {
5456 return errors .Wrapf (err , "failed to parse %s" , arg )
5557 }
5658
5759 collector := obj .(* troubleshootv1beta1.Collector )
5860
59- var additionalRedactors * troubleshootv1beta1.Redactor
61+ additionalRedactors := & troubleshootv1beta1.Redactor {}
6062 if v .GetString ("redactors" ) != "" {
6163 redactorContent , err := loadSpec (v , v .GetString ("redactors" ))
6264 if err != nil {
@@ -73,6 +75,18 @@ func runTroubleshoot(v *viper.Viper, arg string) error {
7375 }
7476 }
7577
78+ for i , additionalDoc := range multidocs [1 :] {
79+ obj , _ , err := decode ([]byte (additionalDoc ), nil , nil )
80+ if err != nil {
81+ return errors .Wrapf (err , "failed to parse additional doc %d" , i )
82+ }
83+ multidocRedactors , ok := obj .(* troubleshootv1beta1.Redactor )
84+ if ! ok {
85+ continue
86+ }
87+ additionalRedactors .Spec .Redactors = append (additionalRedactors .Spec .Redactors , multidocRedactors .Spec .Redactors ... )
88+ }
89+
7690 s := spin .New ()
7791 finishedCh := make (chan bool , 1 )
7892 progressChan := make (chan interface {}, 0 ) // non-zero buffer can result in missed messages
0 commit comments