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

rsh support for multiple resources #8279

Merged
merged 3 commits into from May 10, 2016
Merged

rsh support for multiple resources #8279

merged 3 commits into from May 10, 2016

Conversation

0xmichalis
Copy link
Contributor

}

switch resourceType {
case "pods":
Copy link
Contributor

Choose a reason for hiding this comment

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

add a no-op comment here so it doesn't look like a fallthrough was intended

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Copy link
Contributor

Choose a reason for hiding this comment

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

actually, return name, nil to keep the intent close to the check, and remove the return at the end of the func

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@0xmichalis
Copy link
Contributor Author

[test]

}
pod := &pods.Items[0]
return pod, len(pods.Items), nil
return &pods.Items[0], len(pods.Items), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

if there are multiple pods, shouldn't this prefer running ones to non-running, ready to non-ready, etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was filtering active pods and then sorting to the oldest but then remembered that @deads2k was against it when he was adding this upstream.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was filtering active pods and then sorting to the oldest but then remembered that @deads2k was against it when he was adding this upstream.

I want different sorts for different uses:

  1. rsh: pod better be running, but it probably doesn't matter which one.
  2. logs: show me the crashlooping one, because all happy families are the same.
  3. attach: I probably want the most recent pod.

I haven't looked at this pull, but does it allow different comparators?

@0xmichalis
Copy link
Contributor Author

This is ready for another pass. I still need to add unit tests for GetFirstPod

cc also @soltysh

@0xmichalis 0xmichalis changed the title rsh support for rcs and dcs rsh support for multiple resources Mar 31, 2016
@@ -389,7 +392,8 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
return nil, errors.New("provided options object is not a PodLogOptions")
}
selector := labels.SelectorFromSet(t.Spec.Selector)
pod, numPods, err := GetFirstPod(c, t.Namespace, selector)
f := func(pods []*api.Pod) sort.Interface { return controller.ActivePods(pods) }
Copy link
Contributor

Choose a reason for hiding this comment

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

can't you just pass in controller.ActivePods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, I cannot use the interface argument as an expression.

@smarterclayton
Copy link
Contributor

Rebase

@openshift-bot openshift-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 27, 2016
@smarterclayton
Copy link
Contributor

Can you add a test for pod/ as well.

@0xmichalis
Copy link
Contributor Author

Can you add a test for pod/ as well.

done

Add support for replication controllers, deployment configs, jobs,
and daemon sets.
@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 2a1d195

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3505/)

@0xmichalis
Copy link
Contributor Author

Any other comments?

@smarterclayton
Copy link
Contributor

LGTM [merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented May 10, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5859/) (Image: devenv-rhel7_4149)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 2a1d195

@openshift-bot openshift-bot merged commit a6b6ba9 into openshift:master May 10, 2016
@0xmichalis 0xmichalis deleted the rsh-support-for-dcs branch May 10, 2016 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants