Skip to content

Commit d914a19

Browse files
authored
enh: replace docker with containerd in default ignition probe template (#929)
gardenlinux metal-capi ships containerd via the chost feature set, so docker does not need to be installed at probe boot time. Switch to ctr for image pull and container run, and add the containerd disk mount units that wire /dev/sda into /var/lib/containerd before containerd starts. this comes with the added benefit that it does not require any internet connectivity to install packages. Signed-off-by: Konstantin Koslowski <konstantin.koslowski@sap.com>
1 parent 4d8a1ea commit d914a19

2 files changed

Lines changed: 27 additions & 18 deletions

File tree

config/manager/ignition-template.yaml

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,45 @@ variant: fcos
22
version: "1.3.0"
33
systemd:
44
units:
5-
- name: docker-install.service
5+
- name: var-lib-containerd.mount
66
enabled: true
77
contents: |-
88
[Unit]
9-
Description=Install Docker
10-
Before=metalprobe.service
11-
[Service]
12-
Restart=on-failure
13-
RestartSec=20
14-
Type=oneshot
15-
RemainAfterExit=yes
16-
ExecStart=/usr/bin/apt-get update
17-
ExecStart=/usr/bin/apt-get install docker.io docker-cli -y
9+
Description=tmpfs for containerd image cache
10+
DefaultDependencies=no
11+
Before=containerd.service
12+
13+
[Mount]
14+
What=tmpfs
15+
Where=/var/lib/containerd
16+
Type=tmpfs
17+
Options=mode=0700,size=4g
18+
1819
[Install]
1920
WantedBy=multi-user.target
20-
- name: docker.service
21+
- name: containerd.service
2122
enabled: true
23+
dropins:
24+
- name: 10-wait-mount.conf
25+
contents: |-
26+
[Unit]
27+
After=var-lib-containerd.mount
28+
Requires=var-lib-containerd.mount
2229
- name: metalprobe.service
2330
enabled: true
2431
contents: |-
2532
[Unit]
26-
Description=Run Metalprobe Docker Container
33+
Description=Run Metalprobe Container
34+
After=containerd.service
35+
Requires=containerd.service
2736
[Service]
2837
Restart=on-failure
2938
RestartSec=20
30-
ExecStartPre=-/usr/bin/docker stop metalprobe
31-
ExecStartPre=-/usr/bin/docker rm metalprobe
32-
ExecStartPre=/usr/bin/docker pull {{.Image}}
33-
ExecStart=/usr/bin/docker run --network host --privileged --name metalprobe {{.Image}} {{.Flags}}
34-
ExecStop=/usr/bin/docker stop metalprobe
39+
ExecStartPre=/usr/bin/ctr images pull {{.Image}}
40+
ExecStartPre=-/usr/bin/ctr tasks delete --force metalprobe
41+
ExecStartPre=-/usr/bin/ctr containers delete metalprobe
42+
ExecStart=/usr/bin/ctr run --rm --net-host --privileged {{.Image}} metalprobe ./launch.sh {{.Flags}}
43+
TimeoutSec=600
3544
[Install]
3645
WantedBy=multi-user.target
3746
storage:

internal/ignition/default.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"text/template"
1111
)
1212

13-
// Config holds the Docker image and flags.
13+
// Config holds the container image and flags for the metalprobe ignition template.
1414
type Config struct {
1515
Image string
1616
Flags string

0 commit comments

Comments
 (0)