Merge pull request #2768 from JarreyZhou/master

feat(helm):use a variable for labels to get tiller pod
pull/2785/head
Taylor Thomas 7 years ago committed by GitHub
commit 6ab706ae6c

@ -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,

Loading…
Cancel
Save