linux

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package linux holds Linux host setup: the systemd job slice and read-only checks of the Docker daemon configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerDefaultCgroupParent

func DockerDefaultCgroupParent() (string, error)

DockerDefaultCgroupParent is Host{}.DockerDefaultCgroupParent on the real host.

func EnsureSlice

func EnsureSlice(name string, memMax, swapMax int64) error

EnsureSlice is Host{}.EnsureSlice on the real host.

func SliceUnit

func SliceUnit(memMax, swapMax int64) string

SliceUnit renders the slice unit file. MemoryHigh is deliberately never written: throttling at a soft limit livelocked a production host, a hard MemoryMax fails one job instead. memMax <= 0 omits MemoryMax; swapMax < 0 omits MemorySwapMax (0 means no swap).

Types

type Host

type Host struct {
	Root string // filesystem root prefix; "" = "/" (tests inject a temp dir)
	// Run executes a command; nil runs it for real. Tests inject a recorder.
	Run func(ctx context.Context, name string, args ...string) error
}

Host is the Linux host the setup acts on. The zero value is the real host.

func (Host) DockerDefaultCgroupParent

func (h Host) DockerDefaultCgroupParent() (string, error)

DockerDefaultCgroupParent reads "cgroup-parent" from /etc/docker/daemon.json. Report only: setup shows it, never edits it. A missing file or key yields "".

func (Host) EnsureSlice

func (h Host) EnsureSlice(name string, memMax, swapMax int64) error

EnsureSlice writes /etc/systemd/system/<name> (e.g. "runner-warden-main.slice") and starts it. Idempotent: an unchanged unit is not rewritten and triggers no daemon-reload.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL