<p>I've got this ingress.yaml base configuration:</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  labels:
    sia: aza
    app: asap-ingress-internal
  name: asap-ingress-internal
  annotations:
    kubernetes.io/ingress.class: &quot;nginx-external&quot;
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
spec:
  rules:
    - host: the-host-value
      http:
        paths:
          - path: /asap-srv-template/(.*)
            backend:
              serviceName: asap-srv-template
              servicePort: 8080
</code></pre>
<p>And want to replace the spec.rules.host value only (and keep all http.paths as is.</p>
<p>So I create a env-var.yaml like this :</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: asap-ingress-internal
spec:
  rules:
    - host: the.real.hostname
</code></pre>
<p>But the result is the following:</p>
<pre><code>$ kustomize build
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx-external
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
  labels:
    app: asap-ingress-internal
    env: dev
    sia: aza
  name: asap-ingress-internal
  namespace: aza-72461-dev
spec:
  rules:
  - host: the.real.hostname
</code></pre>
<p>I have lost all http.paths configuration and I can't find out how to do.</p>
<p>I tried with patches: or patchesStrategicMerge in kustomization.yaml but the result is always the same.</p>
<p>Any help would be greatly appreciated</p>

jmcollin92
<p>You can use a json patch for this, below is an example.</p>
<p>Here is an example <code>kustomization.yaml</code>. It will call out a patch in the <code>patches</code> section:</p>
<pre><code>apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../base/app1

patches:
- target:
    kind: Ingress
    name: my-ingress
  path: ingress-patch.json  
</code></pre>
<p>Here would be an example <code>ingress-patch.json</code>:</p>
<pre><code>[
    { 
        &quot;op&quot;: &quot;replace&quot;, 
        &quot;path&quot;: &quot;/spec/rules/0/host&quot;, 
        &quot;value&quot;: &quot;the.real.hostname&quot;
    }
]
</code></pre>
