Skip to content

Instantly share code, notes, and snippets.

@iainsproat
Created December 15, 2022 15:42
Show Gist options
  • Save iainsproat/6398526fd1a9bf9eece320a6a8a843d5 to your computer and use it in GitHub Desktop.
Save iainsproat/6398526fd1a9bf9eece320a6a8a843d5 to your computer and use it in GitHub Desktop.
Kustomize delete a single key from a map. The key includes a backslash / character
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
patchesJson6902:
# deletes a single label from a kubernetes resource.
# the label includes a slash '/' character
# we replace the '/' character with '~1'.
- target:
version: v1
kind: Namespace
name: my-namespace
patch: |-
- op: remove
path: "/metadata/labels/pod-security.kubernetes.io~1enforce"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment