Search code examples
kuberneteskustomize

How to make Kustomize overlay ignore secretGenerator in base?


I'm writing Kustomize configs for several apps and using overlays to overwrite a base configuration for staging and production environments. The base config creates a secret from a file called dev.json and names that secret -dev-config. The staging environment also runs in dev mode and uses the same secret. Production creates a secret from a file named production.json and names that file -prod-config.

When I spin up an app in the production environment, the dev secret and the prod secret are being created. What do I need to add to the prod kustomization.yaml to tell it to ignore the base secretGenerator? It doesn't seem like that much of a security hole to have the dev config on the prod servers, but I'd like to avoid it anyway.


Solution

  • I don’t think you can. You would move the dev config to a dev overlay instead. If you really don’t want to, you can use a jsonpatch to delete the content.