Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions charts/prefect-worker/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,14 @@ spec:
value: {{ template "worker.apiUrl" . }}
- name: PREFECT_KUBERNETES_CLUSTER_UID
value: {{ template "worker.clusterUUID" . }}
{{- if not .Values.worker.config.observerClusterWide }}
- name: PREFECT_INTEGRATIONS_KUBERNETES_OBSERVER_NAMESPACES
{{- if .Values.worker.config.jobNamespace }}
value: {{ .Values.worker.config.jobNamespace }}
{{- else }}
value: {{ include "common.names.namespace" . | quote }}
{{- end }}
{{- end }}
{{- if eq .Values.worker.apiConfig "cloud" }}
- name: PREFECT_API_KEY
valueFrom:
Expand Down
10 changes: 10 additions & 0 deletions charts/prefect-worker/tests/worker_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,16 @@ tests:
path: .spec.template.spec.containers[0].env[?(@.name == "PREFECT_INTEGRATIONS_KUBERNETES_OBSERVER_NAMESPACES")].value
value: job-namespace

- it: Should set Kubernetes worker observer cluster wide
set:
worker:
config:
observerClusterWide: true
asserts:
- template: deployment.yaml
notExists:
path: .spec.template.spec.containers[0].env[?(@.name == "PREFECT_INTEGRATIONS_KUBERNETES_OBSERVER_NAMESPACES")]

- it: Should set auth string secret environment variables when existingSecret is provided
set:
worker:
Expand Down
5 changes: 5 additions & 0 deletions charts/prefect-worker/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@
"title": "Job Namespace",
"description": "the namespace where the jobs would spawn. If unset, spawns in the same namespace as the worker controller. Requires role.namespace to be set with the same value."
},
"observerClusterWide": {
"type": "boolean",
"title": "Observer Cluster Wide",
"description": "if true, the Kubernetes observer will watch for pod events and job crash detection across the entire cluster. If true, PREFECT_INTEGRATIONS_KUBERNETES_OBSERVER_NAMESPACES will not be set."
},
"baseJobTemplate": {
"type": "object",
"title": "Base Job Template",
Expand Down
2 changes: 2 additions & 0 deletions charts/prefect-worker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ worker:
limit: null
# -- the namespace(s) that the Kubernetes observer will watch for pod events and job crash detection. Accepts a comma-separated list (e.g., "default,namespace-2"). If unset, defaults to watching only the namespace where the worker is deployed. This does NOT control where worker jobs are deployed - job deployment namespace is configured via the work pool's base job template.
jobNamespace: null
# -- if true, the Kubernetes observer will watch for pod events and job crash detection across the entire cluster. If true, PREFECT_INTEGRATIONS_KUBERNETES_OBSERVER_NAMESPACES will not be set.
observerClusterWide: false

## If unspecified, Prefect will use the default base job template for the given worker type. If the work pool already exists, this will be ignored.
## e.g.:
Expand Down
Loading