ConfigTemplate Deploy kubernetes manifests
# 🌱|help-and-getting-started
g
Hi, i want to use ConfigTemplates and reuse one kubernetes manifest file for multiple services. When i set the (ConfigTemplate) variable configs[].spec.files[0] to
./manifests/*
i get an error, that the file is not found. Thats fine for the moment, because the file is searched within the directory where the
RenderTemplate
is located. But as soon as i try to change the path one directory up, for example
../manifests/*
i get the following error :/
Copy code
sh
Error validating configure handler output from provider local-kubernetes for Deploy type kubernetes:

config does not match any of the allowed types
b
Sorry for the late reply here. The error message is a bit confusing (tripped me up as well, we need to fix that) but I believe the issue you're seeing is due to the fact that you can't reference files in parent directories in Garden actions. This is really just a limitation of Garden. There is a workaround though in case it makes sense for your use case: You can basically manually overwrite the "source path" of any Garden action and set it to e.g. the root of the project. So let's say you have the following structure:
Copy code
.
├── api
│   └── garden.yml
├── garden.yml
└── manifests
In this case, you can't by default reference the manifests in the
api/garden.yml
file because it would require
files: ../manifests/**/*
and that
../
is basically not allowed. However, in
api/garden.yml
you can set:
Copy code
source:
  path: ../
That basically "tricks" Garden into thinking the action is at the root of the project and you would now reference the manifests with
files: ./manifests/**/*
. There's an example of this pattern here: https://github.com/garden-io/garden/tree/main/examples/k8s-deploy-patch-resources The
source.path
field is basically the only config field in where you'll see
..
in the context of a path.
g
Awesome 🙂 thank you!
6 Views