mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-08-28 20:30:43 +00:00
Merge branch 'main' into feat/integrate
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
This commit is contained in:
commit
ced0de6448
@ -3,6 +3,7 @@ package analysis
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -73,6 +74,8 @@ func (a *Analysis) RunAnalysis() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
a.Results = append(a.Results, results...)
|
a.Results = append(a.Results, results...)
|
||||||
|
} else {
|
||||||
|
return errors.New(fmt.Sprintf("\"%s\" filter does not exist. Please run k8sgpt filters list.", filter))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -2,7 +2,6 @@ package analyzer
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/k8sgpt-ai/k8sgpt/pkg/common"
|
"github.com/k8sgpt-ai/k8sgpt/pkg/common"
|
||||||
"github.com/k8sgpt-ai/k8sgpt/pkg/util"
|
"github.com/k8sgpt-ai/k8sgpt/pkg/util"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -28,22 +27,22 @@ func (HpaAnalyzer) Analyze(a common.Analyzer) ([]common.Result, error) {
|
|||||||
|
|
||||||
switch scaleTargetRef.Kind {
|
switch scaleTargetRef.Kind {
|
||||||
case "Deployment":
|
case "Deployment":
|
||||||
_, err := a.Client.GetClient().AppsV1().Deployments(a.Namespace).Get(a.Context, scaleTargetRef.Name, metav1.GetOptions{})
|
_, err := a.Client.GetClient().AppsV1().Deployments(hpa.Namespace).Get(a.Context, scaleTargetRef.Name, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
scaleTargetRefNotFound = true
|
scaleTargetRefNotFound = true
|
||||||
}
|
}
|
||||||
case "ReplicationController":
|
case "ReplicationController":
|
||||||
_, err := a.Client.GetClient().CoreV1().ReplicationControllers(a.Namespace).Get(a.Context, scaleTargetRef.Name, metav1.GetOptions{})
|
_, err := a.Client.GetClient().CoreV1().ReplicationControllers(hpa.Namespace).Get(a.Context, scaleTargetRef.Name, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
scaleTargetRefNotFound = true
|
scaleTargetRefNotFound = true
|
||||||
}
|
}
|
||||||
case "ReplicaSet":
|
case "ReplicaSet":
|
||||||
_, err := a.Client.GetClient().AppsV1().ReplicaSets(a.Namespace).Get(a.Context, scaleTargetRef.Name, metav1.GetOptions{})
|
_, err := a.Client.GetClient().AppsV1().ReplicaSets(hpa.Namespace).Get(a.Context, scaleTargetRef.Name, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
scaleTargetRefNotFound = true
|
scaleTargetRefNotFound = true
|
||||||
}
|
}
|
||||||
case "StatefulSet":
|
case "StatefulSet":
|
||||||
_, err := a.Client.GetClient().AppsV1().StatefulSets(a.Namespace).Get(a.Context, scaleTargetRef.Name, metav1.GetOptions{})
|
_, err := a.Client.GetClient().AppsV1().StatefulSets(hpa.Namespace).Get(a.Context, scaleTargetRef.Name, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
scaleTargetRefNotFound = true
|
scaleTargetRefNotFound = true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user