Skip to content
intentdPublic

Repository files navigation

tools

The shared building blocks of intentd's projects.

The general-purpose Kubernetes code that intentd's projects share, written once. Nothing in it knows which project uses it: anything project-specific (labels, annotation prefixes, field managers, names) is a parameter with a neutral default.

Packages

Package Holds
kube Kubernetes knowledge that needs no client of its own: CRD files and schemas (CompareSchemas, SchemaLeafPaths, schema path helpers), GVK/GVR, names, field selectors, a Lease-guarded RunExclusively, labels, annotations and finalizers, sentinels (what changed between two versions of an object), Secrets and their rotation, events
kubeclient The client Interface and its implementation, and the object types
kubeclient/kubefake The fake client every test uses
builtins The table of built-in kinds and their lookups
children Reading an object's live children and enriching them (pods, endpoints, PVC → PV, events, …)
condition Conditions on a data map: comparisons, when (all) and or (one), time, day and cron windows
resolver Go templates ({{ … }}) and CEL (${ … }) over a data map, with KEL's functions, a caller's own, and ApplyField (writing a value through a template)
assert Checks on a command's or an API's output: equals, contains, regex, numbers, expr, json and match; extractors (jsonPath, jq, yq, countLines) that pick the value first
external Calls to services outside the cluster's API: HTTP, Postgres, Redis, Kafka, MongoDB
schemagen Editor JSON Schemas from Go types
cluster kind, kubectl and Helm for CLIs: clusters; services as Docker Compose writes them, with their images, volumes, networks and labels; Helm releases; waiting for resources; Deployment health
cluster/access Giving a hub cluster least-privilege access to target clusters: short or long tokens, refresh, revoke, and the credential as a Secret, Argo CD's cluster Secret or a kubeconfig
command The one way to run a process: arguments, directory, input, environment
scaffold Example packs embedded in a binary, and safe .tar.gz extraction, for init --pack commands
structured, fileio, duration, retry, logger, term, version Nested paths and maps, file reading, durations with days and weeks, retry with backoff, logging, CLI output, build version

Rules

  1. No project code. Nothing here imports one of the projects that use it, or names their labels or config.
  2. Known dependencies only: client-go, apimachinery, apiextensions and controller-runtime; KEL and cel-go for expressions; YAML, a cron parser, zerolog and invopop/jsonschema; and, for external alone, the Postgres, Redis, Kafka and MongoDB clients.
  3. Each package stands alone and is named for what it holds.
  4. Pure packages don't log. They return values and errors.
  5. Tests fake the cluster with kubeclient/kubefake.

Versions

tools has no releases of its own. A project requires it at a commit on main, as a Go pseudo-version:

go get github.com/intentd/tools@<commit>

Binaries built on tools set their version at build time:

go build -ldflags "-X github.com/intentd/tools/version.Version=v1.0.0 \
  -X github.com/intentd/tools/version.Commit=$(git rev-parse --short HEAD)"

Releases

Packages

Used by

Contributors

Languages