Documentation
¶
Overview ¶
Package drivers implements common interfaces and utilities for Apoxy service drivers
Index ¶
- Constants
- func ForwardTCP(stopCh <-chan struct{}, cname string, localPort, remotePort int) error
- func WithLogsDir(logsDir string) func(*BackplaneSupervisorDriver)
- func WithTunnelProxyLogsDir(logsDir string) func(*TunnelProxySupervisorDriver)
- type APIServerDockerDriver
- func (d *APIServerDockerDriver) GetAddr(ctx context.Context) (string, error)
- func (db *APIServerDockerDriver) ImageRef(repo string) string
- func (db *APIServerDockerDriver) Init(ctx context.Context, opts ...Option) error
- func (db *APIServerDockerDriver) PullPolicy() string
- func (d *APIServerDockerDriver) Start(ctx context.Context, orgID uuid.UUID, serviceName string, opts ...Option) (string, error)
- func (d *APIServerDockerDriver) Stop(orgID uuid.UUID, serviceName string)
- type APIServerSupervisorDriver
- type BackplaneDockerDriver
- func (d *BackplaneDockerDriver) GetAddr(ctx context.Context) (string, error)
- func (db *BackplaneDockerDriver) ImageRef(repo string) string
- func (db *BackplaneDockerDriver) Init(ctx context.Context, opts ...Option) error
- func (db *BackplaneDockerDriver) PullPolicy() string
- func (d *BackplaneDockerDriver) Start(ctx context.Context, orgID uuid.UUID, proxyName string, opts ...Option) (string, error)
- func (d *BackplaneDockerDriver) Stop(orgID uuid.UUID, proxyName string)
- type BackplaneSupervisorDriver
- type Driver
- func GetAPIServerDriver(driver DriverMode) (Driver, error)
- func GetBackplaneDriver(driver DriverMode) (Driver, error)
- func GetDriver(driverType DriverMode, serviceType ServiceType) (Driver, error)
- func GetTunnelProxyDriver(driver DriverMode) (Driver, error)
- func GetWorkerdManagerDriver(driver DriverMode) (Driver, error)
- type DriverMode
- type Option
- type Options
- type ServiceType
- type TunnelProxyDockerDriver
- func (d *TunnelProxyDockerDriver) GetAddr(ctx context.Context) (string, error)
- func (db *TunnelProxyDockerDriver) ImageRef(repo string) string
- func (db *TunnelProxyDockerDriver) Init(ctx context.Context, opts ...Option) error
- func (db *TunnelProxyDockerDriver) PullPolicy() string
- func (d *TunnelProxyDockerDriver) Start(ctx context.Context, projectID uuid.UUID, proxyName string, opts ...Option) (string, error)
- func (d *TunnelProxyDockerDriver) Stop(orgID uuid.UUID, proxyName string)
- type TunnelProxySupervisorDriver
- type WorkerdManagerDockerDriver
- func (d *WorkerdManagerDockerDriver) GetAddr(ctx context.Context) (string, error)
- func (db *WorkerdManagerDockerDriver) ImageRef(repo string) string
- func (db *WorkerdManagerDockerDriver) Init(ctx context.Context, opts ...Option) error
- func (db *WorkerdManagerDockerDriver) PullPolicy() string
- func (d *WorkerdManagerDockerDriver) Start(ctx context.Context, orgID uuid.UUID, serviceName string, opts ...Option) (string, error)
- func (d *WorkerdManagerDockerDriver) Stop(orgID uuid.UUID, serviceName string)
Constants ¶
const ( // APIServerStdoutLogFile is the name of the apiserver stdout log file APIServerStdoutLogFile = "apiserver.stdout.log" // APIServerStderrLogFile is the name of the apiserver stderr log file APIServerStderrLogFile = "apiserver.stderr.log" // APIServerProcessName is used to identify the apiserver process APIServerProcessName = "apiserver" )
const ( // DefaultLogsDir is the default directory for logs DefaultLogsDir = "/var/log/apoxy" // BackplaneStdoutLogFile is the name of the backplane stdout log file BackplaneStdoutLogFile = "backplane.stdout.log" // BackplaneStderrLogFile is the name of the backplane stderr log file BackplaneStderrLogFile = "backplane.stderr.log" // BackplaneProcessName is used to identify the backplane process BackplaneProcessName = "backplane" )
const ( // BackplaneService represents the backplane service. BackplaneService ServiceType = "backplane" // APIServerService represents the apiserver service. APIServerService ServiceType = "apiserver" // TunnelProxyService represents the tunnel proxy service. TunnelProxyService ServiceType = "tunnelproxy" // WorkerdManagerService represents the workerd-manager service (APO-796): the // privileged/runsc data-plane sidecar that runs the shared resident workerd. WorkerdManagerService ServiceType = "workerd-manager" // DockerMode represents the docker driver mode. DockerMode DriverMode = "docker" // SupervisorMode represents the supervisor driver mode. SupervisorMode DriverMode = "supervisor" )
const ( // DefaultTunnelProxyLogsDir is the default directory for logs DefaultTunnelProxyLogsDir = "/var/log/apoxy" // TunnelProxyStdoutLogFile is the name of the tunnelproxy stdout log file TunnelProxyStdoutLogFile = "tunnelproxy.stdout.log" // TunnelProxyStderrLogFile is the name of the tunnelproxy stderr log file TunnelProxyStderrLogFile = "tunnelproxy.stderr.log" // TunnelProxyProcessName is used to identify the tunnelproxy process TunnelProxyProcessName = "tunnelproxy" )
Variables ¶
This section is empty.
Functions ¶
func ForwardTCP ¶
ForwardTCP forwards localPort on host to a remotePort on a container cname.
func WithLogsDir ¶
func WithLogsDir(logsDir string) func(*BackplaneSupervisorDriver)
WithLogsDir sets the logs directory for the supervisor driver.
func WithTunnelProxyLogsDir ¶
func WithTunnelProxyLogsDir(logsDir string) func(*TunnelProxySupervisorDriver)
WithTunnelProxyLogsDir sets the logs directory for the supervisor driver.
Types ¶
type APIServerDockerDriver ¶
type APIServerDockerDriver struct {
// contains filtered or unexported fields
}
APIServerDockerDriver implements the Driver interface for Docker.
func NewAPIServerDockerDriver ¶
func NewAPIServerDockerDriver() *APIServerDockerDriver
NewAPIServerDockerDriver creates a new Docker driver for apiserver.
func (*APIServerDockerDriver) GetAddr ¶
func (d *APIServerDockerDriver) GetAddr(ctx context.Context) (string, error)
GetAddr implements the Driver interface.
func (*APIServerDockerDriver) PullPolicy ¶
func (db *APIServerDockerDriver) PullPolicy() string
type APIServerSupervisorDriver ¶
type APIServerSupervisorDriver struct {
// LogsDir is the directory where logs will be written
LogsDir string
// contains filtered or unexported fields
}
APIServerSupervisorDriver implements the Driver interface for process supervision.
func NewAPIServerSupervisorDriver ¶
func NewAPIServerSupervisorDriver() *APIServerSupervisorDriver
NewAPIServerSupervisorDriver creates a new Supervisor driver with default configuration.
func (*APIServerSupervisorDriver) GetAddr ¶
func (d *APIServerSupervisorDriver) GetAddr(ctx context.Context) (string, error)
GetAddr implements the Driver interface.
type BackplaneDockerDriver ¶
type BackplaneDockerDriver struct {
// contains filtered or unexported fields
}
BackplaneDockerDriver implements the Driver interface for Docker.
func NewBackplaneDockerDriver ¶
func NewBackplaneDockerDriver() *BackplaneDockerDriver
NewBackplaneDockerDriver creates a new Docker driver for backplane.
func (*BackplaneDockerDriver) GetAddr ¶
func (d *BackplaneDockerDriver) GetAddr(ctx context.Context) (string, error)
GetAddr implements the Driver interface.
func (*BackplaneDockerDriver) PullPolicy ¶
func (db *BackplaneDockerDriver) PullPolicy() string
type BackplaneSupervisorDriver ¶
type BackplaneSupervisorDriver struct {
// LogsDir is the directory where logs will be written
LogsDir string
// contains filtered or unexported fields
}
BackplaneSupervisorDriver implements the Driver interface for process supervision.
func NewBackplaneSupervisorDriver ¶
func NewBackplaneSupervisorDriver() *BackplaneSupervisorDriver
NewBackplaneSupervisorDriver creates a new Supervisor driver with default configuration.
func (*BackplaneSupervisorDriver) GetAddr ¶
func (d *BackplaneSupervisorDriver) GetAddr(ctx context.Context) (string, error)
GetAddr implements the Driver interface.
type Driver ¶
type Driver interface {
// Start deploys and starts the service.
Start(ctx context.Context, orgID uuid.UUID, serviceName string, opts ...Option) (string, error)
// Stop stops the service.
Stop(orgID uuid.UUID, serviceName string)
// GetAddr returns the address of the service.
GetAddr(ctx context.Context) (string, error)
}
Driver is the interface that all service drivers must implement.
func GetAPIServerDriver ¶
func GetAPIServerDriver(driver DriverMode) (Driver, error)
GetAPIServerDriver returns an apiserver driver by name.
func GetBackplaneDriver ¶
func GetBackplaneDriver(driver DriverMode) (Driver, error)
GetBackplaneDriver returns a backplane driver by name.
func GetDriver ¶
func GetDriver(driverType DriverMode, serviceType ServiceType) (Driver, error)
GetDriver returns a driver by name for the specified service type.
func GetTunnelProxyDriver ¶
func GetTunnelProxyDriver(driver DriverMode) (Driver, error)
GetTunnelProxyDriver returns a tunnel proxy driver by name.
func GetWorkerdManagerDriver ¶
func GetWorkerdManagerDriver(driver DriverMode) (Driver, error)
GetWorkerdManagerDriver returns a workerd-manager driver by mode. Only DockerMode is supported: the manager needs a privileged gVisor-capable container, which the subprocess/supervisor path cannot provide.
type DriverMode ¶
type DriverMode string
DriverMode represents the mode in which the driver is running.
type Option ¶
type Option func(*Options)
Option is a function that configures driver options.
func WithAPIServerAddr ¶
WithAPIServerAddr sets the apiserver address.
func WithNetworkContainer ¶
WithNetworkContainer joins another container's network namespace.
func WithWorkerdSocketVolume ¶
WithWorkerdSocketVolume mounts the shared resident-socket volume.
type Options ¶
type Options struct {
Args []string
APIServerAddr string
// NetworkContainer, when set, joins the container's network namespace
// (`docker run --network container:<name>`) instead of the apoxy bridge. The
// workerd-manager uses this to share the co-located BACKPLANE's netns (1:1
// backplane↔resident coupling); it reaches the apiserver (kube-API + the
// routing publish channel) over the docker network by name.
NetworkContainer string
// WorkerdSocketVolume, when set, is a Docker volume mounted at
// /run/workerd-manager in both the backplane and the workerd-manager, so the
// backplane's Envoy can dial the resident workerd's host UDS the manager
// surfaces there.
WorkerdSocketVolume string
}
Options contains common options for all drivers.
type ServiceType ¶
type ServiceType string
ServiceType represents the type of service being managed by a driver.
type TunnelProxyDockerDriver ¶
type TunnelProxyDockerDriver struct {
// contains filtered or unexported fields
}
TunnelProxyDockerDriver implements the Driver interface for Docker.
func NewTunnelProxyDockerDriver ¶
func NewTunnelProxyDockerDriver() *TunnelProxyDockerDriver
NewTunnelProxyDockerDriver creates a new Docker driver for tunnelproxy.
func (*TunnelProxyDockerDriver) GetAddr ¶
func (d *TunnelProxyDockerDriver) GetAddr(ctx context.Context) (string, error)
GetAddr implements the Driver interface.
func (*TunnelProxyDockerDriver) PullPolicy ¶
func (db *TunnelProxyDockerDriver) PullPolicy() string
type TunnelProxySupervisorDriver ¶
type TunnelProxySupervisorDriver struct {
// LogsDir is the directory where logs will be written
LogsDir string
// contains filtered or unexported fields
}
TunnelProxySupervisorDriver implements the Driver interface for process supervision.
func NewTunnelProxySupervisorDriver ¶
func NewTunnelProxySupervisorDriver() *TunnelProxySupervisorDriver
NewTunnelProxySupervisorDriver creates a new Supervisor driver with default configuration.
func (*TunnelProxySupervisorDriver) GetAddr ¶
func (d *TunnelProxySupervisorDriver) GetAddr(ctx context.Context) (string, error)
GetAddr implements the Driver interface.
type WorkerdManagerDockerDriver ¶
type WorkerdManagerDockerDriver struct {
// contains filtered or unexported fields
}
WorkerdManagerDockerDriver runs the APO-796 workerd-manager: a privileged, gVisor-capable sidecar that hosts the dev project's resident workerd (the single-project degenerate case of the per-tenant manager). It joins the apiserver's network namespace (so its kube-API and routing-publish traffic reach the apiserver over loopback, with no relaxation of the publish channel's loopback-only guard) and shares a volume with the backplane carrying the resident's host UDS.
func NewWorkerdManagerDockerDriver ¶
func NewWorkerdManagerDockerDriver() *WorkerdManagerDockerDriver
NewWorkerdManagerDockerDriver creates a new Docker driver for workerd-manager.
func (*WorkerdManagerDockerDriver) GetAddr ¶
func (d *WorkerdManagerDockerDriver) GetAddr(ctx context.Context) (string, error)
GetAddr implements the Driver interface.
func (*WorkerdManagerDockerDriver) PullPolicy ¶
func (db *WorkerdManagerDockerDriver) PullPolicy() string