bunker

package
v0.0.0-...-0de26bf Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ContainerdDaemonPIDFile = "/run/bunkerd.pid"

ContainerdDaemonPIDFile is the file where pid of bunkerd daemon is kept.

View Source
const ContainerdNamespace = "bunker"

ContainerdNamespace is the namespace label used in the containerd context.

View Source
const ContainerdSocketPath = "/run/bunker/bunkerd.sock"

ContainerdSocketPath is the full path of the socket file that is used as the connection to containerd

Variables

View Source
var DaemonIsRunning = false

DaemonIsRunning is a boolean value true if daemon is running.

View Source
var DaemonPID = 0

DaemonPID is the PID of the running bunkerd daemon.

View Source
var Logger *logger.Logger

Logger is a global logger instance. This is initialized once by the CLI or Daemon.

View Source
var Util util

Util is a global instance of util struct.

Functions

func InitLogger

func InitLogger(name string, path string)

InitLogger creates a new instance of logger with the given name and path of the file to log to. The instance is stored as a global logger instance.

Types

type Args

type Args map[string]string

Args is a map of arguments that are passed to the structs that implement Command interface.

func (*Args) Value

func (args *Args) Value(label string) string

Returns the value of a key or empty string if it does not exist

type CLI

type CLI struct {
}

CLI is the starting point for the bunker cli client. It takes care of argument parsing and calling of correct API methods.

func NewCLI

func NewCLI() *CLI

Create a new CLI instance.

func (*CLI) Execute

func (cli *CLI) Execute() error

Start execution of the CLI client.

type Command

type Command interface {

	// Returns the name of the command.
	Name() string

	// Executes the command and returns error when it fails.
	Execute() error

	// Returns help information about the command as string.
	Help() string
}

Command is an interface type for all API commands in bunker.

type Containerd

type Containerd struct {

	// Client is the initialied containerd client.
	Client *containerd.Client

	// Context is the containerd context with a separate namespace for bunker.
	Context context.Context
}

Containerd is a wrapper over containerd client library. It is takes care of storing a containerd client instance which is used by the CLI.

func NewContainerd

func NewContainerd() (*Containerd, error)

NewContainerd return a new initialized instance of containerd client

type Containers

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

Containers implements Command interface. It is responsible to list containers that exist locally.

func NewContainersCommand

func NewContainersCommand(rawArgs *[]string) (*Containers, error)

NewContainersCommand returns an instance of the command. It takes os arguments and parses them to create the command which can be executed.

func (*Containers) Execute

func (cmd *Containers) Execute() error

Execute runs the command and returns error upon failure.

func (*Containers) Help

func (cmd *Containers) Help() string

Help returns the help information about the command.

func (*Containers) Name

func (cmd *Containers) Name() string

Name returns the name of the command.

type Daemon

type Daemon struct {
}

Daemon is the starting point for the bunkerd daemon. It is responsible for starting a new containerd instance.

func NewDaemon

func NewDaemon() *Daemon

NewDaemon returns an instance of Daemon.

func (*Daemon) Disable

func (daemon *Daemon) Disable() error

Disable disables the starting of daemon on startup.

func (*Daemon) Enable

func (daemon *Daemon) Enable() error

Enable enables the starting of daemon on startup.

func (*Daemon) Execute

func (daemon *Daemon) Execute() error

Start execution of bunkerd daemon.

func (*Daemon) Help

func (daemon *Daemon) Help()

Help prints the help information on how to use bunkerd daemon.

func (*Daemon) Start

func (daemon *Daemon) Start() error

Start starts the daemon if not already running.

func (*Daemon) Status

func (daemon *Daemon) Status() error

Status prints the status of the daemon.

func (*Daemon) Stop

func (daemon *Daemon) Stop() error

Stop stops the running daemon.

type Images

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

Images implements Command interface. It list the images pulled from the registry that exist locally.

func NewImagesCommand

func NewImagesCommand(rawArgs *[]string) (*Images, error)

NewImagesCommand returns an instance of the command. It takes os arguments and parses them to create the command which can be executed.

func (*Images) Execute

func (cmd *Images) Execute() error

Execute runs the command and returns error upon failure.

func (*Images) Help

func (cmd *Images) Help() string

Help returns the help information about the command.

func (*Images) Name

func (cmd *Images) Name() string

Name returns the name of the command.

type Pull

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

Pull implements Command interface. It takes care of pulling and image from the registry.

func NewPullCommand

func NewPullCommand(rawArgs *[]string) (*Pull, error)

NewPullCommand returns an instance of the command. It takes os arguments and parses them to create the command which can be executed.

func (*Pull) Execute

func (cmd *Pull) Execute() error

Execute runs the command and returns error upon failure.

func (*Pull) Help

func (cmd *Pull) Help() string

Help returns the help information about the command.

func (*Pull) Name

func (cmd *Pull) Name() string

Name returns the name of the command.

type Rm

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

Rm implements Command interface. It takes care of removing a container locally.

func NewRmCommand

func NewRmCommand(rawArgs *[]string) (*Rm, error)

NewRmCommand returns an instance of the command. It takes os arguments and parses them to create the command which can be executed.

func (*Rm) Execute

func (cmd *Rm) Execute() error

Execute runs the command and returns error upon failure.

func (*Rm) Help

func (cmd *Rm) Help() string

Help returns the help information about the command.

func (*Rm) Name

func (cmd *Rm) Name() string

Name returns the name of the command.

type Run

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

Run implements Command interface. It takes care of running a task in a new or existing container.

func NewRunCommand

func NewRunCommand(rawArgs *[]string) (*Run, error)

NewRunCommand returns an instance of the command. It takes os arguments and parses them to create the command which can be executed.

func (*Run) Execute

func (cmd *Run) Execute() error

Execute runs the command and returns error upon failure.

func (*Run) Help

func (cmd *Run) Help() string

Help returns the help information about the command.

func (*Run) Name

func (cmd *Run) Name() string

Name returns the name of the command.

Jump to

Keyboard shortcuts

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