model

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2017 License: MIT Imports: 8 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultNamespace = "eliot"

DefaultNamespace is namespace what each pod get if there is no metadata.namespace

Functions

func IsValidEnvKeyValuePair

func IsValidEnvKeyValuePair(value string) bool

IsValidEnvKeyValuePair return true if value is valid formated environment variable (e.g. KEY=value)

func Validate

func Validate(pods []Pod) error

Validate validates given pod definitions

Types

type Container

type Container struct {
	Name       string `validate:"required,gt=0,alphanumOrDash"`
	Image      string `validate:"required,gt=0,imageRef"`
	Tty        bool
	Args       []string `validate:"dive,noSpaces"`
	Env        []string `validate:"dive,envKeyValuePair"`
	WorkingDir string   `validate:"omitempty,gt=0"`
	Mounts     []Mount  `validate:"dive"`
	Pipe       *PipeSet
}

Container defines what image should be running

type ContainerStatus

type ContainerStatus struct {
	ContainerID  string `validate:"required,gt=0"`
	Name         string `validate:"required,gt=0"`
	Image        string `validate:"required,gt=0,imageRef"`
	State        string `validate:"required,gt=0"`
	RestartCount int    `validate:"required,gte=0"`
}

ContainerStatus represents one container status

type Deployment

type Deployment struct {
	Metadata
	ID   string         `validate:"required,gt=0"`
	Spec DeploymentSpec `validate:"required"`
}

Deployment model

type DeploymentSpec

type DeploymentSpec struct {
	Selector map[string]string
	Template Pod `validate:"required"`
}

DeploymentSpec model

type DeviceInfo

type DeviceInfo struct {
	// Labels for the device, provided through cli
	Labels map[string]string

	// Device hostname
	Hostname string `validate:"required,gt=0"`

	// IPs
	Addresses []net.IP

	// Port
	GrpcPort int

	// The machine id is an ID identifying a specific Linux/Unix installation.
	// It does not change if hardware is replaced.
	MachineID string `validate:"required,gt=0"`

	// The system uuid is the main board product UUID,
	// as set by the board manufacturer and encoded in the BIOS DMI information
	SystemUUID string `validate:"required,gt=0"`

	// A random ID that is regenerated on each boot
	BootID string `validate:"required,gt=0"`

	// Device operating system. One of 386, amd64, arm, s390x, and so on.
	Arch string

	// device operating system. One of darwin, freebsd, linux, windows, and so on
	OS string
}

DeviceInfo contains information about current device

func (DeviceInfo) GetPrimaryEndpoint

func (d DeviceInfo) GetPrimaryEndpoint() string

GetPrimaryEndpoint return primary GRPC endpoint address

type DeviceState

type DeviceState struct {
	Pods []PodState `validate:"dive"`
}

DeviceState describes current state of the device

type Metadata

type Metadata struct {
	Name      string `validate:"required,gt=0,alphanumOrDash"`
	Namespace string `validate:"omitempty,gt=0,alphanumOrDash"`
}

Metadata is metadata that all resources must have

func NewMetadata

func NewMetadata(namespace, name string) Metadata

NewMetadata creates new metadata with name and metadata fields

type Mount

type Mount struct {
	Type        string   `validate:"omitempty,gt=0"`
	Source      string   `validate:"omitempty,gt=0"`
	Destination string   `validate:"omitempty,gt=0"`
	Options     []string `validate:"dive,gt=0"`
}

Mount defines directory mount from host to the container

type PipeFromStdout

type PipeFromStdout struct {
	Stdin *PipeToStdin
}

PipeFromStdout defines container stdout as source for the piping

type PipeSet

type PipeSet struct {
	Stdout *PipeFromStdout
}

PipeSet allows defining pipe from some source(s) to another container

type PipeToStdin

type PipeToStdin struct {
	Name string
}

PipeToStdin defines container stdin as target for the piping

type Pod

type Pod struct {
	Metadata Metadata `validate:"required"`
	Spec     PodSpec  `validate:"required"`
	Status   PodStatus
}

Pod is set of containers

func (*Pod) AppendContainer

func (p *Pod) AppendContainer(container Container, status ContainerStatus)

AppendContainer adds container to the pod information

type PodSpec

type PodSpec struct {
	HostNetwork   bool
	HostPID       bool
	Containers    []Container `validate:"required,gt=0,dive"`
	RestartPolicy string
}

PodSpec defines what containers should be running

type PodState

type PodState struct {
	ID string `validate:"required,gt=0"`
}

PodState represents information about pod current state

type PodStatus

type PodStatus struct {
	Hostname          string
	ContainerStatuses []ContainerStatus `validate:"dive"`
}

PodStatus represents latest known state of pod

Jump to

Keyboard shortcuts

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