Hi - I have question on how `PodTemplates` interac...
# flyte-support
d
Hi - I have question on how
PodTemplates
interact with other arguments specified in the
@task
definition. For example, I have a pod template specified as follows:
Copy code
CL_POD_TEMPLATE = PodTemplate(
    primary_container_name="classifylink", labels={"project": "classifylink"}
)
Notice that this
PodTemplate
does not specify an
image
. I also have a task
Copy code
@task(
    pod_template=CL_POD_TEMPLATE,
    requests=Resources(cpu="1", mem="5Gi"),
    container_image=CONTAINER_IMAGE_CLASS_LINK,
)...
When i register the task - I notice that the image that my task is using is set to the default image. However, if I comment out the pod_template and re-register, I notice that the image changes to what is defined by
CONTAINER_IMAGE_CLASS_LINK
. My question: Is this intended? I am under the impression that arguments in the task (e.g
container_image
) override or at least augment what is specified in the
PodTemplate
. But I am seeing that is not the case.
g
I think if you don't define the
primary_container_name
in the
PodTemplate
the
container_image
is used. Otherwise the
PodTemplate
is leading, so no overrides. But not sure
d
Sorry - my understading is the the
primary_container_name
has nothing to do with the image used? It's just a name used for referencing?
g
https://github.com/flyteorg/flytekit/blob/55450533417ee5349fa8db23a3f8eea62e6096db/flytekit/core/utils.py#L135 Well, there's some logic here where the image depends on the
primary_container_image
. Especially this line which would be true in your case: https://github.com/flyteorg/flytekit/blob/55450533417ee5349fa8db23a3f8eea62e6096db/flytekit/core/utils.py#L170, so maybe it does? Would need to check from where it's called and what it calls further to see what's going on. BUt it might have to do with that
Of course, I might be wrong as well
Still, you're right. The name doesn't matter. It's just getting selected here
a
hey @dry-shampoo-96961 In a nutshell yes, during the process of merging the base Podspec (the default flytekit uses with each task and the config in the decorator) with a PodTemplate, the base PodSpec takes precedence: https://github.com/flyteorg/flyte/blob/c3869f8fed982533c60c38e71ee5a2f516e08374/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go#L6[…]81