Help us shape the future of Go! Take the 2026 Go Developer Survey

console

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package console is the Steadmesh Console: a read-only browser view of an organisation's seats, runs, handoffs, outputs and readiness. It combines the platform's console API (/console/v1) with the AgentOrganization and AgentSeat resources and seat Pods in the cluster. It is optional and off by default; Terraform enables it in the platform stage.

Index

Constants

View Source
const (
	StateWorking  = "working"
	StateWaiting  = "waiting"
	StateQueued   = "queued"
	StateStarting = "starting"
	StateBlocked  = "blocked"
	StateOffline  = "offline"
	// StateRetiring is a seat removed from the organisation that is winding
	// down before it retires.
	StateRetiring = "retiring"
	StateUnknown  = "unknown"
)

Seat states shown on the organisation view. They summarise the controller's ExecutionState, the platform lease and the inbox.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is a 404 from the platform.

Functions

func New

func New(cfg Config) (http.Handler, error)

New returns the console HTTP handler.

Types

type Cluster

type Cluster interface {
	// Organization returns the AgentOrganization with the given platform
	// organisation id, or nil.
	Organization(ctx context.Context, orgID string) (*v1alpha1.AgentOrganization, error)
	// Seats returns the organisation's AgentSeats keyed by seat id.
	Seats(ctx context.Context, org *v1alpha1.AgentOrganization) (map[string]v1alpha1.AgentSeat, error)
	// Pods returns the organisation's seat runner Pods keyed by seat key.
	Pods(ctx context.Context, org *v1alpha1.AgentOrganization) (map[string]corev1.Pod, error)
	// Claims returns the phases of the namespace's seat volume claims by name.
	Claims(ctx context.Context, namespace string) (map[string]corev1.PersistentVolumeClaimPhase, error)
}

Cluster is the console's read-only view of the Kubernetes resources: what Terraform requested (AgentOrganization, AgentSeat specs), what the controller observed (their status) and what is running (Pods, claims).

type Config

type Config struct {
	Platform Platform
	Cluster  Cluster
	Log      *slog.Logger
	// PollInterval is how often the live activity stream polls the platform.
	PollInterval time.Duration
	// Now is the clock; nil uses time.Now.
	Now func() time.Time
}

Config holds the server's dependencies.

type KubeCluster

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

KubeCluster implements Cluster from an informer cache limited to Steadmesh resources and seat-labelled Pods and claims.

func NewKubeCluster

func NewKubeCluster(ctx context.Context, cfg *rest.Config, syncTimeout time.Duration) (*KubeCluster, error)

NewKubeCluster starts an informer cache and waits up to syncTimeout for it to sync. It stops when ctx is cancelled.

func (*KubeCluster) Claims

func (*KubeCluster) Organization

func (k *KubeCluster) Organization(ctx context.Context, orgID string) (*v1alpha1.AgentOrganization, error)

func (*KubeCluster) Pods

func (*KubeCluster) Seats

type Platform

type Platform interface {
	Organizations(ctx context.Context) ([]runtimeapi.ConsoleOrganization, error)
	Organization(ctx context.Context, orgID string) (*runtimeapi.ConsoleOrganization, error)
	Seats(ctx context.Context, orgID string) ([]runtimeapi.ConsoleSeatStatus, error)
	Seat(ctx context.Context, seatID string) (*runtimeapi.ConsoleSeatDetail, error)
	Execution(ctx context.Context, id string) (*runtimeapi.ConsoleExecutionDetail, error)
	Conversations(ctx context.Context, orgID string) ([]runtimeapi.ConsoleConversation, error)
	Conversation(ctx context.Context, id string) (*runtimeapi.ConsoleConversationDetail, error)
	Operations(ctx context.Context, orgID, seat, status string) ([]runtimeapi.ConsoleOperation, error)
	Artifacts(ctx context.Context, orgID string) ([]runtimeapi.ConsoleArtifact, error)
	// Work lists work items in shared stores with their publication state.
	Work(ctx context.Context, orgID string) ([]runtimeapi.ConsoleWorkItem, error)
	// Executions lists the organisation's runs, newest first, optionally in one state.
	Executions(ctx context.Context, orgID, state string) ([]runtimeapi.ConsoleExecution, error)
	// Activity returns items after the given time, or the latest limit items
	// when after is zero.
	Activity(ctx context.Context, orgID string, after time.Time, limit int) ([]runtimeapi.ConsoleActivityItem, error)
}

Platform is the console API of the platform service.

type PlatformClient

type PlatformClient struct {
	BaseURL   string
	TokenFile string
	HTTP      *http.Client
}

PlatformClient implements Platform over HTTP. It authenticates with the console's ServiceAccount token, re-read on every request because the kubelet rotates it.

func NewPlatformClient

func NewPlatformClient(baseURL, tokenFile string) *PlatformClient

NewPlatformClient returns a client for baseURL. An empty tokenFile sends no credentials (tests only).

func (*PlatformClient) Activity

func (c *PlatformClient) Activity(ctx context.Context, orgID string, after time.Time, limit int) ([]runtimeapi.ConsoleActivityItem, error)

func (*PlatformClient) Artifacts

func (c *PlatformClient) Artifacts(ctx context.Context, orgID string) ([]runtimeapi.ConsoleArtifact, error)

func (*PlatformClient) Conversation

func (*PlatformClient) Conversations

func (c *PlatformClient) Conversations(ctx context.Context, orgID string) ([]runtimeapi.ConsoleConversation, error)

func (*PlatformClient) Execution

func (*PlatformClient) Executions

func (c *PlatformClient) Executions(ctx context.Context, orgID, state string) ([]runtimeapi.ConsoleExecution, error)

func (*PlatformClient) Operations

func (c *PlatformClient) Operations(ctx context.Context, orgID, seat, status string) ([]runtimeapi.ConsoleOperation, error)

func (*PlatformClient) Organization

func (c *PlatformClient) Organization(ctx context.Context, orgID string) (*runtimeapi.ConsoleOrganization, error)

func (*PlatformClient) Organizations

func (*PlatformClient) Seat

func (*PlatformClient) Seats

func (*PlatformClient) Work added in v0.2.0

Jump to

Keyboard shortcuts

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