Skip to content

Commit d05d742

Browse files
committed
Update Kustomize deprecated syntax:
- patchesStrategicMerge -> patches - patchesJson6902 -> patches - vars and varReference -> replacements - bases -> resources and bump version Signed-off-by: Peppi-Lotta <peppi-lotta.saari@est.tech>
1 parent c0a1816 commit d05d742

File tree

98 files changed

+3242
-592
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+3242
-592
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ get_go_version = $(shell go list -m $1 | awk '{print $$2}')
104104
# Binaries.
105105
#
106106
# Note: Need to use abspath so we can invoke these from subdirectories
107-
KUSTOMIZE_VER := v4.5.2
107+
KUSTOMIZE_VER := v5.3.0
108108
KUSTOMIZE_BIN := kustomize
109109
KUSTOMIZE := $(abspath $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER))
110-
KUSTOMIZE_PKG := sigs.k8s.io/kustomize/kustomize/v4
110+
KUSTOMIZE_PKG := sigs.k8s.io/kustomize/kustomize/v5
111111

112112
SETUP_ENVTEST_VER := v0.0.0-20240215143116-d0396a3d6f9f
113113
SETUP_ENVTEST_BIN := setup-envtest

bootstrap/kubeadm/config/certmanager/certificate.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ metadata:
1515
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
1616
namespace: system
1717
spec:
18-
# $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize
18+
# SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize
1919
dnsNames:
20-
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc
21-
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local
20+
- SERVICE_NAME.SERVICE_NAMESPACE.svc
21+
- SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local
2222
issuerRef:
2323
kind: Issuer
2424
name: selfsigned-issuer
25-
secretName: $(SERVICE_NAME)-cert # this secret will not be prefixed, since it's not managed by kustomize
25+
secretName: capi-kubeadm-bootstrap-webhook-service-cert # this secret will not be prefixed, since it's not managed by kustomize
2626
subject:
2727
organizations:
28-
- k8s-sig-cluster-lifecycle
28+
- k8s-sig-cluster-lifecycle

bootstrap/kubeadm/config/certmanager/kustomizeconfig.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,3 @@ nameReference:
66
- kind: Certificate
77
group: cert-manager.io
88
path: spec/issuerRef/name
9-
10-
varReference:
11-
- kind: Certificate
12-
group: cert-manager.io
13-
path: spec/commonName
14-
- kind: Certificate
15-
group: cert-manager.io
16-
path: spec/dnsNames
17-
- kind: Certificate
18-
group: cert-manager.io
19-
path: spec/secretName
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
commonLabels:
2-
cluster.x-k8s.io/v1beta1: v1beta1
1+
labels:
2+
- includeSelectors: true
3+
pairs:
4+
cluster.x-k8s.io/v1beta1: v1beta1
35

46
# This kustomization.yaml is not intended to be run by itself,
57
# since it depends on service name and namespace that are out of this kustomize package.
68
# It should be run by config/
79
resources:
8-
- bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml
9-
- bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml
10+
- bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml
11+
- bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml
1012
# +kubebuilder:scaffold:crdkustomizeresource
1113

12-
patchesStrategicMerge:
14+
patches:
1315
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
1416
# patches here are for enabling the conversion webhook for each CRD
15-
- patches/webhook_in_kubeadmconfigs.yaml
16-
- patches/webhook_in_kubeadmconfigtemplates.yaml
17+
- path: patches/cainjection_in_kubeadmconfigs.yaml
18+
- path: patches/cainjection_in_kubeadmconfigtemplates.yaml
1719
# +kubebuilder:scaffold:crdkustomizewebhookpatch
1820

1921
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
2022
# patches here are for enabling the CA injection for each CRD
21-
- patches/cainjection_in_kubeadmconfigs.yaml
22-
- patches/cainjection_in_kubeadmconfigtemplates.yaml
23+
- path: patches/webhook_in_kubeadmconfigs.yaml
24+
- path: patches/webhook_in_kubeadmconfigtemplates.yaml
2325
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
2426

2527
# the following config is for teaching kustomize how to do kustomization for CRDs.
2628
configurations:
27-
- kustomizeconfig.yaml
29+
- kustomizeconfig.yaml

bootstrap/kubeadm/config/crd/kustomizeconfig.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@ namespace:
1313
path: spec/conversion/webhook/clientConfig/service/namespace
1414
create: false
1515

16-
varReference:
17-
- path: metadata/annotations

bootstrap/kubeadm/config/crd/patches/cainjection_in_kubeadmconfigs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: apiextensions.k8s.io/v1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
7+
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
88
name: kubeadmconfigs.bootstrap.cluster.x-k8s.io

bootstrap/kubeadm/config/crd/patches/cainjection_in_kubeadmconfigtemplates.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: apiextensions.k8s.io/v1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
7+
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
88
name: kubeadmconfigtemplates.bootstrap.cluster.x-k8s.io

bootstrap/kubeadm/config/crd/patches/webhook_in_kubeadmconfigs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ spec:
1515
caBundle: Cg==
1616
service:
1717
namespace: system
18-
name: webhook-service
18+
name: capi-kubeadm-bootstrap-webhook-service
1919
path: /convert

bootstrap/kubeadm/config/default/kustomization.yaml

Lines changed: 109 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,122 @@ namespace: capi-kubeadm-bootstrap-system
33

44
namePrefix: capi-kubeadm-bootstrap-
55

6-
commonLabels:
7-
cluster.x-k8s.io/provider: "bootstrap-kubeadm"
6+
labels:
7+
- includeSelectors: true
8+
pairs:
9+
cluster.x-k8s.io/provider: bootstrap-kubeadm
810

911
resources:
1012
- namespace.yaml
11-
12-
bases:
1313
- ../crd
1414
- ../rbac
1515
- ../manager
1616
- ../webhook
1717
- ../certmanager
1818

19-
patchesStrategicMerge:
20-
# Provide customizable hook for make targets.
21-
- manager_image_patch.yaml
22-
- manager_pull_policy.yaml
23-
# Enable webhook.
24-
- manager_webhook_patch.yaml
25-
# Inject certificate in the webhook definition.
26-
- webhookcainjection_patch.yaml
27-
28-
vars:
29-
- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
30-
objref:
31-
kind: Certificate
32-
group: cert-manager.io
33-
version: v1
34-
name: serving-cert # this name should match the one in certificate.yaml
35-
fieldref:
36-
fieldpath: metadata.namespace
37-
- name: CERTIFICATE_NAME
38-
objref:
39-
kind: Certificate
40-
group: cert-manager.io
41-
version: v1
42-
name: serving-cert # this name should match the one in certificate.yaml
43-
- name: SERVICE_NAMESPACE # namespace of the service
44-
objref:
45-
kind: Service
46-
version: v1
47-
name: webhook-service
48-
fieldref:
49-
fieldpath: metadata.namespace
50-
- name: SERVICE_NAME
51-
objref:
52-
kind: Service
53-
version: v1
54-
name: webhook-service
19+
patches:
20+
# Provide customizable hook for make targets.
21+
- path: manager_image_patch.yaml
22+
- path: manager_pull_policy.yaml
23+
# Enable webhook.
24+
- path: manager_webhook_patch.yaml
25+
# Inject certificate in the webhook definition.
26+
- path: webhookcainjection_patch.yaml
5527

56-
configurations:
57-
- kustomizeconfig.yaml
28+
replacements:
29+
- source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs
30+
kind: Certificate
31+
group: cert-manager.io
32+
version: v1
33+
name: serving-cert # this name should match the one in certificate.yaml
34+
fieldPath: .metadata.namespace # namespace of the certificate CR
35+
targets:
36+
- select:
37+
kind: ValidatingWebhookConfiguration
38+
fieldPaths:
39+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
40+
options:
41+
delimiter: '/'
42+
index: 0
43+
create: true
44+
- select:
45+
kind: MutatingWebhookConfiguration
46+
fieldPaths:
47+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
48+
options:
49+
delimiter: '/'
50+
index: 0
51+
create: true
52+
- select:
53+
kind: CustomResourceDefinition
54+
fieldPaths:
55+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
56+
options:
57+
delimiter: '/'
58+
index: 0
59+
create: true
60+
- source:
61+
kind: Certificate
62+
group: cert-manager.io
63+
version: v1
64+
name: serving-cert # this name should match the one in certificate.yaml
65+
fieldPath: .metadata.name
66+
targets:
67+
- select:
68+
kind: ValidatingWebhookConfiguration
69+
fieldPaths:
70+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
71+
options:
72+
delimiter: '/'
73+
index: 1
74+
create: true
75+
- select:
76+
kind: MutatingWebhookConfiguration
77+
fieldPaths:
78+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
79+
options:
80+
delimiter: '/'
81+
index: 1
82+
create: true
83+
- select:
84+
kind: CustomResourceDefinition
85+
fieldPaths:
86+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
87+
options:
88+
delimiter: '/'
89+
index: 1
90+
create: true
91+
- source: # Add cert-manager annotation to the webhook Service
92+
kind: Service
93+
version: v1
94+
name: webhook-service
95+
fieldPath: .metadata.name # namespace of the service
96+
targets:
97+
- select:
98+
kind: Certificate
99+
group: cert-manager.io
100+
version: v1
101+
fieldPaths:
102+
- .spec.dnsNames.0
103+
- .spec.dnsNames.1
104+
options:
105+
delimiter: '.'
106+
index: 0
107+
create: true
108+
- source:
109+
kind: Service
110+
version: v1
111+
name: webhook-service
112+
fieldPath: .metadata.namespace # namespace of the service
113+
targets:
114+
- select:
115+
kind: Certificate
116+
group: cert-manager.io
117+
version: v1
118+
fieldPaths:
119+
- .spec.dnsNames.0
120+
- .spec.dnsNames.1
121+
options:
122+
delimiter: '.'
123+
index: 1
124+
create: true

bootstrap/kubeadm/config/default/kustomizeconfig.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)