Documentation
¶
Overview ¶
Package shell runs Cloud Shell (§7.1): a short-lived container per user on the controller node, with synctl authenticated as that user through temporary credentials. The dashboard reaches it through exec.
Index ¶
Constants ¶
const TaskPrefix = "shell-"
TaskPrefix starts shell container task IDs.
Variables ¶
ErrUnavailable means there is no node to run shells on.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Image string // with sh; curl, jq and git are welcome (default alpine)
// Synctl is the synctl binary on the controller host, mounted into the
// shell ("" leaves it out).
Synctl string
// Endpoint is the API address as seen from the shell container.
Endpoint func() string
// IdleTimeout stops shells nobody used for this long.
IdleTimeout time.Duration
// Node returns the node to run shells on (the controller node).
Node func() (store.Node, bool)
}
Config of the shell containers.
type Credentials ¶
type Credentials struct {
AccessKeyID, Secret, SessionToken string
}
Credentials are what the shell signs requests with.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) Hooks ¶
Hooks follow the shell containers' state, and remove shells left over from before a controller restart.
func (*Manager) Start ¶
func (m *Manager) Start(ctx context.Context, userID string, creds func() (Credentials, time.Time, error)) (Session, error)
Start runs (or returns) a user's shell. creds are fresh temporary credentials, used when a new container starts.
type Session ¶
type Session struct {
UserID string `json:"-"`
TaskID string `json:"taskId"`
NodeID string `json:"-"`
State string `json:"state"` // starting | running | failed
Error string `json:"error,omitempty"`
StartedAt time.Time `json:"startedAt"`
LastActive time.Time `json:"lastActive"`
ExpiresAt time.Time `json:"expiresAt"` // its credentials
}
Session is one user's shell.