forked from gardener/gardener
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.tpl.sh
24 lines (19 loc) · 809 Bytes
/
init.tpl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
echo "> Prepare temporary directory for image pull and mount"
tmp_dir="$(mktemp -d)"
unmount() {
ctr images unmount "$tmp_dir" && rm -rf "$tmp_dir"
}
trap unmount EXIT
echo "> Pull gardener-node-agent image and mount it to the temporary directory"
ctr images pull "{{ .image }}" --hosts-dir "/etc/containerd/certs.d"
ctr images mount "{{ .image }}" "$tmp_dir"
echo "> Copy gardener-node-agent binary to host ({{ .binaryDirectory }}) and make it executable"
mkdir -p "{{ .binaryDirectory }}"
cp -f "$tmp_dir/gardener-node-agent" "{{ .binaryDirectory }}"
chmod +x "{{ .binaryDirectory }}/gardener-node-agent"
echo "> Bootstrap gardener-node-agent"
exec "{{ .binaryDirectory }}/gardener-node-agent" bootstrap --config="{{ .configFile }}"