Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm configure #7

Merged
merged 15 commits into from
Jan 31, 2019
Merged

helm configure #7

merged 15 commits into from
Jan 31, 2019

Conversation

yorinasub17
Copy link
Contributor

@yorinasub17 yorinasub17 commented Jan 17, 2019

Depends on #8 MERGED

This implements the helm grant and helm configure subcommands which can be used to grant and configure a local helm client to access the specified helm server install in the target Kubernetes namespace.

@yorinasub17
Copy link
Contributor Author

yorinasub17 commented Jan 17, 2019

This is ready for RDD review.

- `HELM_HOME`: The helm client home directory where the TLS certs are located.
- `TILLER_NAMESPACE`: The namespace where the helm server is installed.
- `HELM_TLS_VERIFY`: This will be set to true to enable TLS verification.
- `HELM_TLS_ENABLE`: This will be set to true to enable TLS authentication.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is annoying, but helm doesn't have a concept of a config file. The default way for the user is:

helm --tiller-namespace NAMESPACE --tls --tls-verify

everytime they want to use helm. If they want multiple helm configs, this is even worse:

helm --home HELM_HOME_DIR --tiller-namespace NAMESPACE --tls --tls-verify
# or if they want to share home dir but use different certs
helm --tiller-namespace NAMESPACE --tls --tls-verify --tls-ca-cert ca.cert.pem --tls-cert helm.cert.pem --tls-key helm.key.pem

So the proposal here is to instead provide an environment file they can source that sets these as environment variables. Then this becomes:

source ~/.helm/env
helm

@yorinasub17 yorinasub17 mentioned this pull request Jan 17, 2019
@yorinasub17
Copy link
Contributor Author

yorinasub17 commented Jan 18, 2019

From 1:1 with Jim. Aim for ideal experience:

  • configure => Output config file
  • kubergrunt helm => Sets the environment variables to call to helm
  • Make sure to document what it is doing
  • Look into adding config file to helm directly
    • helm plugin
    • slack to ask thoughts
    • open github issue

Additional notes:

  • not everyone has bash chops so env / aliasing may not be great as a default option
  • Does env sourcing work with windows?

@yorinasub17
Copy link
Contributor Author

Re: config file - I found a github issue in helm on this topic (the OP is completely unrelated, but the discussion evolved to be about config files) and it looks like this will be a helmv3 feature. In that case, I might just stick with the env var style approach, and update this when helmv3 lands.

PS: I found a way to do this in Powershell and Windows Cmd: https://stackoverflow.com/questions/20077820/how-can-i-source-variables-from-a-bat-file-into-a-powershell-script/20078095#20078095. We could detect the OS as part of the command and create the relevant files.

@yorinasub17
Copy link
Contributor Author

This will be ready to review once #8 merges

@yorinasub17 yorinasub17 changed the title [WIP] helm configure [BLOCKED] helm configure Jan 28, 2019
@yorinasub17 yorinasub17 changed the title [BLOCKED] helm configure helm configure Jan 29, 2019
Copy link

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a couple nitpicks/comments right now, +-1700 is a large change and I didn't look in enough depth for an approval

cmd/helm.go Outdated
@@ -15,15 +15,21 @@ import (
)

var (
// Shared configurations
tillerNamespaceFlag = cli.StringFlag{
Name: "namespace",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I wonder if tiller-namespace and namespace would be better naming here? I expect to use this namespace for a single item, the tiller server, while many resources will reside in the resource namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

cmd/helm.go Outdated
Usage: "The name of the RBAC user that should be granted access to Tiller. Pass in multiple times for multiple users.",
}
grantedServiceAccountsFlag = cli.StringSliceFlag{
Name: "service-account",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not rbac-service-account for consistency? It's a little awkward to type, but namespacing all 3 under rbac makes the grouping more clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, ServiceAccounts are technically not a part of the RBAC system. They are grouped under core API.

But I think that is a minor detail and I agree with you about the namespace grouping so will do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted to --rbac-service-account

cmd/helm.go Outdated
rbacUsers := cliContext.StringSlice(grantedRbacUsersFlag.Name)
serviceAccounts := cliContext.StringSlice(grantedServiceAccountsFlag.Name)
if len(rbacGroups) == 0 && len(rbacUsers) == 0 && len(serviceAccounts) == 0 {
return entrypoint.NewRequiredArgsError("At least one --rbac-group or --service-account is required")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But not --rbac-user?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks forgot that when I added in rbac user support

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

helm/deploy.go Outdated
@@ -104,7 +106,7 @@ func Deploy(
logger.Errorf("Error deploying Helm server: %s", err)
return err
}
logger.Infof("Successfully deployed helm server in namespace %s with service account %s", namespace, serviceAccount)
logger.Infof("Successfully deployed helm server in namespace %s with service account %s", tillerNamespace, serviceAccount)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/helm server/Tiller here and a couple lines below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

helm/grant.go Outdated
return nil
}

// grantAccessToRBACGroups will grant access to the deployed Tiller server to the provided RBAC groups.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: outdated function name in comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@yorinasub17
Copy link
Contributor Author

Ok the latest version has been verified to work with gruntwork-io/terraform-kubernetes-helm#9, so I am going to merge this and release.

For reference here is the passing circleci build: https://circleci.com/workflow-run/11f575c4-7d30-4423-a61f-cc0b55bdfc9e?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-checks-link

@yorinasub17 yorinasub17 merged commit fc902f1 into yori-helm-tools Jan 31, 2019
@yorinasub17 yorinasub17 deleted the yori-helm-setup branch January 31, 2019 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants