containers

package
v0.0.0-...-52fd0de Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Overview

* Container Lifecycle Service * * This files describes the container lifecycle service * * API version: 1.0.0 * Contact: info@menucha.de

* Container Lifecycle Service * * This files describes the container lifecycle service * * API version: 1.0.0 * Contact: info@menucha.de

* Container Lifecycle Service * * This files describes the container lifecycle service * * API version: 1.0.0 * Contact: info@menucha.de

* Container Lifecycle Service * * This files describes the container lifecycle service * * API version: 1.0.0 * Contact: info@menucha.de

Index

Constants

View Source
const (
	Default           = "default"
	System            = "system"
	Runtime           = "runtime"
	ContainerConf     = "config"
	ExposedPorts      = "ExposedPorts"
	ExposedPortsLabel = "org.opencontainers.image.exposedPorts"

	ContainerDSock = "/run/containerd/containerd.sock"
	LockFile       = "/run/lock/art"
	MountBaseDir   = "/var/lib/apps/"

	Name        = "NAME"
	Label       = "LABEL"
	Active      = "IS_ACTIVE"
	HostNetwork = "NETHOST"

	Hostname = "HOSTNAME"
)
View Source
const (
	Create      = "Service.CreateService"
	SwitchState = "Service.SwitchServiceState"
	GetStatus   = "Service.GetStatus"
	Upgrade     = "Service.Upgrade"
	Delete      = "Service.DeleteUnitFile"
	HealthCheck = "Service.HealthCheck"
)

SystemdCalls

View Source
const (
	Starting = "STARTING"
	Started  = "STARTED"
	Stopping = "STOPPING"
	Stopped  = "STOPPED"
)
View Source
const SystemdClient = "system:8080"

Variables

View Source
var Clients = wbSocketClients{Clients: make(map[*websocket.Conn]bool)}

Clients websocket opened connections

Functions

func CreateNetwork

func CreateNetwork(netns string, id string, container string, ports []cni.PortMapping) error

func GetClient

func GetClient() (*containerd.Client, error)

func GetNamespaces

func GetNamespaces() [2]string

func HandleMessages

func HandleMessages(topic string, msg logging.Message)

func TearDownNetwork

func TearDownNetwork(netns string, id string, container string, ports []cni.PortMapping) error

Types

type Client

type Client struct {
	utils.Client
	CClient *containerd.Client
}

func (*Client) CleanupImages

func (c *Client) CleanupImages(ns string) error

func (*Client) Close

func (c *Client) Close()

func (*Client) CreateContainer

func (c *Client) CreateContainer(ns string, img containerd.Image, container *Container) (*Container, error)

func (*Client) CreateImageFromSnapshot

func (c *Client) CreateImageFromSnapshot(ns string, container *Container) ([]byte, error)

func (*Client) DeleteContainer

func (c *Client) DeleteContainer(ns string, id string, name string, ignoreService ...bool) error

DeleteContainer ...

func (*Client) DeleteInactive

func (c *Client) DeleteInactive(ns string, name string) error

func (*Client) GetContainer

func (c *Client) GetContainer(ns string, id string) (Container, error)

func (*Client) GetContainerIdByName

func (c *Client) GetContainerIdByName(ns string, name string) string

func (*Client) GetContainerStatus

func (c *Client) GetContainerStatus(result *Container) error

func (*Client) GetContainers

func (c *Client) GetContainers(ns string) ([]Container, error)

func (*Client) GetMounts

func (c *Client) GetMounts(ns string, id string) ([]mount.Mount, error)

func (*Client) GetPortMapping

func (c *Client) GetPortMapping(ns string, id string) ([]cni.PortMapping, error)

func (*Client) MakeContainer

func (c *Client) MakeContainer(ns string, container *Container) (*Container, error)

func (*Client) MakeContainerFromFile

func (c *Client) MakeContainerFromFile(ns string, container *Container) (*Container, error)

func (*Client) ResetContainer

func (c *Client) ResetContainer(ns string, container Container) error

func (*Client) StartContainer

func (c *Client) StartContainer(ns string, id string) (containerd.Task, <-chan containerd.ExitStatus, error)

func (*Client) StopContainer

func (c *Client) StopContainer(ns string, container string, task containerd.Task) error

func (*Client) SwitchServiceState

func (c *Client) SwitchServiceState(name string, state bool) error

func (*Client) UpdateContainer

func (c *Client) UpdateContainer(ns string, container *Container) error

func (*Client) UpdateExists

func (c *Client) UpdateExists(ns string, ref string, user string, passwd string) (bool, error)

func (*Client) UpgradeContainers

func (c *Client) UpgradeContainers(ns string, containers []*Container) error

type Container

type Container struct {
	Id string `json:"id,omitempty"`

	Name string `json:"name,omitempty"`

	Label string `json:"label,omitempty"`

	Image string `json:"image,omitempty"`

	User string `json:"user,omitempty"`

	Passwd string `json:"passwd,omitempty"`

	Trust bool `json:"trust,omitempty"`

	State string `json:"state,omitempty"`

	Namespaces []Namespace `json:"namespaces,omitempty"`

	Devices []Device `json:"devices,omitempty"`

	Mounts []Mount `json:"mounts,omitempty"`

	Capabilities []string `json:"capabilities,omitempty"`

	//Additional Infos
	IsActive  bool   `json:"isactive,omitempty"`
	IsHostNet bool   `json:"ishostnet,omitempty"`
	Version   string `json:"version,omitempty"`
}

type Device

type Device struct {
	Path string `json:"path,omitempty"`
}

type Manifest

type Manifest interface {
	AddLayer(ctx context.Context, contentStore content.Store, layer ocispec.Descriptor) error
	Descriptor() ocispec.Descriptor
}

Manifest The manifest that can be mutated.

func LoadManifest

func LoadManifest(ctx context.Context, contentStore content.Store, desc ocispec.Descriptor) (Manifest, error)

LoadManifest Load a manifest in-memory for easy interaction.

type Mount

type Mount struct {
	Type_ string `json:"type,omitempty"`

	Source string `json:"source,omitempty"`

	Destination string `json:"destination,omitempty"`

	Options []string `json:"options,omitempty"`
}

type Namespace

type Namespace struct {
	Type_ string `json:"type,omitempty"`
}

type StatusInfo

type StatusInfo struct {
	Ref       string
	Status    string
	Offset    int64
	Total     int64
	StartedAt time.Time
	UpdatedAt time.Time
}

StatusInfo holds the status info for an upload or download

Jump to

Keyboard shortcuts

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