Commit 977ceb9b authored by Taylor Thomas's avatar Taylor Thomas Committed by GitHub

Merge pull request #1882 from bacongobbler/1712-portforwarder

move newTillerPortForwarder to pkg/helm/portforwarder
parents 67eb017b 704bc472
......@@ -33,6 +33,7 @@ import (
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/helm/cmd/helm/helmpath"
"k8s.io/helm/pkg/helm/portforwarder"
"k8s.io/helm/pkg/kube"
"k8s.io/helm/pkg/tiller/environment"
)
......@@ -49,6 +50,8 @@ var (
tillerHost string
tillerNamespace string
kubeContext string
// TODO refactor out this global var
tillerTunnel *kube.Tunnel
)
// flagDebug is a signal that the user wants additional output.
......@@ -156,7 +159,12 @@ func markDeprecated(cmd *cobra.Command, notice string) *cobra.Command {
func setupConnection(c *cobra.Command, args []string) error {
if tillerHost == "" {
tunnel, err := newTillerPortForwarder(tillerNamespace, kubeContext)
config, client, err := getKubeClient(kubeContext)
if err != nil {
return err
}
tunnel, err := portforwarder.New(tillerNamespace, client, config)
if err != nil {
return err
}
......
......@@ -14,27 +14,21 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package main
package portforwarder
import (
"fmt"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/helm/pkg/kube"
)
// TODO refactor out this global var
var tillerTunnel *kube.Tunnel
func newTillerPortForwarder(namespace, context string) (*kube.Tunnel, error) {
config, client, err := getKubeClient(context)
if err != nil {
return nil, err
}
func New(namespace string, client *internalclientset.Clientset, config *restclient.Config) (*kube.Tunnel, error) {
podName, err := getTillerPodName(client.Core(), namespace)
if err != nil {
return nil, err
......
......@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package main
package portforwarder
import (
"testing"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment