Skip to content

Commit cf602c2

Browse files
authored
Merge pull request #4737 from RadekManak/kustomize-5
Update Kustomize to v5.4.1
2 parents abd3c08 + 8e51201 commit cf602c2

19 files changed

+191
-136
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ GOLANGCI_LINT_VER := v1.55.2
8585
GOLANGCI_LINT_BIN := golangci-lint
8686
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
8787

88-
KUSTOMIZE_VER := v4.5.2
88+
KUSTOMIZE_VER := v5.4.1
8989
KUSTOMIZE_BIN := kustomize
9090
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)
9191

@@ -755,7 +755,7 @@ $(GOLANGCI_LINT): ## Build golangci-lint from tools folder.
755755
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/golangci/golangci-lint/cmd/golangci-lint $(GOLANGCI_LINT_BIN) $(GOLANGCI_LINT_VER)
756756

757757
$(KUSTOMIZE): ## Build kustomize from tools folder.
758-
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) sigs.k8s.io/kustomize/kustomize/v4 $(KUSTOMIZE_BIN) $(KUSTOMIZE_VER)
758+
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) sigs.k8s.io/kustomize/kustomize/v5 $(KUSTOMIZE_BIN) $(KUSTOMIZE_VER)
759759

760760
$(MOCKGEN): ## Build mockgen from tools folder.
761761
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) go.uber.org/mock/mockgen $(MOCKGEN_BIN) $(MOCKGEN_VER)

config/aso/kustomization.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@ resources:
66
- crds.yaml
77
- settings.yaml
88

9-
patchesStrategicMerge:
10-
- patches/visualizer_label_in_bastionhosts.yaml
11-
- patches/visualizer_label_in_extensions.yaml
12-
- patches/visualizer_label_in_fleetmembers.yaml
13-
- patches/visualizer_label_in_managedclusteragentpools.yaml
14-
- patches/visualizer_label_in_managed_clusters.yaml
15-
- patches/visualizer_label_in_natgateways.yaml
16-
- patches/visualizer_label_in_privateendpoints.yaml
17-
- patches/visualizer_label_in_resourcegroups.yaml
18-
- patches/visualizer_label_in_subnets.yaml
19-
- patches/visualizer_label_in_virtualnetworks.yaml
20-
219
patches:
10+
- path: patches/visualizer_label_in_bastionhosts.yaml
11+
- path: patches/visualizer_label_in_extensions.yaml
12+
- path: patches/visualizer_label_in_fleetmembers.yaml
13+
- path: patches/visualizer_label_in_managedclusteragentpools.yaml
14+
- path: patches/visualizer_label_in_managed_clusters.yaml
15+
- path: patches/visualizer_label_in_natgateways.yaml
16+
- path: patches/visualizer_label_in_privateendpoints.yaml
17+
- path: patches/visualizer_label_in_resourcegroups.yaml
18+
- path: patches/visualizer_label_in_subnets.yaml
19+
- path: patches/visualizer_label_in_virtualnetworks.yaml
2220
- patch: |- # default kustomization includes a namespace already
2321
$patch: delete
2422
apiVersion: v1
@@ -48,6 +46,7 @@ replacements:
4846
targets:
4947
- select:
5048
version: v1
49+
annotationSelector: cert-manager.io/inject-ca-from
5150
fieldPaths:
5251
- metadata.annotations.cert-manager\.io/inject-ca-from
5352
options:

config/capz/kustomization.yaml

Lines changed: 107 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,119 @@ namespace: capz-system
33
namePrefix: capz-
44

55
# Labels to add to all resources and selectors.
6-
commonLabels:
7-
cluster.x-k8s.io/provider: "infrastructure-azure"
6+
labels:
7+
- includeSelectors: true
8+
pairs:
9+
cluster.x-k8s.io/provider: infrastructure-azure
810

