Skip to content

refact: support secrets from env vars and include vault namespace header#45

Merged
daisieh merged 38 commits intomainfrom
refact/secrets-env-vars
Nov 13, 2025
Merged

refact: support secrets from env vars and include vault namespace header#45
daisieh merged 38 commits intomainfrom
refact/secrets-env-vars

Conversation

@v-rocheleau
Copy link
Contributor

@v-rocheleau v-rocheleau commented Oct 16, 2025

Related to the deployment of pcgl-authz on Kubernetes
Problems:

  1. Mounting a shared volume at /app for the API and the OPA sidecar erases the files built in the image at that path, breaking the Flask API
  2. In k8s, pcgl-authz will not use the root Vault namespace, it needs to use a specific namespace that is managed for it. Every request made to Vault must specify the namespace
  3. In k8s, pcgl-authz must not unseal the Vault server

Solutions:

  1. Mount the shared volume at /permissions_engine in the containers, copied/modified from /app/permissions_engine present in the image. This prevents erasing application files at /app.
  2. Add support for a VAULT_NAMESPACE environment variable whose value is added to the X-Vault-Namespace header (if provided), along with X-Vault-Token
  3. Created different entrypoints for local-dev with unseal (dev.entrypoint.sh) and k8s deployment without unseal (entrypoint.sh).

@v-rocheleau v-rocheleau requested a review from daisieh October 16, 2025 21:20

else := "opa"

# TODO: need to pass the 'X-Vault-Namespace' header to the vault requests
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not super familiar with rego, so I would like to know your opinion on the best way to do this @daisieh .
The name of the Vault namespace will be set as an environment variable VAULT_NAMESPACE in the container.
When the env var is present, we simply need to add its value in the X-Vault-Namespace header.

@v-rocheleau
Copy link
Contributor Author

Will fix the tests soon

Copy link
Contributor

@daisieh daisieh left a comment

Choose a reason for hiding this comment

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

I fixed all of the permissions-engine instances to permissions_engine and everything seems to work now. LGTM.

@daisieh daisieh merged commit 3dcbe02 into main Nov 13, 2025
4 of 5 checks passed
@daisieh daisieh deleted the refact/secrets-env-vars branch November 13, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants