scenarios

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunApps added in v0.10.0

func RunApps(ctx context.Context, config RunAppsConfig, apps ...Application) error

RunApps runs applications.

Types

type Application added in v0.10.0

type Application interface {
	GetName() string
	GetIP() net.IP
	GetTaskFunc(config RunAppsConfig, appHosts map[string]net.IP, spawn parallel.SpawnFn, logsCh chan<- logEnvelope) task.Func
}

Application represents an app to run in isolation.

type Container

type Container struct {
	// Name is the name of the container.
	Name string

	// Image is the name of the image.
	Image string

	// Tag is the tag of the image.
	Tag string

	// EnvVars sets environment variables inside container.
	EnvVars map[string]string

	// User is the username or UID to use.
	User string

	// Mounts are the mounts to configure inside container.
	Mounts []Mount

	// WorkingDir specifies a path to working directory.
	WorkingDir string

	// Entrypoint sets entrypoint for container.
	Entrypoint []string

	// Args sets args for container.
	Args []string

	// IP is the IP address of the container.
	IP *net.IPNet

	// DNS is the list of nameservers to configure inside container.
	DNS []net.IP

	// Hosts is the list of hosts and their IP addresses to resolve inside namespace.
	Hosts map[string]net.IP

	// ExposedPorts is the list of ports to expose.
	ExposedPorts []ExposedPort
}

Container defines container.

func (Container) GetIP added in v0.10.0

func (c Container) GetIP() net.IP

GetIP returns IP of the container.

func (Container) GetName added in v0.10.0

func (c Container) GetName() string

GetName returns the name of the container.

func (Container) GetTaskFunc added in v0.10.0

func (c Container) GetTaskFunc(config RunAppsConfig, appHosts map[string]net.IP, spawn parallel.SpawnFn, logsCh chan<- logEnvelope) task.Func

GetTaskFunc returns task function running the container.

type Embedded added in v0.10.0

type Embedded struct {
	// Name is the name of the function.
	Name string

	// Mounts are the mounts to configure inside embedded function.
	Mounts []Mount

	// Args sets args for embedded function.
	Args []string

	// IP is the IP address of the embedded function.
	IP *net.IPNet

	// DNS is the list of nameservers to configure inside embedded function.
	DNS []net.IP

	// Hosts is the list of hosts and their IP addresses to resolve inside namespace.
	Hosts map[string]net.IP

	// ExposedPorts is the list of ports to expose.
	ExposedPorts []ExposedPort
}

Embedded defines embedded function to run inside isolation.

func (Embedded) GetIP added in v0.10.0

func (e Embedded) GetIP() net.IP

GetIP returns IP of the function.

func (Embedded) GetName added in v0.10.0

func (e Embedded) GetName() string

GetName returns the name of the function.

func (Embedded) GetTaskFunc added in v0.10.0

func (e Embedded) GetTaskFunc(config RunAppsConfig, appHosts map[string]net.IP, spawn parallel.SpawnFn, logsCh chan<- logEnvelope) task.Func

GetTaskFunc returns task function running the embedded function.

type ExposedPort

type ExposedPort struct {
	Protocol      string
	HostIP        net.IP
	HostPort      uint16
	NamespacePort uint16
	Public        bool
}

ExposedPort defines a port to be exposed from the container.

type LogsConfig added in v0.11.0

type LogsConfig struct {
	Address string
}

LogsConfig is the configuration of remote loki logs receiver.

type Mount

type Mount struct {
	Host      string
	Namespace string
	Writable  bool
}

Mount defines the mount to be configured inside container.

type RunAppsConfig added in v0.10.0

type RunAppsConfig struct {
	CacheDir   string
	AppsDir    string
	LogsConfig LogsConfig
}

RunAppsConfig is the config for running applications.

Jump to

Keyboard shortcuts

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