Documentation
¶
Index ¶
- Variables
- func IsTelemetryFollowRequest(r *http.Request, ri *apirequest.RequestInfo) bool
- type Manager
- type Option
- func WithAllowInvocationTestWrites(allow bool) Option
- func WithBindAddress(addr string) Option
- func WithBindPort(port int) Option
- func WithCertDir(dir string) Option
- func WithClickHouseAddress(addr string) Option
- func WithClickHouseDatabase(db string) Option
- func WithClickHouseTTLDays(d int) Option
- func WithClientConfig(cfg *rest.Config) Option
- func WithDisableAuth() Option
- func WithHealthBindAddress(addr string) Option
- func WithInsecureAllowPublic() Option
- func WithLeaderElection(id, namespace string) Option
- func WithMetricsBindAddress(addr string) Option
- func WithNATS(p invocation.NATSProvider) Option
- func WithResource(obj resource.Object) Option
- func WithResources(objs ...resource.Object) Option
- func WithSQLiteConnArgs(args map[string]string) Option
- func WithSQLitePath(path string) Option
Constants ¶
This section is empty.
Variables ¶
var Scheme = runtime.NewScheme()
Scheme is the controller-runtime scheme used by the embedded apiserver and the reconcilers attached to it. It is populated at init() time so that the apiserver and ctrl.Manager both see the same type registry.
Functions ¶
func IsTelemetryFollowRequest ¶
func IsTelemetryFollowRequest(r *http.Request, ri *apirequest.RequestInfo) bool
IsTelemetryFollowRequest reports whether r is a streaming follow read of the {logs,traces} read subresources (taskagents|daemonagents/{name}/ {logs,traces}?follow=true). Such a request streams for as long as the client watches -- serveFollow polls ClickHouse on an interval and writes NDJSON chunks -- so it must be exempted from the apiserver's non-long-running request timeout. Without the exemption that timeout (60s by default) fires mid-stream, after the 200 and headers are already flushed, and aborts the handler with http.ErrAbortHandler, resetting the HTTP/2 stream (the client sees "stream error ... INTERNAL_ERROR").
A non-follow GET of the same subresource is a one-shot paged query and is deliberately NOT long-running, so it keeps the request timeout as a safety bound. The check mirrors telemetry.parseFilters' ParseBool of the follow param.
Types ¶
type Manager ¶
type Manager struct {
ReadyCh chan error
// StartCh gates the ctrl.Manager start. Start() signals ReadyCh after
// the apiserver and ctrl.Manager are set up, then blocks on StartCh
// before calling ctrl.Manager.Start. Callers (cmd/controller-manager,
// clrk dev) use this window to SetupWithManager the reconcilers and
// do APIService bootstrap that must happen before the ctrl.Manager
// cache starts discovery.
StartCh chan struct{}
// contains filtered or unexported fields
}
Manager runs an embedded apiserver and a controller-runtime manager bound to it. Callers register reconcilers on the ctrl.Manager returned by CtrlManager() after ReadyCh fires.
func (*Manager) CtrlManager ¶
CtrlManager returns the controller-runtime manager after Start signals ready.
func (*Manager) EmbeddedLoopbackConfig ¶
EmbeddedLoopbackConfig returns a rest.Config for the embedded apiserver's loopback endpoint. The notifications recorder and the advisory materializer use it to read/write events.k8s.io/v1 Events against clrk's own apiserver -- never the customer cluster, whose built-in Events group an APIService cannot override. Valid only after Start has brought the apiserver up (the caller resolves it lazily, like the invoke/agentmetrics client seams).
func (*Manager) InvocationPool ¶
func (m *Manager) InvocationPool() *invocation.LazyPool
InvocationPool returns the shared LazyPool backing the Invocation read model, or nil if startAPIServer hasn't run yet. Callers (the TaskAgent revision controller's active-execution counter) read through it after ReadyCh fires; the pool itself resolves asynchronously as the embedded ClickHouse comes up, and a Do before resolution blocks (bounded by the caller's ctx) then returns "storage unavailable" if the dial failed.
type Option ¶
type Option func(*options)
Option configures the Manager.
func WithAllowInvocationTestWrites ¶
WithAllowInvocationTestWrites opens the header-gated Create/Update door on the top-level Invocation resource (still requires the per-request X-Clrk-Invocation-Write header). Dev/CI only; leave off in production so the system-written billing record can't be forged.
func WithBindAddress ¶
WithBindAddress sets the apiserver bind address. Defaults to 127.0.0.1. Binding to a non-loopback address while authentication is disabled (the current default) requires WithInsecureAllowPublic — otherwise Start refuses to launch a publicly reachable, unauthenticated apiserver.
func WithBindPort ¶
WithBindPort sets the apiserver bind port. Defaults to 8443.
func WithCertDir ¶
WithCertDir sets the TLS certificate directory. When empty, the apiserver generates self-signed certs on the fly and the manager uses an insecure loopback client.
func WithClickHouseAddress ¶
WithClickHouseAddress overrides the address (host:port) the embedded-CH Invocation storage dials. Defaults to 127.0.0.1:9000 (the loopback the in-cm ClickHouse supervisor exposes).
func WithClickHouseDatabase ¶
WithClickHouseDatabase overrides the CH schema name. Defaults to "default" — same schema the otel_logs / otel_traces tables live in.
func WithClickHouseTTLDays ¶
WithClickHouseTTLDays overrides the Invocation row retention. The rendered TTL is enforced at the CH MergeTree level. Defaults to 90 days.
func WithClientConfig ¶
WithClientConfig overrides the client *rest.Config used by the embedded ctrl.Manager. The default is a loopback insecure config.
func WithDisableAuth ¶
func WithDisableAuth() Option
WithDisableAuth disables authentication and authorization. Dev-only.
func WithHealthBindAddress ¶
WithHealthBindAddress sets the ctrl.Manager healthz endpoint.
func WithInsecureAllowPublic ¶
func WithInsecureAllowPublic() Option
WithInsecureAllowPublic acknowledges that the apiserver is intentionally being bound to a non-loopback address while authentication is disabled. Without this, Start refuses such a configuration to prevent accidental exposure of an unauthenticated control plane (e.g. a Service published on a host network or a docker -p mapping). Required only when disableAuth is true and bindAddress is non-loopback.
func WithLeaderElection ¶
WithLeaderElection enables controller-runtime leader election against the embedded apiserver using the given lease name and namespace.
func WithMetricsBindAddress ¶
WithMetricsBindAddress sets the ctrl.Manager metrics endpoint.
func WithNATS ¶
func WithNATS(p invocation.NATSProvider) Option
WithNATS supplies the embedded NATS/JetStream server the Invocation pub/sub uses: the materializing consumer, the Watch ordered consumers, and the test-write publisher. When nil (NATS disabled), Invocation Watch degrades to an empty watch and the test-write door stays 405.
func WithResource ¶
WithResource registers a resource type with the apiserver.
func WithResources ¶
WithResources registers a batch of resource types.
func WithSQLiteConnArgs ¶
WithSQLiteConnArgs overrides the SQLite DSN parameters.
func WithSQLitePath ¶
WithSQLitePath sets the SQLite file path. Use "file::memory:" for in-memory.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agentmetrics backs the Tier-1 metrics.clrk.apoxy.dev snapshot kinds — TaskAgentMetrics and DaemonAgentMetrics — with query-time ClickHouse aggregation over the otel_traces table.
|
Package agentmetrics backs the Tier-1 metrics.clrk.apoxy.dev snapshot kinds — TaskAgentMetrics and DaemonAgentMetrics — with query-time ClickHouse aggregation over the otel_traces table. |
|
Package chsql holds the small ClickHouse SQL-building primitives shared by the apiserver read models (invocation, telemetry, agentmetrics).
|
Package chsql holds the small ClickHouse SQL-building primitives shared by the apiserver read models (invocation, telemetry, agentmetrics). |
|
Package egressmetrics backs the Tier-1 metrics.clrk.apoxy.dev EgressGatewayMetrics kind with query-time ClickHouse aggregation over the otel_traces table, the way agentmetrics backs the agent snapshot kinds.
|
Package egressmetrics backs the Tier-1 metrics.clrk.apoxy.dev EgressGatewayMetrics kind with query-time ClickHouse aggregation over the otel_traces table, the way agentmetrics backs the agent snapshot kinds. |
|
Package invocation backs the Invocation API kind with a ClickHouse read model materialized from a JetStream event stream.
|
Package invocation backs the Invocation API kind with a ClickHouse read model materialized from a JetStream event stream. |
|
Package invoke serves the taskagents/{name}/invoke connect subresource: the write-side door the run-task CLI POSTs to.
|
Package invoke serves the taskagents/{name}/invoke connect subresource: the write-side door the run-task CLI POSTs to. |
|
Package metricsquery serves the Tier-2 time-series surface of the clrk metrics API: a metric catalog plus a series query, for the charts the Tier-1 metrics-server-shaped snapshots (internal/apiserver/agentmetrics) structurally cannot express -- labeled series, histogram percentiles, and free-dimension group-by.
|
Package metricsquery serves the Tier-2 time-series surface of the clrk metrics API: a metric catalog plus a series query, for the charts the Tier-1 metrics-server-shaped snapshots (internal/apiserver/agentmetrics) structurally cannot express -- labeled series, histogram percentiles, and free-dimension group-by. |
|
Package telemetry serves the read API for an agent's OTel logs and traces: the taskagents/{name}/{logs,traces} and daemonagents/{name}/{logs,traces} connect subresources.
|
Package telemetry serves the read API for an agent's OTel logs and traces: the taskagents/{name}/{logs,traces} and daemonagents/{name}/{logs,traces} connect subresources. |
|
Package workerpoolmetrics backs the Tier-1 metrics.clrk.apoxy.dev WorkerPoolMetrics kind with query-time ClickHouse aggregation over the otel_traces table, the way agentmetrics and egressmetrics back the other Tier-1 snapshot kinds.
|
Package workerpoolmetrics backs the Tier-1 metrics.clrk.apoxy.dev WorkerPoolMetrics kind with query-time ClickHouse aggregation over the otel_traces table, the way agentmetrics and egressmetrics back the other Tier-1 snapshot kinds. |