Skip to content

Commit 3c4eb72

Browse files
Merge pull request #19093 from mfojtik/fix-rsh
Automatic merge from submit-queue. cli: get latest rc from a dc when selecting pod to rsh fixes: #19089 This will make sure we are using the latest RC when selecting the pod we are going to rsh into. In case the latest rollout does not have any pods created yet, this will fail, which I think is correct, because it won't connect you to the "old" pods which will likely be terminated soon. /cc @tnozicka /cc @soltysh (as you always appreciate code removal)
2 parents e03c8a6 + a2d63c6 commit 3c4eb72

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

pkg/oc/cli/util/clientcmd/factory.go

+1-10
Original file line numberDiff line numberDiff line change
@@ -342,20 +342,11 @@ func (f *Factory) PodForResource(resource string, timeout time.Duration) (string
342342
if err != nil {
343343
return "", err
344344
}
345-
kc, err := f.ClientSet()
346-
if err != nil {
347-
return "", err
348-
}
349345
dc, err := appsClient.Apps().DeploymentConfigs(namespace).Get(name, metav1.GetOptions{})
350346
if err != nil {
351347
return "", err
352348
}
353-
selector := labels.SelectorFromSet(dc.Spec.Selector)
354-
pod, _, err := kcmdutil.GetFirstPod(kc.Core(), namespace, selector.String(), timeout, sortBy)
355-
if err != nil {
356-
return "", err
357-
}
358-
return pod.Name, nil
349+
return f.PodForResource(fmt.Sprintf("rc/%s", appsutil.LatestDeploymentNameForConfig(dc)), timeout)
359350
case extensions.Resource("daemonsets"):
360351
kc, err := f.ClientSet()
361352
if err != nil {

0 commit comments

Comments
 (0)