agent

package
v0.2.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 31 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package agent runs the in-cluster continuous loop: collect → evaluate per target → ClusterReadiness CRD status (always) → push snapshot to the server on content change. The agent's local value never depends on server availability (spec §3).

Index

Constants

This section is empty.

Variables

View Source
var AgentVersion = "dev"

AgentVersion is stamped into CRD status and push envelopes. The CLI sets it from the build version; "dev" otherwise.

Functions

func CleartextPushWarning added in v0.2.0

func CleartextPushWarning(serverURL, token string) string

CleartextPushWarning says why pushing to serverURL with token is unsafe, or returns "": a bearer token sent over plain http:// to a host that is not loopback crosses the network in the clear, where anyone on the path can replay it — and the shared ingest token may push as any cluster.

func Run

Run executes the continuous loop until ctx is canceled (returns nil — a cancel is a graceful stop, not an error). The first tick runs immediately; later ticks fire every Interval ±10% jitter, each under tickTimeout. Every tick logs one line and updates the metrics; tick errors are never fatal: the loop never dies on a tick error. With HealthAddr set, /healthz, /readyz and /metrics are served until Run returns.

Types

type Config

type Config struct {
	Interval       time.Duration // default 10m, min 1m
	ServerURL      string        // optional; "" = CRD-only mode
	ServerToken    string        // bearer for push
	ClusterName    string        // human label sent to server; default = ClusterID
	CRName         string        // default crd.DefaultName
	TeamLabel      string        // default "team"
	ForceSyncEvery time.Duration // default 1h: push even if hash unchanged
	// Targets, when non-empty, are the source of truth for spec.targets:
	// every tick reconciles the CR to them, overriding kubectl edits. Empty
	// leaves spec.targets to whoever edits the CR. applyDefaults normalizes
	// each to MAJOR.MINOR ("v1.38" → "1.38", "1.37.2" → "1.37").
	Targets []string
	// SkipCRDManagement leaves the CRD alone entirely (--manage-crd=false):
	// no read, no schema upgrade. The default keeps it in step with the
	// embedded manifest at startup.
	SkipCRDManagement bool
	// HealthAddr is where /healthz, /readyz and /metrics listen, e.g.
	// ":8081"; "" serves none of them.
	HealthAddr string
	// Logger receives the startup line and one line per tick; nil uses
	// slog.Default().
	Logger *slog.Logger
}

Jump to

Keyboard shortcuts

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