Brett
04/21/2023, 5:45 PMKevin Grismore
04/21/2023, 6:20 PMKevin Grismore
04/21/2023, 6:24 PMKevin Grismore
04/21/2023, 6:25 PMBrett
04/21/2023, 6:37 PMKevin Grismore
04/21/2023, 6:39 PMBrett
04/21/2023, 7:21 PMBrett
04/21/2023, 7:21 PM{
  "PYODBC_CONN_STR": {
    "valueFrom": {
      "secretKeyRef": {
        "name": "prefect-env",
        "key": "PYODBC_CONN_STR"
      }
    }
  }
}Kevin Grismore
04/21/2023, 7:27 PMadvanced and then you can edit it like a typical kubernetes job manifest, including for your env varsKevin Grismore
04/21/2023, 7:29 PMBrett
04/27/2023, 2:08 PM{
  "key": "value",
  "ENVIRONMENT": "dev"
}Brett
04/27/2023, 2:10 PMKevin Grismore
04/27/2023, 3:15 PMBrett
04/27/2023, 3:15 PMKevin Grismore
04/27/2023, 3:21 PMBrett
04/27/2023, 3:29 PM{{ env }} variables in that template.
Could it be under the job_manifest/spec/template/spec/containers/{[env]} ?
"job_manifest": {
      "kind": "Job",
      "spec": {
        "template": {
          "spec": {
            "containers": [
              {
       ------>> "env": "{{ env }}",
                "args": "{{ command }}",
                "name": "prefect-job",
                "image": "{{ image }}",
                "imagePullPolicy": "{{ image_pull_policy }}"
              }
            ],Kevin Grismore
04/27/2023, 3:42 PM{
  "name": "PYODBC_CONN_STR",
  "valueFrom": {
      "secretKeyRef": {
        "key": "PYODBC_CONN_STR",
        "name": "prefect-env"
      }
    }
  }
}Kevin Grismore
04/27/2023, 3:53 PMKevin Grismore
04/27/2023, 3:53 PMself.job_manifest["spec"]["template"]["spec"]["containers"][0]["env"] = [
     {"name": k, "value": v} for k, v in self.env.items()
 ]Kevin Grismore
04/27/2023, 3:54 PMenv is expecting just "name": "value" pairs.Kevin Grismore
04/27/2023, 4:03 PMenv is inherited from prefect.workers.base.BaseJobConfiguration, which defines env like:
class BaseJobConfiguration(BaseModel):
    ...
    env: Dict[str, Optional[str]] = Field(
        default_factory=dict,
        title="Environment Variables",
        description="Environment variables to set when starting a flow run.",
    )Kevin Grismore
04/27/2023, 4:05 PM{{ env }} part of the template, but given how this is written, I don't think that would workBrett
04/27/2023, 5:07 PM