911
resources:
10-
- namespace.yaml
11-
12-
bases:
13-
- ../crd
14-
- ../rbac
15-
- ../manager
16-
- ../webhook
17-
- ../certmanager
18-
19-
patchesStrategicMerge:
20-
- manager_image_patch.yaml
21-
- manager_pull_policy.yaml
22-
- manager_webhook_patch.yaml
23-
- webhookcainjection_patch.yaml
24-
25-
vars:
26-
- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
27-
objref:
28-
kind: Certificate
12+
- namespace.yaml
13+
- ../crd
14+
- ../rbac
15+
- ../manager
16+
- ../webhook
17+
- ../certmanager
18+
19+
patches:
20+
- path: manager_image_patch.yaml
21+
- path: manager_pull_policy.yaml
22+
- path: manager_webhook_patch.yaml
23+
- path: validatingwebhookcainjection_patch.yaml
24+
- path: mutatingwebhookcainjection_patch.yaml
25+
26+
configurations:
27+
- kustomizeconfig.yaml
28+
29+
replacements:
30+
- source: # CERTIFICATE_NAMESPACE
31+
fieldPath: metadata.namespace
32+
kind: Certificate
33+
name: serving-cert
34+
targets:
35+
- fieldPaths:
36+
- metadata.annotations.[cert-manager.io/inject-ca-from]
37+
options:
38+
delimiter: /
39+
select:
40+
annotationSelector: cert-manager.io/inject-ca-from
41+
- source: # CERTIFICATE_NAME
42+
kind: Certificate
43+
name: serving-cert
44+
targets:
45+
- fieldPaths:
46+
- metadata.annotations.[cert-manager.io/inject-ca-from]
47+
options:
48+
delimiter: /
49+
index: 1
50+
select:
51+
annotationSelector: cert-manager.io/inject-ca-from
52+
53+
- source: # SERVICE_NAMESPACE
54+
fieldPath: metadata.namespace
55+
kind: Service
56+
name: webhook-service
57+
targets:
58+
- fieldPaths:
59+
- spec.dnsNames.0
60+
options:
61+
delimiter: .
62+
index: 1
63+
select:
2964
group: cert-manager.io
65+
kind: Certificate
66+
name: serving-cert
67+
namespace: system
3068
version: v1
31-
name: serving-cert # this name should match the one in certificate.yaml
32-
fieldref:
33-
fieldpath: metadata.namespace
34-
- name: CERTIFICATE_NAME
35-
objref:
69+
- fieldPaths:
70+
- spec.dnsNames.1
71+
options:
72+
delimiter: .
73+
index: 1
74+
select:
75+
group: cert-manager.io
3676
kind: Certificate
77+
name: serving-cert
78+
namespace: system
79+
version: v1
80+
81+
- source: # SERVICE_NAME
82+
kind: Service
83+
name: webhook-service
84+
targets:
85+
- fieldPaths:
86+
- spec.dnsNames.0
87+
options:
88+
delimiter: .
89+
select:
3790
group: cert-manager.io
91+
kind: Certificate
92+
name: serving-cert
93+
namespace: system
3894
version: v1
39-
name: serving-cert # this name should match the one in certificate.yaml
40-
- name: SERVICE_NAMESPACE # namespace of the service
41-
objref:
42-
kind: Service
95+
- fieldPaths:
96+
- spec.dnsNames.1
97+
options:
98+
delimiter: .
99+
select:
100+
group: cert-manager.io
101+
kind: Certificate
102+
name: serving-cert
103+
namespace: system
43104
version: v1
44-
name: webhook-service
45-
fieldref:
46-
fieldpath: metadata.namespace
47-
- name: SERVICE_NAME
48-
objref:
49-
kind: Service
105+
- fieldPaths:
106+
- spec.secretName
107+
options:
108+
delimiter: '-'
109+
select:
110+
group: cert-manager.io
111+
kind: Certificate
112+
name: serving-cert
113+
namespace: system
50114
version: v1
51-
name: webhook-service
52-
53-
configurations:
54-
- kustomizeconfig.yaml
115+
- fieldPaths:
116+
- spec.template.spec.volumes.0.secret.secretName
117+
options:
118+
delimiter: '-'
119+
select:
120+
name: controller-manager
121+
namespace: system

