Hi! I’m trying to add a kubernetes pod label to al...
# flytekit
z
Hi! I’m trying to add a kubernetes pod label to all pods generated as a result of launching a workflow. Execution code:
Copy code
remote.execute(
        workflow,
        inputs=inputs,
        options=Options(labels=common_models.Labels({"flyte.user": os.getenv("USER", "na")}))
where
remote
is of type
FlyteRemote
. I can see that the workflow’s pod has the expected label, but none of the subworkflows do. Is there a way to have all pod labels be passed to all child pods of a workflow pod?
d
Hi @Zachary Carrico, I'm going to look into this here. Subworkflows should inherit this attribute from their parent workflow during execution. However, it seems that's not happening.
z
ty! yes, that’s our observation. If you see something different than this, please let me know and we can investigate what might be different
is there an issue I can follow for this?
d
Sorry, did get around to making an issue but I do have this on my list. Hopefully get to it in the next few days.
Would you mind creating an issue? Like I said, I'll pick it up right away.
👍 1
f
Is this because we are just using
app
as a label when creating the pods https://github.com/flyteorg/flytepropeller/blob/master/manager/manager.go#L91-L93 ?
d
@Fabian Baier so the flytepropeller manager is a way of starting multiple flytepropeller instances. the code you linked is setting the pod labels on those managed instances rather than the pods flytepropeller starts for tasks.
👍 1
Hey @Zachary Carrico, I'm not able to reproduce this here. All subworkflows are adopting the parent workflows Pod labels. Using your example
FlyteRemote
commands:
Copy code
from flytekit.configuration import Config, PlatformConfig
from flytekit.models.common import Labels
from flytekit.remote import FlyteRemote
from flytekit.remote.remote import Options

import os

config = Config.for_endpoint("localhost:8089", insecure=True)

remote = FlyteRemote(config=config)

workflow = remote.fetch_workflow(project="flytesnacks", domain="development", name="core.control_flow.subworkflows.parent_wf", version="v0.3.100")

remote.execute(workflow, inputs={"a": 1}, options=Options(labels=Labels({"flyte.user": os.getenv("USER", "na")})), project="flytesnacks", domain="development")
where the workflow is one of our flytesnacks subworkflow tests I am seeing all the pods (including those launched by the subworkflow) have the correct labels set:
Copy code
hamersaw@ragnarok:~$ kubectl -n flytesnacks-development get pod fc09411a31e134117aaa-node-t1-parent-0 -o yaml
apiVersion: v1
kind: Pod
metadata:
  labels:
    flyte.user: hamersaw
// ...

hamersaw@ragnarok:~$ kubectl -n flytesnacks-development get pod fc09411a31e134117aaa-n1-0-n0-0 -o yaml
apiVersion: v1
kind: Pod
metadata:
  labels:
    flyte.user: hamersaw
// ...

hamersaw@ragnarok:~$ kubectl -n flytesnacks-development get pod fc09411a31e134117aaa-n1-0-n1-0 -o yaml
apiVersion: v1
kind: Pod
metadata:
  labels:
    flyte.user: hamersaw
// ...
Can you maybe provide a little more information on this? Is the workflow more complex than a single subworkflow?
z
we just tested this out in flytekit1.1 and it works. It didn’t work in flytekit0.3. Thank you for investigating this and I apologize for the goose-chase
d
no problem! glad everything is working 😄
🙏 1
💯 1
233 Views