This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
generated from knative-extensions/sample-controller
-
Notifications
You must be signed in to change notification settings - Fork 8
/
controlplane.yaml
286 lines (264 loc) · 7.21 KB
/
controlplane.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# Copyright 2022 Chainguard, Inc.
# SPDX-License-Identifier: Apache-2.0
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: controlplane
namespace: knative-serving
spec:
minAvailable: 50%
selector:
matchLabels:
app: controlplane
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: controlplane
namespace: knative-serving
labels:
knative.dev/release: devel
spec:
replicas: 2
# We allow things to deploy and update in parallel, but use a
# PodDisruptionBudget (above) to ensure that at least 1 pod remains available
# as we are updating things. This is a delicate balancing act because:
# 1. We need to launch the initial set of pods in "Parallel" so that whichever
# pod ends up the leader of the webhook cert comes up immediately, but
# 2. We cannot update all pods in parallel because this serves a webhook that
# would become unavailable if all the pods were deleted at once.
podManagementPolicy: Parallel
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
app: controlplane
serviceName: &service "autoscaler"
template:
metadata:
labels:
app: controlplane
knative.dev/release: devel
spec:
# To avoid node becoming SPOF, spread our replicas to different nodes.
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
app: controlplane
topologyKey: kubernetes.io/hostname
weight: 100
serviceAccountName: controlplane
containers:
- name: controlplane
# This is the Go import path for the binary that is containerized
# and substituted here.
image: ko://github.com/chainguard-dev/hakn/cmd/serving
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 1000m
memory: 1000Mi
readinessProbe:
periodSeconds: 1
httpGet:
scheme: HTTPS
port: 8443
httpHeaders:
- name: k-kubelet-probe
value: "controlplane"
livenessProbe:
periodSeconds: 1
failureThreshold: 50
httpGet:
scheme: HTTPS
port: 8443
httpHeaders:
- name: k-kubelet-probe
value: "controlplane"
env:
# These settings are used for statefulset-based
# leader selection.
- name: STATEFUL_CONTROLLER_ORDINAL
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: STATEFUL_SERVICE_NAME
value: *service
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: CONFIG_LOGGING_NAME
value: config-logging
- name: CONFIG_OBSERVABILITY_NAME
value: config-observability
- name: CONFIG_FEATURE_FLAGS_NAME
value: config-features
- name: KUBERNETES_MIN_VERSION
value: "1.23.0"
# TODO(https://github.com/knative/pkg/pull/953): Remove stackdriver specific config
- name: METRICS_DOMAIN
value: chainguard.dev/hakn
- name: METRICS_PROMETHEUS_PORT
value: "9030"
- name: PROFILING_PORT
value: "8010"
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
ports:
- name: profiling
containerPort: 8010
- name: https-webhook
containerPort: 8443
- name: autoscaler
# This is the Go import path for the binary that is containerized
# and substituted here.
image: ko://knative.dev/serving/cmd/autoscaler
resources:
requests:
cpu: 30m
memory: 40Mi
limits:
cpu: 300m
memory: 400Mi
env:
- name: STATEFUL_CONTROLLER_ORDINAL
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: STATEFUL_SERVICE_NAME
value: *service
- name: STATEFUL_SERVICE_PROTOCOL
value: "ws"
- name: STATEFUL_SERVICE_PORT
value: "8080"
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: CONFIG_LOGGING_NAME
value: config-logging
- name: CONFIG_OBSERVABILITY_NAME
value: config-observability
- name: KUBERNETES_MIN_VERSION
value: "1.23.0"
# TODO(https://github.com/knative/pkg/pull/953): Remove stackdriver specific config
- name: METRICS_DOMAIN
value: chainguard.dev/hakn
- name: METRICS_PROMETHEUS_PORT
value: "9031"
- name: PROFILING_PORT
value: "8011"
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
ports:
- name: profiling
containerPort: 8011
- name: websocket
containerPort: 8080
readinessProbe:
httpGet:
port: 8080
httpHeaders:
- name: k-kubelet-probe
value: "autoscaler"
livenessProbe:
httpGet:
port: 8080
httpHeaders:
- name: k-kubelet-probe
value: "autoscaler"
failureThreshold: 6
dnsPolicy: ClusterFirst
---
apiVersion: v1
kind: Service
metadata:
labels:
app: controlplane
knative.dev/release: devel
name: webhook
namespace: knative-serving
spec:
ports:
# Define metrics and profiling for them to be accessible within service meshes.
- name: http-metrics
port: 9090
targetPort: 9090
- name: http-profiling
port: 8008
targetPort: 8008
- name: https-webhook
port: 443
targetPort: 8443
- name: http
port: 8080
targetPort: 8080
selector:
app: controlplane
---
apiVersion: v1
kind: Service
metadata:
name: autoscaler
namespace: knative-serving
spec:
clusterIP: None
ports:
- name: http
port: 8080
targetPort: 8080
selector:
app: controlplane
---
apiVersion: v1
kind: Service
metadata:
# We need this service for things to work properly, but
# the Endpoints should always be empty because we use a
# bogus selector and don't install the activator.
name: activator-service
namespace: knative-serving
labels:
knative.dev/release: devel
spec:
selector:
role: no-activator-here
ports:
# Define metrics and profiling for them to be accessible within service meshes.
- name: http-metrics
port: 9090
targetPort: 9090
- name: http-profiling
port: 8008
targetPort: 8008
- name: http
port: 80
targetPort: 8012
- name: http2
port: 81
targetPort: 8013
type: ClusterIP