config/capz/manager_webhook_patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ spec:
2020
- name: cert
2121
secret:
2222
defaultMode: 420
23-
secretName: $(SERVICE_NAME)-cert
23+
secretName: SERVICE_NAME_PLACEHOLDER-cert
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This patch add annotation to admission webhook config and
2+
# the variables CERTIFICATE_NAMESPACE and CERTIFICATE_NAME will be substituted by kustomize.
3+
apiVersion: admissionregistration.k8s.io/v1
4+
kind: MutatingWebhookConfiguration
5+
metadata:
6+
name: mutating-webhook-configuration
7+
annotations:
8+
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE_PLACEHOLDER/CERTIFICATE_NAME_PLACEHOLDER
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This patch add annotation to admission webhook config and
2+
# the variables CERTIFICATE_NAMESPACE and CERTIFICATE_NAME will be substituted by kustomize.
3+
apiVersion: admissionregistration.k8s.io/v1
4+
kind: ValidatingWebhookConfiguration
5+
metadata:
6+
name: validating-webhook-configuration
7+
annotations:
8+
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE_PLACEHOLDER/CERTIFICATE_NAME_PLACEHOLDER

config/capz/webhookcainjection_patch.yaml

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

config/certmanager/certificate.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ metadata:
1414
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
1515
namespace: system
1616
spec:
17-
# $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize
1817
dnsNames:
19-
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc
20-
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local
18+
- SERVICE_NAME_PLACEHOLDER.SERVICE_NAMESPACE_PLACEHOLDER.svc
19+
- SERVICE_NAME_PLACEHOLDER.SERVICE_NAMESPACE_PLACEHOLDER.svc.cluster.local
2120
issuerRef:
2221
kind: Issuer
2322
name: selfsigned-issuer
24-
secretName: $(SERVICE_NAME)-cert
23+
secretName: SERVICE_NAME_PLACEHOLDER-cert

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

config/crd/kustomization.yaml

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,54 +25,54 @@ resources:
2525
# +kubebuilder:scaffold:crdkustomizeresource
2626

2727

28-
patchesStrategicMerge:
28+
patches:
2929
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
3030
# patches here are for enabling the conversion webhook for each CRD
31-
- patches/webhook_in_azuremachines.yaml
32-
- patches/webhook_in_azureclusters.yaml
33-
- patches/webhook_in_azureclustertemplates.yaml
34-
- patches/webhook_in_azureclusteridentities.yaml
35-
- patches/webhook_in_azuremachinetemplates.yaml
36-
- patches/webhook_in_azuremachinepools.yaml
37-
- patches/webhook_in_azuremachinepoolmachines.yaml
38-
# - patches/webhook_in_azuremanagedmachinepools.yaml
39-
# - patches/webhook_in_azuremanagedclusters.yaml
40-
# - patches/webhook_in_azuremanagedcontrolplanes.yaml
31+
- path: patches/webhook_in_azuremachines.yaml
32+
- path: patches/webhook_in_azureclusters.yaml
33+
- path: patches/webhook_in_azureclustertemplates.yaml
34+
- path: patches/webhook_in_azureclusteridentities.yaml
35+
- path: patches/webhook_in_azuremachinetemplates.yaml
36+
- path: patches/webhook_in_azuremachinepools.yaml
37+
- path: patches/webhook_in_azuremachinepoolmachines.yaml
38+
# - path: patches/webhook_in_azuremanagedmachinepools.yaml
39+
# - path: patches/webhook_in_azuremanagedclusters.yaml
40+
# - path: patches/webhook_in_azuremanagedcontrolplanes.yaml
4141
# +kubebuilder:scaffold:crdkustomizewebhookpatch
4242

