I’ve been using prefect with some success until to...
# prefect-kubernetes
g
I’ve been using prefect with some success until today, when I needed to add a memory request on the pods for a specific flow run that the k8s agent is creating. I followed the [example from anna geller](https://github.com/anna-geller/prefect-deployment-patterns/blob/main/blocks/infrastructure_blocks/kubernetes-job/customizations/cpu_memory_limits.py) to add the resource requests to the Kubernetes Job block in the UI. i also added labels to aid in viewing logs in an external application. however, neither the lables nor the customizations made it onto the flow run pods that were created. am i doing something wrong here in defining these blocks? Note that i’m running the
prefecthq/prefect:2.7.7-python3.9
image for the agent
r
the path looks wrong to me should be something like "/spec/template/spec/containers/0/resources"
gratitude thank you 2
we add it via code and that is the path we use
message has been deleted
g
gotcha. i based it on an earlier message i saw pointing to one of your repos. why is it different here? https://github.com/anna-geller/prefect-deployment-patterns/blob/main/blocks/infrastructure_blocks/kubernetes-job/customizations/cpu_memory_limits.py#L8
also, any input on why the labels aren’t making it to the pods? i assume i’m using the wrong format there as well
r
@Garett Dunn hey, try labels as an array, not sure why @Anna Geller repo has the cpu like that
👍 1
a
I was using it from a colleague, I'm no K8s expert. If something is wrong in those examples, could you submit a PR to that repository? 🙏 I'd supper appreciate it to help others avoid that mistake
r
Done 👍
g
would it be possible to add documentation somewhere for how to fill these in on the prefect GUI? it took a while for me to realize that the format matched what what you’d pass in via the python SDK vs various other formats you might use when working with k8s. specifically the
"op", "path", "value"
mapping
r
Yeah - I expect a few of the common ones will make it into the ui/api as single values and prefect will create the patch under the hood like some of the other values (image) etc
g
yep, that would be nice. esp being able to use more varied html elements to input lists vs maps vs etc. but even having it described somewhere how to write the customizations would go a long way to cover most use cases
r
@Garett Dunn the prefect discourse is good for searching and finding gems https://discourse.prefect.io/
👍 1
w
Wow you guys just saved me a ton of time. Thanks for this!
🎉 1