kubernetes

package
v0.3.11-0...-4fdaadb Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: BSD-3-Clause Imports: 30 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// LabelApp is the shared label between the simnet components.
	LabelApp = "go.dedis.ch.app"
	// AppName is the value of the shared label.
	AppName = "simnet"

	// LabelID is the label for each type of component.
	LabelID = "go.dedis.ch.id"
	// AppID is the value of the component label for the simulation application.
	AppID = "simnet-app"
	// RouterID is the value of the component label for the router.
	RouterID = "simnet-router"

	// LabelNode is attached to the node identifier in the topology.
	LabelNode = "go.dedis.ch.node.id"

	// TimeoutRouterDeployment is the amount of time in seconds that the router
	// has to progress to full availability.
	TimeoutRouterDeployment = 300
	// TimeoutAppDeployment is the amount of time in seconds that the app
	// has to progress to full availability.
	TimeoutAppDeployment = 300

	// ClientCertificateDistantPath is the location of the client certificate
	// in the router container.
	ClientCertificateDistantPath = "/etc/openvpn/pki/issued/client1.crt"
	// ClientKeyDistantPath is the location of the client key in the router
	// container.
	ClientKeyDistantPath = "/etc/openvpn/pki/private/client1.key"
	// CADistantPath is the location of the CA certificate in the router
	// container.
	CADistantPath = "/etc/openvpn/pki/ca.crt"

	// MonitorDataFilepath is the location of the monitor data file inside the
	// monitor container.
	MonitorDataFilepath = "/root/data"

	// DefaultNetworkDevice is the name of the network interface that Docker
	// containers have available.
	DefaultNetworkDevice = "eth0"
	// DefaultNetworkMask is the mask used when the router cannot determine
	// the cluster subnet.
	DefaultNetworkMask = "255.255.0.0"
)
View Source
const (
	// ContainerAppName is the name of the container where the application
	// will be deployed.
	ContainerAppName = "app"
	// ContainerMonitorName is the name of the container where the monitor
	// will be deployed.
	ContainerMonitorName = "monitor"
	// ContainerRouterName is the name of the container where the router
	// will be deployed.
	ContainerRouterName = "router"

	// OptionMemoryAlloc is the name of the option to change the default max
	// limit of the amount of memory allocated.
	OptionMemoryAlloc = "memory-alloc"
	// OptionCPUAlloc is the name of the option to change the default max limit
	// of the amount of cpu allocated.
	OptionCPUAlloc = "cpu-alloc"

	// CleaningTimeout is the maximum amount the cleaning should take.
	CleaningTimeout = 60 * time.Second
)

Variables

View Source
var (
	// DeamonRequestMemory is the amount of memory for monitoring containers.
	DeamonRequestMemory = resource.MustParse("64Mi")
	// DeamonRequestCPU is the number of CPU for monitoring containers.
	DeamonRequestCPU = resource.MustParse("20m")

	// AppRequestMemory is the amount of memory allocated to app containers in the
	// simulation pods.
	AppRequestMemory = resource.MustParse("128Mi")
	// AppRequestCPU is the number of CPU allocated to app containers in the
	// simulation pods.
	AppRequestCPU = resource.MustParse("100m")
)

Functions

func WithResources

func WithResources(cpu, memory string) sim.Option

WithResources is a Kubernetes specific option to change the default limits of resources allocated.

Types

type Encoder

type Encoder interface {
	Encode(interface{}) error
}

Encoder is the interface used to instantiate the encoder that will write the statistics into a file.

type IO

type IO interface {
	Read(pod, container, path string) (io.ReadCloser, error)
	Write(pod, container, path string, content io.Reader) error
	Exec(pod, container string, cmd []string, options sim.ExecOptions) error
}

IO is the interface that provides primitives to readand write in a given container's pod. It also provide a primitive to execute a command.

type Strategy

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

Strategy is a simulation strategy that will deploy simulation nodes on Kubernetes.

func NewStrategy

func NewStrategy(cfg string, opts ...sim.Option) (*Strategy, error)

NewStrategy creates a new simulation engine.

func (*Strategy) Clean

func (s *Strategy) Clean(ctx context.Context) error

Clean removes any resource created for the simulation.

func (*Strategy) Deploy

func (s *Strategy) Deploy(ctx context.Context, round sim.Round) error

Deploy will create a deployment on the Kubernetes cluster. A pod will then be assigned to simulation nodes.

func (*Strategy) Execute

func (s *Strategy) Execute(ctx context.Context, round sim.Round) error

Execute uses the round implementation to execute a simulation round.

func (*Strategy) Option

func (s *Strategy) Option(opt sim.Option)

Option sets the global options.

func (*Strategy) String

func (s *Strategy) String() string

func (*Strategy) WriteStats

func (s *Strategy) WriteStats(ctx context.Context, filename string) error

WriteStats fetches the stats of the nodes then write them into a JSON formatted file.

Jump to

Keyboard shortcuts

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