Is it possible to separately apply a job_template ...
# ask-community
l
Is it possible to separately apply a job_template with kubectl and register a flow without passing the job_template? I think that would be done by passing the image explicitly in the
KuberneetsRun
?
k
I think that’s right. Specify the location of the job_template in the
KubernetesRun
. During Flow start, it will retrieve the template at the specified location.
l
Hmm, I’m somewhat missing that — maybe a better questions is, in what are job templates and flows associated to each-other? Basically the plan is to template + render job specs with helm, then apply them with kubectl before flow registration. Could a flow then be registered without the job template and somehow associated with a job template that has already been aplied?
k
The RunConfig or Agent need to know about the job template before the job is applied. Could you give more details about what you’re trying to do?
l
Sure - so we were planning to use helm to manage templating and rendering the job spec, which would then be applied to the cluster via kubectl - that would all happen outside of the flow registration loop Then I would want to register my flow, and somehow associate the flow I’m registering to a job template that has already been applied to the cluster
Not sure if this could be a potential enhancement, but basically allowing the
KubernetesRun
to accept a
job_template_name
parameter that would be able to reference a job that has already been applied to the cluster
k
So an engineer looked at this and it’s not possible. The k8s agent needs to kick off the flow run job and if you create a job without the agent, it won’t know about the job.
👍 1
l
Thanks @Kevin Kho
s
@Leon Kozlowski Would you be able to make use of k8s config maps here? You'd be able to mount your configuration as files inside the necessary pods (including the agent) so they'd be accessible at a static path AND be updated whenever you update the config map. Then you'd just need to register your flows with the static path as the job_template_path parameter
l
I believe the job_template_path resolver would attempt to resolve the path locally when there is no file scheme for like s3 etc during registration time, but I may be interpreting that wrong
s
And that would be fine on the agent since you can mount a configmap as a local file path on the pod. When you register I don't think Prefect cares if it can resolve the path locally on whatever is registering, it just needs to exist on the agent pod