So I have two separate projects, one deploys the UI and the other deploys the backend API. The common thing they share is a Kubernetes namespace. Is there a way to have either project deploy the namespace without each project trying to own it? I could create a third project that does the namespace but that is a bit.... cluttered
07/14/2022, 5:21 AM
There isn't a clean way to do this. You could create them in one, then import them in the other, but you can't create them in both (well, you can if you create them in the 2nd one with the import opt, then remove it).
A 3rd project, and stack references, is the idiomatic solution.
07/14/2022, 5:42 AM
I recommend to ask yourself the following questions:
1. Do UI & API need to be separate projects, i.e. are those stacks owned by different teams or do they have different lifecycles? If ownership and lifecycle are the same, I'd combine them into one single project. If ownership/lifecycle are separate, continue to question #2.
2. If UI & API need to be separate, should they maybe be in separate namespaces?
If you want to keep UI & API as separate projects but in the same namespace, I recommend to split the K8s cluster including the namespace out into a 3rd project and to use stack references to import relevant stack outputs in the UI & API projects.
07/14/2022, 12:58 PM
Thanks to both you you. I think I am going to go a slightly different way. I my mind the UI can not exist without the API but the API can exist on its own. So I am going to have the API "own" the namespace and have the UI stack refer to it via a stack reference as a requiredOutput to ensure the service was created before the UI
07/14/2022, 5:46 PM
@quiet-hairdresser-18834 That sounds like a good idea! 👍