3

Here's my directory structure:

|- base
|  |- file1.yaml
|  |- file2.yaml
|  |- kustomization.yaml
|- overlays
   |- nofile2
      |- kustomization.yaml
      |- nofile2.yaml

base/kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - file1.yaml
  - file2.yaml

Desired behavior: when I apply the Kustomization in overlays/nofile2, I want to run the kustomization in base, but I want to remove file2.yaml from the resources. So, I tried this for overlays/nofile2/kustomization.yaml:

resources:
  - ../../base
patches:
  - target:
      kind: Kustomization
    path: nofile2.yaml

And in nofile2.yaml:

- op: delete
  path: /resources/1

But when I run kustomize build overlays/nofile2, the output is identical to when I build the base kustomization.

What am I doing wrong here? And is there a better way to kustomize kustomizations?

Shaul Behr
  • 36,951
  • 69
  • 249
  • 387

0 Answers0