handle appsv1.DeploymenConfigs in AttachablePodForObject helper
@@ -12,6 +12,7 @@ import (
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
"k8s.io/kubernetes/pkg/kubectl/polymorphichelpers"
+ appsv1 "github.com/openshift/api/apps/v1"
appsapi "github.com/openshift/origin/pkg/apps/apis/apps"
)
@@ -35,6 +36,23 @@ func NewAttachablePodForObjectFn(delegate polymorphichelpers.AttachableLogsForOb
pod, _, err := polymorphichelpers.GetFirstPod(coreClient.CoreV1(), t.Namespace, selector.String(), 1*time.Minute, f)
return pod, err
+ case *appsv1.DeploymentConfig:
+ config, err := restClientGetter.ToRESTConfig()
+ if err != nil {
+ return nil, err
+ }
+ coreClient, err := kubernetes.NewForConfig(config)
+ if err != nil {
+ return nil, err
+ }
+
+ selector := labels.SelectorFromSet(t.Spec.Selector)
+ f := func(pods []*v1.Pod) sort.Interface {
+ return sort.Reverse(controller.ActivePods(pods))
+ }
+ pod, _, err := polymorphichelpers.GetFirstPod(coreClient.CoreV1(), t.Namespace, selector.String(), 1*time.Minute, f)
+ return pod, err
+
default:
return delegate(restClientGetter, object, timeout)
}
