Billy McMonagle
12/20/2023, 7:49 PMprefect work-pool update
command (it is not updated automatically, say the next time the worker restarts). I intend to implement custom, dynamic job templates, so I want to make sure that my job template is always up-to-date for a given helm release. Is there a recommended way to do this?Billy McMonagle
12/20/2023, 7:53 PMprefect work-pool update
as either an initContainer or a post-install hook. Any issues with this approach?alex
12/20/2023, 7:56 PMBilly McMonagle
12/20/2023, 8:00 PMapp-branch
, and then {{ HELM_RELEASE }}
is used in a bunch of places to facilitate this.
• Trying to use external-secrets instead of the manually created K8s secrets recommended in the docs
• Not sure if this matters, but using IAM Roles for Service Accounts.Billy McMonagle
12/20/2023, 8:18 PMalex
12/20/2023, 8:20 PMvariables
or the values in job_configuration
directly.Billy McMonagle
12/20/2023, 8:21 PMjob_configuration
directly.alex
12/20/2023, 8:25 PMBilly McMonagle
12/20/2023, 8:29 PMwith open(job_template_path, "r") as job_file:
job_template = yaml.safe_load(
"".join(job_file.readlines()).format(
HELM_CHART=HELM_CHART, HELM_RELEASE=HELM_RELEASE
)
)
infrastructure = KubernetesJob(
name=f"{HELM_RELEASE}-prefect-job",
image=IMAGE_NAME,
image_pull_policy="Always",
service_account_name=HELM_RELEASE,
job=job_template,
env=environment_variables,
finished_job_ttl=300,
namespace="default",
stream_output=False,
)
infrastructure.save(name=f"{HELM_RELEASE}-kubernetes-job", overwrite=True)
That said, I like the idea of workers, and I like configuring this stuff at the worker level, because it simplifies the creation of a bunch of individual flows that then don't need to worry about infra at all unless they need something custom.
I'd love to see Kubernetes Custom Resource Definitions for prefect resources, but that may be overkill.alex
12/20/2023, 8:50 PMBilly McMonagle
12/20/2023, 8:59 PM