model

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

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 Filesystem added in v0.2.8

type Filesystem struct {
	// E.g /dev/vda1, tmpfs, cgroup, etc.
	Filesystem string
	// E.g. ext4, tmpfs, cgroup, etc.
	TypeName string
	// Path to the mounted dir
	MountDir string
	// Total data blocks
	Total uint64
	// Free blocks
	Free uint64
	// Free blocks available to unprivileged user
	Available uint64
}

Filesystem represents information about single filesystem in the target node

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 NodeInfo added in v0.2.8

type NodeInfo struct {
	// Labels for the node, provided through cli
	Labels map[string]string

	// Node 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"`

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

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

	// Server version
	Version string

	// Filesystems
	Filesystems []Filesystem

	// Seconds since node boot up
	Uptime uint64
}

NodeInfo contains information about current node

type NodeState added in v0.2.8

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

NodeState describes current state of the node

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