Skip to content

Commit

Permalink
remove clusterResources from the default SupportBundle Spec (#4936)
Browse files Browse the repository at this point in the history
* remove cluster-resourcs from default spec

* collect cluster resources for kots namespace
  • Loading branch information
diamonwiggins authored Oct 10, 2024
1 parent fe6874c commit 5cebd23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 14 additions & 5 deletions pkg/supportbundle/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,14 @@ func createDefaultSpec(app *apptypes.App, b *troubleshootv1beta2.SupportBundle,
}

if isKurl {
kurlSupportBunlde, err := staticspecs.GetKurlSpec(app)
kurlSupportBundle, err := staticspecs.GetKurlSpec(app)
if err != nil {
logger.Errorf("Failed to load kurl support bundle spec: %v", err)
return nil, err
}

supportBundle.Spec.Collectors = append(supportBundle.Spec.Collectors, kurlSupportBunlde.Spec.Collectors...)
supportBundle.Spec.Analyzers = append(supportBundle.Spec.Analyzers, kurlSupportBunlde.Spec.Analyzers...)
supportBundle.Spec.Collectors = append(supportBundle.Spec.Collectors, kurlSupportBundle.Spec.Collectors...)
supportBundle.Spec.Analyzers = append(supportBundle.Spec.Analyzers, kurlSupportBundle.Spec.Analyzers...)
}

supportBundle = addDefaultDynamicTroubleshoot(supportBundle, app, imageName, pullSecret)
Expand Down Expand Up @@ -647,8 +647,10 @@ func deduplicatedCollectors(supportBundle *troubleshootv1beta2.SupportBundle) *t
next.Spec.Collectors = append(next.Spec.Collectors[:j], next.Spec.Collectors[j+1:]...)
j--
} else if next.Spec.Collectors[i].ClusterResources != nil && next.Spec.Collectors[j].ClusterResources != nil {
next.Spec.Collectors = append(next.Spec.Collectors[:j], next.Spec.Collectors[j+1:]...)
j--
if reflect.DeepEqual(next.Spec.Collectors[i].ClusterResources.Namespaces, next.Spec.Collectors[j].ClusterResources.Namespaces) {
next.Spec.Collectors = append(next.Spec.Collectors[:j], next.Spec.Collectors[j+1:]...)
j--
}
} else if next.Spec.Collectors[i].ClusterInfo != nil && next.Spec.Collectors[j].ClusterInfo != nil {
next.Spec.Collectors = append(next.Spec.Collectors[:j], next.Spec.Collectors[j+1:]...)
j--
Expand Down Expand Up @@ -727,6 +729,13 @@ func addDefaultDynamicTroubleshoot(supportBundle *troubleshootv1beta2.SupportBun
func getDefaultDynamicCollectors(app *apptypes.App, imageName string, pullSecret *troubleshootv1beta2.ImagePullSecrets) []*troubleshootv1beta2.Collect {
collectors := make([]*troubleshootv1beta2.Collect, 0)

// Collect Cluster Resources for the namespace that the Admin Console is running in
collectors = append(collectors, &troubleshootv1beta2.Collect{
ClusterResources: &troubleshootv1beta2.ClusterResources{
Namespaces: []string{util.PodNamespace},
},
})

license, err := store.GetStore().GetLatestLicenseForApp(app.GetID())
if err != nil {
logger.Errorf("Failed to load license data from store: %v", err)
Expand Down
1 change: 0 additions & 1 deletion pkg/supportbundle/staticspecs/defaultspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ spec:
uri: "https://raw.githubusercontent.com/replicatedhq/kots/main/pkg/supportbundle/staticspecs/defaultspec.yaml"
collectors:
- clusterInfo: {}
- clusterResources: {}
- exec:
args:
- "http://localhost:3030/goroutines"
Expand Down

0 comments on commit 5cebd23

Please sign in to comment.