mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-08-20 00:37:00 +00:00
fix: defer to service analyser when selectors are missing (#652)
Signed-off-by: Aris Boutselis <arisboutselis08@gmail.com> Co-authored-by: Aris Boutselis <arisboutselis08@gmail.com> Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
This commit is contained in:
parent
598ef22e57
commit
6c5a0628e4
@ -78,6 +78,10 @@ func (MutatingWebhookAnalyzer) Analyze(a common.Analyzer) ([]common.Result, erro
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When Service selectors are empty we defer to service analyser
|
||||||
|
if len(service.Spec.Selector) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
// Get pods within service
|
// Get pods within service
|
||||||
pods, err := a.Client.GetClient().CoreV1().Pods(svc.Namespace).List(context.Background(), v1.ListOptions{
|
pods, err := a.Client.GetClient().CoreV1().Pods(svc.Namespace).List(context.Background(), v1.ListOptions{
|
||||||
LabelSelector: util.MapToString(service.Spec.Selector),
|
LabelSelector: util.MapToString(service.Spec.Selector),
|
||||||
|
@ -76,6 +76,10 @@ func (ValidatingWebhookAnalyzer) Analyze(a common.Analyzer) ([]common.Result, er
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When Service selectors are empty we defer to service analyser
|
||||||
|
if len(service.Spec.Selector) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
// Get pods within service
|
// Get pods within service
|
||||||
pods, err := a.Client.GetClient().CoreV1().Pods(svc.Namespace).List(context.Background(), v1.ListOptions{
|
pods, err := a.Client.GetClient().CoreV1().Pods(svc.Namespace).List(context.Background(), v1.ListOptions{
|
||||||
LabelSelector: util.MapToString(service.Spec.Selector),
|
LabelSelector: util.MapToString(service.Spec.Selector),
|
||||||
|
Loading…
Reference in New Issue
Block a user