-
Notifications
You must be signed in to change notification settings - Fork 748
feat(microvm): add lifecycle hook service #5280
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
Open
edersonbrilhante
wants to merge
42
commits into
feat-microvm-runner-provider
Choose a base branch
from
feat-microvm-lifecycle-hooks
base: feat-microvm-runner-provider
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,870
−1,916
Open
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
d8bc2a7
feat(multi-runner): integrate Lambda MicroVM provider
edersonbrilhante 4110ffa
docs: auto update terraform docs
github-actions[bot] 1747ea5
fix(multi-runner): align v2 configuration tests
edersonbrilhante e41e27d
feat(microvm): add lifecycle hook service
edersonbrilhante 360cdf9
test(microvm): remove legacy DynamoDB payload case
edersonbrilhante 6f1ead8
fix(microvm): align storage environment export
edersonbrilhante 8c1c06a
docs: auto update terraform docs
github-actions[bot] 702d2e9
chore(pr): scope lifecycle hook change to service
edersonbrilhante 2bcccbf
Merge branch 'feat-microvm-runner-provider' into feat-microvm-lifecyc…
edersonbrilhante 8efc209
Merge branch 'feat-microvm-runner-provider' into feat-microvm-lifecyc…
edersonbrilhante a6aa30d
Merge branch 'feat-microvm-runner-provider' into feat-microvm-lifecyc…
edersonbrilhante 890b456
Merge branch 'feat-microvm-runner-provider' into feat-microvm-lifecyc…
edersonbrilhante 4afb4c7
chore(microvm): build and publish lifecycle hook (#5380)
edersonbrilhante c99ffef
chore(microvm): build lifecycle hook server
edersonbrilhante 08732d7
Merge branch 'feat-microvm-runner-provider' into feat-microvm-lifecyc…
edersonbrilhante 0cc81cf
test: fix microvm test with ministack
edersonbrilhante e70da22
Merge branch 'feat-microvm-runner-provider' into feat-microvm-lifecyc…
edersonbrilhante c31c050
docs: auto update terraform docs
github-actions[bot] 10f0423
Merge branch 'feat-microvm-runner-provider' into feat-microvm-lifecyc…
edersonbrilhante 73551e2
Merge branch 'feat-microvm-runner-provider' into feat-microvm-lifecyc…
edersonbrilhante 99dc6e7
test: fix microvm variables
edersonbrilhante e3e57b1
feat(ministack): add multi-provider webhook smoke test
edersonbrilhante ebfdc93
docs: auto update terraform docs
github-actions[bot] 27d8910
Merge branch 'feat-microvm-runner-provider' into feat-microvm-lifecyc…
edersonbrilhante b27dce2
docs: auto update terraform docs
github-actions[bot] ebb2fd4
Merge branch 'feat-microvm-runner-provider' into feat-microvm-lifecyc…
edersonbrilhante a924d33
fix(ministack): align webhook example provider locks
edersonbrilhante 820d1d5
docs: auto update terraform docs
github-actions[bot] 42565a2
fix: fix issue in tf 1.5.6
edersonbrilhante d3e6903
fix(storage): recognize wrapped SSM parameter errors
edersonbrilhante 2d6ee5c
ci: use latest ministack version
edersonbrilhante a42e542
ci: fix ministack job
edersonbrilhante f0299db
docs(microvm): explain image and runtime dependencies (#5457)
edersonbrilhante 3dd87d0
ci: fix dist
edersonbrilhante c9aeb9b
feat(microvm): add lifecycle hook runner startup
edersonbrilhante 29534ed
Merge remote-tracking branch 'origin/feat-microvm-runner-provider' in…
edersonbrilhante 97dd19e
Merge remote-tracking branch 'origin/feat-microvm-runner-provider' in…
edersonbrilhante 5ea10d1
Merge remote-tracking branch 'origin/feat-microvm-runner-provider' in…
edersonbrilhante 37d0b36
Merge remote-tracking branch 'origin/feat-microvm-runner-provider' in…
edersonbrilhante 1951d82
test: fix smoke test
edersonbrilhante 02d486d
Merge remote-tracking branch 'origin/feat-microvm-runner-provider' in…
edersonbrilhante 977aef6
ci: fix job
edersonbrilhante File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,3 +29,6 @@ secrets.auto.tfvars | |
|
|
||
| node_modules/ | ||
| site/ | ||
|
|
||
| __pycache__/ | ||
| ministack-smoke-checklist.txt | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| --8<-- "examples/multi-runner-webhook/README.md" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| # Lambda MicroVM Runners (Experimental) | ||
|
|
||
| !!! warning | ||
| Lambda MicroVM runner support is experimental. The image build, lifecycle-hook server, control-plane integration, and AWS MicroVM APIs must be configured together. Validate the complete flow in a non-production environment before relying on it for workloads. | ||
|
|
||
| ## Overview | ||
|
|
||
| Lambda MicroVM runners provide ephemeral GitHub Actions runners backed by | ||
| Lambda MicroVMs. The runner control plane receives demand, obtains the | ||
| one-time runner configuration, starts a MicroVM from a published image, and | ||
| passes the runtime execution role to the MicroVM. | ||
|
|
||
| The repository includes a combined [multi-runner webhook example](examples/multi-runner-webhook.md) | ||
| that places EC2 and Lambda MicroVM lanes behind one webhook endpoint. The | ||
| provider-specific lifecycle checks are shared where possible, so the same | ||
| deployment can validate both providers. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Before deploying the MicroVM runner lane, prepare all of the following in the | ||
| target AWS Region: | ||
|
|
||
| 1. **MicroVM foundation.** Apply the | ||
| [MicroVM foundation example](examples/microvm-foundation.md). It creates the | ||
| regional artifact bucket, Lambda Network Connectors, the image-build role, | ||
| and the reusable MicroVM usage policy. | ||
| 2. **Lifecycle-hook artifact.** Build and release | ||
| `lambdas/services/microvm-lifecycle-hooks` through the same workspace | ||
| artifact process used for the repository's Lambda services. The resulting | ||
| ZIP is embedded in the MicroVM image. | ||
| 3. **Published MicroVM image.** Use the | ||
| [MicroVM Ubuntu image instructions](https://github.com/github-aws-runners/terraform-aws-github-runner/blob/main/images/microvm-ubuntu/README.md) | ||
| to build and publish an image with Packer. The image must contain the | ||
| compatible lifecycle-hook server and runner entrypoint. | ||
| 4. **Runner execution role.** Configure the runner role through the runner | ||
| configuration. This is different from the foundation's build role. The | ||
| control-plane TypeScript passes the execution role to `RunMicrovm`, so the | ||
| Lambda that starts the MicroVM must have permission to pass it. | ||
| 5. **Runner control plane and artifacts.** Deploy the runner control plane with | ||
| the published image ARN/version, Network Connector ARNs, GitHub App | ||
| configuration, and the runner-control and webhook Lambda ZIPs. | ||
|
|
||
| The foundation does not create the image or the runner execution role. The | ||
| image build does not choose the runtime role. These are separate dependencies | ||
| owned by the image build and runner-control-plane stages respectively. | ||
|
|
||
| ## IAM roles | ||
|
|
||
| MicroVM deployments use two roles for two different operations: | ||
|
|
||
| | Role | Used by | Responsibility | | ||
| | --- | --- | --- | | ||
| | Build role (`build_role_arn`) | Packer/image publisher | Creates and publishes the MicroVM image and accesses the foundation build artifacts. | | ||
| | Execution role | Runner control plane and the MicroVM | Is passed to `RunMicrovm` and provides the permissions used by the ephemeral runner at runtime. | | ||
|
|
||
| Do not use the build role as the runner execution role. The control-plane | ||
| Lambda needs `iam:PassRole` for the configured execution role, and the | ||
| execution role must contain the runtime permissions required by the selected | ||
| runner lane. | ||
|
|
||
| ## Deployment order | ||
|
|
||
| The complete dependency chain is: | ||
|
|
||
| ```text | ||
| MicroVM foundation | ||
| | | ||
| v | ||
| Build/release lifecycle-hook server | ||
| | | ||
| v | ||
| Packer builds and publishes image | ||
| | | ||
| v | ||
| Runner control plane resolves execution role | ||
| | | ||
| v | ||
| RunMicrovm starts an ephemeral runner | ||
| ``` | ||
|
|
||
| The lifecycle-hook server is part of the image artifact. Updating the hook | ||
| server therefore requires building/releasing the artifact and publishing a | ||
| new compatible image before deploying that image version to the runner lane. | ||
|
|
||
| ## Combined EC2 and MicroVM deployment | ||
|
|
||
| The [multi-runner webhook example](examples/multi-runner-webhook.md) accepts | ||
| explicit `runners_lambda_zip` and `webhook_lambda_zip` inputs and configures | ||
| both compute providers behind one webhook. Its MicroVM settings require a | ||
| published image: | ||
|
|
||
| ```hcl | ||
| compute_provider = { | ||
| aws = { | ||
| microvm = { | ||
| image_arn = "arn:aws:lambda:eu-west-1:123456789012:microvm-image:gha-ubuntu-arm64" | ||
| image_version = null | ||
| ingress_network_connectors = [] | ||
| egress_network_connectors = ["arn:aws:lambda:eu-west-1:123456789012:network-connector:example"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Use the example's complete Terraform configuration as the source of truth for | ||
| the current input shape. The example deploys the control plane; it does not | ||
| build the foundation, lifecycle-hook artifact, or MicroVM image for you. | ||
|
|
||
| ## Known limitations | ||
|
|
||
| - This integration is experimental and depends on AWS Lambda MicroVM APIs and | ||
| the lifecycle-hook protocol. | ||
| - A compatible lifecycle-hook server must be present in every image used by | ||
| the MicroVM provider. | ||
| - Image publication and activation are separate from Terraform deployment; | ||
| wait for the image version to become active before starting jobs. | ||
| - The build role and execution role are intentionally separate. Changes to | ||
| either role can affect a different stage of the lifecycle. | ||
| - The combined webhook example is useful for integration testing, but a real | ||
| deployment still needs a real MicroVM image and the network/runtime IAM | ||
| configuration described above. | ||
|
|
||
| ## Repository examples | ||
|
|
||
| - [MicroVM foundation](examples/microvm-foundation.md) | ||
| - [MicroVM image build README](https://github.com/github-aws-runners/terraform-aws-github-runner/blob/main/images/microvm-ubuntu/README.md) | ||
| - [Lifecycle-hook service README](https://github.com/github-aws-runners/terraform-aws-github-runner/blob/main/lambdas/services/microvm-lifecycle-hooks/README.md) | ||
| - [Multi-runner webhook](examples/multi-runner-webhook.md) | ||
| - [MicroVM foundation module](modules/public/microvm-foundation.md) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.