Skip to content

Commit 7e7d5cc

Browse files
authored
Merge pull request #694 from furkatgofurov7/bump-kustomize-v5
🌱 Align kustomize layover structure with v5 version
2 parents 1fa06ef + b502572 commit 7e7d5cc

26 files changed

+224
-121
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ROOT:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
2323

2424
.DEFAULT_GOAL:=help
2525

26-
GO_VERSION ?= 1.22.5
26+
GO_VERSION ?= 1.22.11
2727
GO_CONTAINER_IMAGE ?= docker.io/library/golang:$(GO_VERSION)
2828

2929
# Use GOPROXY environment variable if set
@@ -74,7 +74,7 @@ GOLANGCI_LINT_VER := v1.57.2
7474
GOLANGCI_LINT_BIN := golangci-lint
7575
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
7676

77-
KUSTOMIZE_VER := v5.3.0
77+
KUSTOMIZE_VER := v5.6.0
7878
KUSTOMIZE_BIN := kustomize
7979
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)
8080

Tiltfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def build_image():
2020
"SECURITY_CONTACTS"
2121
],
2222
build_args = {
23-
"builder_image": "docker.io/library/golang:1.22.5",
23+
"builder_image": "docker.io/library/golang:1.22.11",
2424
}
2525
)
2626

config/certmanager/certificate.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ 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
17+
# SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize
1818
dnsNames:
19-
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc
20-
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local
19+
- SERVICE_NAME.SERVICE_NAMESPACE.svc
20+
- SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local
2121
issuerRef:
2222
kind: Issuer
2323
name: selfsigned-issuer
24-
secretName: $(SERVICE_NAME)-cert # this secret will not be prefixed, since it's not managed by kustomize
24+
secretName: capi-operator-webhook-service-cert # this secret will not be prefixed, since it's not managed by kustomize

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/chart/kustomization.yaml

Lines changed: 89 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ namespace: "{{ .Release.Namespace }}"
99
namePrefix: capi-operator-
1010

1111
# Labels to add to all resources and selectors.
12-
commonLabels:
13-
clusterctl.cluster.x-k8s.io/core: "capi-operator"
12+
labels:
13+
- includeSelectors: true
14+
pairs:
15+
clusterctl.cluster.x-k8s.io/core: "capi-operator"
1416

15-
bases:
17+
resources:
1618
- ../crd
1719
- ../rbac
1820
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
@@ -27,40 +29,102 @@ patches:
2729
- path: patches/keep-crds.yaml
2830
target:
2931
kind: CustomResourceDefinition
32+
- path: webhookcainjection_patch.yaml
3033

31-
patchesStrategicMerge:
32-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
33-
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
34-
# 'CERTMANAGER' needs to be enabled to use ca injection
35-
- webhookcainjection_patch.yaml
36-
37-
configurations:
38-
- kustomizeconfig.yaml
39-
vars:
40-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
41-
- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
42-
objref:
34+
replacements:
35+
- source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs
4336
kind: Certificate
4437
group: cert-manager.io
4538
version: v1
4639
name: serving-cert # this name should match the one in certificate.yaml
47-
fieldref:
48-
fieldpath: metadata.namespace
49-
- name: CERTIFICATE_NAME
50-
objref:
40+
fieldPath: .metadata.namespace # namespace of the certificate CR
41+
targets:
42+
- select:
43+
kind: ValidatingWebhookConfiguration
44+
fieldPaths:
45+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
46+
options:
47+
delimiter: '/'
48+
index: 0
49+
create: true
50+
- select:
51+
kind: MutatingWebhookConfiguration
52+
fieldPaths:
53+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
54+
options:
55+
delimiter: '/'
56+
index: 0
57+
create: true
58+
- select:
59+
kind: CustomResourceDefinition
60+
fieldPaths:
61+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
62+
options:
63+
delimiter: '/'
64+
index: 0
65+
create: true
66+
- source:
5167
kind: Certificate
5268
group: cert-manager.io
5369
version: v1
5470
name: serving-cert # this name should match the one in certificate.yaml
55-
- name: SERVICE_NAMESPACE # namespace of the service
56-
objref:
71+
fieldPath: .metadata.name
72+
targets:
73+
- select:
74+
kind: ValidatingWebhookConfiguration
75+
fieldPaths:
76+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
77+
options:
78+
delimiter: '/'
79+
index: 1
80+
create: true
81+
- select:
82+
kind: MutatingWebhookConfiguration
83+
fieldPaths:
84+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
85+
options:
86+
delimiter: '/'
87+
index: 1
88+
create: true
89+
- select:
90+
kind: CustomResourceDefinition
91+
fieldPaths:
92+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
93+
options:
94+
delimiter: '/'
95+
index: 1
96+
create: true
97+
- source: # Add cert-manager annotation to the webhook Service
5798
kind: Service
5899
version: v1
59100
name: webhook-service
60-
fieldref:
61-
fieldpath: metadata.namespace
62-
- name: SERVICE_NAME
63-
objref:
101+
fieldPath: .metadata.name # namespace of the service
102+
targets:
103+
- select:
104+
kind: Certificate
105+
group: cert-manager.io
106+
version: v1
107+
fieldPaths:
108+
- .spec.dnsNames.0
109+
- .spec.dnsNames.1
110+
options:
111+
delimiter: '.'
112+
index: 0
113+
create: true
114+
- source:
64115
kind: Service
65116
version: v1
66117
name: webhook-service
118+
fieldPath: .metadata.namespace # namespace of the service
119+
targets:
120+
- select:
121+
kind: Certificate
122+
group: cert-manager.io
123+
version: v1
124+
fieldPaths:
125+
- .spec.dnsNames.0
126+
- .spec.dnsNames.1
127+
options:
128+
delimiter: '.'
129+
index: 1
130+
create: true

