Unverified Commit 3ba2a009 authored by Taylor Thomas's avatar Taylor Thomas Committed by GitHub

Merge pull request #3784 from jkoleszar/tiller-rbac

Fix tiller deployment on RBAC clusters
parents 9654c616 1e03f1bc
...@@ -176,6 +176,7 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) { ...@@ -176,6 +176,7 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) {
return nil, err return nil, err
} }
} }
automountServiceAccountToken := opts.ServiceAccount != ""
d := &v1beta1.Deployment{ d := &v1beta1.Deployment{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Namespace: opts.Namespace, Namespace: opts.Namespace,
...@@ -189,7 +190,8 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) { ...@@ -189,7 +190,8 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) {
Labels: labels, Labels: labels,
}, },
Spec: v1.PodSpec{ Spec: v1.PodSpec{
ServiceAccountName: opts.ServiceAccount, ServiceAccountName: opts.ServiceAccount,
AutomountServiceAccountToken: &automountServiceAccountToken,
Containers: []v1.Container{ Containers: []v1.Container{
{ {
Name: "tiller", Name: "tiller",
......
...@@ -96,6 +96,9 @@ func TestDeploymentManifestForServiceAccount(t *testing.T) { ...@@ -96,6 +96,9 @@ func TestDeploymentManifestForServiceAccount(t *testing.T) {
if got := d.Spec.Template.Spec.ServiceAccountName; got != tt.serviceAccount { if got := d.Spec.Template.Spec.ServiceAccountName; got != tt.serviceAccount {
t.Errorf("%s: expected service account value %q, got %q", tt.name, tt.serviceAccount, got) t.Errorf("%s: expected service account value %q, got %q", tt.name, tt.serviceAccount, got)
} }
if got := *d.Spec.Template.Spec.AutomountServiceAccountToken; got != (tt.serviceAccount != "") {
t.Errorf("%s: unexpected automountServiceAccountToken = %t for serviceAccount %q", tt.name, got, tt.serviceAccount)
}
} }
} }
......
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