<@ULVA73B9P> im using prefect 3.x and deploying my...
# marvin-in-the-wild
f
@Marvin im using prefect 3.x and deploying my flows using prefect.yaml. My tolerations on kubernetes was not applied when i set in the file. Whats the right way to set tolerations on prefect.yaml infrastructure block?
m
Ah, the joys of YAML not doing what you want, huh? Let me find the best way to apply Kubernetes tolerations in your
prefect.yaml
infrastructure block. I'll check the Prefect 3.x documentation and any related GitHub issues just to be sure. One moment! Seems like there might be an issue with setting Kubernetes tolerations directly in the
prefect.yaml
file. The GitHub issue I found indicates that sometimes infrastructure settings are not respected unless set through
infra_overrides
. Here's a workaround you can try: 1. Define your KubernetesJob in a deployment script:
Copy code
python
    from prefect.deployments import Deployment
    from prefect.infrastructure.kubernetes import KubernetesJob
    from your_flow_file import your_flow

    job = KubernetesJob(tolerations=[{"key": "key", "operator": "Exists"}])  # Adjust your tolerations here

    deployment = Deployment.build_from_flow(
        flow=your_flow,
        name="your_deployment_name",
        infrastructure=job,
        infra_overrides={"tolerations": [{"key": "key", "operator": "Exists"}]}  # This ensures it gets picked up
    )

    if __name__ == "__main__":
        deployment.apply()
2. Apply this deployment instead of setting it directly in
prefect.yaml
. Check out this GitHub issue for more context. For more details, you can refer to the Prefect 3.x documentation on deployment and infrastructure customization once it's accessible. If you have any more specific details or need another approach, let me know!