config/chart/kustomizeconfig.yaml

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

config/chart/webhookcainjection_patch.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ kind: MutatingWebhookConfiguration
55
metadata:
66
name: mutating-webhook-configuration
77
annotations:
8-
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
8+
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
99
---
1010
apiVersion: admissionregistration.k8s.io/v1
1111
kind: ValidatingWebhookConfiguration
1212
metadata:
1313
name: validating-webhook-configuration
1414
annotations:
15-
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
15+
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME

config/crd/kustomization.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ resources:
1111
- bases/operator.cluster.x-k8s.io_runtimeextensionproviders.yaml
1212
# +kubebuilder:scaffold:crdkustomizeresource
1313

14-
patchesStrategicMerge:
14+
patches:
1515
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
1616
# patches here are for enabling the conversion webhook for each CRD
17-
- patches/webhook_in_coreproviders.yaml
18-
- patches/webhook_in_bootstrapproviders.yaml
19-
- patches/webhook_in_controlplaneproviders.yaml
20-
- patches/webhook_in_infrastructureproviders.yaml
21-
- patches/webhook_in_addonproviders.yaml
22-
- patches/webhook_in_ipamproviders.yaml
23-
- patches/webhook_in_runtimeextensionproviders.yaml
17+
- path: patches/webhook_in_coreproviders.yaml
18+
- path: patches/webhook_in_bootstrapproviders.yaml
19+
- path: patches/webhook_in_controlplaneproviders.yaml
20+
- path: patches/webhook_in_infrastructureproviders.yaml
21+
- path: patches/webhook_in_addonproviders.yaml
22+
- path: patches/webhook_in_ipamproviders.yaml
23+
- path: patches/webhook_in_runtimeextensionproviders.yaml
2424
# +kubebuilder:scaffold:crdkustomizewebhookpatch
2525

2626
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
2727
# patches here are for enabling the CA injection for each CRD
28-
- patches/cainjection_in_coreproviders.yaml
29-
- patches/cainjection_in_bootstrapproviders.yaml
30-
- patches/cainjection_in_controlplaneproviders.yaml
31-
- patches/cainjection_in_infrastructureproviders.yaml
32-
- patches/cainjection_in_addonproviders.yaml
33-
- patches/cainjection_in_ipamproviders.yaml
34-
- patches/cainjection_in_runtimeextensionproviders.yaml
28+
- path: patches/cainjection_in_coreproviders.yaml
29+
- path: patches/cainjection_in_bootstrapproviders.yaml
30+
- path: patches/cainjection_in_controlplaneproviders.yaml
31+
- path: patches/cainjection_in_infrastructureproviders.yaml
32+
- path: patches/cainjection_in_addonproviders.yaml
33+
- path: patches/cainjection_in_ipamproviders.yaml
34+
- path: patches/cainjection_in_runtimeextensionproviders.yaml
3535
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
3636

3737
# the following config is for teaching kustomize how to do kustomization for CRDs.

config/crd/kustomizeconfig.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,3 @@ namespace:
1212
group: apiextensions.k8s.io
1313
path: spec/conversion/webhook/clientConfig/service/namespace
1414
create: false
15-
16-
varReference:
17-
- path: metadata/annotations

config/crd/patches/cainjection_in_addonproviders.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: addonproviders.operator.cluster.x-k8s.io

config/crd/patches/cainjection_in_bootstrapproviders.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: bootstrapproviders.operator.cluster.x-k8s.io

config/crd/patches/cainjection_in_controlplaneproviders.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: controlplaneproviders.operator.cluster.x-k8s.io

config/crd/patches/cainjection_in_coreproviders.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: coreproviders.operator.cluster.x-k8s.io

config/crd/patches/cainjection_in_infrastructureproviders.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: infrastructureproviders.operator.cluster.x-k8s.io

config/crd/patches/cainjection_in_ipamproviders.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: ipamproviders.operator.cluster.x-k8s.io

config/crd/patches/cainjection_in_runtimeextensionproviders.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: runtimeextensionproviders.operator.cluster.x-k8s.io

0 commit comments

Comments
 (0)