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

Show pods number when describing services #8778

Merged
merged 1 commit into from May 28, 2015
Merged

Show pods number when describing services #8778

merged 1 commit into from May 28, 2015

Conversation

0xmichalis
Copy link
Contributor

No description provided.

@k8s-bot
Copy link

k8s-bot commented May 25, 2015

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain @ixdy.

@thockin
Copy link
Member

thockin commented May 25, 2015

LGTM, but I am not core UX team.


return describeService(service, endpoints, events)
return describeService(service, endpoints, events, pods.Items)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're already fetching endpoints. Why not just count that instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Endpoints has the additional advantages that dead and not-ready pods are filtered out, and that it would work for manually populated Endpoints (for services w/o selectors).

@bgrant0607 bgrant0607 self-assigned this May 26, 2015
@kelseyhightower
Copy link
Contributor

@Kargakis Maybe some example output will make this slightly easier to review? I'm thinking the output of kubectl get services in a code block would be nice and helpful to the reviewer.

@@ -477,8 +477,9 @@ func (d *ServiceDescriber) Describe(namespace, name string) (string, error) {

endpoints, _ := d.Endpoints(namespace).Get(name)
events, _ := d.Events(namespace).Search(service)
pods, _ := d.Pods(namespace).List(labels.Set(service.Spec.Selector).AsSelector(), fields.Everything())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't going to get the set you want, I don't think. It will include terminated and not-ready pods.

@0xmichalis
Copy link
Contributor Author

@bgrant0607 I've updated the PR as per your comments, PTAL.

@kelseyhightower is there any example that spawns a service with multiple pods that I can test this against? A simple describe follows but I am not really happy with it.

Name:           ruby-hello-world
Labels:         <none>
Selector:       deploymentconfig=ruby-hello-world
IP:             172.30.168.67
Port:           ruby-hello-world-tcp-8080   8080/TCP
Endpoints:      ruby-hello-world-tcp-8080   <none>
Pods:           0
Session Affinity:   None
No events.

}
fmt.Fprintf(out, "Pods:\t%d\n", pods)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is unnecessary.

@0xmichalis
Copy link
Contributor Author

@bgrant0607 I've made the changes you suggested but I am not sure we should let the user guess that the number of their pods is the number of their endpoints...

@bgrant0607
Copy link
Member

Thanks. LGTM.

This is a service. It doesn't necessarily target any pods, though it typically does.

@bgrant0607 bgrant0607 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 28, 2015
thockin added a commit that referenced this pull request May 28, 2015
Show pods number when describing services
@thockin thockin merged commit 32859c3 into kubernetes:master May 28, 2015
@0xmichalis 0xmichalis deleted the show-pod-number branch May 28, 2015 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants