<@ULVA73B9P> with the transition from agents to wo...
# ask-marvin
m
@Marvin with the transition from agents to workers, is there any equivalent for customizations in a kubernetes worker, allowing arbitrary jsonpatches at deployment time
m
Yes, with the transition from agents to workers in Prefect, you can still perform customizations in a Kubernetes worker environment, including applying arbitrary JSON patches at deployment time. According to the Prefect documentation, in the Advanced Settings when you're modifying the default base job template for a Kubernetes worker, you can edit the JSON representation of the template to add other fields or delete existing fields. For example, you can set CPU requests by specifying the appropriate JSON structure under
job_configuration
and
containers
. Here are relevant sections in the Prefect Docs you might want to look at for more details: - Kubernetes Deployment Guide - Work Pools Concept They should contain information on how to customize your Kubernetes work pool settings and possibly apply JSON patches to achieve the configuration you need.
k
not exactly, but you can do something pretty close to it
👋 1
the k8s work pool template has the entire job manifest in it, which you can fill with your own template variables
all of those variables can then be overridden at deployment time
m
yeah ok, i was playing with it, so i could add more template variables to make it more customizable. I'm excited about not having to do json patches for resource allocations, which is primarily what i was customizing before.
The other settings we sometimes need to tweak at deployment time are secrets + environment variables.
but previously the json patch was used as an escape hatch for things we hadn't "pre-templated"
k
the resource request and limit fields aren't in the default template, but you can definitely add them yourself. it's also on our to-do list to expose them by default
🙌 1
yeah json patching was just syntactically difficult, being able to see the whole manifest is much much easier imo
💯 1
m
Is the templating with variables sophisticated, or just straightforward substitution? e.g. is it possible to do conditionals ?
k
very straightforward
you add them to the template, we directly drop in the values you supply on your deployment
if you want conditional values, you can use flow run job variables, which I think we talked about a while back. I believe that's a thing now! brand new, so I haven't tried it yet
m
yeah i saw that crop up, very exciting!
thanks for the help, appreciate it!
k
np!