feat: refactor integration to use Failure object

Signed-off-by: Matthis Holleville <matthish29@gmail.com>
This commit is contained in:
Matthis Holleville
2023-04-12 11:40:51 +02:00
35 changed files with 1394 additions and 160 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/fatih/color"
"github.com/k8sgpt-ai/k8sgpt/pkg/ai"
"github.com/k8sgpt-ai/k8sgpt/pkg/analyzer"
"github.com/k8sgpt-ai/k8sgpt/pkg/common"
"github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes"
"github.com/k8sgpt-ai/k8sgpt/pkg/util"
"github.com/schollz/progressbar/v3"
@@ -21,7 +22,7 @@ type Analysis struct {
Filters []string
Client *kubernetes.Client
AIClient ai.IAI
Results []analyzer.Result
Results []common.Result
Namespace string
NoCache bool
Explain bool
@@ -35,9 +36,9 @@ const (
)
type JsonOutput struct {
Status AnalysisStatus `json:"status"`
Problems int `json:"problems"`
Results []analyzer.Result `json:"results"`
Status AnalysisStatus `json:"status"`
Problems int `json:"problems"`
Results []common.Result `json:"results"`
}
func (a *Analysis) RunAnalysis() error {
@@ -46,7 +47,7 @@ func (a *Analysis) RunAnalysis() error {
analyzerMap := analyzer.GetAnalyzerMap()
analyzerConfig := analyzer.Analyzer{
analyzerConfig := common.Analyzer{
Client: a.Client,
Context: a.Context,
Namespace: a.Namespace,