-
Notifications
You must be signed in to change notification settings - Fork 114
/
003-webhook.yaml
61 lines (60 loc) · 1.99 KB
/
003-webhook.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: {{.SRIOVMutatingWebhookName}}
namespace: {{.Namespace}}
annotations:
{{- if eq .ClusterType "openshift" }}
service.beta.openshift.io/inject-cabundle: "true"
{{- else if and (not .CaBundle) (eq .ClusterType "kubernetes") }}
cert-manager.io/inject-ca-from: {{.Namespace}}/operator-webhook-service
{{- end }}
webhooks:
- name: operator-webhook.sriovnetwork.openshift.io
sideEffects: None
admissionReviewVersions: [v1]
failurePolicy: Fail
clientConfig:
service:
name: operator-webhook-service
namespace: {{.Namespace}}
path: "/mutating-custom-resource"
{{- if and (.CaBundle) (eq .ClusterType "kubernetes") }}
caBundle: "{{.CaBundle}}"
{{- end}}
rules:
- operations: [ "CREATE", "UPDATE" ]
apiGroups: ["sriovnetwork.openshift.io"]
apiVersions: ["v1"]
resources: ["sriovnetworknodepolicies"]
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: {{.SRIOVMutatingWebhookName}}
namespace: {{.Namespace}}
annotations:
{{- if eq .ClusterType "openshift" }}
service.beta.openshift.io/inject-cabundle: "true"
{{- else if and (not .CaBundle) (eq .ClusterType "kubernetes") }}
cert-manager.io/inject-ca-from: {{.Namespace}}/operator-webhook-service
{{- end }}
webhooks:
- name: operator-webhook.sriovnetwork.openshift.io
sideEffects: None
admissionReviewVersions: [v1]
failurePolicy: Fail
clientConfig:
service:
name: operator-webhook-service
namespace: {{.Namespace}}
path: "/validating-custom-resource"
{{- if and (.CaBundle) (eq .ClusterType "kubernetes") }}
caBundle: "{{.CaBundle}}"
{{- end }}
rules:
- operations: [ "CREATE", "UPDATE", "DELETE" ]
apiGroups: ["sriovnetwork.openshift.io"]
apiVersions: ["v1"]
resources: ["sriovnetworknodepolicies"]