-
Notifications
You must be signed in to change notification settings - Fork 48
/
hook.template.yaml
303 lines (276 loc) · 8.01 KB
/
hook.template.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
# Attention, this is a template that is run through envsubst, but with a specific list of variables to replace. Thus:
# - HOOK_VERSION: ${HOOK_VERSION} (a simple 1.2.3 string, no 'v')
# - HOOK_KERNEL_IMAGE: ${HOOK_KERNEL_IMAGE}
# - HOOK_KERNEL_ID: ${HOOK_KERNEL_ID}
# - HOOK_KERNEL_VERSION: ${HOOK_KERNEL_VERSION}
# - HOOK_CONTAINER_BOOTKIT_IMAGE: ${HOOK_CONTAINER_BOOTKIT_IMAGE}
# - HOOK_CONTAINER_DOCKER_IMAGE: ${HOOK_CONTAINER_DOCKER_IMAGE}
# - HOOK_CONTAINER_MDEV_IMAGE: ${HOOK_CONTAINER_MDEV_IMAGE}
# - HOOK_CONTAINER_CONTAINERD_IMAGE: ${HOOK_CONTAINER_CONTAINERD_IMAGE}
# - HOOK_CONTAINER_RUNC_IMAGE: ${HOOK_CONTAINER_RUNC_IMAGE}
# - Other variables are not replaced: for example this is a literal dollarsign-SOMETHING: $SOMETHING and with braces: ${SOMETHING}
kernel:
image: "${HOOK_KERNEL_IMAGE}"
cmdline: "this_is_not_used=at_at_all_in_hook command_line_is_determined_by=ipxe"
init:
# this sha is the first with cgroups v2 as the default
- linuxkit/init:8a7b6cdb89197dc94eb6db69ef9dc90b750db598
- "${HOOK_CONTAINER_RUNC_IMAGE}"
- "${HOOK_CONTAINER_CONTAINERD_IMAGE}"
- linuxkit/ca-certificates:v1.0.0
- linuxkit/firmware:24402a25359c7bc290f7fc3cd23b6b5f0feb32a5 # "Some" firmware from Linuxkit pkg; see https://github.com/linuxkit/linuxkit/blob/master/pkg/firmware/Dockerfile
onboot:
- name: rngd1
image: linuxkit/rngd:v1.0.0
command: [ "/sbin/rngd", "-1" ]
- name: sysctl
image: linuxkit/sysctl:v1.0.0
- name: sysfs
image: linuxkit/sysfs:v1.0.0
- name: modprobe
image: linuxkit/modprobe:v1.0.0
command: [ "modprobe", "cdc_ncm" ] # for usb ethernet dongles
- name: vlan
image: linuxkit/ip:v1.0.0
capabilities:
- all
binds.add:
- /etc/ip/vlan.sh:/etc/ip/vlan.sh
command: [ "/etc/ip/vlan.sh" ]
- name: dhcpcd-once
image: linuxkit/dhcpcd:v1.0.0
command: [ "/etc/ip/dhcp.sh", "true" ] # 2nd paramter is one-shot true/false: true for onboot, false for services
#capabilities.add:
# - CAP_SYS_TIME # for ntp one-shot no-max-offset after ntpd, for hardware missing RTC's that boot in 1970
capabilities:
- all
binds.add:
- /var/lib/dhcpcd:/var/lib/dhcpcd
- /run:/run
- /etc/ip/dhcp.sh:/etc/ip/dhcp.sh
- /dhcpcd.conf:/dhcpcd.conf
runtime:
mkdir:
- /var/lib/dhcpcd
services:
- name: rngd
image: linuxkit/rngd:v1.0.0
- name: ntpd
image: linuxkit/openntpd:v1.0.0
- name: mdev
image: "${HOOK_CONTAINER_MDEV_IMAGE}"
command: [ "mdev", "-v", "-S", "-df" ]
capabilities:
- all
binds:
- /dev/:/dev/
- /lib/modules:lib/modules
rootfsPropagation: shared
devices:
- path: all
type: b
- name: getty
image: linuxkit/getty:v1.0.0
capabilities:
- all
binds.add:
- /etc/profile.d/local.sh:/etc/profile.d/local.sh
- /etc/securetty:/etc/securetty
- /etc/motd:/etc/motd
- /etc/os-release:/etc/os-release
- /:/host_root
- /dev:/dev
- /dev/console:/dev/console
- /usr/bin/nerdctl:/usr/bin/nerdctl
env:
- INSECURE=true
devices:
- path: all
type: b
- path: "/dev/console"
type: c
major: 5
minor: 1
mode: "0666"
- path: "/dev/tty0"
type: c
major: 4
minor: 0
mode: "0666"
- path: "/dev/tty1"
type: c
major: 4
minor: 1
mode: "0666"
- path: "/dev/ttyS0"
type: c
major: 4
minor: 64
mode: "0666"
- path: "/dev/ttyS1"
type: c
major: 4
minor: 65
mode: "0666"
- path: "/dev/ttyAMA0"
type: c
major: 204
minor: 64
mode: "0666"
- path: "/dev/ttyAMA1"
type: c
major: 204
minor: 65
mode: "0666"
- path: "/dev/ttyAML0"
type: c
major: 243
minor: 0
mode: "0666"
- path: "/dev/ttyAML1"
type: c
major: 243
minor: 1
mode: "0666"
- path: "/dev/ttyUSB0"
type: c
major: 188
minor: 0
mode: "0666"
- path: "/dev/ttyUSB1"
type: c
major: 188
minor: 1
mode: "0666"
- name: hook-docker
image: "${HOOK_CONTAINER_DOCKER_IMAGE}"
capabilities:
- all
net: host
pid: host
mounts:
- type: cgroup2
options: [ "rw", "nosuid", "noexec", "nodev", "relatime" ]
destination: /sys/fs/cgroup
binds.add:
- /dev/console:/dev/console
- /dev:/dev
- /etc/resolv.conf:/etc/resolv.conf
- /lib/modules:/lib/modules
- /var/run/docker:/var/run
- /var/run/images:/var/lib/docker
- /var/run/worker:/worker
runtime:
mkdir:
- /var/run/images
- /var/run/docker
- /var/run/worker
devices:
- path: all
type: b
- name: hook-bootkit
image: "${HOOK_CONTAINER_BOOTKIT_IMAGE}"
capabilities:
- all
net: host
mounts:
- type: cgroup2
options: [ "rw", "nosuid", "noexec", "nodev", "relatime" ]
destination: /sys/fs/cgroup
binds:
- /var/run/docker:/var/run
runtime:
mkdir:
- /var/run/docker
- name: dhcpcd-daemon
image: linuxkit/dhcpcd:v1.0.0
command: [ "/etc/ip/dhcp.sh", "false" ] # 2nd paramter is one-shot true/false: true for onboot, false for services
#capabilities.add:
# - CAP_SYS_TIME # for ntp one-shot no-max-offset after ntpd, for hardware missing RTC's that boot in 1970
capabilities:
- all
binds.add:
- /var/lib/dhcpcd:/var/lib/dhcpcd
- /run:/run
- /etc/ip/dhcp.sh:/etc/ip/dhcp.sh
- /dhcpcd.conf:/dhcpcd.conf
runtime:
mkdir:
- /var/lib/dhcpcd
#dbg - name: sshd
#dbg image: linuxkit/sshd:v1.0.0
files:
- path: etc/profile.d/local.sh
contents: |
alias docker='nerdctl -n services.linuxkit exec -it hook-docker docker'
alias docker-shell='nerdctl -n services.linuxkit exec -it hook-docker sh'
export PS1='HookOS ${HOOK_VERSION}:\w\$ '
# only print WARNING or higher kernel messages to console
echo 4 > /proc/sys/kernel/printk
mode: "0644"
- path: etc/motd
mode: "0644"
# This is ANSI Regular font
contents: |
Welcome to HookOS! Your Tinkerbell operating system installation environment.
██ ██ ██ ██████ ███████
██ ██ ██████ ██████ ██ ██ ██ ██ ██
███████ ██ ██ ██ ██ █████ ██ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██████ ██████ ██ ██ ██████ ███████
- Hook flavor ${HOOK_KERNEL_ID} version ${HOOK_VERSION} / Kernel version ${HOOK_KERNEL_VERSION}
- Use `docker` commands to access the tink worker/agent container and workflow action containers.
- Logs are located in the `/var/log/` directory.
- Use `docker logs tink-worker --follow` to watch the worker logs.
- path: etc/os-release
mode: "0444"
contents: |
NAME="HookOS"
VERSION=${HOOK_VERSION}
ID=hookos
VERSION_ID=${HOOK_VERSION}
PRETTY_NAME="HookOS ${HOOK_KERNEL_ID} v${HOOK_VERSION}/k${HOOK_KERNEL_VERSION}"
ANSI_COLOR="1;34"
HOME_URL="https://github.com/tinkerbell/hook"
- path: etc/ip/vlan.sh
source: "files/vlan.sh"
mode: "0777"
- path: etc/ip/dhcp.sh
source: "files/dhcp.sh"
mode: "0777"
- path: dhcpcd.conf
source: "files/dhcpcd.conf"
mode: "0644"
- path: etc/securetty
contents: |
console
tty0
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
tty10
tty11
hvc0
ttyS0
ttyS1
ttyAMA0
ttyAMA1
ttyAML0
ttyAML1
ttyUSB0
ttyUSB1
ttyUSB2
#dbg - path: root/.ssh/authorized_keys
#dbg source: ~/.ssh/id_rsa.pub
#dbg mode: "0600"
#dbg optional: true
trust:
org:
- linuxkit
- library