From e02e2c74344bc12c06d3498a4cb8c67348c9cebd Mon Sep 17 00:00:00 2001 From: Lucas Koontz Date: Tue, 12 Dec 2023 14:55:54 -0500 Subject: [PATCH] feat(base-job-template): Add base job template name (#275) * feat(base-job-template): Add base job template name * docs(README): add value to worker readme --------- Co-authored-by: Jamie Zieziula --- charts/prefect-worker/README.md | 1 + charts/prefect-worker/templates/configmap.yaml | 3 ++- charts/prefect-worker/templates/deployment.yaml | 2 +- charts/prefect-worker/values.schema.json | 6 ++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/charts/prefect-worker/README.md b/charts/prefect-worker/README.md index 417d4802..8885a92c 100644 --- a/charts/prefect-worker/README.md +++ b/charts/prefect-worker/README.md @@ -246,6 +246,7 @@ helm install prefect-worker prefect/prefect-worker -f values.yaml --set-file wor | worker.cloudApiConfig.cloudUrl | string | `"https://api.prefect.cloud/api"` | prefect cloud API url; the full URL is constructed as https://cloudUrl/accounts/accountId/workspaces/workspaceId | | worker.cloudApiConfig.workspaceId | string | `""` | prefect workspace ID | | worker.clusterUid | string | `""` | unique cluster identifier, if none is provided this value will be infered at time of helm install | +| worker.config.baseJobTemplateName | string | `nil` | Name for the base job template. If unspecified, Prefect will use the default base job template name for the given worker type. | | worker.config.baseJobTemplate | string | `nil` | JSON formatted base job template. 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. | | worker.config.http2 | bool | `true` | connect using HTTP/2 if the server supports it (experimental) | | worker.config.installPolicy | string | `"prompt"` | install policy to use workers from Prefect integration packages. | diff --git a/charts/prefect-worker/templates/configmap.yaml b/charts/prefect-worker/templates/configmap.yaml index 8c126274..355fc61a 100644 --- a/charts/prefect-worker/templates/configmap.yaml +++ b/charts/prefect-worker/templates/configmap.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: prefect-worker-base-job-template + name: {{ default "prefect-worker-base-job-template" .Values.worker.config.baseJobTemplateName . }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: worker @@ -12,3 +12,4 @@ metadata: data: baseJobTemplate.json: {{ .Values.worker.config.baseJobTemplate | toJson }} {{- end }} + diff --git a/charts/prefect-worker/templates/deployment.yaml b/charts/prefect-worker/templates/deployment.yaml index cf728cfb..b4f425b7 100644 --- a/charts/prefect-worker/templates/deployment.yaml +++ b/charts/prefect-worker/templates/deployment.yaml @@ -170,5 +170,5 @@ spec: {{- if .Values.worker.config.baseJobTemplate }} - name: base-job-template-file configMap: - name: prefect-worker-base-job-template + name: {{ default "prefect-worker-base-job-template" .Values.worker.config.baseJobTemplateName . }} {{- end }} diff --git a/charts/prefect-worker/values.schema.json b/charts/prefect-worker/values.schema.json index ff69b74c..e1a07a88 100644 --- a/charts/prefect-worker/values.schema.json +++ b/charts/prefect-worker/values.schema.json @@ -152,6 +152,12 @@ "description": "the type of worker to start i.e kubernetes", "form": true }, + "baseJobTemplateName": { + "type": ["string", "null"], + "title": "Base Job Template Name", + "description": "Template name of the base job template. If unspecified, Prefect will use the default base job template name for the given worker type.", + "form": true + }, "baseJobTemplate": { "type": ["string", "null"], "title": "Base Job Template",