mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
More analyzer types checks
This commit is contained in:
@@ -3,7 +3,6 @@ package analyzer
|
||||
import (
|
||||
"archive/tar"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@@ -15,7 +14,6 @@ import (
|
||||
troubleshootscheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
|
||||
"github.com/replicatedhq/troubleshoot/pkg/docrewrite"
|
||||
"github.com/replicatedhq/troubleshoot/pkg/logger"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
)
|
||||
|
||||
@@ -188,29 +186,15 @@ func parseAnalyzers(spec string) ([]*troubleshootv1beta2.Analyze, error) {
|
||||
}
|
||||
|
||||
// SupportBundle overwrites Analyzer if defined
|
||||
if gvk.String() == "troubleshoot.sh/v1beta2, Kind=SupportBundle" {
|
||||
if gvk.Group == "troubleshoot.sh" && gvk.Version == "v1beta2" && gvk.Kind == "SupportBundle" {
|
||||
supportBundle := obj.(*troubleshootv1beta2.SupportBundle)
|
||||
analyzer := supportBundleToAnalyzer(supportBundle)
|
||||
return analyzer.Spec.Analyzers, nil
|
||||
} else {
|
||||
return supportBundle.Spec.Analyzers, nil
|
||||
} else if gvk.Group == "troubleshoot.sh" && gvk.Version == "v1beta2" && gvk.Kind == "Analyzer" {
|
||||
analyzer := obj.(*troubleshootv1beta2.Analyzer)
|
||||
return analyzer.Spec.Analyzers, nil
|
||||
}
|
||||
}
|
||||
|
||||
func supportBundleToAnalyzer(sb *troubleshootv1beta2.SupportBundle) *troubleshootv1beta2.Analyzer {
|
||||
return &troubleshootv1beta2.Analyzer{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
APIVersion: "troubleshoot.sh/v1beta2",
|
||||
Kind: "Analyzer",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: fmt.Sprintf("%s-analyzer", sb.Name),
|
||||
},
|
||||
Spec: troubleshootv1beta2.AnalyzerSpec{
|
||||
Analyzers: sb.Spec.Analyzers,
|
||||
},
|
||||
}
|
||||
return nil, errors.Errorf("invalid gvk %q", gvk)
|
||||
}
|
||||
|
||||
func getDefaultAnalyzers() ([]*troubleshootv1beta2.Analyze, error) {
|
||||
|
||||
Reference in New Issue
Block a user