check if the service provides selectors (#2322)

mine
Jayson Wang 2023-12-02 06:51:40 +08:00 committed by GitHub
parent 0c642c6786
commit 4e37faf383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -66,6 +66,10 @@ func (s *Service) showPods(a *App, _ ui.Tabular, gvr, path string) {
a.Flash().Warnf("No matching pods. Service %s is an external service.", path) a.Flash().Warnf("No matching pods. Service %s is an external service.", path)
return return
} }
if svc.Spec.Selector == nil {
a.Flash().Warnf("No matching pods. Service %s does not provide any selectors", path)
return
}
showPodsWithLabels(a, path, svc.Spec.Selector) showPodsWithLabels(a, path, svc.Spec.Selector)
} }