Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fixes env handling to allow hard coding of environment variable in base job template #94

Merged
merged 6 commits into from
Sep 18, 2023

Conversation

desertaxle
Copy link
Member

@desertaxle desertaxle commented Sep 18, 2023

Updates propagation of env values into the job manifest generated by the Kubernetes worker to allow hard coding of env values in the base job template. With this change, users can add hardcoded environment variables to the base job template to enable the use of Kubernetes secrets like so:

"containers": [
    {
        "name": "prefect-job",
        "env": [
            {
                "name": "TEST_ENV",
                "valueFrom": {
                    "secretKeyRef": {
                        "name": "test-secret",
                        "key": "shhhhh",
                    }
                },
            },
        ],
        "image": "{{ image }}",
        "imagePullPolicy": "{{ image_pull_policy }}",
        "args": "{{ command }}",
    }
],

The Kubernetes worker will still handle adding the necessary Prefect setting environment variables to the job manifest, but those values will not override the user hardcoded values.

Closes #83
Closes PrefectHQ/prefect#10717

Checklist

  • References any related issue by including "Closes #" or "Closes ".
    • If no issue exists and your change is not a small fix, please create an issue first.
  • Includes tests or only affects documentation.
  • Passes pre-commit checks.
    • Run pre-commit install && pre-commit run --all locally for formatting and linting.
  • Includes screenshots of documentation updates.
    • Run mkdocs serve view documentation locally.
  • Summarizes PR's changes in CHANGELOG.md

@desertaxle desertaxle changed the title Fixes env handling to allow hard coding of env values Fixes env handling to allow hard coding of environment variable in base job template Sep 18, 2023
prefect_kubernetes/worker.py Show resolved Hide resolved
@desertaxle desertaxle merged commit 5637522 into main Sep 18, 2023
@desertaxle desertaxle deleted the fix-env-handling branch September 18, 2023 17:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants