package systemd

import "k8s.io/kubernetes/pkg/kubelet/nodeshutdown/systemd"

Package systemd provides utility functions for kubelet to perform systemd related operations.

Index

Types

type DBusCon

type DBusCon struct {
	SystemBus dBusConnector
}

DBusCon has functions that can be used to interact with systemd and logind over dbus.

func NewDBusCon

func NewDBusCon() (*DBusCon, error)

func (*DBusCon) CurrentInhibitDelay

func (bus *DBusCon) CurrentInhibitDelay() (time.Duration, error)

CurrentInhibitDelay returns the current delay inhibitor timeout value as configured in logind.conf(5). see https://www.freedesktop.org/software/systemd/man/logind.conf.html for more details.

func (*DBusCon) InhibitShutdown

func (bus *DBusCon) InhibitShutdown() (InhibitLock, error)

InhibitShutdown creates an systemd inhibitor by calling logind's Inhibt() and returns the inhibitor lock see https://www.freedesktop.org/wiki/Software/systemd/inhibit/ for more details.

func (*DBusCon) MonitorShutdown

func (bus *DBusCon) MonitorShutdown() (<-chan bool, error)

MonitorShutdown detects the node shutdown by watching for "PrepareForShutdown" logind events. see https://www.freedesktop.org/wiki/Software/systemd/inhibit/ for more details.

func (*DBusCon) OverrideInhibitDelay

func (bus *DBusCon) OverrideInhibitDelay(inhibitDelayMax time.Duration) error

OverrideInhibitDelay writes a config file to logind overriding InhibitDelayMaxSec to the value desired.

func (*DBusCon) ReleaseInhibitLock

func (bus *DBusCon) ReleaseInhibitLock(lock InhibitLock) error

ReleaseInhibitLock will release the underlying inhibit lock which will cause the shutdown to start.

func (*DBusCon) ReloadLogindConf

func (bus *DBusCon) ReloadLogindConf() error

ReloadLogindConf uses dbus to send a SIGHUP to the systemd-logind service causing logind to reload it's configuration.

type InhibitLock

type InhibitLock uint32

InhibitLock is a lock obtained after creating an systemd inhibitor by calling InhibitShutdown().

Source Files

doc.go inhibit_linux.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
3 hours ago

Tools for package owners.