container

package
v0.0.0-...-f33bef4 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 45 Imported by: 3 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidCommand is returned if a command is empty or malformed
	ErrInvalidCommand = errors.New("container: invalid command")
	// ErrInvalidEndpoint is returned if an endpoint is empty or malformed
	ErrInvalidEndpoint = errors.New("container: invalid endpoint")
	// ErrInvalidTenantID is returned if a TenantID is empty or malformed
	ErrInvalidTenantID = errors.New("container: invalid tenant id")
	// ErrInvalidServiceID is returned if a ServiceID is empty or malformed
	ErrInvalidServiceID = errors.New("container: invalid service id")
	// ErrInvalidService is returned if a Service is empty or malformed
	ErrInvalidService = errors.New("container: invalid serviced")
	// ErrInvalidHostID is returned if the host is empty or malformed
	ErrInvalidHostID = errors.New("container: invalid host id")
	// ErrNoServiceEndpoints is returned if we can't fetch the service endpoints
	ErrNoServiceEndpoints = errors.New("container: unable to retrieve service endpoints")
)

Functions

This section is empty.

Types

type ContainerEndpoints

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

ContainerEndpoints manages import and export bindings for the instance.

func NewContainerEndpoints

func NewContainerEndpoints(svc *service.Service, opts ContainerEndpointsOptions) (*ContainerEndpoints, error)

NewContainerEndpoints loads the service state and manages port bindings for the instance.

func (*ContainerEndpoints) AddExport

func (ce *ContainerEndpoints) AddExport(cancel <-chan struct{}, bind zkservice.ExportBinding)

AddExport ensures that an export is registered for other services to bind

func (*ContainerEndpoints) AddImport

func (ce *ContainerEndpoints) AddImport(cancel <-chan struct{}, application string, bind zkservice.ImportBinding)

AddImport tracks exports for a given import binding

func (*ContainerEndpoints) Run

func (ce *ContainerEndpoints) Run(cancel <-chan struct{})

Run manages the container endpoints

func (*ContainerEndpoints) RunImportListener

func (ce *ContainerEndpoints) RunImportListener(cancel <-chan struct{}, tenantID string, binds ...zkservice.ImportBinding)

RunImportListener keeps track of the state of all matching imports TODO: isvcs imports should be stored under tenantID /net/export/cc

func (*ContainerEndpoints) UpdateRemoteExports

func (ce *ContainerEndpoints) UpdateRemoteExports(bind zkservice.ImportBinding, exports []registry.ExportDetails)

UpdateRemoteExports updates the proxy connections for an import port binding

type ContainerEndpointsOptions

type ContainerEndpointsOptions struct {
	HostID               string
	TenantID             string
	InstanceID           int
	IsShell              bool
	TCPMuxPort           uint16
	UseTLS               bool
	VirtualAddressSubnet string
}

ContainerEndpointsOptions are options for the container endpoint

type Controller

type Controller struct {
	PIDFile string
	// contains filtered or unexported fields
}

Controller is a object to manage the operations withing a container. For example, it creates the managed service instance, logstash forwarding, port forwarding, etc.

func NewController

func NewController(options ControllerOptions) (*Controller, error)

NewController creates a new Controller for the given options

func (*Controller) Close

func (c *Controller) Close() error

Close shuts down the controller

func (*Controller) Run

func (c *Controller) Run() (err error)

Run executes the controller's main loop and block until the service exits according to it's restart policy or Close() is called.

type ControllerOptions

type ControllerOptions struct {
	ServicedEndpoint string
	RPCDisableTLS    bool
	Service          struct {
		ID          string   // The uuid of the service to launch
		InstanceID  string   // The running instance ID
		Autorestart bool     // Controller will restart the service if it exits
		Command     []string // The command to launch
		RunAs       string   // Run command as user or user:group
	}
	Mux struct {
		Enabled     bool   // True if muxing is used
		Port        int    // the TCP port to use
		DisableTLS  bool   // True if TLS is disabled
		KeyPEMFile  string // Path to the key file when TLS is used
		CertPEMFile string // Path to the cert file when TLS is used
	}
	Logforwarder LogforwarderOptions
	Metric       struct {
		Address       string // TCP port to host the metric service, :22350
		RemoteEndoint string // The url to forward metric queries
	}
	VirtualAddressSubnet string // The subnet of virtual addresses, 10.3
	MetricForwarding     bool   // Whether or not the Controller should forward metrics
	HostIPs              string // The ip addresses of the host
	ServiceNamePath      string // Path of the service
}

ControllerOptions are options to be run when starting a new proxy server

type LogforwarderOptions

type LogforwarderOptions struct {
	Enabled    bool          // True if enabled
	Path       string        // Path to the logforwarder program (e.g. filebeat)
	ConfigFile string        // Path to the config file for filebeat
	SettleTime time.Duration // time to wait for forwarder to flush its buffer before exiting
}

Logforwarder configuration for filebeat

type MetricForwarder

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

MetricForwarder contains all configuration parameters required to provide a forward metrics inside a docker container.

func NewMetricForwarder

func NewMetricForwarder(port, metricsRedirectURL string) (config *MetricForwarder, err error)

NewMetricForwarder creates a new metric forwarder at port, all metrics are forwarded to metricsRedirectURL

func (*MetricForwarder) Close

func (forwarder *MetricForwarder) Close() error

Close shuts down the forwarder.

type VIFRegistry

type VIFRegistry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

VIFRegistry holds state regarding virtual interfaces. It is meant to be created in the proxy to manage vifs in the running service container.

func NewVIFRegistry

func NewVIFRegistry() *VIFRegistry

NewVIFRegistry initializes a new VIFRegistry.

func (*VIFRegistry) RegisterVirtualAddress

func (reg *VIFRegistry) RegisterVirtualAddress(address, toport, protocol string) error

RegisterVirtualAddress takes care of the entire virtual address setup. It creates a virtual interface if one does not yet exist, allocates an IP address, assigns it to the virtual interface, adds an entry to /etc/hosts, and sets up the iptables rule to redirect traffic to the specified port.

func (*VIFRegistry) SetSubnet

func (reg *VIFRegistry) SetSubnet(subnet string) error

SetSubnet sets the subnet used for virtual addresses

Jump to

Keyboard shortcuts

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