lxkns

package module
v0.21.9 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

README

Linux kernel Namespaces

…and Containers.

view manual PkgGoDev GitHub build and test goroutines file descriptors Go Report Card

lxkns is a Golang package for discovering Linux kernel namespaces as well as mount points in mount namespaces. It then relates them to containers, where possible. In (almost) every nook and cranny of your Linux hosts.

This discovery can be operated as a stand-alone REST service with additional web UI. Or it can be integrated into system diagnosis tools that need an unobstructed view on Linux-kernel namespaces.

For mount namespaces, lxkns finds mount points even in process-less mount namespaces (for instance, as utilized in "snap" technology). Our discovery engine even determines the visibility of mount points, taking different forms of "overmounting" into consideration.

Take a look at the comprehensive user (and developer) manual.

Please check Important Changes, especially if you have been used the API in the past, and not only the service.

Or, watch the short overview video how to find your way around discovery web frontend:

lxkns web app

Notes

lxkns supports versions of Go that are noted by the Go release policy, that is, major versions N and N-1 (where N is the current major version).

Hacking It

This project comes with comprehensive unit tests, also covering leak checks:

  • goroutine leak checking courtesy of Gomega's gleak package.

  • file descriptor leak checking courtesy of the @thediveo/fdooze module.

Note: do not run parallel tests for multiple packages. make test ensures to run all package tests always sequentially, but in case you run go test yourself, please don't forget -p 1 when testing multiple packages in one, erm, go.

lxkns is Copyright 2020‒21 Harald Albrecht, and licensed under the Apache License, Version 2.0.

Documentation

Overview

Package lxkns discovers Linux kernel namespaces. Please see the discovery (sub)package for the specific API to namespace discovery.

