Thread
#prefect-community
    Leon Kozlowski

    Leon Kozlowski

    1 year ago
    Has anyone had success with a single agent deployment handling multiple environments via labels? (more info in thread)
    Lets say there is 1 single agent deployment with both
    dev
    and
    prod
    label to serve both “environments”
    Each set of flows could be grouped in a project say
    dev-xyz
    and
    prod-xyz
    to separate deployments, but when a flow is deployed to
    dev-xyz
    the label
    dev
    is used, and
    prod
    for the other
    Kevin Kho

    Kevin Kho

    1 year ago
    Hey @Leon Kozlowski, I’m not sure I am following 100%. Is there a use labelling dev and prod if they end up going to the same underlying compute? It will work though if your agent has labels
    dev
    and
    prod
    since flow labels just need to be a subset of the agent labels. Or is the main question how to assign
    dev
    to the flow if it’s in the
    dev-xyz
    project and
    prod
    automatically if it’s in the
    prod-xyz
    project?
    Leon Kozlowski

    Leon Kozlowski

    1 year ago
    I want to use a different set of secrets for dev and prod + the question is, is it an antipattern for them to exist on the same cluster
    Kevin Kho

    Kevin Kho

    1 year ago
    Ah ok do you have multiple tenants? I think it is an anti-pattern, but i can understand why it makes sense if you are changing all the connections and secrets.
    Leon Kozlowski

    Leon Kozlowski

    1 year ago
    No, do not have multiple tenants, the real problem is that were just using 1 cluster
    If there were 2 clusters, I’d just deploy 2 agents, one dev and one prod - and it would be pretty simple
    Kevin Kho

    Kevin Kho

    1 year ago
    Oh I see what you mean, and then you’d just set the environment variables different for those agents? Well, what if you have one cluster that has two
    config.toml
    files and you put secrets there, and then set
    prefect.config.user_config_path
    to point to the corresponding
    config.toml
    file for dev and prod. And then you can start 2 agents on the same machine with different env variables and secrets?
    Leon Kozlowski

    Leon Kozlowski

    1 year ago
    Acutally, could this just be done with namespaces?
    this is for k8s btw, specifically an eks cluster
    I guess the question there is, can the agent live in a different namespace than where the jobs are run
    Kevin Kho

    Kevin Kho

    1 year ago
    I would imagine so, but not 100% sure because I’m not that good at kubernetes myself. But I see it working since you can have a different configuration for each namespace yep. Then you would have one agent per namespace right?
    Oh I was thinking you would just make the
    dev
    agent and the
    prod
    agent in different namespaces then they would pick up the appropriate flows?
    Leon Kozlowski

    Leon Kozlowski

    1 year ago
    that would be ideal, but its somewhat out of scope for our helm workflow that were using to deploy the agent - I’ll see if I can make that happen - thanks @Kevin Kho
    Update: actually figured out the helm part, appreciate you thinking this out with me
    Kevin Kho

    Kevin Kho

    1 year ago
    Glad you got it working 👍