Skip to content

Commit 3afb2ad

Browse files
committed
Move away from bases, patchesStrategicMerge and vars use.
Signed-off-by: Tuomas Katila <[email protected]>
1 parent 63f90a6 commit 3afb2ad

File tree

70 files changed

+801
-314
lines changed

Some content is hidden

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

70 files changed

+801
-314
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
bases:
1+
resources:
22
- base
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
bases:
1+
resources:
22
- ../../base
33
patches:
44
- path: dlb_initcontainer.yaml
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
bases:
1+
resources:
22
- base
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
bases:
1+
resources:
22
- ../../base
3-
patchesStrategicMerge:
4-
- dsa_initcontainer.yaml
3+
apiVersion: kustomize.config.k8s.io/v1beta1
4+
kind: Kustomization
5+
patches:
6+
- path: dsa_initcontainer.yaml
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,96 @@
1-
bases:
1+
resources:
22
- ../crd
33
- ../rbac
44
- ../manager
55
- ../webhook
66
- ../certmanager
77

8-
patchesStrategicMerge:
98
# Enable webhook
10-
- manager_webhook_patch.yaml
119
# Enable certmanager integration
12-
- webhookcainjection_patch.yaml
1310

14-
vars:
15-
- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
16-
objref:
17-
kind: Certificate
18-
group: cert-manager.io
19-
version: v1
20-
name: serving-cert # this name should match the one in certificate.yaml
21-
fieldref:
22-
fieldpath: metadata.namespace
23-
- name: CERTIFICATE_NAME
24-
objref:
25-
kind: Certificate
26-
group: cert-manager.io
27-
version: v1
28-
name: serving-cert # this name should match the one in certificate.yaml
29-
- name: SERVICE_NAMESPACE # namespace of the service
30-
objref:
31-
kind: Service
32-
version: v1
33-
name: webhook-service
34-
fieldref:
35-
fieldpath: metadata.namespace
36-
- name: SERVICE_NAME
37-
objref:
38-
kind: Service
39-
version: v1
40-
name: webhook-service
11+
apiVersion: kustomize.config.k8s.io/v1beta1
12+
kind: Kustomization
13+
patches:
14+
- path: manager_webhook_patch.yaml
15+
- path: webhookcainjection_patch.yaml
16+
replacements:
17+
- source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs
18+
kind: Certificate
19+
group: cert-manager.io
20+
version: v1
21+
name: serving-cert # this name should match the one in certificate.yaml
22+
fieldPath: .metadata.namespace # namespace of the certificate CR
23+
targets:
24+
- select:
25+
kind: ValidatingWebhookConfiguration
26+
fieldPaths:
27+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
28+
options:
29+
delimiter: '/'
30+
index: 0
31+
create: true
32+
- select:
33+
kind: MutatingWebhookConfiguration
34+
fieldPaths:
35+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
36+
options:
37+
delimiter: '/'
38+
index: 0
39+
create: true
40+
- source:
41+
kind: Certificate
42+
group: cert-manager.io
43+
version: v1
44+
name: serving-cert # this name should match the one in certificate.yaml
45+
fieldPath: .metadata.name
46+
targets:
47+
- select:
48+
kind: ValidatingWebhookConfiguration
49+
fieldPaths:
50+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
51+
options:
52+
delimiter: '/'
53+
index: 1
54+
create: true
55+
- select:
56+
kind: MutatingWebhookConfiguration
57+
fieldPaths:
58+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
59+
options:
60+
delimiter: '/'
61+
index: 1
62+
create: true
63+
- source: # Add cert-manager annotation to the webhook Service
64+
kind: Service
65+
version: v1
66+
name: webhook-service
67+
fieldPath: .metadata.name # namespace of the service
68+
targets:
69+
- select:
70+
kind: Certificate
71+
group: cert-manager.io
72+
version: v1
73+
fieldPaths:
74+
- .spec.dnsNames.0
75+
- .spec.dnsNames.1
76+
options:
77+
delimiter: '.'
78+
index: 0
79+
create: true
80+
- source:
81+
kind: Service
82+
version: v1
83+
name: webhook-service
84+
fieldPath: .metadata.namespace # namespace of the service
85+
targets:
86+
- select:
87+
kind: Certificate
88+
group: cert-manager.io
89+
version: v1
90+
fieldPaths:
91+
- .spec.dnsNames.0
92+
- .spec.dnsNames.1
93+
options:
94+
delimiter: '.'
95+
index: 1
96+
create: true
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# This patch adds an annotation to admission webhook config and
2-
# the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize.
2+
# the variables CERTIFICATE_NAMESPACE and CERTIFICATE_NAME will be substituted by kustomize.
33
apiVersion: admissionregistration.k8s.io/v1
44
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

deployments/fpga_admissionwebhook/certmanager/certificate.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +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
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
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,90 @@
1-
# Adds namespace to all resources.
21
namespace: intelfpgawebhook-system
3-
4-
# Value of this field is prepended to the
5-
# names of all resources, e.g. a deployment named
6-
# "wordpress" becomes "alices-wordpress".
7-
# Note that it should also match with the prefix (text before '-') of the namespace
8-
# field above.
92
namePrefix: intelfpgawebhook-
103

