Skip to content

Commit

Permalink
feat(helm): add service account flag to helm init
Browse files Browse the repository at this point in the history
helps with half of helm#2224
  • Loading branch information
Michelle Noorali committed Apr 28, 2017
1 parent 1230074 commit 01e66ce
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
25 changes: 14 additions & 11 deletions cmd/helm/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,18 @@ var (
)

type initCmd struct {
image string
clientOnly bool
canary bool
upgrade bool
namespace string
dryRun bool
skipRefresh bool
out io.Writer
home helmpath.Home
opts installer.Options
kubeClient internalclientset.Interface
image string
clientOnly bool
canary bool
upgrade bool
namespace string
dryRun bool
skipRefresh bool
out io.Writer
home helmpath.Home
opts installer.Options
kubeClient internalclientset.Interface
serviceAccount string
}

func newInitCmd(out io.Writer) *cobra.Command {
Expand Down Expand Up @@ -116,6 +117,7 @@ func newInitCmd(out io.Writer) *cobra.Command {
f.StringVar(&localRepositoryURL, "local-repo-url", localRepositoryURL, "URL for local repository")

f.BoolVar(&i.opts.EnableHostNetwork, "net-host", false, "install tiller with net=host")
f.StringVar(&i.serviceAccount, "service-account", "", "name of service account")

return cmd
}
Expand Down Expand Up @@ -154,6 +156,7 @@ func (i *initCmd) run() error {
i.opts.Namespace = i.namespace
i.opts.UseCanary = i.canary
i.opts.ImageSpec = i.image
i.opts.ServiceAccount = i.serviceAccount

if settings.Debug {
writeYAMLManifest := func(apiVersion, kind, body string, first, last bool) error {
Expand Down
1 change: 1 addition & 0 deletions cmd/helm/installer/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func generateDeployment(opts *Options) *extensions.Deployment {
Labels: labels,
},
Spec: api.PodSpec{
ServiceAccountName: opts.ServiceAccount,
Containers: []api.Container{
{
Name: "tiller",
Expand Down
4 changes: 4 additions & 0 deletions cmd/helm/installer/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ type Options struct {
// Namespace is the kubernetes namespace to use to deploy tiller.
Namespace string

// ServiceAccount
// TODO: make description better
ServiceAccount string

// ImageSpec indentifies the image tiller will use when deployed.
//
// Valid if and only if UseCanary is false.
Expand Down

0 comments on commit 01e66ce

Please sign in to comment.