HiveBrain v1.2.0
Get Started
← Back to all entries
patternkubernetesMinor

Remove resource from Kustomize base?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
kustomizeresourceremovefrombase

Problem

I have a kustomize base that I'd like to re-use without editing it. Unfortunately, it creates a namespace I don't want to create. I'd like to simply remove that resource from consideration when compiling the manifests and add a resource for mine since I can't patch a namespace to change the name.

How can this be done?

Solution

You can remove specified manifest using 'patchesStrategicMerge' as following:

patchesStrategicMerge:
- |-
  apiVersion: v1
  kind: Namespace
  metadata:
    name: unwanted-namespace
  $patch: delete

Code Snippets

patchesStrategicMerge:
- |-
  apiVersion: v1
  kind: Namespace
  metadata:
    name: unwanted-namespace
  $patch: delete

Context

StackExchange DevOps Q#12796, answer score: 5

Revisions (0)

No revisions yet.