Skip to content

Commit 2fa20fe

Browse files
authored
feat: add webhook server (#2566) (#267)
Signed-off-by: Ashing Zheng <[email protected]>
1 parent 7f6fdd9 commit 2fa20fe

34 files changed

+1025
-133
lines changed

PROJECT

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# This file is used to track the info used to scaffold your project
33
# and allow the plugins properly work.
44
# More info: https://book.kubebuilder.io/reference/project-config.html
5-
domain: github.com
65
layout:
76
- go.kubebuilder.io/v4
87
projectName: apisix-ingress-controller
@@ -12,24 +11,13 @@ resources:
1211
crdVersion: v1
1312
namespaced: true
1413
controller: true
15-
domain: github.com
16-
group: apisix.apache.org
17-
kind: Guestbook
18-
path: github.com/apache/apisix-ingress-controller/api/v1alpha1
19-
version: v1alpha1
20-
- api:
21-
crdVersion: v1
22-
namespaced: true
23-
controller: true
24-
domain: github.com
2514
group: apisix.apache.org
2615
kind: GatewayProxy
2716
path: github.com/apache/apisix-ingress-controller/api/v1alpha1
2817
version: v1alpha1
2918
- api:
3019
crdVersion: v1
3120
namespaced: true
32-
domain: github.com
3321
group: apisix.apache.org
3422
kind: HTTPRoutePolicy
3523
path: github.com/apache/apisix-ingress-controller/api/v1alpha1
@@ -38,7 +26,6 @@ resources:
3826
crdVersion: v1
3927
namespaced: true
4028
controller: true
41-
domain: github.com
4229
group: apisix.apache.org
4330
kind: ApisixRoute
4431
path: github.com/apache/apisix-ingress-controller/api/v2
@@ -47,7 +34,6 @@ resources:
4734
crdVersion: v1
4835
namespaced: true
4936
controller: true
50-
domain: github.com
5137
group: apisix.apache.org
5238
kind: ApisixConsumer
5339
path: github.com/apache/apisix-ingress-controller/api/v2
@@ -56,7 +42,6 @@ resources:
5642
crdVersion: v1
5743
namespaced: true
5844
controller: true
59-
domain: github.com
6045
group: apisix.apache.org
6146
kind: ApisixGlobalRule
6247
path: github.com/apache/apisix-ingress-controller/api/v2
@@ -65,7 +50,6 @@ resources:
6550
crdVersion: v1
6651
namespaced: true
6752
controller: true
68-
domain: github.com
6953
group: apisix.apache.org
7054
kind: ApisixTls
7155
path: github.com/apache/apisix-ingress-controller/api/v2
@@ -74,17 +58,24 @@ resources:
7458
crdVersion: v1
7559
namespaced: true
7660
controller: true
77-
domain: github.com
7861
group: apisix.apache.org
7962
kind: ApisixUpstream
8063
path: github.com/apache/apisix-ingress-controller/api/v2
8164
version: v2
8265
- api:
8366
crdVersion: v1
8467
namespaced: true
85-
domain: github.com
8668
group: apisix.apache.org
8769
kind: ApisixPluginConfig
8870
path: github.com/apache/apisix-ingress-controller/api/v2
8971
version: v2
72+
- core: true
73+
domain: k8s.io
74+
group: networking
75+
kind: Ingress
76+
path: k8s.io/api/networking/v1
77+
version: v1
78+
webhooks:
79+
validation: true
80+
webhookVersion: v1
9081
version: "3"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# The following manifests contain a self-signed issuer CR and a metrics certificate CR.
2+
# More document can be found at https://docs.cert-manager.io
3+
apiVersion: cert-manager.io/v1
4+
kind: Certificate
5+
metadata:
6+
labels:
7+
app.kubernetes.io/name: apisix-ingress-controller
8+
app.kubernetes.io/managed-by: kustomize
9+
name: metrics-certs # this name should match the one appeared in kustomizeconfig.yaml
10+
namespace: system
11+
spec:
12+
dnsNames:
13+
# SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize
14+
# replacements in the config/default/kustomization.yaml file.
15+
- SERVICE_NAME.SERVICE_NAMESPACE.svc
16+
- SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local
17+
issuerRef:
18+
kind: Issuer
19+
name: selfsigned-issuer
20+
secretName: metrics-server-cert
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# The following manifests contain a self-signed issuer CR and a certificate CR.
2+
# More document can be found at https://docs.cert-manager.io
3+
apiVersion: cert-manager.io/v1
4+
kind: Certificate
5+
metadata:
6+
labels:
7+
app.kubernetes.io/name: apisix-ingress-controller
8+
app.kubernetes.io/managed-by: kustomize
9+
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
10+
namespace: system
11+
spec:
12+
# SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize
13+
# replacements in the config/default/kustomization.yaml file.
14+
dnsNames:
15+
- SERVICE_NAME.SERVICE_NAMESPACE.svc
16+
- SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local
17+
issuerRef:
18+
kind: Issuer
19+
name: selfsigned-issuer
20+
secretName: webhook-server-cert

config/certmanager/issuer.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# The following manifest contains a self-signed issuer CR.
2+
# More information can be found at https://docs.cert-manager.io
3+
# WARNING: Targets CertManager v1.0. Check https://cert-manager.io/docs/installation/upgrading/ for breaking changes.
4+
apiVersion: cert-manager.io/v1
5+
kind: Issuer
6+
metadata:
7+
labels:
8+
app.kubernetes.io/name: apisix-ingress-controller
9+
app.kubernetes.io/managed-by: kustomize
10+
name: selfsigned-issuer
11+
namespace: system
12+
spec:
13+
selfSigned: {}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resources:
2+
- issuer.yaml
3+
- certificate-webhook.yaml
4+
- certificate-metrics.yaml
5+
6+
configurations:
7+
- kustomizeconfig.yaml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This configuration is for teaching kustomize how to update name ref substitution
2+
nameReference:
3+
- kind: Issuer
4+
group: cert-manager.io
5+
fieldSpecs:
6+
- kind: Certificate
7+
group: cert-manager.io
8+
path: spec/issuerRef/name

config/crd/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ patches:
4242
# [WEBHOOK] To enable webhook, uncomment the following section
4343
# the following config is for teaching kustomize how to do kustomization for CRDs.
4444

45-
#configurations:
46-
#- kustomizeconfig.yaml
45+
configurations:
46+
- kustomizeconfig.yaml

0 commit comments

Comments
 (0)