Skip to content

Commit

Permalink
Update JSON 6902 patch for compatibility with older kubectl
Browse files Browse the repository at this point in the history
The inline patch technique only works on kubectl v1.21.0 and
later. While it is certainly much more convenient to write it
out in that manner, this uses the previously available technique
of referencing the location of a patch file to apply a patch,
thus ensuring greater compatibility.
  • Loading branch information
Jonathan S. Katz committed Jan 10, 2022
1 parent 099bc0c commit 9bb49e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 9 additions & 5 deletions kustomize/install/bases/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ patchesJson6902:
version: v1
kind: Deployment
name: pgo
patch: |-
- op: remove
path: /spec/selector/matchLabels/app.kubernetes.io~1name
- op: remove
path: /spec/selector/matchLabels/app.kubernetes.io~1version
path: ./patches/selectors.yaml
# path is used for compatibility with version of kubectl prior to v1.21.0.
# newer version of kubectl can use the inline patch below, which is the
# preferred method going forward.
# patch: |-
# - op: remove
# path: /spec/selector/matchLabels/app.kubernetes.io~1name
# - op: remove
# path: /spec/selector/matchLabels/app.kubernetes.io~1version
4 changes: 4 additions & 0 deletions kustomize/install/bases/patches/selectors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- op: remove
path: /spec/selector/matchLabels/app.kubernetes.io~1name
- op: remove
path: /spec/selector/matchLabels/app.kubernetes.io~1version

0 comments on commit 9bb49e6

Please sign in to comment.