prober

package
v0.6.76 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 20 Imported by: 0

Documentation

Overview

Package prober is the gateway half of the agent probe handoff (pkg/devbox/probe): it watches the operator's probe request ConfigMaps, runs each probe in an actor resumed from the revision's golden tag and writes the result back.

The probe actor is a pseudo-instance: it isn't a console instance, so its only credential is the box-scoped AI proxy token the operator minted, registered with egress as a static credential, and its egress policy allows nothing but the AI proxy host. Prober resolves its actors for egress (ResolveActor); chain it in front of the core with Chain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain

func Chain(resolvers ...egress.ActorResolver) egress.ActorResolver

Chain resolves an actor with the first resolver that knows it.

func InstanceID

func InstanceID(configMap string) string

InstanceID is the egress pseudo-instance of a probe request.

Types

type Actors

type Actors interface {
	CreateActor(ctx context.Context, spec actors.Spec) (*ateapi.Actor, error)
	ApplyEgressPolicy(ctx context.Context, ref actors.Ref, rules []*ateapi.EgressRule) error
	Resume(ctx context.Context, ref actors.Ref) error
	WaitState(ctx context.Context, ref actors.Ref, states ...ateapi.ActorState) (*ateapi.Actor, error)
	DeleteActor(ctx context.Context, ref actors.Ref) error
}

Actors is the Substrate subset the prober uses (*actors.Client).

type Config

type Config struct {
	// Namespace holds the probe ConfigMaps and the token Secret (the operator namespace).
	Namespace string
	// Holder identifies this replica in claims, normally the pod name.
	Holder     string
	ConsoleURL string
	AIProxyURL string

	AttemptTimeout time.Duration
	Attempts       int
	RetryDelay     time.Duration
	// Resync re-lists pending requests, catching anything a dropped watch missed and abandoned claims.
	Resync time.Duration
}

type Credentials

type Credentials interface {
	SetStaticCredential(instanceID, kind, token string, expiresAt time.Time) error
	Invalidate(instanceID string)
}

Credentials registers the probe token with egress (*egress.Service).

type Daemons

type Daemons interface {
	Daemon(actor string) devboxv1.DaemonClient
}

Daemons reaches an actor's daemon (*router.Router).

type Deps

type Deps struct {
	Client      client.WithWatch
	Actors      Actors
	Daemons     Daemons
	Credentials Credentials
	Log         logr.Logger
	Now         func() time.Time
}

type Prober

type Prober struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config, deps Deps) (*Prober, error)

func (*Prober) ResolveActor

func (p *Prober) ResolveActor(_ context.Context, actorID string) (*egress.InstanceInfo, error)

ResolveActor resolves the actors of running probes; anything else is egress.ErrUnknownActor.

func (*Prober) Run

func (p *Prober) Run(ctx context.Context) error

Run watches probe requests until ctx is done, then waits for running probes to clean up.

func (*Prober) UseCredentials

func (p *Prober) UseCredentials(c Credentials)

UseCredentials sets the egress service once it exists; egress needs the prober as a resolver first.

Jump to

Keyboard shortcuts

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