-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebhook.yaml
125 lines (125 loc) · 2.51 KB
/
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
metadata:
name: mutating-webhook-configuration
namespace: default
labels:
app: kustomize-webhook
webhooks:
- name: kustomize.webhook.com
clientConfig:
service:
name: kustomize-webhook
namespace: default
path: /mutate
caBundle: $TLS_CRT_BASE64
failurePolicy: Fail
sideEffects: None
rules:
- apiGroups:
- ""
apiVersions:
- "v1"
operations:
- "CREATE"
resources:
- "pods"
---
apiVersion: v1
kind: Secret
metadata:
labels:
app: kustomize-webhook
name: kustomize-webhook-server-cert
namespace: default
stringData:
tls.crt: |-
$TLS_CRT
tls.key: |-
$TLS_KEY
---
apiVersion: v1
kind: Service
metadata:
labels:
app: kustomize-webhook
name: kustomize-webhook
namespace: default
spec:
ports:
- name: https
port: 443
targetPort: webhook-server
selector:
app: kustomize-webhook
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kustomize-webhook
namespace: default
labels:
app: kustomize-webhook
spec:
selector:
matchLabels:
app: kustomize-webhook
replicas: 1
template:
metadata:
labels:
app: kustomize-webhook
spec:
containers:
- image: docker.pkg.github.com/sbueringer/kustomize-webhook/webhook:latest
imagePullPolicy: Always
args:
- --patches-glob
- "/tmp/patches/patch-*.yaml"
name: webhook
ports:
- containerPort: 8443
name: webhook-server
protocol: TCP
- containerPort: 8080
name: metrics
protocol: TCP
volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
- mountPath: /tmp/patches
name: patches
readOnly: true
terminationGracePeriodSeconds: 10
volumes:
- name: cert
secret:
defaultMode: 420
secretName: kustomize-webhook-server-cert
- name: patches
configMap:
defaultMode: 420
name: kustomize-webhook-patches
---
apiVersion: v1
kind: ConfigMap
metadata:
name: kustomize-webhook-patches
namespace: default
labels:
app: kustomize-webhook
data:
patch-0.yaml: |-
apiVersion: v1
kind: Pod
metadata:
name: {{.Name}}
spec:
containers:
- name: sidecar
image: alpine
command:
- tail
- -f
- /dev/null