Skip to content

Commit 19c0caa

Browse files
authored
🐛 (kustomize/v2,go/v4): Remove use of deprecated patchesStrategicMerge / ✨ Upgrade kustomize version from v5.1.1 to v5.2.1 (#3661)
Remove use of deprecated patchesStrategicMerge It also needed to bump version of kustomize to v5.2.1 in order to support multiple patches in a single file. (config/default/webhookcainjection_- patch.yaml)
1 parent a64e9ba commit 19c0caa

File tree

19 files changed

+47
-47
lines changed

19 files changed

+47
-47
lines changed

docs/book/src/component-config-tutorial/testdata/project/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
155155
ENVTEST ?= $(LOCALBIN)/setup-envtest
156156

157157
## Tool Versions
158-
KUSTOMIZE_VERSION ?= v5.1.1
158+
KUSTOMIZE_VERSION ?= v5.2.1
159159
CONTROLLER_TOOLS_VERSION ?= v0.13.0
160160

161161
.PHONY: kustomize

docs/book/src/component-config-tutorial/testdata/project/config/default/kustomization.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@ resources:
2626
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2727
#- ../prometheus
2828

29-
patchesStrategicMerge:
29+
patches:
3030
# Protect the /metrics endpoint by putting it behind auth.
3131
# If you want your controller-manager to expose the /metrics
3232
# endpoint w/o any authn/z, please comment the following line.
33-
- manager_auth_proxy_patch.yaml
33+
- path: manager_auth_proxy_patch.yaml
3434

3535
# Mount the controller config file for loading manager configurations
3636
# through a ComponentConfig type
37-
- manager_config_patch.yaml
37+
- path: manager_config_patch.yaml
3838

3939
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
4040
# crd/kustomization.yaml
41-
#- manager_webhook_patch.yaml
41+
#- path: manager_webhook_patch.yaml
4242

4343
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
4444
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
4545
# 'CERTMANAGER' needs to be enabled to use ca injection
46-
#- webhookcainjection_patch.yaml
46+
#- path: webhookcainjection_patch.yaml
4747

4848
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
4949
# Uncomment the following replacements to add the cert-manager CA injection annotations

docs/book/src/cronjob-tutorial/testdata/project/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
155155
ENVTEST ?= $(LOCALBIN)/setup-envtest
156156

157157
## Tool Versions
158-
KUSTOMIZE_VERSION ?= v5.1.1
158+
KUSTOMIZE_VERSION ?= v5.2.1
159159
CONTROLLER_TOOLS_VERSION ?= v0.13.0
160160

161161
.PHONY: kustomize

docs/book/src/cronjob-tutorial/testdata/project/config/default/kustomization.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ resources:
2626
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2727
- ../prometheus
2828

29-
patchesStrategicMerge:
29+
patches:
3030
# Protect the /metrics endpoint by putting it behind auth.
3131
# If you want your controller-manager to expose the /metrics
3232
# endpoint w/o any authn/z, please comment the following line.
33-
- manager_auth_proxy_patch.yaml
33+
- path: manager_auth_proxy_patch.yaml
3434

3535
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
3636
# crd/kustomization.yaml
37-
- manager_webhook_patch.yaml
37+
- path: manager_webhook_patch.yaml
3838

3939
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
4040
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
4141
# 'CERTMANAGER' needs to be enabled to use ca injection
42-
- webhookcainjection_patch.yaml
42+
- path: webhookcainjection_patch.yaml
4343

4444
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
4545
# Uncomment the following replacements to add the cert-manager CA injection annotations

hack/docs/internal/cronjob-tutorial/generate_cronjob.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ func updateKustomization(sp *Sample) {
549549

550550
err = pluginutil.UncommentCode(
551551
filepath.Join(sp.ctx.Dir, "config/default/kustomization.yaml"),
552-
`#- webhookcainjection`, `#`)
552+
`#- path: webhookcainjection`, `#`)
553553
CheckError("fixing default/kustomization", err)
554554

555555
err = pluginutil.UncommentCode(

pkg/plugins/common/kustomize/v2/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
)
2626

2727
// KustomizeVersion is the kubernetes-sigs/kustomize version to be used in the project
28-
const KustomizeVersion = "v5.1.1"
28+
const KustomizeVersion = "v5.2.1"
2929

3030
const pluginName = "kustomize.common." + plugins.DefaultNameQualifier
3131

pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/kustomization.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,27 +72,27 @@ resources:
7272
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
7373
#- ../prometheus
7474
75-
patchesStrategicMerge:
75+
patches:
7676
# Protect the /metrics endpoint by putting it behind auth.
7777
# If you want your controller-manager to expose the /metrics
7878
# endpoint w/o any authn/z, please comment the following line.
79-
- manager_auth_proxy_patch.yaml
79+
- path: manager_auth_proxy_patch.yaml
8080
8181
{{ if .ComponentConfig -}}
8282
# Mount the controller config file for loading manager configurations
8383
# through a ComponentConfig type
84-
- manager_config_patch.yaml
84+
- path: manager_config_patch.yaml
8585
8686
{{ end -}}
8787
8888
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
8989
# crd/kustomization.yaml
90-
#- manager_webhook_patch.yaml
90+
#- path: manager_webhook_patch.yaml
9191
9292
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
9393
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
9494
# 'CERTMANAGER' needs to be enabled to use ca injection
95-
#- webhookcainjection_patch.yaml
95+
#- path: webhookcainjection_patch.yaml
9696
9797
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
9898
# Uncomment the following replacements to add the cert-manager CA injection annotations

pkg/plugins/common/kustomize/v2/scaffolds/webhook.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ func (s *webhookScaffolder) Scaffold() error {
9696
}
9797
}
9898

99-
err = pluginutil.UncommentCode(kustomizeFilePath, "#- manager_webhook_patch.yaml", `#`)
99+
err = pluginutil.UncommentCode(kustomizeFilePath, "#- path: manager_webhook_patch.yaml", `#`)
100100
if err != nil {
101-
hasWebHookUncommented, err := pluginutil.HasFragment(kustomizeFilePath, "- manager_webhook_patch.yaml")
101+
hasWebHookUncommented, err := pluginutil.HasFragment(kustomizeFilePath, "- path: manager_webhook_patch.yaml")
102102
if !hasWebHookUncommented || err != nil {
103-
log.Errorf("Unable to find the target #- manager_webhook_patch.yaml to uncomment in the file "+
103+
log.Errorf("Unable to find the target #- path: manager_webhook_patch.yaml to uncomment in the file "+
104104
"%s.", kustomizeFilePath)
105105
}
106106
}

test/e2e/v4/generate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func GenerateV4(kbc *utils.TestContext) {
6262
"#- ../prometheus", "#")).To(Succeed())
6363
ExpectWithOffset(1, pluginutil.UncommentCode(
6464
filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"),
65-
"#- webhookcainjection_patch.yaml", "#")).To(Succeed())
65+
"#- path: webhookcainjection_patch.yaml", "#")).To(Succeed())
6666
ExpectWithOffset(1, pluginutil.UncommentCode(filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"),
6767
certManagerTarget, "#")).To(Succeed())
6868

testdata/project-v4-multigroup-with-deploy-image/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
155155
ENVTEST ?= $(LOCALBIN)/setup-envtest
156156

157157
## Tool Versions
158-
KUSTOMIZE_VERSION ?= v5.1.1
158+
KUSTOMIZE_VERSION ?= v5.2.1
159159
CONTROLLER_TOOLS_VERSION ?= v0.13.0
160160

161161
.PHONY: kustomize

0 commit comments

Comments
 (0)