Skip to content

Expand documentation on how to use baseJobTemplate #444

@mitchnielsen

Description

@mitchnielsen

Summary

I've noticed that lately we've gotten more questions about how to use base job templates, including:

  • How to expose more environment variables
  • How to expose environment variables from secrets
  • How to set image pull secrets

Let's expand our docs a little to make usage more clear.

What we have so far:

  • #### Updating the Base Job Template
    If a base job template is set through Helm (via either `.Values.worker.config.baseJobTemplate.configuration` or `.Values.worker.config.baseJobTemplate.existingConfigMapName`), we'll run an optional `initContainer` that will sync the template configuration to the work pool named in `.Values.worker.config.workPool`.
    Any time the base job template is updated, the subsequent `initContainer` run will run `prefect work-pool update <work-pool-name> --base-job-template <template-json>` and sync this template to the API.
    Please note that configuring the template via `baseJobTemplate.existingConfigMapName` will require a manual restart of the `prefect-worker` Deployment in order to kick off the `initContainer` - alternatively, you can use a tool like [reloader](https://github.com/stakater/Reloader) to automatically restart an associated Deployment. However, configuring the template via `baseJobTemplate.configuration` value will automatically roll the Deployment on any update.
  • ## 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.:
    ## baseJobTemplate:
    ## configuration: |
    ## {
    ## "variables": {
    ## ...
    ## },
    ## "job_configuration": {
    ## ...
    ## }
    ## }
    ## OR
    ## baseJobTemplate:
    ## existingConfigMapName: "my-existing-config-map"
    baseJobTemplate:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions