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

Using and testing non-default AWS credentials #367

Merged
merged 10 commits into from
Apr 17, 2020
Merged

Conversation

metral
Copy link
Contributor

@metral metral commented Apr 9, 2020

Proposed changes

The following changes are related to using and testing alternative AWS credentials, instead of the default credential chain, to create EKS clusters.

CI:

  • Fixes CI smoke test bug

  • Updates CI AWS auth to use aws configure to allow the use of alternative named profiles.

    Note: TravisCI environment variables were also updated to work with aws configure.

Cluster:

  • Pass an AWS provider to all AWS resources if one is set in the cluster resource options.

    Note: Tested in CloudTrail for alternative profile use to get/create all AWS resources.

kubeconfig + non-default AWS creds:

  • Adds a new cluster option: providerCredentialOpts to configure the cluster's kubeconfig auth when using a non-default AWS creds chain (e.g. such as using named profiles or AWS provider instance).
  • Adds a new example/test for that uses a named profile and an AWS provider instance.

Related issues (optional)

Fixes #368
Fixes #369
Closes #370
Fixes #296

@metral metral force-pushed the metral/aws-providers branch 10 times, most recently from ce22694 to ebc6a40 Compare April 10, 2020 21:35
@metral metral changed the title fix(cluster): use scoped kubeconfig with non-default AWS credentials Fix CI setup, missing AWS providers, and scoping a kubeconfig for non-default AWS credentials Apr 10, 2020
@metral metral marked this pull request as ready for review April 10, 2020 23:28
@metral metral force-pushed the metral/aws-providers branch 3 times, most recently from 4594e65 to 561b115 Compare April 11, 2020 15:19
@metral metral changed the title Fix CI setup, missing AWS providers, and scoping a kubeconfig for non-default AWS credentials Using and testing alternative AWS credentials Apr 11, 2020
@metral metral changed the title Using and testing alternative AWS credentials Using and testing non-default AWS credentials Apr 11, 2020
nodejs/eks/cluster.ts Outdated Show resolved Hide resolved
nodejs/eks/cluster.ts Outdated Show resolved Hide resolved
nodejs/eks/cluster.ts Outdated Show resolved Hide resolved
nodejs/eks/cluster.ts Outdated Show resolved Hide resolved
nodejs/eks/cluster.ts Outdated Show resolved Hide resolved
nodejs/eks/securitygroup.ts Outdated Show resolved Hide resolved
nodejs/eks/securitygroup.ts Outdated Show resolved Hide resolved
nodejs/eks/securitygroup.ts Outdated Show resolved Hide resolved
nodejs/eks/securitygroup.ts Outdated Show resolved Hide resolved
nodejs/eks/securitygroup.ts Outdated Show resolved Hide resolved
nodejs/eks/cluster.ts Outdated Show resolved Hide resolved
nodejs/eks/examples/examples_test.go Outdated Show resolved Hide resolved
@metral metral force-pushed the metral/aws-providers branch 3 times, most recently from c9db5f3 to 0d00315 Compare April 14, 2020 05:47
This needs to be updated since the replacement of
`aws-iam-authenticator` for `aws eks get-token` in the kubeconfig
exec-based auth changed the number of args.
This change moves away from setting and using the AWS environment variables in
Travis: `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`, to using `aws
configure` in the Travis install phase to setup all AWS creds.

The existence of the standard AWS environment variables always takes precedence
over alternative AWS auth methods, which does not allow the use of
AWS named profiles if necessary.
@metral metral force-pushed the metral/aws-providers branch 2 times, most recently from 3a5849e to 2b23606 Compare April 17, 2020 17:22
metral and others added 5 commits April 17, 2020 10:31
Co-Authored-By: Levi Blackstone <levi@pulumi.com>
Add `providerCredentialOpts` to scope the cluster's kubeconfig to the AWS
credentials used in certain auth scenarios.

For example:
  - Creating and using a new AWS provider instance, or
  - Setting the AWS_PROFILE environment variable, or
  - Using a named profile configured on the AWS provider via:
  `pulumi config set aws:profile <profileName>`

This fixes the use of profiles to properly create the k8s VPC CNI and
aws-auth ConfigMap.

See for more details:
  - https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/aws/#Provider
  - https://www.pulumi.com/docs/intro/cloud-providers/aws/setup/
  - https://www.pulumi.com/docs/intro/cloud-providers/aws/#configuration
  - https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html
@metral
Copy link
Contributor Author

metral commented Apr 17, 2020

Feedback has been addressed. PTAL @lblackstone

@metral metral requested review from lukehoban and removed request for lukehoban April 17, 2020 17:33
nodejs/eks/cluster.ts Show resolved Hide resolved
nodejs/eks/examples/aws-profile/package.json Outdated Show resolved Hide resolved
@metral metral merged commit c513cf8 into master Apr 17, 2020
@pulumi-bot pulumi-bot deleted the metral/aws-providers branch April 17, 2020 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants