<p>I'm not sure how to phrase this so I apologize if the title of the question does not make sense to you.</p>
<p>Due to various historical reasons, I have multiple teams contribute to the same code repo, that serves multiple service endpoints. Currently all teams deployments and releases are done together which creates a lot of churn.</p>
<p>I'm trying to get to this state: team A and B can still share the same code base, but they can deploy separately using different Kubernetes namespace? Like:</p>
<ul>
<li>Team A's code is all under <code>com/mycompany/team_a</code>, team B's under <code>com/mycompany/team_b</code></li>
<li>Somewhere in the repo there is a config that does the mapping:
<ul>
<li><code>com/mycompany/team_a/*</code> =&gt; <code>config_team_a.yaml</code>, that has a Kubernetes config, maybe with namespace <code>TeamA/ServiceA</code></li>
<li><code>com/mycompany/team_b/*</code> =&gt; <code>config_team_b.yaml</code> with namespace <code>TeamB/ServiceB</code></li>
</ul>
</li>
</ul>
<p>So that they can build their image separately and, of course, deploy separately.</p>

EmptyStackEngineer
<p>Correct me if I'm wrong, but from the description of your problem it looks like you actually have two problems:</p>
<ul>
<li>The fact that you have separate services code in the same repo (team A and team B);</li>
<li>The fact that you have several environments (development/production, for example)</li>
</ul>
<p>The second issue can be easily solved if you use <a href="https://helm.sh/" rel="nofollow noreferrer">Helm</a>, for example. It allows you to template your builds and pass different configs to it.
The first one, can also be partly solved by helm, since you can also separate your teams builds using templating.</p>
<p>However, a few years ago, I was working on a .net monorepo and faced yet another problem: every time there was a PR merged to our git repo, a build was triggered in Jenkins for every service we had, even those that did not have changes. From the description of your problem, it is not clear to me if you have a Jenkins pipeline configured and/or if you are also facing something similar, but if you are, you can have a look at what I did to workaround the issue: <a href="https://github.com/pgeadas/jenkinssharedlibrary/blob/master/src/com/pgeadas/K8sUtilities.groovy" rel="nofollow noreferrer">repo</a>. Feel free to have a look and I hope that helps.</p>
