Documentation
¶
Overview ¶
Package agent provides agent helpers.
Index ¶
- type BuildServer
- type Config
- type DeployServer
- type LogServer
- type MirrorServer
- func (s *MirrorServer) Close() error
- func (s *MirrorServer) DeleteSession(ctx context.Context, req *apiv1.MirrorDeleteSessionRequest) (*apiv1.MirrorDeleteSessionResponse, error)
- func (s *MirrorServer) Export(req *apiv1.MirrorExportRequest, stream apiv1.MirrorService_ExportServer) error
- func (s *MirrorServer) GetSession(ctx context.Context, req *apiv1.MirrorGetSessionRequest) (*apiv1.MirrorSession, error)
- func (s *MirrorServer) ListSessions(ctx context.Context, req *apiv1.MirrorListSessionsRequest) (*apiv1.MirrorListSessionsResponse, error)
- func (s *MirrorServer) Publish(stream apiv1.MirrorService_PublishServer) error
- func (s *MirrorServer) SetSessionMeta(ctx context.Context, req *apiv1.MirrorSetSessionMetaRequest) (*apiv1.MirrorSession, error)
- func (s *MirrorServer) SetSessionStatus(ctx context.Context, req *apiv1.MirrorSetSessionStatusRequest) (*apiv1.MirrorSession, error)
- func (s *MirrorServer) Subscribe(req *apiv1.MirrorSubscribeRequest, stream apiv1.MirrorService_SubscribeServer) error
- func (s *MirrorServer) UpsertSessionMeta(ctx context.Context, sessionID string, meta MirrorSessionMeta, ...) MirrorSession
- func (s *MirrorServer) UpsertSessionStatus(ctx context.Context, sessionID string, st MirrorSessionStatus) MirrorSession
- type MirrorServerOption
- type MirrorSession
- type MirrorSessionMeta
- type MirrorSessionState
- type MirrorSessionStatus
- type MirrorStore
- type MirrorStoreOptions
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildServer ¶
type BuildServer struct {
apiv1.UnimplementedBuildServiceServer
Service buildsvc.Service
Mirror *MirrorServer
Logger logr.Logger
}
BuildServer exposes buildsvc over gRPC.
func (*BuildServer) RunBuild ¶
func (s *BuildServer) RunBuild(req *apiv1.RunBuildRequest, stream apiv1.BuildService_RunBuildServer) error
RunBuild executes a remote build and streams progress.
type Config ¶
type Config struct {
ListenAddr string
KubeconfigPath string
KubeContext string
AuthToken string
HTTPListenAddr string
TLSCertFile string
TLSKeyFile string
TLSClientCAFile string
MirrorStore string
MirrorMaxSessions int
MirrorMaxFramesPerSession uint64
MirrorMaxBytes int64
MirrorPruneInterval time.Duration
}
Config defines the runtime settings for the gRPC agent.
type DeployServer ¶
type DeployServer struct {
apiv1.UnimplementedDeployServiceServer
Logger logr.Logger
Mirror *MirrorServer
}
DeployServer exposes deploy apply/destroy workflows over gRPC.
func (*DeployServer) Apply ¶
func (s *DeployServer) Apply(req *apiv1.DeployApplyRequest, stream apiv1.DeployService_ApplyServer) (retErr error)
Apply runs the Helm upgrade/install workflow remotely.
func (*DeployServer) Destroy ¶
func (s *DeployServer) Destroy(req *apiv1.DeployDestroyRequest, stream apiv1.DeployService_DestroyServer) (retErr error)
Destroy removes a Helm release remotely.
type LogServer ¶
type LogServer struct {
apiv1.UnimplementedLogServiceServer
Config Config
Logger logr.Logger
Mirror *MirrorServer
}
LogServer relays torque log streams over gRPC.
func (*LogServer) StreamLogs ¶
func (s *LogServer) StreamLogs(req *apiv1.LogRequest, stream apiv1.LogService_StreamLogsServer) (retErr error)
StreamLogs executes a tailer instance and streams log lines to clients.
type MirrorServer ¶
type MirrorServer struct {
apiv1.UnimplementedMirrorServiceServer
// contains filtered or unexported fields
}
MirrorServer implements the gRPC mirror bus.
The server can optionally persist frames via a MirrorStore so sessions are replayable across restarts.
func NewMirrorServer ¶
func NewMirrorServer(opts ...MirrorServerOption) *MirrorServer
NewMirrorServer constructs a mirror bus server.
func (*MirrorServer) Close ¶
func (s *MirrorServer) Close() error
func (*MirrorServer) DeleteSession ¶
func (s *MirrorServer) DeleteSession(ctx context.Context, req *apiv1.MirrorDeleteSessionRequest) (*apiv1.MirrorDeleteSessionResponse, error)
func (*MirrorServer) Export ¶
func (s *MirrorServer) Export(req *apiv1.MirrorExportRequest, stream apiv1.MirrorService_ExportServer) error
func (*MirrorServer) GetSession ¶
func (s *MirrorServer) GetSession(ctx context.Context, req *apiv1.MirrorGetSessionRequest) (*apiv1.MirrorSession, error)
func (*MirrorServer) ListSessions ¶
func (s *MirrorServer) ListSessions(ctx context.Context, req *apiv1.MirrorListSessionsRequest) (*apiv1.MirrorListSessionsResponse, error)
func (*MirrorServer) Publish ¶
func (s *MirrorServer) Publish(stream apiv1.MirrorService_PublishServer) error
Publish accepts frames from producers.
func (*MirrorServer) SetSessionMeta ¶
func (s *MirrorServer) SetSessionMeta(ctx context.Context, req *apiv1.MirrorSetSessionMetaRequest) (*apiv1.MirrorSession, error)
func (*MirrorServer) SetSessionStatus ¶
func (s *MirrorServer) SetSessionStatus(ctx context.Context, req *apiv1.MirrorSetSessionStatusRequest) (*apiv1.MirrorSession, error)
func (*MirrorServer) Subscribe ¶
func (s *MirrorServer) Subscribe(req *apiv1.MirrorSubscribeRequest, stream apiv1.MirrorService_SubscribeServer) error
Subscribe streams frames for a session to the caller.
func (*MirrorServer) UpsertSessionMeta ¶
func (s *MirrorServer) UpsertSessionMeta(ctx context.Context, sessionID string, meta MirrorSessionMeta, tags map[string]string) MirrorSession
UpsertSessionMeta updates in-memory and durable metadata for a session. It's safe to call this even if the session has no frames yet.
func (*MirrorServer) UpsertSessionStatus ¶
func (s *MirrorServer) UpsertSessionStatus(ctx context.Context, sessionID string, st MirrorSessionStatus) MirrorSession
UpsertSessionStatus updates in-memory and durable lifecycle state for a session. It's safe to call this even if the session has no frames yet.
type MirrorServerOption ¶
type MirrorServerOption func(*MirrorServer)
func WithMirrorBuffer ¶
func WithMirrorBuffer(n int) MirrorServerOption
func WithMirrorStore ¶
func WithMirrorStore(store MirrorStore) MirrorServerOption
type MirrorSession ¶
type MirrorSession struct {
SessionID string
CreatedUnixNano int64
LastSeenUnixNano int64
LastSequence uint64
Meta MirrorSessionMeta
Tags map[string]string
Status MirrorSessionStatus
}
MirrorSession holds lightweight metadata about a mirror session stored by a flight recorder.
type MirrorSessionMeta ¶
type MirrorSessionMeta struct {
Command string
Args []string
Requester string
Cluster string
KubeContext string
Namespace string
Release string
Chart string
}
MirrorSessionMeta holds optional fields that make sessions searchable and self-describing for UIs and AI agents.
type MirrorSessionState ¶
type MirrorSessionState int32
const ( MirrorSessionStateUnspecified MirrorSessionState = 0 MirrorSessionStateRunning MirrorSessionState = 1 MirrorSessionStateDone MirrorSessionState = 2 MirrorSessionStateError MirrorSessionState = 3 )
type MirrorSessionStatus ¶
type MirrorSessionStatus struct {
State MirrorSessionState
ExitCode int32
ErrorMessage string
CompletedUnixNano int64
}
MirrorSessionStatus is a lightweight lifecycle marker for UIs/agents.
type MirrorStore ¶
type MirrorStore interface {
Append(frame *apiv1.MirrorFrame) error
UpsertSessionMeta(ctx context.Context, sessionID string, meta MirrorSessionMeta, tags map[string]string) error
UpsertSessionStatus(ctx context.Context, sessionID string, st MirrorSessionStatus) error
DeleteSession(ctx context.Context, sessionID string) (bool, error)
GetSession(ctx context.Context, sessionID string) (MirrorSession, bool, error)
ListSessions(ctx context.Context, limit int) ([]MirrorSession, error)
Replay(ctx context.Context, sessionID string, fromSequence uint64, send func(*apiv1.MirrorFrame) error) (lastSequence uint64, _ error)
Close() error
}
MirrorStore is an optional durable backend for MirrorService.
Append must be fast; implementations should batch/flush asynchronously.
func OpenMirrorStore ¶
func OpenMirrorStore(path string, opts MirrorStoreOptions) (MirrorStore, error)
OpenMirrorStore opens a SQLite-backed flight recorder database. If path is empty, it returns (nil, nil) and the mirror bus stays in-memory only.