Commit 23905f14 authored by Jerry Zhou's avatar Jerry Zhou Committed by z00417096 zhoujaiwei

feat(helm):use a variable for labels to get tiller pod

parent e61ee5c5
......@@ -29,6 +29,10 @@ import (
"k8s.io/helm/pkg/kube"
)
var (
tillerPodLabels labels.Set = labels.Set{"app": "helm", "name": "tiller"}
)
// New creates a new and initialized tunnel.
func New(namespace string, client kubernetes.Interface, config *rest.Config) (*kube.Tunnel, error) {
podName, err := getTillerPodName(client.CoreV1(), namespace)
......@@ -41,8 +45,7 @@ func New(namespace string, client kubernetes.Interface, config *rest.Config) (*k
}
func getTillerPodName(client corev1.PodsGetter, namespace string) (string, error) {
// TODO use a const for labels
selector := labels.Set{"app": "helm", "name": "tiller"}.AsSelector()
selector := tillerPodLabels.AsSelector()
pod, err := getFirstRunningPod(client, namespace, selector)
if err != nil {
return "", err
......
......@@ -29,7 +29,7 @@ func mockTillerPod() v1.Pod {
ObjectMeta: metav1.ObjectMeta{
Name: "orca",
Namespace: v1.NamespaceDefault,
Labels: map[string]string{"app": "helm", "name": "tiller"},
Labels: tillerPodLabels,
},
Status: v1.PodStatus{
Phase: v1.PodRunning,
......
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