11-
# Labels to add to all resources and selectors.
12-
#commonLabels:
13-
# someName: someValue
14-
15-
bases:
16-
- ../base
17-
184
resources:
5+
- ../base
196
- namespace.yaml
7+
8+
apiVersion: kustomize.config.k8s.io/v1beta1
9+
kind: Kustomization
10+
replacements:
11+
- source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs
12+
kind: Certificate
13+
group: cert-manager.io
14+
version: v1
15+
name: serving-cert # this name should match the one in certificate.yaml
16+
fieldPath: .metadata.namespace # namespace of the certificate CR
17+
targets:
18+
- select:
19+
kind: ValidatingWebhookConfiguration
20+
fieldPaths:
21+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
22+
options:
23+
delimiter: '/'
24+
index: 0
25+
create: true
26+
- select:
27+
kind: MutatingWebhookConfiguration
28+
fieldPaths:
29+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
30+
options:
31+
delimiter: '/'
32+
index: 0
33+
create: true
34+
- source:
35+
kind: Certificate
36+
group: cert-manager.io
37+
version: v1
38+
name: serving-cert # this name should match the one in certificate.yaml
39+
fieldPath: .metadata.name
40+
targets:
41+
- select:
42+
kind: ValidatingWebhookConfiguration
43+
fieldPaths:
44+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
45+
options:
46+
delimiter: '/'
47+
index: 1
48+
create: true
49+
- select:
50+
kind: MutatingWebhookConfiguration
51+
fieldPaths:
52+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
53+
options:
54+
delimiter: '/'
55+
index: 1
56+
create: true
57+
- source: # Add cert-manager annotation to the webhook Service
58+
kind: Service
59+
version: v1
60+
name: webhook-service
61+
fieldPath: .metadata.name # namespace of the service
62+
targets:
63+
- select:
64+
kind: Certificate
65+
group: cert-manager.io
66+
version: v1
67+
fieldPaths:
68+
- .spec.dnsNames.0
69+
- .spec.dnsNames.1
70+
options:
71+
delimiter: '.'
72+
index: 0
73+
create: true
74+
- source:
75+
kind: Service
76+
version: v1
77+
name: webhook-service
78+
fieldPath: .metadata.namespace # namespace of the service
79+
targets:
80+
- select:
81+
kind: Certificate
82+
group: cert-manager.io
83+
version: v1
84+
fieldPaths:
85+
- .spec.dnsNames.0
86+
- .spec.dnsNames.1
87+
options:
88+
delimiter: '.'
89+
index: 1
90+
create: true
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
bases:
1+
resources:
22
- base
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# the following config is for teaching kustomize where to look at when substituting vars.
1+
# the following config is for teaching kustomize where to look at when substituting nameReference.
22
# It requires kustomize v2.1.0 or newer to work properly.
33
nameReference:
44
- kind: Service
@@ -7,12 +7,16 @@ nameReference:
77
- kind: MutatingWebhookConfiguration
88
group: admissionregistration.k8s.io
99
path: webhooks/clientConfig/service/name
10+
- kind: ValidatingWebhookConfiguration
11+
group: admissionregistration.k8s.io
12+
path: webhooks/clientConfig/service/name
1013

1114
namespace:
1215
- kind: MutatingWebhookConfiguration
1316
group: admissionregistration.k8s.io
1417
path: webhooks/clientConfig/service/namespace
1518
create: true
16-
17-
varReference:
18-
- path: metadata/annotations
19+
- kind: ValidatingWebhookConfiguration
20+
group: admissionregistration.k8s.io
21+
path: webhooks/clientConfig/service/namespace
22+
create: true

deployments/fpga_plugin/overlays/af/kustomization.yaml

+84
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,87 @@ namePrefix: intelfpgaplugin-
44
resources:
55
- ../../base
66
- ../../../fpga_admissionwebhook/base
7+
8+
apiVersion: kustomize.config.k8s.io/v1beta1
9+
kind: Kustomization
10+
replacements:
11+
- source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs
12+
kind: Certificate
13+
group: cert-manager.io
14+
version: v1
15+
name: serving-cert # this name should match the one in certificate.yaml
16+
fieldPath: .metadata.namespace # namespace of the certificate CR
17+
targets:
18+
- select:
19+
kind: ValidatingWebhookConfiguration
20+
fieldPaths:
21+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
22+
options:
23+
delimiter: '/'
24+
index: 0
25+
create: true
26+
- select:
27+
kind: MutatingWebhookConfiguration
28+
fieldPaths:
29+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
30+
options:
31+
delimiter: '/'
32+
index: 0
33+
create: true
34+
- source:
35+
kind: Certificate
36+
group: cert-manager.io
37+
version: v1
38+
name: serving-cert # this name should match the one in certificate.yaml
39+
fieldPath: .metadata.name
40+
targets:
41+
- select:
42+
kind: ValidatingWebhookConfiguration
43+
fieldPaths:
44+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
45+
options:
46+
delimiter: '/'
47+
index: 1
48+
create: true
49+
- select:
50+
kind: MutatingWebhookConfiguration
51+
fieldPaths:
52+
- .metadata.annotations.[cert-manager.io/inject-ca-from]
53+
options:
54+
delimiter: '/'
55+
index: 1
56+
create: true
57+
- source: # Add cert-manager annotation to the webhook Service
58+
kind: Service
59+
version: v1
60+
name: webhook-service
61+
fieldPath: .metadata.name # namespace of the service
62+
targets:
63+
- select:
64+
kind: Certificate
65+
group: cert-manager.io
66+
version: v1
67+
fieldPaths:
68+
- .spec.dnsNames.0
69+
- .spec.dnsNames.1
70+
options:
71+
delimiter: '.'
72+
index: 0
73+
create: true
74+
- source:
75+
kind: Service
76+
version: v1
77+
name: webhook-service
78+
fieldPath: .metadata.namespace # namespace of the service
79+
targets:
80+
- select:
81+
kind: Certificate
82+
group: cert-manager.io
83+
version: v1
84+
fieldPaths:
85+
- .spec.dnsNames.0
86+
- .spec.dnsNames.1
87+
options:
88+
delimiter: '.'
89+
index: 1
90+
create: true

0 commit comments

Comments
 (0)