Documentation ¶
Index ¶
- Constants
- Variables
- func WithResources(cpu, memory string) sim.Option
- type Encoder
- type IO
- type Strategy
- func (s *Strategy) Clean(ctx context.Context) error
- func (s *Strategy) Deploy(ctx context.Context, round sim.Round) error
- func (s *Strategy) Execute(ctx context.Context, round sim.Round) error
- func (s *Strategy) Option(opt sim.Option)
- func (s *Strategy) String() string
- func (s *Strategy) WriteStats(ctx context.Context, filename string) error
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 ¶
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 ¶
NewStrategy creates a new simulation engine.
func (*Strategy) Deploy ¶
Deploy will create a deployment on the Kubernetes cluster. A pod will then be assigned to simulation nodes.
Click to show internal directories.
Click to hide internal directories.