Is there anyway to inject Vault secrets to Prefect Kubernetes job automatically without using Blocks...
n
Is there anyway to inject Vault secrets to Prefect Kubernetes job automatically without using Blocks?
1
r
n
Awesome let me try that thank you.
👍 1
Just wondering where this goes since I do not see overrides property in
class KubernetesJob(Infrastructure):
r
its on the deployment build from flow
infra overrides
n
Good morning. Thank you very much for you help and for that link. In my case I need to append doc like this.
Copy code
apiVersion: apps/v1
kind: Job
  ....
---
apiVersion: "<http://koudingspawn.de/v1|koudingspawn.de/v1>"
kind: Vault
metadata:
  name: control-service
  namespace: dev
spec:
  path: "control-service"
  type: "KEYVALUEV2"
How can I add such block using customization can I still use
customization
with
op
: add
or with
infra_overrides
r
hey, you can add anything using the patch spec, basically using more customizations into infra overrides
n
ok cool I was more concerned about that
---
separator.
Something like this then?
Copy code
k8s_job = KubernetesJob(
    namespace="prefect",
    customizations=[
        {
            "op": "add",
            "path": "/",
            "value": {
                {
                    "---": {
                        "apiVersion": "<http://koudingspawn.de/v1|koudingspawn.de/v1>",
                        "kind": "Vault",
                        "metadata": {
                            "name": "control-service",
                            "namespace": "dev"            
                        },
                        "spec": {
                            "path": "control-service",
                            "type": "KEYVALUEV2"
                        }
                    }
                }
            },
        }
    ],
)
r
youll need path /spec/
👍 1
n
ok I will try that. Thank you very much.
👍 1
r
for the control service *
the name and namespace can be set on the k8s job
rather than patch
n
Apparently that
vault
CRD needed that namespace but I will remove that and try like you said.
r
Yeah I cant remember exactly which props prefect sets for you but you should be able to play around and get it working how you need
we have added tons of patches to ours for taints etv
j
this is a late follow-up, but in case you all are interested, another solution is https://www.hashicorp.com/blog/injecting-vault-secrets-into-kubernetes-pods-via-a-sidecar
(assuming you mean HashiCorp Vault)
n
Do you know how I can use this in KubernetesJob?