clever-policeman-58407
11/27/2023, 8:03 PMvariables.SOME_IMAGE
so that the YAML files can substitute any instances of ${var.SOME_IMAGE}
and deploy with the right image.
When I'm using Kustomize, however, it doesn't look like Kustomize is given access to Garden variables. So I can no longer use the ${var.SOME_IMAGE}
method I was using beforehand to get custom images into a Kustomize deployment.
Is there a canonical way to access Garden variables when using Kustomize? Is this a bug or intended behavior?quaint-dress-831
11/28/2023, 8:41 AMgarden.yml
files look like for deploying your Kustomize manifests?
Do you know of the patchResources
field we expose for Kustomize? It's intended for cases like this. https://docs.garden.io/reference/module-types/kubernetes#patchresources
You'd then reference the image https://docs.garden.io/other-plugins/container#referencing-from-other-actions
https://docs.garden.io/reference/action-types/build/container#usd-actions.build.less-than-name-greater-than.outputs.deploymentimageid
e.g. ${actions.build.<name>.outputs.deploymentImageId}
clever-policeman-58407
11/28/2023, 6:47 PMkind: Deploy
type: kubernetes
name: admin-api
variables:
ADMIN_IMAGE: ${actions.build.admin-api.outputs.deployment-image-name}:${actions.build.admin-api.version}
dependencies:
- build.admin-api
spec:
kustomize:
path: ./kubernetes/overlays/${environment.name}
patchResources:
- name: admin-api
kind: Deployment
patch:
spec:
template:
spec:
containers:
- name: api-container
image: ${var.ADMIN_IMAGE}
initContainers:
- name: init-api
image: ${var.ADMIN_IMAGE}
famous-fireman-34051
07/03/2024, 6:47 PMkustomize
. I create the variables in the environment declaration and when I refer to them they come empty ""
.
Example: ${var.ABCD}
Are there any additional steps to be able to load variable values declared in the garden Project
under environment
-> variables
in kustomization.yaml and the other kubernetes manifests while using kustomize
?
Thanks a lot!quaint-dress-831
07/04/2024, 8:46 PMfamous-fireman-34051
07/04/2024, 9:44 PMswift-garage-61180
07/09/2024, 11:58 AMpatchResources
field is the recommended way to accomplish this in Garden, and can serve the same role as Kustomize.
Copying your Kustomize overlays into patchResources
should be relatively straightforward (see the code examples previously posted in this thread), and then you can take it from there—hope this helps!famous-fireman-34051
07/10/2024, 2:36 PM