<p>I have a kustomize transformer plugin that reads the value of serviceName in Ingress spec/rules/*/http/paths/0/backend/serviceName. The intent of the plugin is to update the host entries in the Ingress with the final serviceName after nameSuffix/namePrefix has been applied.</p>

<p>The plugins reads from stdin, but the state of the yaml isn't what I expected. The names of the Service and the Ingress have the nameSuffix/namePrefix applied, but the value of serviceName in the Ingress is still the raw service name. I verified this by dumping the Ingress yaml when the plugin executes. After the plugin runs, the final output does have the updated serviceName (with prefix/suffix). So something is running after the plugin that does the updating.</p>

<p>How do I configure the plugin so that it runs after the serviceName in the Ingress has been updated? </p>

Erick T
<p>According to this example: <a href="https://github.com/kubernetes-sigs/kustomize/tree/master/examples/transformerconfigs" rel="nofollow noreferrer">Transformer Configs</a></p>

<p><code>namePrefix</code> and <code>nameSuffix</code> have reference only:</p>

<pre><code> namePrefix:
- path: metadata/name
</code></pre>

<p>If you want to include <code>serviceName</code> to the <code>nameReference</code>, you can create, for example, a <code>kustomize-config.yml</code> file with the content:</p>

<pre><code>nameReference:
- kind: ServiceName
  fieldSpecs:
  - path: spec/rules/*/http/paths/0/backend/serviceName
    kind: Ingress
</code></pre>

<p>Then, on your <code>kustomization.yml</code> you need to reference it:</p>

<pre><code>configurations:
- kustomize-config.yml
</code></pre>

<p>Next time you run <code>kubectl kustomize .</code> or <code>kustomize build .</code>, you may see both Prefix and Suffix reflect also to <code>serviceName</code></p>