TDD support can be found in the test/matchers (sub)package implementing domain-specific Gomega (https://onsi.github.io/gomega) matcher about containers, container groups, pods, et cetera.

Index

Constants

View Source
const SemVersion = "0.21.9"

SemVersion is the semantic version string of the lxkns module.

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
api
types
Package types defines the common types for (un)marshalling elements of the lxkns information model from/to JSON.
Package types defines the common types for (un)marshalling elements of the lxkns information model from/to JSON.
cmd
dumpns
dumpns runs a namespace (and process) discovery and then dumps the results as JSON.
dumpns runs a namespace (and process) discovery and then dumps the results as JSON.
internal/pkg/cli
Package cli handles registering CLI flags via a plug-in mechanism.
Package cli handles registering CLI flags via a plug-in mechanism.
internal/pkg/filter
Package filter provides CLI-controlled filtering of namespaces by type.
Package filter provides CLI-controlled filtering of namespaces by type.
internal/pkg/style
Package style styles text output of the CLI commands with foreground and background colors, as well as different text styles (bold, italics, ...).
Package style styles text output of the CLI commands with foreground and background colors, as well as different text styles (bold, italics, ...).
internal/test/getstdout
Package getstdout captures os.Stdout and os.Stderr while executing a specified function, returning the captured output afterwards.
Package getstdout captures os.Stdout and os.Stderr while executing a specified function, returning the captured output afterwards.
lspidns
lspidns lists the tree of PID namespaces, optionally with their owning user namespaces.
lspidns lists the tree of PID namespaces, optionally with their owning user namespaces.
lsuns
lsuns lists the tree of user namespaces, optionally with the other namespaces they own.
lsuns lists the tree of user namespaces, optionally with the other namespaces they own.
nscaps
nscaps determines a process' capabilities in some namespace.
nscaps determines a process' capabilities in some namespace.
pidtree
pidtree displays a tree (or only a single branch) of processes together with their PID namespaces, and additionally also shows the local PIDs of processes (where applicable).
pidtree displays a tree (or only a single branch) of processes together with their PID namespaces, and additionally also shows the local PIDs of processes (where applicable).
Package containerizer provides the implementations to store data about Containers and ContainerEngines.
Package containerizer provides the implementations to store data about Containers and ContainerEngines.
whalefriend
Package whalefriend implements a Containerizer that discovers containers from container engines supported by the github.com/thediveo/whalewatcher module, such as Docker and containerd (moby & friends).
Package whalefriend implements a Containerizer that discovers containers from container engines supported by the github.com/thediveo/whalewatcher module, such as Docker and containerd (moby & friends).
Package decorator defines the Decorator plug-in interface, where Decorators adorn the container information model with additional data, such as container grouping and unified pod-related container labels.
Package decorator defines the Decorator plug-in interface, where Decorators adorn the container information model with additional data, such as container grouping and unified pod-related container labels.
all
Package all imports and activates all lxkns (container) decorator plugins, activating them during discoveries.
Package all imports and activates all lxkns (container) decorator plugins, activating them during discoveries.
composer
Package composer decorates lxkns information models with (Docker) Composer project groups.
Package composer decorates lxkns information models with (Docker) Composer project groups.
industrialedge
Package industrialedge decorates the composer-project flavor of Siemens Industrial Edge apps when an IE App project is detected.
Package industrialedge decorates the composer-project flavor of Siemens Industrial Edge apps when an IE App project is detected.
kuhbernetes
Package kuhbernetes provides Decorators for "recovering" Kubernetes pods from the containers found.
Package kuhbernetes provides Decorators for "recovering" Kubernetes pods from the containers found.
kuhbernetes/cricontainerd
Package cricontainerd decorates Kubernetes pod groups discovered from CRI-managed containers, based on their CRI-related labels.
Package cricontainerd decorates Kubernetes pod groups discovered from CRI-managed containers, based on their CRI-related labels.
kuhbernetes/dockershim
Package dockershim decorates Kubernetes pod groups discovered from Docker container names managed by the (in)famous Docker shim.
Package dockershim decorates Kubernetes pod groups discovered from Docker container names managed by the (in)famous Docker shim.
Package discover discovers Linux kernel namespaces of types cgroup, ipc, mount, net, pid, time, user, and uts.
Package discover discovers Linux kernel namespaces of types cgroup, ipc, mount, net, pid, time, user, and uts.
examples
internal
log
Package log allows consumers of the lxkns module to forward logging originating in the lxkns module to whatever logger module they prefer.
Package log allows consumers of the lxkns module to forward logging originating in the lxkns module to whatever logger module they prefer.
logrus
Package logrus enables logging within the lxkns module and directs all logging output to the sirupsen/logrus logging module.
Package logrus enables logging within the lxkns module and directs all logging output to the sirupsen/logrus logging module.
Package model defines the core of lxkns information model: Linux kernel namespaces and processes, and how they relate to each other; with the additional missing link between processes and user-land containers.
Package model defines the core of lxkns information model: Linux kernel namespaces and processes, and how they relate to each other; with the additional missing link between processes and user-land containers.
Package mounts enhances the Linux kernel's mountinfo data model ("/proc/[PID]/mountinfo") with mount point visibility ("overmounts") and a hierarchical mount path tree.
Package mounts enhances the Linux kernel's mountinfo data model ("/proc/[PID]/mountinfo") with mount point visibility ("overmounts") and a hierarchical mount path tree.
Package nstest provides testing support in the context of Linux kernel namespaces.
Package nstest provides testing support in the context of Linux kernel namespaces.
gmodel
Package gmodel provides Gomega matches for lxkns model elements.
Package gmodel provides Gomega matches for lxkns model elements.
ops
Package ops provides a Golang-idiomatic API to the query and switching operations on Linux-kernel namespaces, hiding ioctl()s and syscalls.
Package ops provides a Golang-idiomatic API to the query and switching operations on Linux-kernel namespaces, hiding ioctl()s and syscalls.
internal/opener
Package opener provides access to the file descriptors of namespace references.
Package opener provides access to the file descriptors of namespace references.
mountineer
Package mountineer allows accessing the file system contents from (other) mount namespaces via procfs.
Package mountineer allows accessing the file system contents from (other) mount namespaces via procfs.
mountineer/mntnssandbox
Package mntnssandbox is a single-purpose, stripped-down version of thediveo/gons.
Package mntnssandbox is a single-purpose, stripped-down version of thediveo/gons.
portable
Package portable provides so-called "portable" namespace references with validation and "locking" (keeping the referenced namespace open and thus alive).
Package portable provides so-called "portable" namespace references with validation and "locking" (keeping the referenced namespace open and thus alive).
relations
Package relations gives access to properties of and relationships between Linux-kernel namespaces, such as type and ID of a namespace, its owning user namespace, parent namespace in case of hierarchical namespaces, et cetera.
Package relations gives access to properties of and relationships between Linux-kernel namespaces, such as type and ID of a namespace, its owning user namespace, parent namespace in case of hierarchical namespaces, et cetera.
Package plural supplies lxkns with (only) English-language plurals for common objects appearing in the lxkns information model.
Package plural supplies lxkns with (only) English-language plurals for common objects appearing in the lxkns information model.
Package species defines the type constants and type names of the currently 8 Linux kernel namespace types ("species").
Package species defines the type constants and type names of the currently 8 Linux kernel namespace types ("species").
test
containerdtest
Package containerdtest is a poor-man's dockertest.
Package containerdtest is a poor-man's dockertest.
matcher
Package matcher implements Gomega matchers for lxkns information model artifacts, such as containers and container groups (pods in particular).
Package matcher implements Gomega matchers for lxkns information model artifacts, such as containers and container groups (pods in particular).

Jump to

Keyboard shortcuts

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