lxkns

package module
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

README

Linux kernel Namespaces

Manual PkgGoDev GitHub

build and test Coverage goroutines file descriptors Go Report Card

Overview

lxkns discovers:

  • Linux namespaces in almost every nook and cranny of your hosts (open file descriptors, bind-mounts, processes, and now even tasks),
  • the mount points inside mount namespaces (correctly representing "overmounts").
  • container workloads: these are then related to the underlying Linux namespaces.

The following container engine types are supported:

The lxkns discovery engine can be operated as a stand-alone REST service with additional web UI. Alternatively, it can be embedded/integrated into other system diagnosis tools.

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

CLI Tools

If you use the CLI tools on systems without any container engine(s) please consider using the --noengines flag to avoid unsuppressable error notices from the Docker client library and a delay in startup until the containerd client is satisfied that there isn't any containerd engine present.

Supported Go Versions

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‒23 Harald Albrecht, and licensed under the Apache License, Version 2.0.

Documentation

Overview

Package lxkns discovers Linux kernel namespaces. Please see github.com/thediveo/lxkns/discovery for the specific API to namespace discovery.

For a broader introduction into lxkns, including the service deployment and web user interface, please refer to the 📖online manual.

Additional TDD support can be found in github.com/thediveo/lxkns/test/matchers, implementing domain-specific Gomega matchers about containers, container groups, pods, et cetera.

Index

Constants

View Source
const SemVersion = "0.25.0"

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.
internal/tool
Package tool provides convenience helpers useful to the lxkns CLI tools.
Package tool provides convenience helpers useful to the lxkns CLI tools.
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 [Container] and [ContainerEngine] objects.
Package containerizer provides the implementations to store data about [Container] and [ContainerEngine] objects.
whalefriend
Package whalefriend implements a [containerizer.Containerizer] that discovers containers from container engines supported by the [@thediveo/whalewatcher] module, such as Docker and containerd (moby & friends).
Package whalefriend implements a [containerizer.Containerizer] that discovers containers from container engines supported by the [@thediveo/whalewatcher] module, such as Docker and containerd (moby & friends).
Package decorator defines the [Decorate] plug-in interface, where the so-called “decorators” adorn the container information model with additional data, such as container grouping and unified pod-related container labels.
Package decorator defines the [Decorate] plug-in interface, where the so-called “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.
dockerplugin
Package dockerplugin decorates containerd containers that are represent managed Docker plugins.
Package dockerplugin decorates containerd containers that are represent managed Docker plugins.
industrialedge
Package industrialedge decorates the composer-project flavor of [Siemens Industrial Edge] apps (“IE apps”) when an IE App project is detected.
Package industrialedge decorates the composer-project flavor of [Siemens Industrial Edge] apps (“IE 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.
podman
Package podman decorates lxkns information models with Podman pod groups.
Package podman decorates lxkns information models with Podman pod groups.
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 (as available through "/proc/[PID]/mountinfo") with mount point visibility (“overmounts”) and a hierarchical mount path tree.
Package mounts enhances the Linux kernel's mountinfo data model (as available through "/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” to the referenced namespace open and thus alive.
Package portable provides so-called “portable” namespace references with validation and “locking” to 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
cmd/loosethread
Program loosethread creates a thread (task) that is attached to a newly created network namespace, without attaching this process' other tasks to the new network namespace.
Program loosethread creates a thread (task) that is attached to a newly created network namespace, without attaching this process' other tasks to the new network namespace.
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