diff --git a/pkg/apis/troubleshoot/v1beta2/supportbundle_interfaces.go b/pkg/apis/troubleshoot/v1beta2/supportbundle_interfaces.go index b852a6eb7..74f3619a2 100644 --- a/pkg/apis/troubleshoot/v1beta2/supportbundle_interfaces.go +++ b/pkg/apis/troubleshoot/v1beta2/supportbundle_interfaces.go @@ -21,11 +21,12 @@ func (s *SupportBundle) ConcatSpec(bundle *SupportBundle) { func (s *SupportBundleSpec) MergeCollectors(spec *SupportBundleSpec) { for _,c := range spec.Collectors { + // we want to move away from checking for specific collectors in favor of allowing collectors to expose their own merge method + // ideally we'd just want to be able to call something like c.Merge(spec) here and have the collector's own merge method work out what to do' if c.ClusterInfo != nil { // we only actually want one of these so skip if there's already one y := 0 - // we want to move away from checking for specific collectors in favor of allowing collectors to expose their own merge method for _,v := range s.Collectors{ if v.ClusterInfo != nil { y = 1 @@ -37,6 +38,19 @@ func (s *SupportBundleSpec) MergeCollectors(spec *SupportBundleSpec) { continue } + if c.ClusterResources != nil { + y := 0 + for _,v := range s.Collectors { + if v.ClusterResources != nil { + y = 1 + } + } + if y != 1 { + s.Collectors = append(s.Collectors, c) + } + continue + } + s.Collectors = append(s.Collectors, c) }