From e679c4a8f6ea9a576ab124c3b3428a309d5e6bf0 Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Tue, 12 Nov 2024 12:28:20 -0500 Subject: [PATCH] Fix panic when no services in namespace with --all specified --- cmd/minikube/cmd/service.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/service.go b/cmd/minikube/cmd/service.go index 227271cfe1f2..b0dfa558ec17 100644 --- a/cmd/minikube/cmd/service.go +++ b/cmd/minikube/cmd/service.go @@ -112,7 +112,10 @@ var serviceCmd = &cobra.Command{ services = newServices } - if len(services) == 0 { + if len(services) == 0 && all { + exit.Message(reason.SvcNotFound, `No services were found in the '{{.namespace}}' namespace. +You may select another namespace by using 'minikube service --all -n '`, out.V{"namespace": namespace}) + } else if len(services) == 0 { exit.Message(reason.SvcNotFound, `Service '{{.service}}' was not found in '{{.namespace}}' namespace. You may select another namespace by using 'minikube service {{.service}} -n '. Or list out all the services using 'minikube service list'`, out.V{"service": args[0], "namespace": namespace}) }