<p>For CI/CD purposes, the project is maintaining 2 kustomization.yaml files</p>
<ol>
<li>Regular deployments - kustomization_deploy.yaml</li>
<li>Rollback deployment - kustomization_rollback.yaml</li>
</ol>
<p>To run kustomize build, a file with the name &quot;kustomization.yaml&quot; is required in the current directory.
If the project wants to use kustomization_rollback.yaml and NOT kustomization.yaml, how is this possible? Does kustomize accept file name as an argument? Docs do not specify anything on this.</p>

<p>Currently there is no possibility to change the behavior of <code>kustomize</code> to support other file names (by using precompiled binaries) than:</p>
<ul>
<li><code>kustomization.yaml</code></li>
<li><code>kustomization.yml</code></li>
<li><code>Kustomization</code></li>
</ul>
<p>All of the below cases will produce the same error output:</p>
<ul>
<li><code>kubectl kustomize dir/</code></li>
<li><code>kubectl apply -k dir/</code></li>
<li><code>kustomize build dir/</code></li>
</ul>
<pre class="lang-sh prettyprint-override"><code>Error: unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization' in directory 'FULL_PATH/dir'
</code></pre>
<p>Depending on the CI/CD platform/solution/tool you should try other way around like for example:</p>
<ul>
<li>split the <code>Deployment</code> into 2 directories <code>kustomization_deploy</code>/<code>kustomization_rollback</code> with <code>kustomization.yaml</code></li>
</ul>
<hr />
<blockquote>
<p>As a side note!</p>
<p>File names that kustomize uses are placed in the:</p>
<ul>
<li><code>/kubernetes/vendor/sigs.k8s.io/kustomize/pkg/constants/constants.go</code></li>
</ul>
<pre class="lang-golang prettyprint-override"><code>// Package constants holds global constants for the kustomize tool.
package constants

// KustomizationFileNames is a list of filenames that can be recognized and consumbed
// by Kustomize.
// In each directory, Kustomize searches for file with the name in this list.
// Only one match is allowed.
var KustomizationFileNames = []string{
  &quot;kustomization.yaml&quot;,
  &quot;kustomization.yml&quot;,
  &quot;Kustomization&quot;,
}
</code></pre>
<p>The logic behind choosing the <code>Kustomization</code> file is placed in:</p>
<ul>
<li><code>/kubernetes/vendor/sigs.k8s.io/kustomize/pkg/target/kusttarget.go</code></li>
</ul>
</blockquote>
<hr />
<p>Additional reference:</p>
<ul>
<li><em><a href="https://github.com/kubernetes-sigs/kustomize" rel="noreferrer">Github.com: Kubernetes-sigs: Kustomize</a></em></li>
<li><em><a href="https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/" rel="noreferrer">Kubernetes.io: Docs: Tasks: Manage kubernetes objects: Kustomization</a></em></li>
</ul>
