Commit Graph

54 Commits

Author SHA1 Message Date
Avi Deitcher
198db9089f
containerd 20 (#4100)
* bump containerd-dev to 2.0.2

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update pkg/init libs to containerd-20

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* bump linuxkit CLI containerd deps to 20

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update test/pkg/containerd to work with containerd v2.x tests

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update containerd-dev deps

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update pkg/init and pkg/containerd dependencies

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update test/pkg/containerd deps

Signed-off-by: Avi Deitcher <avi@deitcher.net>

---------

Signed-off-by: Avi Deitcher <avi@deitcher.net>
2025-02-24 18:40:56 +02:00
Avi Deitcher
5848a2856f use only stdout/stderr or file for runc output
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-08-28 14:45:26 +03:00
Avi Deitcher
15c808c4ee more verbose runc messages
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-08-22 20:23:44 +03:00
Avi Deitcher
b36cad081b when building read-only volumes, still use overlayfs
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-08-22 18:49:08 +03:00
Avi Deitcher
2af30c5503 support cmdline-driven debugging mode for runc
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-08-22 15:14:35 +03:00
Avi Deitcher
a5085fc9ea pkg/init support for volumes
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-07-21 17:48:39 +03:00
Jacob Weinstock
803747f01a Make cgroups v2 the default:
cgroups v2 has been out since 2015. Not having
to set a kernel parameter helps improve the user
experience by not requiring it when it is required
by services in a build. Making this the default was
discussed back in 2021.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2024-04-27 15:40:00 -06:00
Avi Deitcher
b26c169797
Merge pull request #3920 from vouch-opensource/fix/service-restarts-with-memlogd
Allow service restarts when using memlogd
2023-11-14 06:23:58 -08:00
Avi Deitcher
0e2f17a05a correctly handle fields in cmdline for cgroupsv2
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2023-10-25 18:33:28 +03:00
Stijn Opheide
247d919a81
remove file at fifo logging location if it exists
Signed-off-by: Stijn Opheide <stijn@opheide.be>
2023-04-18 14:28:01 +02:00
Avi Deitcher
45e299ce91
Merge pull request #3848 from dgageot/remove-more-dead-code-pkg
Remove dead or redundant code (packages)
2022-10-10 20:55:02 +03:00
David Gageot
39807bb0bd Remove dead or redundant code
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-09 15:33:42 +02:00
David Gageot
810c3e788f
Prefer nil empty slices
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-09 15:02:23 +02:00
David Gageot
d4e132021a
Remove 99% of deprecated ioutil usage
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-09 13:10:38 +02:00
David Gageot
998ad7eea1
Fix comments
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-08 22:41:20 +02:00
David Scott
c4d7f5d993 service: handle creating cgroupv2 cgroups
These are easier to create than cgroupv1 cgroups as they are only a
single mkdir.

Detect which mode we are in by looking for the presence of the
cgroupv2-only cgroup.controllers file.

Signed-off-by: David Scott <dave@recoil.org>
2022-03-13 19:37:05 +00:00
Dave Tucker
fcaab549fe init: Migrate to Go Modules
Moves vendoring over to Go modules.
Fixes issues found by Go Vet in Go 1.16

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2022-01-11 20:18:37 +00:00
Tonis Tiigi
5af7c526ec init: add support for cgroupv2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-10-24 23:03:51 -07:00
Avi Deitcher
ef3e45ac02 pkgs: Update packages to the latest linuxkit/alpine
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-04-28 09:13:18 +03:00
Avi Deitcher
203cbd9b9f multiple containerd options
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2020-10-21 11:11:48 +03:00
Avi Deitcher
54be4048f0 fix reversed equals error
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2020-10-19 20:54:14 +03:00
Avi Deitcher
865ed8a1ce add containerd cli opts
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2020-10-19 14:49:15 +03:00
Ilya Dmitrichenko
86fb6ba0aa
pkg/init: Mount /sys/fs/bpf
NOTE: This will be a shared mount, due to root being turned into a
shared with `MC_REC` set: `mount("", "/", "", rec|shared, "")`.
For some reason setting `shared` when mounting `/sys/fs/bpf` doesn't
work at all, perhaps that's just a kernel feature.

Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
2020-05-06 11:06:54 +01:00
Rolf Neugebauer
2427145dfc pkg/init: Revert "workaround bad containerd bug"
This reverts commit 6653c3387e.

Signed-off-by: Rolf Neugebauer <rn@rneugeba.io>
2020-04-26 22:49:48 +01:00
Avi Deitcher
6653c3387e workaround bad containerd bug
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2020-03-23 12:18:14 +02:00
Tomas Knappek
63a6a60fed Fixes linuxkit#3237: add support for named pipes to init
Signed-off-by: Tomas Knappek <tomas.knappek@gmail.com>
2019-02-07 10:37:15 -08:00
Justin Cormack
cf5cec204d
Update LinuxKit for merge of moby tool
- use the mkimage hashes that we had in LinuxKit as more up to date than tool.
- update docs
- move the code from moby under src/cmd/linuxkit

Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2018-07-16 14:22:15 +01:00
David Scott
7c243a8e8b pkg/init: only create /var/log/onboot symlink if not using memlogd
When logging directly to files (the not-using-memlogd case) the onboot
services must log to /run/log because /var/log might be overmounted
by a persistent disk. Therefore we create a symlink at the end of
the onboot section.

When logging via memlogd, all logs are buffered until a logwrite service
starts, so no symlink is needed.

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-13 11:47:43 +01:00
David Scott
5201049f2c pkg/init: write stderr to <name> rather than <name>.err
This will then be written to disk as <name>.log by logwrite.

Part of #3111

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-13 10:48:31 +01:00
David Scott
f4bbce7a6c service: use the logging system with runc
If external logging is enabled, this patch sets the stdout and stderr
of the `runc` invocations to one end of a socketpair and the other end is
sent to the logging service. Otherwise we log to files as before.

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-06 21:49:21 +01:00
David Scott
4dc75bc67b service: use the logging system with containerd
An external logging system exists if the socket

  /var/run/linuxkit-external-logging.sock

exists.

If an external logging system is enabled then create FIFOs for
containerd and send the other end of the FIFOs to the logging service.
Otherwise use /var/log files as before.

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-06 21:48:57 +01:00
Justin Barrick
9821180548 Add a restart and stop command to service.
Signed-off-by: justinbarrick <jbarrick@cloudflare.com>
2018-06-12 15:04:16 -07:00
Ian Campbell
e8e28c27e9 Bump packages to new alpine w/ containerd v1.1.0-rc.2
Since we are building containerd v1.1.0 with go 1.10 (as it requires) to the
same for init and runc too for consistency. In the case of init it is actually
required since we use the containerd client library there.

The subreaper interfaces have been removed from containerd and replaced with a
similar interface in runc/libcontainer, update init to use that now.

Signed-off-by: Ian Campbell <ijc@docker.com>
2018-04-18 11:27:03 +01:00
Avi Deitcher
cc57288b64 Add logging to /var/log for onboot containers
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2018-03-02 15:29:23 +02:00
Justin Cormack
4b9ffadb2e Add support for runtime containerd namespace configuration
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2018-01-18 12:40:56 +00:00
Ian Campbell
a4230b74aa init: print integer with %d not %s
go_vet (via https://goreportcard.com/report/github.com/linuxkit/linuxkit)
reported:

    error: arg resource for printf verb %s of wrong type: int (vet)

Signed-off-by: Ian Campbell <ijc@docker.com>
2018-01-15 17:24:36 +00:00
Ian Campbell
794ea7ed72 Make runtime.mounts[].destination relative to container rootfs
This is similar to ae64ab6b82 from #2849 which
did the same for runtime.mkdir.

This makes it possible to specify both host (absolute) or container (relative)
paths.

Signed-off-by: Ian Campbell <ijc@docker.com>
2018-01-11 12:58:09 +00:00
Justin Cormack
ae64ab6b82 Make relative paths in runtime mkdir be relative to container rootfs
Currently all paths were treated as absolute paths.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2018-01-10 14:58:49 +00:00
Justin Cormack
a4a332f39a Use logrus not log for logging consistently
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2018-01-10 14:28:50 +00:00
Stephen J Day
fbbab9eafd
pkg/init/cmd/service: plumb containerd namespace
This PR correctly plumbs a single context to propagate the containerd
namespace to the necessary commands. Services launched with containerd
after this change will now be in a default namespace of
`services.linuxkit`.

A top-level flag is added to the service command,
`--containerd-namespace` which can be used to change, if needed.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-01-05 14:45:19 -08:00
Tobias Klauser
642c6f23ac Use pure Go unix.Reboot function in rc.init
Use unix.Reboot from golang.org/x/sys/unix for poweroff and reboot
instead of relying on external commands.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2018-01-04 13:16:28 +01:00
Ian Campbell
28e22e40bb Bump packages to new alpine w/ containerd v1.0.0-rc.0
Minor updates due to renamings in containerd.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-12-01 13:36:16 +00:00
Justin Cormack
6cb919b489 Add support for creating cgroups in runtime section
Implements https://github.com/moby/tool/pull/181

Design for things like Kubernetes setup that requires some cgroups to
exist when the service starts but it is not running in these, other
services are, so there would be a race if they are not created in each.

Essentially it is just a sugared `mkdir` in all the cgroup dirs.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-11-17 14:12:41 +00:00
Ian Campbell
09c89a923b Bump init and containerd package to v1.0.0-beta.1
golint on pkg/init now complains:

    golint...
    ./init.go:199:2: redundant if ...; err != nil check, just return error instead.

Resulting in a change which doesn't seem like an improvement to me.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-09-25 13:39:21 +01:00
Justin Cormack
042cd763fe Add vendoring for rc.init
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-09-18 11:46:00 -07:00
Justin Cormack
bcfb760a1d Convert rc.init and rc.shutdown to Go
This removes more shell scripts to improve maintainability.

This now also works correctly in userspace, so it can be used for
running LinuxKit images in Docker and other such use cases.

It is a literal conversion of the shell scripts with a few small
tweaks.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-09-18 11:45:59 -07:00
David Scott
9c35dbaac2 service: log stdout and stderr to separate files
Previously we would pass the path `/var/log/service.log` for both
stdout and stderr to containerd. containerd would construct a dict
with the paths as keys[1] and, due to the duplicate key, would only
open one of the files and start one `io.Copy` instance. Writes to
the other stream would be buffered by the pipe connected to
containerd-shim and would eventually block.

If we modified containerd to open the file twice and start 2
`io.Copy` instances, we would end up with the two streams interleaved
together. It seems cleaner to keep the streams separate; therefore
this patch logs stdout to `/var/log/service.out.log` and stderr to
`/var/log/service.err.log`.

[1]
49437711c3/linux/shim/io.go (L51)

Signed-off-by: David Scott <dave.scott@docker.com>
2017-09-14 11:15:04 +01:00
Ian Campbell
b0b08e18a2 Bump init and containerd packages to v1.0.0-alpha6
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-08-29 01:02:20 +01:00
Justin Cormack
5773dfd844 Cleanup cleanup code
Only remove main mount at rootfs, as we do not really know
about the state of the rest.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-23 16:40:03 +01:00
Justin Cormack
49cf74f4f6 Switch to having the moby tool specify how to do mounts
This removes all the code that had knowledge of how to do read only
and read write container mounts, and just uses the runtime config.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-23 16:40:03 +01:00