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

rework to use Workload Identity #5

Merged
merged 4 commits into from
May 7, 2024
Merged

rework to use Workload Identity #5

merged 4 commits into from
May 7, 2024

Conversation

tgross
Copy link
Contributor

@tgross tgross commented May 2, 2024

Heavily revise the repo to use Nomad's Workload Identity. From a high-level perspective, we use WI to authorize a Consul task to bootstrap Envoy and correctly register it with Consul. The API Gateway is deployed in its own Nomad namespace. We add a Consul ACL role that the Consul binding rule matches for that Nomad namespace. And then that Consul ACL role grants the appropriate permissions to the API Gateway.

This also refactors the repo to split out the setup of the agents from the API GW deployment, because a user may have a running cluster already either for production purposes or one they stood up using the tutorial for Nomad and Consul Workload Identity.

Fixes: #2
Fixes: #3


Notes to reviewers:

After testing in a fresh environment, I found a number of steps that don't work,
are out of order, or have undesireable effects. This changeset represents a
minimum amount of updates just to get this all working without improving the
workflow more generally.

This includes:
* Bootstrap Consul ACLs after configuring the Consul environment variables, so
  that we can connect to the Consul agent we're trying to configure.
* Run `nomad` with the `-dev-connect` flag so that the API GW is listening on a
  non-localhost address.
* Make it clear the certs used for the Nomad CLI are the ones named "server".
* Update the Docker build step so that in the default local development case
  we're building an image that Nomad will not try to download.
* Add the missing Consul gRPC and HTTP address to the values we write to Nomad
  Variables, and make the name of the Consul CA variable consistent with
  Consul's use.
* Explain where to find the API GW address and port.
* Remove incorrect references to env vars from the Nomad agent config.
* Make the `tls.cert_file` and `tls.key_file` path match the names of the files
  we create.
* Ensure we don't commit certificates by adding them to `.gitignore`

Additional PRs will follow on this repo to resolve #2 and #3.
@tgross tgross changed the title Workload identity rework to use Workload Identity May 2, 2024
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Heavily revise the repo to use Nomad's Workload Identity. From a high-level
perspective, we use WI to authorize the gateway job to gateway job to correctly
register itself with Consul. The API Gateway is deployed in its own Nomad
namespace. You'll add a Consul ACL role that the Consul binding rule matches for
that Nomad namespace. And then that Consul ACL role grants the appropriate
permissions to the API Gateway.

This also refactors the repo to split out the setup of the agents from the API
GW setup, because a user may have a running cluster already either for
production purposes or one they stood up using the tutorial for Nomad and Consul
Workload Identity.

Fixes: #2
Fixes: #3
@tgross tgross removed the request for review from shoenig May 3, 2024 14:31
@tgross tgross removed the request for review from kkavish May 7, 2024 13:10
Copy link

@jrasell jrasell left a comment

Choose a reason for hiding this comment

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

An initial pass looks good but I've not run it through yet. I can look at this tomorrow as needed.

api-gateway.nomad.hcl Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@tgross tgross merged commit f2c119e into main May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants