Tony Lim
02/13/2025, 11:30 PMMarvin
02/13/2025, 11:30 PMflow
, task
, and deploy
, which are essential for defining and deploying flows. You might utilize these to programmatically define how secrets are accessed and passed to your Kubernetes environment.
If you have more specific requirements or configurations, feel free to ask!Nate
02/13/2025, 11:31 PMjob_variables:
env:
SOME_ENV_VAR: "{{ prefect.blocks.secret.foo }}"
or instead using k8s secrets
https://github.com/zzstoatzz/prefect-pack/blob/main/prefect.yaml#L66-L79Tony Lim
02/13/2025, 11:35 PMTony Lim
02/14/2025, 12:34 AMResponse: {'detail': "Error creating deployment: Validation failed for field 'env'. Failure reason: [{'name': 'ENV', 'value': 'stg'}, {'name': 'VAULT_ADDR', 'valueFrom': {'secretKeyRef': {'name': 'vault-secrets', 'key': 'VAULT_ADDR'}}}] is not valid under any of the given schemas"}
my block:
env:
- name: ENV
value: "stg"
- name: VAULT_ADDR
valueFrom:
secretKeyRef:
name: vault-secrets
key: VAULT_ADDR
my k get secrets -n prefect | grep vault already have vault-secrets with correct VAULT_ADDR=....
Tony Lim
02/14/2025, 2:06 AMjob_variables:
image: "{{ build-image.image }}"
env:
- name: ENV
value: "stg"
Validation failed for field 'env'. Failure reason: [{'name': 'ENV', 'value': 'stg'}] is not valid under any of the given schemas"}Tony Lim
02/14/2025, 2:08 AMMarvin
02/14/2025, 2:08 AMTony Lim
02/14/2025, 2:08 AMjob_variables:
image: "{{ build-image.image }}"
env:
- name: ENV
value: "stg"
Validation failed for field 'env'. Failure reason: [{'name': 'ENV', 'value': 'stg'}] is not valid under any of the given schemas"}Marvin
02/14/2025, 2:08 AMenv
field is not valid according to the expected schema.
In many systems, environment variables are expected in a specific format. Commonly, they might be expected as a dictionary rather than a list of dictionaries. Here's a possible correction:
yaml
job_variables:
image: "{{ build-image.image }}"
env:
ENV: "stg"
This format assumes that the system expects env
as a dictionary mapping environment variable names to their values. However, if the system indeed expects a list of dictionaries, you might need to ensure that the schema or the validator is correctly set up to accept that format.
If this is related to Prefect or a similar tool, please let me know, and I can look into the specific documentation or schema requirements for that tool.Tony Lim
02/14/2025, 2:09 AMMarvin
02/14/2025, 2:10 AMyaml
job_variables:
image: "{{ build-image.image }}"
env:
- name: ENV
value: "stg"
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: my-secret
key: secret-key
In this example:
- The env
field is a list of dictionaries, where each dictionary represents an environment variable.
- The SECRET_KEY
environment variable uses a valueFrom
field to reference a secret key.
- secretKeyRef
specifies the secret's name and the key within that secret.
This format is commonly used in Kubernetes configurations, where environment variables can be set from secrets. If you're using a specific platform or tool that requires a different format, please let me know, and I can adjust the example accordingly.Tony Lim
02/14/2025, 2:10 AMTony Lim
02/14/2025, 2:10 AMMarvin
02/14/2025, 2:10 AMyaml
job_variables:
image: "{{ build-image.image }}"
env:
ENV: "stg"
SECRET_KEY:
valueFrom:
secretKeyRef:
name: my-secret
key: secret-key
In this configuration:
- env
is a dictionary where each key is the name of an environment variable.
- The value for SECRET_KEY
is a nested dictionary using valueFrom
to specify the secret key reference.
This format assumes that the system you're working with can interpret such a dictionary structure for environment variables. Adjustments may be needed based on the specific requirements or capabilities of the tool or platform you're using.