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
- Variables
- func New(cfg Config) (http.Handler, error)
- type Cluster
- type Config
- type KubeCluster
- func (k *KubeCluster) Claims(ctx context.Context, namespace string) (map[string]corev1.PersistentVolumeClaimPhase, error)
- func (k *KubeCluster) Organization(ctx context.Context, orgID string) (*v1alpha1.AgentOrganization, error)
- func (k *KubeCluster) Pods(ctx context.Context, org *v1alpha1.AgentOrganization) (map[string]corev1.Pod, error)
- func (k *KubeCluster) Seats(ctx context.Context, org *v1alpha1.AgentOrganization) (map[string]v1alpha1.AgentSeat, error)
- type Platform
- type PlatformClient
- func (c *PlatformClient) Activity(ctx context.Context, orgID string, after time.Time, limit int) ([]runtimeapi.ConsoleActivityItem, error)
- func (c *PlatformClient) Artifacts(ctx context.Context, orgID string) ([]runtimeapi.ConsoleArtifact, error)
- func (c *PlatformClient) Conversation(ctx context.Context, id string) (*runtimeapi.ConsoleConversationDetail, error)
- func (c *PlatformClient) Conversations(ctx context.Context, orgID string) ([]runtimeapi.ConsoleConversation, error)
- func (c *PlatformClient) Execution(ctx context.Context, id string) (*runtimeapi.ConsoleExecutionDetail, error)
- func (c *PlatformClient) Executions(ctx context.Context, orgID, state string) ([]runtimeapi.ConsoleExecution, error)
- func (c *PlatformClient) Operations(ctx context.Context, orgID, seat, status string) ([]runtimeapi.ConsoleOperation, error)
- func (c *PlatformClient) Organization(ctx context.Context, orgID string) (*runtimeapi.ConsoleOrganization, error)
- func (c *PlatformClient) Organizations(ctx context.Context) ([]runtimeapi.ConsoleOrganization, error)
- func (c *PlatformClient) Seat(ctx context.Context, seatID string) (*runtimeapi.ConsoleSeatDetail, error)
- func (c *PlatformClient) Seats(ctx context.Context, orgID string) ([]runtimeapi.ConsoleSeatStatus, error)
- func (c *PlatformClient) Work(ctx context.Context, orgID string) ([]runtimeapi.ConsoleWorkItem, error)
Constants ¶
const ( StateWorking = "working" StateWaiting = "waiting" StateQueued = "queued" StateStarting = "starting" StateBlocked = "blocked" StateOffline = "offline" StateUnknown = "unknown" )
Seat states shown on the organisation view. They summarise the controller's ExecutionState, the platform lease and the inbox.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is a 404 from the platform.
Functions ¶
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 (k *KubeCluster) Claims(ctx context.Context, namespace string) (map[string]corev1.PersistentVolumeClaimPhase, error)
func (*KubeCluster) Organization ¶
func (k *KubeCluster) Organization(ctx context.Context, orgID string) (*v1alpha1.AgentOrganization, error)
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 ¶
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 (c *PlatformClient) Conversation(ctx context.Context, id string) (*runtimeapi.ConsoleConversationDetail, error)
func (*PlatformClient) Conversations ¶
func (c *PlatformClient) Conversations(ctx context.Context, orgID string) ([]runtimeapi.ConsoleConversation, error)
func (*PlatformClient) Execution ¶
func (c *PlatformClient) Execution(ctx context.Context, id string) (*runtimeapi.ConsoleExecutionDetail, error)
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 (c *PlatformClient) Organizations(ctx context.Context) ([]runtimeapi.ConsoleOrganization, error)
func (*PlatformClient) Seat ¶
func (c *PlatformClient) Seat(ctx context.Context, seatID string) (*runtimeapi.ConsoleSeatDetail, error)
func (*PlatformClient) Seats ¶
func (c *PlatformClient) Seats(ctx context.Context, orgID string) ([]runtimeapi.ConsoleSeatStatus, error)
func (*PlatformClient) Work ¶ added in v0.2.0
func (c *PlatformClient) Work(ctx context.Context, orgID string) ([]runtimeapi.ConsoleWorkItem, error)