4343
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
4444
# patches here are for enabling the CA injection for each CRD
45-
- patches/cainjection_in_azuremachines.yaml
46-
- patches/cainjection_in_azureclusters.yaml
47-
- patches/cainjection_in_azureclustertemplates.yaml
48-
- patches/cainjection_in_azureclusteridentities.yaml
49-
- patches/cainjection_in_azuremachinetemplates.yaml
50-
- patches/cainjection_in_azuremachinepools.yaml
51-
- patches/cainjection_in_azuremachinepoolmachines.yaml
52-
# - patches/cainjection_in_azuremanagedmachinepools.yaml
53-
# - patches/cainjection_in_azuremanagedclusters.yaml
54-
# - patches/cainjection_in_azuremanagedcontrolplanes.yaml
45+
- path: patches/cainjection_in_azuremachines.yaml
46+
- path: patches/cainjection_in_azureclusters.yaml
47+
- path: patches/cainjection_in_azureclustertemplates.yaml
48+
- path: patches/cainjection_in_azureclusteridentities.yaml
49+
- path: patches/cainjection_in_azuremachinetemplates.yaml
50+
- path: patches/cainjection_in_azuremachinepools.yaml
51+
- path: patches/cainjection_in_azuremachinepoolmachines.yaml
52+
# - path: patches/cainjection_in_azuremanagedmachinepools.yaml
53+
# - path: patches/cainjection_in_azuremanagedclusters.yaml
54+
# - path: patches/cainjection_in_azuremanagedcontrolplanes.yaml
5555
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
5656

57-
- patches/capicontract_in_azuremachines.yaml
58-
- patches/capicontract_in_azureclusters.yaml
59-
- patches/capicontract_in_azureclustertemplates.yaml
60-
- patches/capicontract_in_azuremachinetemplates.yaml
61-
- patches/capicontract_in_azureclusteridentities.yaml
62-
- patches/capicontract_in_azuremachinepools.yaml
63-
- patches/capicontract_in_azuremanagedmachinepools.yaml
64-
- patches/capicontract_in_azuremanagedclusters.yaml
65-
- patches/capicontract_in_azuremanagedcontrolplanes.yaml
66-
- patches/capicontract_in_azuremachinepoolmachines.yaml
67-
- patches/capicontract_in_azuremanagedclustertemplates.yaml
68-
- patches/capicontract_in_azuremanagedcontrolplanetemplates.yaml
69-
- patches/capicontract_in_azuremanagedmachinepooltemplates.yaml
70-
- patches/capicontract_in_azureasomanagedclusters.yaml
71-
- patches/capicontract_in_azureasomanagedclustertemplates.yaml
72-
- patches/capicontract_in_azureasomanagedcontrolplanes.yaml
73-
- patches/capicontract_in_azureasomanagedcontrolplanetemplates.yaml
74-
- patches/capicontract_in_azureasomanagedmachinepools.yaml
75-
- patches/capicontract_in_azureasomanagedmachinepooltemplates.yaml
57+
- path: patches/capicontract_in_azuremachines.yaml
58+
- path: patches/capicontract_in_azureclusters.yaml
59+
- path: patches/capicontract_in_azureclustertemplates.yaml
60+
- path: patches/capicontract_in_azuremachinetemplates.yaml
61+
- path: patches/capicontract_in_azureclusteridentities.yaml
62+
- path: patches/capicontract_in_azuremachinepools.yaml
63+
- path: patches/capicontract_in_azuremanagedmachinepools.yaml
64+
- path: patches/capicontract_in_azuremanagedclusters.yaml
65+
- path: patches/capicontract_in_azuremanagedcontrolplanes.yaml
66+
- path: patches/capicontract_in_azuremachinepoolmachines.yaml
67+
- path: patches/capicontract_in_azuremanagedclustertemplates.yaml
68+
- path: patches/capicontract_in_azuremanagedcontrolplanetemplates.yaml
69+
- path: patches/capicontract_in_azuremanagedmachinepooltemplates.yaml
70+
- path: patches/capicontract_in_azureasomanagedclusters.yaml
71+
- path: patches/capicontract_in_azureasomanagedclustertemplates.yaml
72+
- path: patches/capicontract_in_azureasomanagedcontrolplanes.yaml
73+
- path: patches/capicontract_in_azureasomanagedcontrolplanetemplates.yaml
74+
- path: patches/capicontract_in_azureasomanagedmachinepools.yaml
75+
- path: patches/capicontract_in_azureasomanagedmachinepooltemplates.yaml
7676

7777
# the following config is for teaching kustomize how to do kustomization for CRDs.
7878
configurations:

0 commit comments

Comments
 (0)