I am trying to create a deployment in a GKE work p...
# ask-community
l
I am trying to create a deployment in a GKE work pool. I want to pass k8s secrets as environment variables in the form of
Copy code
env: [{"name": "MY_SECRET", "valueFrom": {"secretKeyRef": {"name": "k8s_secret_name", "key": "MY_SECRET"}}}]
I am using the python SDK to perform this deployment and I am passing these k8s environment variables in the job variables. I am getting this error when applying the update. I noticed that
KubernetesWorkerVariables
declares env as a dict however `KubernetesJobConfiguration`declares env as a union of dict and list. I am guessing this is the source of the schema validation error. IIUC, job variables is a subset of job configuration and should have the same types.
Copy code
File "/Users/lev/Documents/github/plus/python/.venv/lib/python3.12/site-packages/prefect/deployments/runner.py", line 367, in _update
        await client.update_deployment(
      File "/Users/lev/Documents/github/plus/python/.venv/lib/python3.12/site-packages/prefect/client/orchestration/_deployments/client.py", line 711, in update_deployment
        await self.request(
      File "/Users/lev/Documents/github/plus/python/.venv/lib/python3.12/site-packages/prefect/client/orchestration/base.py", line 53, in request
        return await self._client.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/lev/Documents/github/plus/python/.venv/lib/python3.12/site-packages/prefect/client/base.py", line 354, in send
        response.raise_for_status()
      File "/Users/lev/Documents/github/plus/python/.venv/lib/python3.12/site-packages/prefect/client/base.py", line 162, in raise_for_status
        raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.__cause__
    prefect.exceptions.PrefectHTTPStatusError: Client error '409 Conflict' for url '<https://prefect.eng.additive.ai/api/deployments/687488fa-22e4-4a3a-89a8-cce4687a153d>'
    Response: {'detail': "Error creating deployment: <ValidationError: '[] is not valid under any of the given schemas'>"}
    For more information check: <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409>
Is there a better way to do this (preferably not by using a yaml file)? Happy to post any other helpful information.