/kind feature
wire up periodic full e2e tests
/assign @liztio
/priority critical-urgent
This should be the conformance suite on a full cluster deployment.
We spent a lot of time discussing what exactly the E2E tests should entail.
The current "e2e" tests just build Docker images and test that they can boot.
This is a decent smoke test, but to validate our assumptions more detailed tests.
The proposed minimum viable test stack is as follows:
I've wrapped up a pull request that implements the above steps.
It makes several assumptions about the environment it's running in.
First, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
The checkin_account.py scripts will set these.
It's intended to be used as eval $(./hack/checkin_account.py)
Those scripts expect a BOSKOS_HOST environment variable, in the form of localhost:8080.
checkout_account.py also needs the name of the account from boskos.
The eval() command will set this.
The existing integration tests are run as E2E in scripts/ci-bazel-e2e.sh. If we choose to make
the new tests E2E, we will only need to modify that script.
If we wish to instead use periodic E2E (as this issue requests), we will need to [create a new prow job][job].
All we currently exercise is that AWS, and therefore Cluster API, thinks our booted control plane node is healthy. Some future ideas include:
To fully test the AWS cluster provider, we need access to AWS accounts.
This presents a problem for CI, as these accounts can't be simply committed to the repository.
A more complex management solution was needed.
After considering many alternatives, we decided that a central place to "check in" and "check out" AWS accounts was the best solution.
[Boskos][bosksos] is a service for managing shared resources between tests.
It is owned by sig-testing and therefore already deployed and maintained.
Boskos works on CRDs that move through arbitrary "states."
In our case, two applications will be checking in and out the AWS accounts: the tests themselves and the janitor.
Janitors are responible for taking resources and making them ready for use again.
In our case, that means emptying the AWS account to the extent possible so tests do not intefere with each other over multiple runs.
Unfortunately, the only way to clean an AWS account is to simply enumerate all resources and delete them.
Some resources depend on others, so deletion order is very important.
We make use of the existing aws-janitor codebase to delete in dependency order.
The new aws-boskos-janitor has been tested and merged.
This comment sums up the work that still remains to be done.
In summary, the Janitor itself still needs be deployed in the Boskos Cluster.
Boskos also needs to populated with new resources for the aws accounts.
This is unfortunately blocked on upstream CNCF issues with our AWS accounts.
Once this is resolved, the new accounts should be addeded to resource.yaml.
After the resources have been added, AWS credentials will need to be added to account resource.
An IAM account with Administrator Privileges should be sufficient.
The creds can either be added to boskos using either the update API or kubectl edit directly on the Boskos CRDs.
The AWS Janitor codebase is not comprehensive.
It doesn't presently contain Cloudformation and SSH Keypair objects for example, both of which are created by the Cluster API bootstrap. Added in https://github.com/kubernetes/test-infra/pull/11323
If AWS account isn't completely cleaned, repeated test runs could bump up against account limits that will be difficult to debug.
AWS Janitor may need retries as well.
I suspect in practice the dependency order is brittle and subject to race conditions.
For example, if NAT Gateways haven't completed deletion (which can take several minutes) by the time VPC deletion is called, deletion of the VPC will fail.
/assign
Can sort out some of the janitor tasks
Hi @liztio,
Thank you for this. I look forward to our chat tomorrow. I also sent you some questions at https://github.com/kubernetes/test-infra/issues/10693#issuecomment-463840731.
I鈥檓 sorry you are being asked to hand this off to at least one newbie. When it comes to Boskos and this test workflow, I鈥檓 still trying to wrap my head around the larger picture, and the brain dump assumes pre-existing experience with some concepts and tooling. There is a brief, high-level overview of Boskos -- but I鈥檓 afraid at least I will have to spend a lot more time understanding Boskos as a service, how it鈥檚 deployed, where it鈥檚 deployed, and how it works before I鈥檓 able to provide any value to the e2e discussion or process.
Is there possibly a good link or starting point for Boskos in action?
Boskos for dummies?
I think after the brain dump above it鈥檚 more clear to me that Boskos is simply a way to manage access to shared AWS accounts, whereas I thought it was for tracking all the resources created as part of a CAPA CI run (VPCs, instances, subnets, volumes, etc). This does not appear to be the case. It seems Boskos is test-infra鈥檚 version of Hashicorp Vault and its dynamic secrets engine with support for AWS? At the risk of being hit in the head with a digital can of soup, was Vault considered as part of the exploratory process?
Thank you!
--
-a
@akutz
I replied to your comment on test-infra. Hopefully that helps at least a little? Boskos isn't something we run or manage, it's something we can assume is available. I don't really have any information that isn't what I've linked to, unfortunately, but I think you will find the sig-testing folks very friendly and helpful.
We didn't consider Vault mostly because a service in the hand is worth two in the bush :)
Hi @liztio,
Your answers were spectacularly succinct solutions to my inquiries, thank you!
Hi all,
I have tried to condense some of the call (recording) we had last week regarding the next steps for periodic e2e testing as well as restate some of what Liz said above as a way to teach myself about the subject matter. Please let me know if the following is as clear as mud :)
The following steps illustrate a basic e2e test workflow:
A golang-based test, aws_test.go, already exists that implements most of the above workflow. The existing test does not implement all of step five, instead the verification process is currently limited to querying AWS to see if the deployed instance is in the _Ready_ state.
This section assumes periodic tests, but the same principals apply to PR-blocking tests as well. Either type of test is configured as a Prow job. The following steps illustrate a periodic e2e test workflow:
clean AWS creds from Boskos, a service running on the same cluster as Prowdirty back to BoskosCAPA should work in a basically pristine environment, since that is what customers will have when they use CAPA for the first time. Because the AWS accounts used for periodic e2e tests are reused, any resources created by a test must be cleaned up before any other test can use the same shared account.
The final step of a test job is to return the AWS credentials to Boskos in the dirty state. Because of the requirement that an account should be in a pristine state prior to a test run, the accounts in a dirty state must be cleaned. That is achieved by configuring another service in the same cluster where Prow and Boskos are running. The new service is a Boskos janitor -- a process that queries Boskos for resources of a certain type and state and takes actions on said resources.
Thanks to Liz there is now an AWS janitor for Boskos that may be used to clean the shared AWS accounts and return them to the clean state.
(cc @liztio @randomvariable @vincepri @rdodev)
Seems about right. I have touched the Prow jobs test-infra a small amount, but Slack will have more expertise anyway.
Also can probably rattle off some of the AWS API specific janitors and sort out dependency management where we have gaps.
One more task:
To get a e2e MVP in, the controller is started with the root credentials coming from boskos. Actually want to test it with the IAM policies in our CloudFormation template, which will mean creating an AWS IAM keypair for the bootstrap user and feeding that into the e2e test.
and
pull-cluster-api-provider-aws-bazel-e2e to pull-cluster-api-provider-aws-bazel-integration and make the latter blocking.Optionally:
@randomvariable Do we actually want to make the e2e jobs blocking? It seems like it would be more prudent to have them live as periodics to avoid having long running blocking jobs.
I'm agnostic. The current e2e is actually an integration test bazel run //test/integration that makes sure the controller runs and that's it. It could complete in two minutes if we turn on bazel caching, but also not sure how useful it is in and of itself?
bazel run //test/e2e actually spins up a cluster.
In that case :+1: to running the integration test as PR blocking
Hi @randomvariable,
While I agree that the integration test doesn't validate the e2e workflow, doesn't it at least validate the CRDs and any activity involved in deploying the CAPI/CAPA controllers themselves? That alone seems like it would be nice to block if some error is introduced.
Hi All,
Here's a summary of the completed and outstanding work towards periodic e2e testing for CAPA. This is not an exhaustive list -- only the work for which I'm responsible in case there are any issues that necessitate a revert of a merged PR. Hopefully that won't happen, but in case it does, the following PRs are a good place to start looking:
Test-infra PRs
CAPA PRs
I will be OOTO Wed-Fri of this week, so I wanted to at least enqueue the PRs needed to close Phase 1 of CAPA e2e testing.
cc @detiber @clintkitson @timh
Hi All,
I'm going offline a bit to get ready for my trip. Two things:
cc @detiber
@ncdc - Can we help offload Andrew here in the next couple of days?
Hi @timothysc,
I engaged with Andy on Slack, and he pointed me in the direction of resources. Thank you!
/close
this is done
Most helpful comment
Hi all,
I have tried to condense some of the call (recording) we had last week regarding the next steps for periodic e2e testing as well as restate some of what Liz said above as a way to teach myself about the subject matter. Please let me know if the following is as clear as mud :)
Local e2e test workflow
The following steps illustrate a basic e2e test workflow:
A golang-based test,
aws_test.go, already exists that implements most of the above workflow. The existing test does not implement all of step five, instead the verification process is currently limited to querying AWS to see if the deployed instance is in the _Ready_ state.Periodic e2e test workflow
This section assumes periodic tests, but the same principals apply to PR-blocking tests as well. Either type of test is configured as a Prow job. The following steps illustrate a periodic e2e test workflow:
cleanAWS creds from Boskos, a service running on the same cluster as Prowdirtyback to BoskosAWS account cleanup
CAPA should work in a basically pristine environment, since that is what customers will have when they use CAPA for the first time. Because the AWS accounts used for periodic e2e tests are reused, any resources created by a test must be cleaned up before any other test can use the same shared account.
The final step of a test job is to return the AWS credentials to Boskos in the
dirtystate. Because of the requirement that an account should be in a pristine state prior to a test run, the accounts in adirtystate must be cleaned. That is achieved by configuring another service in the same cluster where Prow and Boskos are running. The new service is a Boskos janitor -- a process that queries Boskos for resources of a certain type and state and takes actions on said resources.Thanks to Liz there is now an AWS janitor for Boskos that may be used to clean the shared AWS accounts and return them to the
cleanstate.Next steps
(cc @liztio @randomvariable @vincepri @rdodev)