client

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocateOptions

type AllocateOptions struct {
	// Architecture optionally requests a runner architecture. Empty defaults to amd64.
	Architecture string
	// KubernetesVersion optionally requests a control-plane Kubernetes version.
	KubernetesVersion string
	// WireGuardPrivateKey is the client's WireGuard private key. If empty, one is generated.
	WireGuardPrivateKey string
	// Tunnel optionally overrides local tunnel settings.
	Tunnel TunnelConfig
}

AllocateOptions controls one playpen allocation.

type Client

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

Client is a high-level client for allocating and releasing playpens.

func New

func New(cfg Config) (*Client, error)

New returns a client configured to use the Kubernetes aggregated API server.

func (*Client) Allocate

func (c *Client) Allocate(ctx context.Context, opts AllocateOptions) (*Playpen, error)

Allocate allocates an idle playpen runner and returns its metadata.

func (*Client) AllocateControlPlane

func (c *Client) AllocateControlPlane(ctx context.Context, opts AllocateOptions) (*ControlPlane, error)

AllocateControlPlane allocates an idle Kubernetes control plane and returns its metadata.

type Config

type Config struct {
	// RESTConfig connects to the Kubernetes API server hosting the playpen aggregated API.
	RESTConfig *rest.Config
	// HTTPClient overrides the client built from RESTConfig. It is intended for tests.
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Config contains settings for connecting to the playpen aggregated API.

type ControlPlane

type ControlPlane struct {
	Metadata operator.AllocResponse
	// contains filtered or unexported fields
}

ControlPlane represents one allocated playpen Kubernetes control plane.

func (*ControlPlane) Close

func (cp *ControlPlane) Close(ctx context.Context) error

Close releases the control-plane allocation.

func (*ControlPlane) Kubeconfig

func (cp *ControlPlane) Kubeconfig() string

Kubeconfig returns the host-reachable kubeconfig for this control plane.

type Playpen

type Playpen struct {
	Metadata operator.AllocResponse
	// contains filtered or unexported fields
}

Playpen represents one allocated playpen runner pod and its local resources.

func (*Playpen) Close

func (p *Playpen) Close(ctx context.Context) error

Close tears down local tunnel resources and releases the playpen.

func (*Playpen) Command

func (p *Playpen) Command(ctx context.Context, name string, args ...string) (*exec.Cmd, error)

Command returns a command configured to execute inside the playpen network namespace.

func (*Playpen) ConfigureTunnel

func (p *Playpen) ConfigureTunnel(ctx context.Context) error

ConfigureTunnel creates the local WireGuard and VXLAN resources for this playpen.

func (*Playpen) OverrideEndpoint

func (p *Playpen) OverrideEndpoint(host string, port int32)

OverrideEndpoint replaces the WireGuard endpoint used by future tunnel setup.

func (*Playpen) Run

func (p *Playpen) Run(ctx context.Context, name string, args ...string) error

Run executes a command inside the playpen network namespace.

func (*Playpen) StreamConsoleLogs

func (p *Playpen) StreamConsoleLogs(ctx context.Context, dst io.Writer) <-chan error

StreamConsoleLogs asynchronously streams serial console logs into dst until ctx is canceled or the stream fails. The returned channel receives one error.

func (*Playpen) TunnelConfig

func (p *Playpen) TunnelConfig() TunnelConfig

TunnelConfig returns the local tunnel settings for this playpen.

func (*Playpen) WireGuardPrivateKey

func (p *Playpen) WireGuardPrivateKey() string

WireGuardPrivateKey returns the client's WireGuard private key for this playpen.

type TunnelConfig

type TunnelConfig struct {
	NetworkNamespace             string
	WireGuardInterface           string
	VXLANInterface               string
	ManagementHostInterface      string
	ManagementNamespaceInterface string
	ManagementHostAddress        string
	ManagementNamespaceAddress   string
	WireGuardListenPort          int
	PersistentKeepalive          int
	PrivateKeyFile               string
}

TunnelConfig controls local interface names and WireGuard settings.

Jump to

Keyboard shortcuts

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