Set namespace for container type of module
# 🌱|help-and-getting-started
b
Hey, I'd like to have a single instance of a service (functioning as a reverse proxy) in a separated namespace. I know I can make that happen using k8s module type but then I'd have to give up on in-cluster building. Is there a way to enforce a namespace using container module type?
q
Hi @best-flower-46100 you can reference the container module from other modules like the k8s and helm modules. Does that help? https://docs.garden.io/guides/container-modules#referencing-from-other-modules
b
can the dependency be disabled but still build when necessary for the k8s module?
q
All results are cached so there would be no need to disable the module if I'm understanding your use-case correctly
That's the big benefit of Garden. Because everything is mapped to a directed acyclic graph, any dependent thing (Task, Test, image build, etc.) is only re-run when changed
b
yeah, sure 😄 i just wanted to disable the container module so that it doesn't deploy because it would double the functionality of the k8s module and more importantly deploy to undesirable namespaces. In short, I want to use the container module just to give me the image dynamically but deploy the image through k8s module only
q
Check out this bit of our docs where we discuss exactly your use-case but using the helm module 😊 https://docs.garden.io/guides/using-helm-charts#linking-container-modules-and-helm-modules
To recap: remove the service definition from your container module, link it to either a k8s or helm module and that should do the trick
Let me know if it works!
b
It worked out great! Would be even better if the artifact registry service account secret was copied over from the default namespace to the one this runs in but I figured it out manually, the rest is beautiful, thanks a lot and happy holidays
q
I'm so glad! Happy holidays ❄️. Please do submit any feature requests you'd like to see in open source Garden on our GitHub 🐇