Commit 704bc472 authored by Matthew Fisher's avatar Matthew Fisher

move newTillerPortForwarder to pkg/helm/portforwarder

parent e440a36d
...@@ -33,6 +33,7 @@ import ( ...@@ -33,6 +33,7 @@ import (
"k8s.io/kubernetes/pkg/client/restclient" "k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/helm/cmd/helm/helmpath" "k8s.io/helm/cmd/helm/helmpath"
"k8s.io/helm/pkg/helm/portforwarder"
"k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/kube"
"k8s.io/helm/pkg/tiller/environment" "k8s.io/helm/pkg/tiller/environment"
) )
...@@ -49,6 +50,8 @@ var ( ...@@ -49,6 +50,8 @@ var (
tillerHost string tillerHost string
tillerNamespace string tillerNamespace string
kubeContext string kubeContext string
// TODO refactor out this global var
tillerTunnel *kube.Tunnel
) )
// flagDebug is a signal that the user wants additional output. // flagDebug is a signal that the user wants additional output.
...@@ -154,7 +157,12 @@ func markDeprecated(cmd *cobra.Command, notice string) *cobra.Command { ...@@ -154,7 +157,12 @@ func markDeprecated(cmd *cobra.Command, notice string) *cobra.Command {
func setupConnection(c *cobra.Command, args []string) error { func setupConnection(c *cobra.Command, args []string) error {
if tillerHost == "" { 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 { if err != nil {
return err return err
} }
......
...@@ -14,27 +14,21 @@ See the License for the specific language governing permissions and ...@@ -14,27 +14,21 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package portforwarder
import ( import (
"fmt" "fmt"
"k8s.io/kubernetes/pkg/api" "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/clientset_generated/internalclientset/typed/core/internalversion"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/labels"
"k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/kube"
) )
// TODO refactor out this global var func New(namespace string, client *internalclientset.Clientset, config *restclient.Config) (*kube.Tunnel, error) {
var tillerTunnel *kube.Tunnel
func newTillerPortForwarder(namespace, context string) (*kube.Tunnel, error) {
config, client, err := getKubeClient(context)
if err != nil {
return nil, err
}
podName, err := getTillerPodName(client.Core(), namespace) podName, err := getTillerPodName(client.Core(), namespace)
if err != nil { if err != nil {
return nil, err return nil, err
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package portforwarder
import ( import (
"testing" "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