captain

package module
v0.0.0-...-c1ef799 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: MIT Imports: 12 Imported by: 0

README

Build Status

Captain

Captain is a computation worker node in project Armada. It runs task container in Docker deployed by application deployers.

What is this?

When a machine wants to join Armada system and contributes its computation power, it needs to run this captain module to manage its local task containers and connect to other modules in Armada. It includes receive application deployment requests, set up task Docker containers, container configuration, and internal network connections. Note that the captain module will access to the local Docker engine to perform container-related operations. The resource contribued to Armada is limited to the resources allocated to Docker engine.

Quick Start

Prerequisites: Docker

To download the spinner image run:
docker pull armadaumn/captain:latest
To start the spinner just run:
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock armadaumn/captain:latest $SERVER_TYPE $LOC $TAG $SPINNER_URL
Arguments:

  • $SERVER_TYPE: indicate the type of the current machine, "Sserver" for a local server, "volunteer" for a personal machine.
  • $LOC: The location of the current machine. The captain module can locate the machine automatically, so this field is just a placeholder for now.
  • $TAG: Any tag for the machine.
  • $SPINNER_URL: the ip address of the spinner

Build from the source

Prerequisites: Go environment, Docker

Build and run spinner:

git clone https://github.com/armadanet/captain.git
cd captain/build
make build
make run

Documentation

Overview

Package captain leads and manages the containers on a single machine

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeaconResponse

type BeaconResponse struct {
	Valid         bool   `json:"Valid"` // true if find a spinner
	Token         string `json:"Token"`
	Ip            string `json:"Ip"`
	OverlayName   string `json:"OverlayName"`
	ContainerName string `json:"ContainerName"`
}

type Captain

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

Captain holds state information and an exit mechanism.

func New

func New(name string) (*Captain, error)

Constructs a new captain.

func (*Captain) ConnectStorage

func (c *Captain) ConnectStorage()

func (*Captain) Dial

func (c *Captain) Dial(dailurl string) error

Dial a socket connection to a given url. Listen for reads and writes

func (*Captain) ExecuteConfig

func (c *Captain) ExecuteConfig(config *dockercntrl.Config, write chan interface{})

Executes a given config, waiting to print output. Should be changed to logging or a logging system. Kubeedge uses Mosquito for example.

func (*Captain) QueryBeacon

func (c *Captain) QueryBeacon(beaconURL string, selfSpin bool) (string, error)

func (*Captain) Run

func (c *Captain) Run(beaconURL string, selfSpin bool)

Connects to a given spinner and runs an infinite loop. This loop is because the dial runs a goroutine, which stops if the main thread closes.

func (*Captain) SelfSpin

func (c *Captain) SelfSpin() (string, string)

func (*Captain) StartSpinner

func (c *Captain) StartSpinner(spinner_name string)

Directories

Path Synopsis
dockercntrl module

Jump to

Keyboard shortcuts

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