Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions cmd/agent_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ func setupAgent(
serviceProvider,
)

registry.Register("network",
registry.Register(
"network",
agent.NewNetworkProcessor(
dnsProvider, pingProvider,
interfaceProvider, routeProvider,
Expand All @@ -274,27 +275,32 @@ func setupAgent(
interfaceProvider, routeProvider,
)

registry.Register("command",
registry.Register(
"command",
agent.NewCommandProcessor(commandProvider, log),
commandProvider,
)

registry.Register("file",
registry.Register(
"file",
agent.NewFileProcessor(fileProvider, log),
fileProvider,
)

registry.Register("docker",
registry.Register(
"docker",
agent.NewDockerProcessor(dockerProvider, log),
dockerProvider,
)

registry.Register("schedule",
registry.Register(
"schedule",
agent.NewScheduleProcessor(cronProvider, log),
cronProvider,
)

registry.Register("certificate",
registry.Register(
"certificate",
agent.NewCertificateProcessor(certificateProvider, log),
certificateProvider,
)
Expand Down Expand Up @@ -363,7 +369,8 @@ func createFileProvider(
objStoreName := job.ApplyNamespaceToInfraName(namespace, appConfig.NATS.Objects.Bucket)
objStore, err := b.nc.ObjectStore(ctx, objStoreName)
if err != nil {
log.Warn("Object Store not available, file operations disabled",
log.Warn(
"Object Store not available, file operations disabled",
slog.String("bucket", objStoreName),
slog.String("error", err.Error()),
)
Expand All @@ -373,7 +380,8 @@ func createFileProvider(
fileStateKVConfig := cli.BuildFileStateKVConfig(namespace, appConfig.NATS.FileState)
fileStateKV, err := b.nc.CreateOrUpdateKVBucketWithConfig(ctx, fileStateKVConfig)
if err != nil {
log.Warn("file state KV not available, file operations disabled",
log.Warn(
"file state KV not available, file operations disabled",
slog.String("bucket", fileStateKVConfig.Bucket),
slog.String("error", err.Error()),
)
Expand All @@ -382,7 +390,8 @@ func createFileProvider(

// Seed system templates into the object store (idempotent).
if err := agent.SeedSystemTemplates(ctx, log, objStore); err != nil {
log.Warn("failed to seed system templates",
log.Warn(
"failed to seed system templates",
slog.String("error", err.Error()),
)
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/client_agent_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ func displayAgentGetDetail(
}

if data.LoadAverage != nil {
cli.PrintKV("Load", fmt.Sprintf("%.2f, %.2f, %.2f",
cli.PrintKV("Load", fmt.Sprintf(
"%.2f, %.2f, %.2f",
data.LoadAverage.OneMin, data.LoadAverage.FiveMin, data.LoadAverage.FifteenMin,
)+" "+cli.DimStyle.Render("(1m, 5m, 15m)"))
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/client_job_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ var clientJobDeleteCmd = &cobra.Command{
fmt.Println()
cli.PrintKV("Job ID", jobID, "Status", "Deleted")

logger.Info("job deleted successfully",
logger.Info(
"job deleted successfully",
slog.String("job_id", jobID),
)
},
Expand Down
3 changes: 2 additions & 1 deletion cmd/client_job_retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ var clientJobRetryCmd = &cobra.Command{
cli.PrintKV("Revision", fmt.Sprintf("%d", resp.Data.Revision))
}

logger.Info("job retried successfully",
logger.Info(
"job retried successfully",
slog.String("original_job_id", jobID),
slog.String("new_job_id", resp.Data.JobID),
slog.String("target_hostname", targetHostname),
Expand Down
6 changes: 4 additions & 2 deletions cmd/client_node_status_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ func displayNodeStatusDetail(
cli.PrintKV(kvArgs...)

if data.LoadAverage != nil {
cli.PrintKV("Load", fmt.Sprintf("%.2f, %.2f, %.2f",
cli.PrintKV("Load", fmt.Sprintf(
"%.2f, %.2f, %.2f",
data.LoadAverage.OneMin, data.LoadAverage.FiveMin, data.LoadAverage.FifteenMin,
)+" "+cli.DimStyle.Render("(1m, 5m, 15m)"))
}

if data.Memory != nil {
cli.PrintKV("Memory", fmt.Sprintf("%d GB used / %d GB total / %d GB free",
cli.PrintKV("Memory", fmt.Sprintf(
"%d GB used / %d GB total / %d GB free",
data.Memory.Used/1024/1024/1024,
data.Memory.Total/1024/1024/1024,
data.Memory.Free/1024/1024/1024,
Expand Down
9 changes: 6 additions & 3 deletions cmd/controller_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,8 @@ func registerControllerHandlers(
handlers := make([]func(e *echo.Echo), 0, 16)
handlers = append(
handlers,
agentAPI.Handler(log, jc, signingKey, customRoles, enrollmentWatcher)...)
agentAPI.Handler(log, jc, signingKey, customRoles, enrollmentWatcher)...,
)
handlers = append(handlers, nodeAPI.Handler(log, jc, signingKey, customRoles)...)
handlers = append(handlers, jobAPI.Handler(log, jc, signingKey, customRoles)...)
handlers = append(
Expand All @@ -766,7 +767,8 @@ func registerControllerHandlers(
subComponents,
signingKey,
customRoles,
)...)
)...,
)
handlers = append(handlers, hostnameAPI.Handler(log, jc, signingKey, customRoles)...)
handlers = append(handlers, dockerAPI.Handler(log, jc, signingKey, customRoles)...)
handlers = append(handlers, scheduleAPI.Handler(log, jc, signingKey, customRoles)...)
Expand All @@ -789,7 +791,8 @@ func registerControllerHandlers(
if objStore != nil {
handlers = append(
handlers,
file.Handler(log, objStore, fileStateKV, signingKey, customRoles)...)
file.Handler(log, objStore, fileStateKV, signingKey, customRoles)...,
)
}
handlers = append(handlers, factsAPI.Handler(log, signingKey, customRoles)...)

Expand Down
3 changes: 2 additions & 1 deletion cmd/token_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ This command ensures that the token is authentic, has not expired, and conforms
cli.PrintKV("Effective Permissions", strings.Join(effectivePerms, ", "))

cli.PrintKV("Audience", strings.Join(claims.Audience, ", "))
cli.PrintKV("Issued", claims.IssuedAt.Format(time.RFC3339),
cli.PrintKV(
"Issued", claims.IssuedAt.Format(time.RFC3339),
"Expires", claims.ExpiresAt.Format(time.RFC3339),
)
},
Expand Down
69 changes: 39 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/prometheus/client_golang v1.23.2
github.com/robfig/cron/v3 v3.0.1
github.com/samber/slog-echo v1.21.0
github.com/shirou/gopsutil/v4 v4.26.3
github.com/shirou/gopsutil/v4 v4.26.4
github.com/spf13/cobra v1.10.2
github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.11.1
Expand All @@ -46,6 +46,7 @@ require (
require (
4d63.com/gocheckcompilerdirectives v1.3.0 // indirect
4d63.com/gochecknoglobals v0.2.2 // indirect
charm.land/lipgloss/v2 v2.0.3 // indirect
codeberg.org/chavacava/garif v0.2.0 // indirect
codeberg.org/polyfloyd/go-errorlint v1.9.0 // indirect
dev.gaijin.team/go/exhaustruct/v4 v4.0.0 // indirect
Expand All @@ -58,12 +59,13 @@ require (
github.com/Antonboom/nilnil v1.1.1 // indirect
github.com/Antonboom/testifylint v1.6.4 // indirect
github.com/BurntSushi/toml v1.6.0 // indirect
github.com/ClickHouse/clickhouse-go-linter v1.2.0 // indirect
github.com/Djarvur/go-err113 v0.1.1 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/Masterminds/semver/v3 v3.5.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/MirrexOne/unqueryvet v1.5.4 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.2.1 // indirect
github.com/alecthomas/chroma/v2 v2.23.1 // indirect
github.com/alecthomas/chroma/v2 v2.24.1 // indirect
github.com/alecthomas/go-check-sumtype v0.3.1 // indirect
github.com/alecthomas/kingpin/v2 v2.4.0 // indirect
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect
Expand All @@ -74,29 +76,34 @@ require (
github.com/alingse/nilnesserr v0.2.0 // indirect
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op // indirect
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/ashanbrown/forbidigo/v2 v2.3.0 // indirect
github.com/ashanbrown/makezero/v2 v2.1.0 // indirect
github.com/ashanbrown/forbidigo/v2 v2.3.1 // indirect
github.com/ashanbrown/makezero/v2 v2.2.1 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bkielbasa/cyclop v1.2.3 // indirect
github.com/blizzy78/varnamelen v0.8.0 // indirect
github.com/bombsimon/wsl/v4 v4.7.0 // indirect
github.com/bombsimon/wsl/v5 v5.6.0 // indirect
github.com/bombsimon/wsl/v5 v5.8.0 // indirect
github.com/boumenot/gocover-cobertura v1.4.0 // indirect
github.com/breml/bidichk v0.3.3 // indirect
github.com/breml/errchkjson v0.4.1 // indirect
github.com/butuzov/ireturn v0.4.0 // indirect
github.com/butuzov/ireturn v0.4.1 // indirect
github.com/butuzov/mirror v1.3.0 // indirect
github.com/catenacyber/perfsprint v0.10.1 // indirect
github.com/ccojocar/zxcvbn-go v1.0.4 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charithe/durationcheck v0.0.11 // indirect
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
github.com/charmbracelet/x/ansi v0.10.1 // indirect
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect
github.com/charmbracelet/colorprofile v0.4.3 // indirect
github.com/charmbracelet/ultraviolet v0.0.0-20251205161215-1948445e3318 // indirect
github.com/charmbracelet/x/ansi v0.11.7 // indirect
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
github.com/charmbracelet/x/term v0.2.2 // indirect
github.com/charmbracelet/x/termios v0.1.1 // indirect
github.com/charmbracelet/x/windows v0.2.2 // indirect
github.com/ckaznocha/intrange v0.3.1 // indirect
github.com/clipperhouse/displaywidth v0.11.0 // indirect
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
Expand All @@ -106,7 +113,7 @@ require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/denis-tingaikin/go-header v0.5.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/dlclark/regexp2 v1.11.5 // indirect
github.com/dlclark/regexp2 v1.12.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect
github.com/ebitengine/purego v0.10.0 // indirect
Expand Down Expand Up @@ -138,14 +145,15 @@ require (
github.com/godoc-lint/godoc-lint v0.11.2 // indirect
github.com/gofrs/flock v0.13.0 // indirect
github.com/golangci/asciicheck v0.5.0 // indirect
github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32 // indirect
github.com/golangci/dupl v0.0.0-20260401084720-c99c5cf5c202 // indirect
github.com/golangci/go-printf-func-name v0.1.1 // indirect
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect
github.com/golangci/golangci-lint/v2 v2.11.4 // indirect
github.com/golangci/golangci-lint/v2 v2.12.2 // indirect
github.com/golangci/golines v0.15.0 // indirect
github.com/golangci/misspell v0.8.0 // indirect
github.com/golangci/plugin-module-register v0.1.2 // indirect
github.com/golangci/revgrep v0.8.0 // indirect
github.com/golangci/rowserrcheck v0.0.0-20260419091836-c5f79b8a11ba // indirect
github.com/golangci/swaggoswag v0.0.0-20250504205917-77f2aca3143e // indirect
github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e // indirect
github.com/google/go-cmp v0.7.0 // indirect
Expand All @@ -157,11 +165,10 @@ require (
github.com/gostaticanalysis/nilerr v0.1.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
github.com/hashicorp/go-version v1.8.0 // indirect
github.com/hashicorp/go-version v1.9.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/jgautheron/goconst v1.8.2 // indirect
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
github.com/jgautheron/goconst v1.10.0 // indirect
github.com/jjti/go-spancheck v0.6.5 // indirect
github.com/julz/importas v0.2.0 // indirect
github.com/karamaru-alpha/copyloopvar v1.2.2 // indirect
Expand All @@ -179,15 +186,15 @@ require (
github.com/ldez/usetesting v0.5.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/leonklingele/grouper v1.1.2 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/lucasb-eyer/go-colorful v1.4.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/macabu/inamedparam v0.2.0 // indirect
github.com/manuelarte/embeddedstructfieldcheck v0.4.0 // indirect
github.com/manuelarte/funcorder v0.5.0 // indirect
github.com/manuelarte/funcorder v0.6.0 // indirect
github.com/maratori/testableexamples v1.0.1 // indirect
github.com/maratori/testpackage v1.1.2 // indirect
github.com/matoous/godox v1.1.0 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mattn/go-runewidth v0.0.23 // indirect
github.com/mgechev/revive v1.15.0 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/minio/highwayhash v1.0.4 // indirect
Expand All @@ -197,6 +204,7 @@ require (
github.com/moby/term v0.5.2 // indirect
github.com/moricho/tparallel v0.3.2 // indirect
github.com/morikuni/aec v1.1.0 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nakabonne/nestif v0.3.1 // indirect
Expand All @@ -210,7 +218,7 @@ require (
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pelletier/go-toml/v2 v2.3.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
Expand All @@ -227,20 +235,21 @@ require (
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/ryancurrah/gomodguard v1.4.1 // indirect
github.com/ryancurrah/gomodguard/v2 v2.1.3 // indirect
github.com/ryanrolds/sqlclosecheck v0.6.0 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/samber/lo v1.52.0 // indirect
github.com/sanposhiho/wastedassign/v2 v2.1.0 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
github.com/sashamelentyev/usestdlibvars v1.29.0 // indirect
github.com/securego/gosec/v2 v2.24.8-0.20260309165252-619ce2117e08 // indirect
github.com/securego/gosec/v2 v2.26.1 // indirect
github.com/segmentio/golines v0.13.0 // indirect
github.com/sirupsen/logrus v1.9.4 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
github.com/sonatard/noctx v0.5.1 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/sourcegraph/go-diff v0.7.0 // indirect
github.com/sourcegraph/go-diff v0.8.0 // indirect
github.com/speakeasy-api/jsonpath v0.6.0 // indirect
github.com/speakeasy-api/openapi-overlay v0.10.2 // indirect
github.com/spf13/afero v1.15.0 // indirect
Expand All @@ -250,8 +259,8 @@ require (
github.com/stbenjam/no-sprintf-host-port v0.3.1 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tetafro/godot v1.5.4 // indirect
github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67 // indirect
github.com/tetafro/godot v1.5.6 // indirect
github.com/timakin/bodyclose v0.0.0-20260129054331-73d1f95b84b4 // indirect
github.com/timonwong/loggercheck v0.11.0 // indirect
github.com/tklauser/go-sysconf v0.3.16 // indirect
github.com/tklauser/numcpus v0.11.0 // indirect
Expand All @@ -260,7 +269,7 @@ require (
github.com/ultraware/funlen v0.2.0 // indirect
github.com/ultraware/whitespace v0.2.0 // indirect
github.com/uudashr/gocognit v1.2.1 // indirect
github.com/uudashr/iface v1.4.1 // indirect
github.com/uudashr/iface v1.4.2 // indirect
github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect
github.com/woodsbury/decimal128 v1.3.0 // indirect
github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect
Expand All @@ -273,7 +282,7 @@ require (
github.com/yusufpapurcu/wmi v1.2.4 // indirect
gitlab.com/bosi/decorder v0.4.2 // indirect
go-simpler.org/musttag v0.14.0 // indirect
go-simpler.org/sloglint v0.11.1 // indirect
go-simpler.org/sloglint v0.12.0 // indirect
go.augendre.info/arangolint v0.4.0 // indirect
go.augendre.info/fatcontext v0.9.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
Expand Down Expand Up @@ -313,11 +322,11 @@ require (
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
golang.org/x/crypto v0.50.0 // indirect
golang.org/x/mod v0.34.0 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/mod v0.35.0 // indirect
golang.org/x/net v0.53.0 // indirect
golang.org/x/sys v0.43.0 // indirect
golang.org/x/text v0.36.0 // indirect
golang.org/x/tools v0.43.0 // indirect
golang.org/x/tools v0.44.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
Loading
Loading