Skip to content

Commit 9bb49e6

Browse files
author
Jonathan S. Katz
committed
Update JSON 6902 patch for compatibility with older kubectl
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.
1 parent 099bc0c commit 9bb49e6

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

kustomize/install/bases/kustomization.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ patchesJson6902:
2121
version: v1
2222
kind: Deployment
2323
name: pgo
24-
patch: |-
25-
- op: remove
26-
path: /spec/selector/matchLabels/app.kubernetes.io~1name
27-
- op: remove
28-
path: /spec/selector/matchLabels/app.kubernetes.io~1version
24+
path: ./patches/selectors.yaml
25+
# path is used for compatibility with version of kubectl prior to v1.21.0.
26+
# newer version of kubectl can use the inline patch below, which is the
27+
# preferred method going forward.
28+
# patch: |-
29+
# - op: remove
30+
# path: /spec/selector/matchLabels/app.kubernetes.io~1name
31+
# - op: remove
32+
# path: /spec/selector/matchLabels/app.kubernetes.io~1version
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- op: remove
2+
path: /spec/selector/matchLabels/app.kubernetes.io~1name
3+
- op: remove
4+
path: /spec/selector/matchLabels/app.kubernetes.io~1version

0 commit comments

Comments
 (0)