Documentation
¶
Index ¶
- func CommandFunc(driverCmd func(ctx context.Context, params *driver.CommandParams) error, ...) inject.ExecFunc
- func Deliver(ctx context.Context, strategy AgentDelivery, preOpts *PreStartOptions, ...) error
- func ExecFuncFromDriver(...) inject.ExecFunc
- type AgentDelivery
- type BinarySourceFunc
- type Cleaner
- type DeliveryPhase
- type FactoryOptions
- type KubernetesDelivery
- func (d *KubernetesDelivery) Cleanup(_ context.Context, _ string) error
- func (d *KubernetesDelivery) DeliverPostStart(ctx context.Context, opts PostStartOptions) error
- func (d *KubernetesDelivery) DeliverPreStart(_ context.Context, _ PreStartOptions) error
- func (d *KubernetesDelivery) Phase() DeliveryPhase
- type LegacyShellDelivery
- func (d *LegacyShellDelivery) Cleanup(_ context.Context, _ string) error
- func (d *LegacyShellDelivery) DeliverPostStart(ctx context.Context, opts PostStartOptions) error
- func (d *LegacyShellDelivery) DeliverPreStart(_ context.Context, _ PreStartOptions) error
- func (d *LegacyShellDelivery) Phase() DeliveryPhase
- type LocalDockerDelivery
- func (d *LocalDockerDelivery) Cleanup(ctx context.Context, workspaceID string) error
- func (d *LocalDockerDelivery) DeliverPostStart(_ context.Context, _ PostStartOptions) error
- func (d *LocalDockerDelivery) DeliverPreStart(ctx context.Context, opts PreStartOptions) error
- func (d *LocalDockerDelivery) Phase() DeliveryPhase
- func (d *LocalDockerDelivery) SeedWorkspaceVolume(ctx context.Context, opts WorkspaceSeedOptions) error
- type PodExecFunc
- type PostStartOptions
- type PreStartOptions
- type RemoteDockerDelivery
- func (d *RemoteDockerDelivery) Cleanup(_ context.Context, _ string) error
- func (d *RemoteDockerDelivery) DeliverPostStart(ctx context.Context, opts PostStartOptions) error
- func (d *RemoteDockerDelivery) DeliverPreStart(_ context.Context, _ PreStartOptions) error
- func (d *RemoteDockerDelivery) Phase() DeliveryPhase
- type WorkspaceSeedOptions
- type WorkspaceVolumeSeeder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandFunc ¶
func CommandFunc( driverCmd func(ctx context.Context, params *driver.CommandParams) error, workspaceID string, ) inject.ExecFunc
CommandFunc adapts a driver's command function to inject.ExecFunc.
func Deliver ¶
func Deliver( ctx context.Context, strategy AgentDelivery, preOpts *PreStartOptions, postOpts *PostStartOptions, ) error
Deliver calls the appropriate delivery method based on the strategy's phase.
Types ¶
type AgentDelivery ¶
type AgentDelivery interface {
Cleaner
Phase() DeliveryPhase
DeliverPreStart(ctx context.Context, opts PreStartOptions) error
DeliverPostStart(ctx context.Context, opts PostStartOptions) error
}
func NewAgentDelivery ¶
func NewAgentDelivery(opts FactoryOptions) AgentDelivery
type BinarySourceFunc ¶
type Cleaner ¶ added in v1.5.1
Cleaner removes the resources a delivery created for a workspace. Cleanup is best-effort and safe to call when nothing was created.
type DeliveryPhase ¶
type DeliveryPhase int
const ( PhasePreStart DeliveryPhase = iota PhasePostStart )
func (DeliveryPhase) String ¶
func (p DeliveryPhase) String() string
type FactoryOptions ¶
type FactoryOptions struct {
WorkspaceConfig *provider.AgentWorkspaceInfo
WorkspaceID string
DockerCommand string
DockerEnv []string
HelperImage string
IsRemoteDocker bool
ContainerID string
ExecFunc inject.ExecFunc //nolint:staticcheck // legacy delivery strategies require this type
PodExec PodExecFunc
}
type KubernetesDelivery ¶
type KubernetesDelivery struct {
Exec PodExecFunc
// ExpectedVersion defaults to version.GetVersion() when empty.
ExpectedVersion string
}
KubernetesDelivery streams the agent binary into the pod over the cluster's exec API.
func (*KubernetesDelivery) Cleanup ¶
func (d *KubernetesDelivery) Cleanup(_ context.Context, _ string) error
func (*KubernetesDelivery) DeliverPostStart ¶
func (d *KubernetesDelivery) DeliverPostStart(ctx context.Context, opts PostStartOptions) error
func (*KubernetesDelivery) DeliverPreStart ¶
func (d *KubernetesDelivery) DeliverPreStart(_ context.Context, _ PreStartOptions) error
func (*KubernetesDelivery) Phase ¶
func (d *KubernetesDelivery) Phase() DeliveryPhase
type LegacyShellDelivery ¶
type LegacyShellDelivery struct {
ExecFunc inject.ExecFunc //nolint:staticcheck
DownloadURL string
Timeout func() time.Duration
}
func (*LegacyShellDelivery) Cleanup ¶
func (d *LegacyShellDelivery) Cleanup(_ context.Context, _ string) error
func (*LegacyShellDelivery) DeliverPostStart ¶
func (d *LegacyShellDelivery) DeliverPostStart(ctx context.Context, opts PostStartOptions) error
func (*LegacyShellDelivery) DeliverPreStart ¶
func (d *LegacyShellDelivery) DeliverPreStart(_ context.Context, _ PreStartOptions) error
func (*LegacyShellDelivery) Phase ¶
func (d *LegacyShellDelivery) Phase() DeliveryPhase
type LocalDockerDelivery ¶
type LocalDockerDelivery struct {
DockerCommand string
Environment []string
HelperImage string
ExpectedVersion string
}
func (*LocalDockerDelivery) Cleanup ¶
func (d *LocalDockerDelivery) Cleanup(ctx context.Context, workspaceID string) error
Cleanup removes every devsy-managed volume owned by the workspace (the agent volume and any seeded workspace volume), identified by labels. Only labeled volumes are removed, so foreign/external volumes are left untouched.
func (*LocalDockerDelivery) DeliverPostStart ¶
func (d *LocalDockerDelivery) DeliverPostStart(_ context.Context, _ PostStartOptions) error
func (*LocalDockerDelivery) DeliverPreStart ¶
func (d *LocalDockerDelivery) DeliverPreStart(ctx context.Context, opts PreStartOptions) error
func (*LocalDockerDelivery) Phase ¶
func (d *LocalDockerDelivery) Phase() DeliveryPhase
func (*LocalDockerDelivery) SeedWorkspaceVolume ¶ added in v1.5.1
func (d *LocalDockerDelivery) SeedWorkspaceVolume( ctx context.Context, opts WorkspaceSeedOptions, ) error
SeedWorkspaceVolume ensures the workspace volume exists and, unless it was already seeded, copies SourceDir into it as a faithful working-tree copy. Seeding is idempotent: an already-seeded volume is left untouched unless Reset is set.
type PodExecFunc ¶ added in v1.3.1
PodExecFunc runs argv in the workspace pod's dev container with the given streams.
type PostStartOptions ¶
type PostStartOptions struct {
WorkspaceID string
ContainerDetails *config.ContainerDetails
BinarySource BinarySourceFunc
Arch string
}
type PreStartOptions ¶
type PreStartOptions struct {
WorkspaceID string
RunOptions *driver.RunOptions
BinarySource BinarySourceFunc
Arch string
}
type RemoteDockerDelivery ¶
func (*RemoteDockerDelivery) Cleanup ¶
func (d *RemoteDockerDelivery) Cleanup(_ context.Context, _ string) error
func (*RemoteDockerDelivery) DeliverPostStart ¶
func (d *RemoteDockerDelivery) DeliverPostStart(ctx context.Context, opts PostStartOptions) error
func (*RemoteDockerDelivery) DeliverPreStart ¶
func (d *RemoteDockerDelivery) DeliverPreStart(_ context.Context, _ PreStartOptions) error
func (*RemoteDockerDelivery) Phase ¶
func (d *RemoteDockerDelivery) Phase() DeliveryPhase
type WorkspaceSeedOptions ¶ added in v1.5.1
type WorkspaceSeedOptions struct {
// WorkspaceID owns the volume (used for labels).
WorkspaceID string
// VolumeName is the named volume backing the workspace mount.
VolumeName string
// SourceDir is the host/remote directory whose contents are copied into
// the volume (a faithful working-tree copy).
SourceDir string
// Reset removes an existing managed volume first so it is re-seeded.
Reset bool
}
WorkspaceSeedOptions describes a request to seed a named workspace volume from a local source directory.
type WorkspaceVolumeSeeder ¶ added in v1.5.1
type WorkspaceVolumeSeeder interface {
SeedWorkspaceVolume(ctx context.Context, opts WorkspaceSeedOptions) error
}
WorkspaceVolumeSeeder is implemented by deliveries that can populate a named workspace volume from a local directory.