This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Add option to provide Prefect API key to created jobs as a Kubernetes secret #99
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.
Adds an option to have a worker store its Prefect API key as a Kubernetes secret and provide the secret to created jobs. Prevents the exposure of a worker's Prefect API key by inspecting the manifests of the jobs it creates. The worker will clean up any created secrets upon shutdown.
This feature is opt-in because it requires the worker to have the necessary permissions to create secrets. Once it is battle-tested, this feature will be updates to be the default.
Closes PrefectHQ/prefect#10716
Example
To activate, set the
PREFECT_KUBERNETES_WORKER_STORE_PREFECT_API_IN_SECRET
environment variable:After running a job, you'll see a new secret created:
If you inspect the job, you'll see the same secret used:
After shutting down the worker, the created secret should be gone:
$ kubectl get secrets No resources found in default namespace.
Screenshots
Checklist
pre-commit
checks.pre-commit install && pre-commit run --all
locally for formatting and linting.mkdocs serve
view documentation locally.