Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIXED: issue#99, add a check for service scale down to 0 situation panic. #100

Merged
merged 1 commit into from
Dec 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmd/kubefwd/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,14 @@ func (opts *FwdServiceOpts) ForwardService(svcName string, svcNamespace string)
return
}

// for issue #99
// add this check for the service scale down to 0 situation.
// TODO: a better way to do this check.
if len(pods.Items) < 1 {
log.Warnf("WARNING: No Running Pods returned for service %s in %s on cluster %s.\n", svc.Name, svc.Namespace, svc.ClusterName)
return
}

// normal service portforward the first pod as service name.
// headless service not only forward first Pod as service name, but also portforward all pods.
if svc.Spec.ClusterIP == "None" {
Expand Down