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

Identity provider aws iam auth e2e tests #556

Merged
merged 7 commits into from
Nov 11, 2021

Conversation

pokearu
Copy link
Member

@pokearu pokearu commented Nov 2, 2021

Issue #90

Description of changes:
The changes include e2e tests for aws-iam-authenticator as an identity provider.

  • Create cluster with aws-iam-authenticator enabled
  • Test authentication using aws-iam-authenticator client to the cluster
  • Delete cluster

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@abhay-krishna abhay-krishna added approved size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 2, 2021
@pokearu pokearu force-pushed the identity-provider-aws-iam-auth-e2e branch from c3bfa4e to 2941720 Compare November 2, 2021 22:57
pkg/cluster/spec.go Outdated Show resolved Hide resolved
cmd/integration_test/cmd/run.go Outdated Show resolved Hide resolved
internal/pkg/api/awsiam.go Outdated Show resolved Hide resolved
test/framework/awsiam.go Outdated Show resolved Hide resolved
test/framework/awsiam.go Show resolved Hide resolved

// GetAllPods uses the kubectl installed on the host machine
// Modifies the command context to add ./bin to path
func GetAllPods(ctx context.Context, opts ...string) ([]corev1.Pod, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Don't need to change it, but couldn't we do this using the kubectl in executables?
we would just need to implement a new Executable that runs the magic to add ./bin to the path
It seems more flexible and we don't duplicate code (plus the get pods method in executables already has unit tests

Copy link
Member Author

Choose a reason for hiding this comment

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

So the main reason i rewrote this was because the kubectl in executables uses the cli tools docker image.
When i am running kubectl here I pass in the kubeconfig for aws-iam-auth which has an exec to use the aws-iam-authenticator client binary which is downloaded in to ./bin
When running kubectl through docker run the container does not have the aws-iam-auth client in it.
I am open to changing this, but I couldnt get an easy solution for using the downloaded local binary with docker run?

Copy link
Member

Choose a reason for hiding this comment

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

The kubectl in executables doesn't always use the cli-tools image, it depends on the dependency we inject
For example, in the cli, it's possible to disable the cli-tools image and use directly the binaries from the host, it's just another type implementing the Executable interface
I'm proposing doing something similar, implementing that interface in a way that allows you to add the iam-authenticator to the path

test/framework/awsiam.go Outdated Show resolved Hide resolved
@pokearu pokearu force-pushed the identity-provider-aws-iam-auth-e2e branch 4 times, most recently from 07a15ae to 1830ada Compare November 10, 2021 23:48
Copy link
Member

@g-gaston g-gaston left a comment

Choose a reason for hiding this comment

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

💯 🚀

if err != nil {
return fmt.Errorf("error finding current working directory: %v", err)
}
err = os.Setenv("PATH", fmt.Sprintf("%s/bin:%s", workDir, envPath))
Copy link
Member

Choose a reason for hiding this comment

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

nit: no big deal but you could check first if this has already been added to the path before adding it
To prevent adding it twice

@abhay-krishna
Copy link
Member

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: g-gaston, pokearu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pokearu pokearu force-pushed the identity-provider-aws-iam-auth-e2e branch from 1830ada to 981d3d9 Compare November 11, 2021 22:58
@g-gaston
Copy link
Member

/lgtm

@abhay-krishna abhay-krishna merged commit 73bb84e into aws:main Nov 11, 2021
eks-distro-bot pushed a commit that referenced this pull request Nov 12, 2021
* Adding framework support for aws-iam-authenticator tests

* Refactored gzip file download

* Adding e2e tests for aws-iam-authenticator

* Enabling feature gates activation from e2e run command

* Refactoring changes based on framework updates, reverting e2e --gates flag

* Refactor IamAuth test validations to use existing kubectl

* Checking env PATH before updating
wanyufe pushed a commit to wanyufe/eks-anywhere that referenced this pull request Mar 9, 2022
* Adding framework support for aws-iam-authenticator tests

* Refactored gzip file download

* Adding e2e tests for aws-iam-authenticator

* Enabling feature gates activation from e2e run command

* Refactoring changes based on framework updates, reverting e2e --gates flag

* Refactor IamAuth test validations to use existing kubectl

* Checking env PATH before updating
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants