Categorygithub.com/thediveo/sealwatcher/v2
modulepackage
2.0.0
Repository: https://github.com/thediveo/sealwatcher.git
Documentation: pkg.go.dev

# README

Sealwatcher

sealwatcher

PkgGoDev GitHub build and test goroutines Coverage Go Report Card

sealwatcher adds Podman support to @thediveo/whalewatcher in order to track the list of containers (name, PID, project, pod) without constant polling and without the hassle of event "binge processing".

Note: sealwatcher/v2 requires podman 4+ as it uses the podman API v4 client – and version compatibility of podman is very limited and very weak when compared to Docker API compatibility.

Note: because building the Podman REST API client requires a considerable amount of C libraries as well as header files to be installed in the build system, sealwatcher isn't an integral part of the whalewatcher module so far. If at some future point the Podman project improves the situation so that Podman REST API clients can be built without the huge installation overhead, then sealwatcher might be finally integrated into whalewatcher.

Installation

First, install the non-Go stuff the Podman module insists of having available, even if it is totally unnecessary for a REST API client. The following is a massively stripped-down version of the Debian/Ubuntu package list from Podman's "Building from scratch" instructions:

sudo apt-get -y install build-essential pkg-config libbtrfs-dev libgpgme-dev

...then you can go get v2 of the sealwatcher module.

go get github.com/thediveo/sealwatcher/v2@latest

Finally, when building your application using sealwatcher directly or indirectly, use these build tags:

-tags exclude_graphdriver_btrfs,exclude_graphdriver_devicemapper,libdm_no_deferred_remove

Supported Go Versions

sealwatcher supports versions of Go that are noted by the Go release policy, that is, N and N-1 major versions.

Miscellaneous

  • to view the package documentation locally:
    • either: make pkgsite,
    • or, in VSCode (using the VSCode-integrated simple browser): “Tasks: Run Task” ⇢ “View Go module documentation”.
  • make shows the available make targets.

Hacking It

This project comes with comprehensive unit tests, even covering goroutine and file descriptor 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.

Copyright and License

Copyright 2022-23 Harald Albrecht, licensed under the Apache License, Version 2.0.

# Packages

Package podman implements the [Podman] [engineclient.EngineClient].
Package test provides simple Podman client convenience helpers to be used in unit tests.
Package util provides convenience utilities for working with the Podman REST API client.

# Functions

New returns a [watcher.Watcher] for keeping track of the currently alive containers, optionally with the composer projects they're associated with.

# Constants

InfraLabelName is the label key that is present on “infrastructure” containers only; the label value is irrelevant and must not be relied upon.
PodLabelName is the label key for the pod name in case a container belongs to a pod.
Type ID of the container engine handled by this watcher.