This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
deploy.yaml
316 lines (305 loc) · 8.15 KB
/
deploy.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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fake-kubelet
namespace: kube-system
labels:
app: fake-kubelet
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: fake-kubelet
labels:
app: fake-kubelet
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- watch
- list
- create
- get
- apiGroups:
- ""
resources:
- nodes/status
verbs:
- update
- patch
- apiGroups:
- ""
resources:
- pods
verbs:
- watch
- list
- delete
- update
- patch
- apiGroups:
- ""
resources:
- pods/status
verbs:
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: fake-kubelet
labels:
app: fake-kubelet
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: fake-kubelet
subjects:
- kind: ServiceAccount
name: fake-kubelet
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
name: fake-kubelet
namespace: kube-system
labels:
app: fake-kubelet
data:
pod_status_template: |-
{{ $startTime := .metadata.creationTimestamp }}
conditions:
- lastTransitionTime: {{ $startTime }}
status: "True"
type: Initialized
- lastTransitionTime: {{ $startTime }}
status: "True"
type: Ready
- lastTransitionTime: {{ $startTime }}
status: "True"
type: ContainersReady
- lastTransitionTime: {{ $startTime }}
status: "True"
type: PodScheduled
{{ range .spec.readinessGates }}
- lastTransitionTime: {{ $startTime }}
status: "True"
type: {{ .conditionType }}
{{ end }}
containerStatuses:
{{ range .spec.containers }}
- image: {{ .image }}
name: {{ .name }}
ready: true
restartCount: 0
state:
running:
startedAt: {{ $startTime }}
{{ end }}
initContainerStatuses:
{{ range .spec.initContainers }}
- image: {{ .image }}
name: {{ .name }}
ready: true
restartCount: 0
state:
terminated:
exitCode: 0
finishedAt: {{ $startTime }}
reason: Completed
startedAt: {{ $startTime }}
{{ end }}
{{ with .status }}
hostIP: {{ with .hostIP }} {{ . }} {{ else }} {{ NodeIP }} {{ end }}
podIP: {{ with .podIP }} {{ . }} {{ else }} {{ PodIP }} {{ end }}
{{ end }}
phase: Running
startTime: {{ $startTime }}
node_template: |-
apiVersion: v1
kind: Node
metadata:
annotations:
node.alpha.kubernetes.io/ttl: "0"
labels:
app: fake-kubelet
beta.kubernetes.io/arch: amd64
beta.kubernetes.io/os: linux
kubernetes.io/arch: amd64
kubernetes.io/hostname: {{ .metadata.name }}
kubernetes.io/os: linux
kubernetes.io/role: agent
node-role.kubernetes.io/agent: ""
type: fake-kubelet
name: {{ .metadata.name }}
spec:
taints:
- effect: NoSchedule
key: fake-kubelet/provider
value: fake
node_heartbeat_template: |-
conditions:
- lastHeartbeatTime: {{ Now }}
lastTransitionTime: {{ StartTime }}
message: kubelet is posting ready status
reason: KubeletReady
status: "True"
type: Ready
- lastHeartbeatTime: {{ Now }}
lastTransitionTime: {{ StartTime }}
message: kubelet has sufficient disk space available
reason: KubeletHasSufficientDisk
status: "False"
type: OutOfDisk
- lastHeartbeatTime: {{ Now }}
lastTransitionTime: {{ StartTime }}
message: kubelet has sufficient memory available
reason: KubeletHasSufficientMemory
status: "False"
type: MemoryPressure
- lastHeartbeatTime: {{ Now }}
lastTransitionTime: {{ StartTime }}
message: kubelet has no disk pressure
reason: KubeletHasNoDiskPressure
status: "False"
type: DiskPressure
- lastHeartbeatTime: {{ Now }}
lastTransitionTime: {{ StartTime }}
message: RouteController created a route
reason: RouteCreated
status: "False"
type: NetworkUnavailable
node_initialization_template: |-
{{ with .status }}
addresses:
{{ with .addresses }}
{{ YAML . 1 }}
{{ else }}
- address: {{ NodeIP }}
type: InternalIP
{{ end }}
allocatable:
{{ with .allocatable }}
{{ YAML . 1 }}
{{ else }}
cpu: 1k
memory: 1Ti
pods: 1M
{{ end }}
capacity:
{{ with .capacity }}
{{ YAML . 1 }}
{{ else }}
cpu: 1k
memory: 1Ti
pods: 1M
{{ end }}
{{ with .nodeInfo }}
nodeInfo:
architecture: {{ with .architecture }} {{ . }} {{ else }} "amd64" {{ end }}
bootID: {{ with .bootID }} {{ . }} {{ else }} "" {{ end }}
containerRuntimeVersion: {{ with .containerRuntimeVersion }} {{ . }} {{ else }} "" {{ end }}
kernelVersion: {{ with .kernelVersion }} {{ . }} {{ else }} "" {{ end }}
kubeProxyVersion: {{ with .kubeProxyVersion }} {{ . }} {{ else }} "fake" {{ end }}
kubeletVersion: {{ with .kubeletVersion }} {{ . }} {{ else }} "fake" {{ end }}
machineID: {{ with .machineID }} {{ . }} {{ else }} "" {{ end }}
operatingSystem: {{ with .operatingSystem }} {{ . }} {{ else }} "linux" {{ end }}
osImage: {{ with .osImage }} {{ . }} {{ else }} "" {{ end }}
systemUUID: {{ with .osImage }} {{ . }} {{ else }} "" {{ end }}
{{ end }}
phase: Running
{{ end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: fake-kubelet
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
app: fake-kubelet
template:
metadata:
name: fake-kubelet
namespace: kube-system
labels:
app: fake-kubelet
spec:
containers:
- name: fake-kubelet
image: ghcr.io/wzshiming/fake-kubelet/fake-kubelet:v0.8.0
imagePullPolicy: IfNotPresent
env:
- name: NODE_NAME
value: "" # This is to specify a single Node, use GENERATE_NODE_NAME and GENERATE_REPLICAS to generate multiple nodes
- name: GENERATE_NODE_NAME
value: fake-
- name: GENERATE_SERIAL_LENGTH
value: "1"
- name: GENERATE_REPLICAS
value: "5"
- name: TAKE_OVER_LABELS_SELECTOR
value: type=fake-kubelet
- name: POD_CUSTOM_STATUS_ANNOTATION_SELECTOR
value: fake=custom
- name: TAKE_OVER_ALL
value: "false"
- name: CIDR
value: 10.0.0.1/24
- name: HEALTH_ADDRESS # deprecated: use SERVER_ADDRESS instead
value: :8080
- name: SERVER_ADDRESS
value: :8080
- name: NODE_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_STATUS_TEMPLATE
valueFrom:
configMapKeyRef:
name: fake-kubelet
key: pod_status_template
- name: NODE_TEMPLATE
valueFrom:
configMapKeyRef:
name: fake-kubelet
key: node_template
- name: NODE_HEARTBEAT_TEMPLATE
valueFrom:
configMapKeyRef:
name: fake-kubelet
key: node_heartbeat_template
- name: NODE_INITIALIZATION_TEMPLATE
valueFrom:
configMapKeyRef:
name: fake-kubelet
key: node_initialization_template
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 2
timeoutSeconds: 2
periodSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 2
timeoutSeconds: 2
periodSeconds: 10
failureThreshold: 3
serviceAccount: fake-kubelet
serviceAccountName: fake-kubelet
restartPolicy: Always
---