<p>I have a scenario and was wondering the best way to structure it with Kustomize.</p>
<p>Say I have multiple environments: <code>dev</code>, <code>qa</code>, <code>prod</code></p>
<p>and say I have multiple DCs: <code>OnPrem</code>, <code>AWS</code>, <code>GCP</code></p>
<p>Let's say each DC above has a <code>dev</code>, <code>qa</code>, <code>prod</code> environment.</p>
<p>I have data that is per environment but also per DC. For example, apply this string to dev overlays but apply these, if AWS.</p>
<p>Is there a way to easily doing this without duplication. An example may be, say if it's AWS, I want to run an additional container in my pod, and if it's prod I want extra replicas. If it's GCP, I want a different image but if it's prod, I still want extra replicas.</p>
<p>The below example, will have a lot of duplication. I've read you can do multiple bases. Maybe it makes sense to have a <code>AWS</code>, <code>GCP</code>, <code>OnPrep</code> Base and then have a <code>dev</code>, <code>qa</code>, <code>prod</code> overlay and have mutiple Kustomize files for each?</p>
<p>ie</p>
<pre><code>├── base
│   ├── guestbook-ui-deployment.yaml
│   ├── guestbook-ui-svc.yaml
│   └── kustomization.yaml
└── overlay
    ├── dev
    │   ├── aws
    │   │   ├── guestbook-ui-deployment.yaml
    │   │   └── kustomization.yaml
    │   └── gcp
    │       ├── guestbook-ui-deployment.yaml
    │       └── kustomization.yaml
    └── qa
        ├── aws
        │   ├── guestbook-ui-deployment.yaml
        │   └── kustomization.yaml
        └── gcp
            ├── guestbook-ui-deployment.yaml
            └── kustomization.yaml
</code></pre>

CodyK
<p>I recommend having an overlay for each combination you want to build. e.g:</p>
<pre><code>└── overlays
    ├── aws-dev
    ├── aws-qa
    └── gcp-dev
</code></pre>
<p>Then you can structure in different ways, such as using components:</p>
<pre><code>└── components
    ├── environments
    │   ├── dev
    │   └── qa
    └── providers
        ├── aws
        └── gcp
</code></pre>
<p>This makes sense because you usually don't create all combinations of possible environments, but only some that make sense to you.</p>
<p>More documentation: <a href="https://github.com/kubernetes-sigs/kustomize/blob/master/examples/components.md" rel="nofollow noreferrer">https://github.com/kubernetes-sigs/kustomize/blob/master/examples/components.md</a></p>
