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

move newTillerPortForwarder to pkg/helm/portforwarder

parent e440a36d
......@@ -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.
......@@ -154,7 +157,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