blueprint

package
v0.0.0-...-f852ded Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const PublicInternetLabel = "public"

PublicInternetLabel is a magic label that allows connections to or from the public network.

Variables

This section is empty.

Functions

func DivideContainerValues

func DivideContainerValues(vals map[string]ContainerValue) (
	rawStrings, secrets map[string]string)

DivideContainerValues divides a map of ContainerValues into two maps -- one of string values, and one of secrets.

Types

type Blueprint

type Blueprint struct {
	Containers    []Container    `json:",omitempty"`
	LoadBalancers []LoadBalancer `json:",omitempty"`
	Connections   []Connection   `json:",omitempty"`
	Placements    []Placement    `json:",omitempty"`
	Machines      []Machine      `json:",omitempty"`
	Volumes       []Volume       `json:",omitempty"`

	AdminACL  []string `json:",omitempty"`
	Namespace string   `json:",omitempty"`
}

A Blueprint is an abstract representation of the policy language.

func FromFile

func FromFile(filename string) (Blueprint, error)

FromFile gets a Blueprint handle from a file on disk.

func FromFileWithArgs

func FromFileWithArgs(filename string, cmdLineArgs []string) (Blueprint, error)

FromFileWithArgs gets a Blueprint handle from a file on disk, passing the given arguments to the node process.

func FromJSON

func FromJSON(jsonStr string) (bp Blueprint, err error)

FromJSON gets a Blueprint handle from the deployment representation.

func (Blueprint) String

func (bp Blueprint) String() string

String returns the Blueprint in its deployment representation.

type Connection

type Connection struct {
	From    []string `json:",omitempty"`
	To      []string `json:",omitempty"`
	MinPort int      `json:",omitempty"`
	MaxPort int      `json:",omitempty"`
}

A Connection allows any container whose hostname appears in `From` to speak with any container whose hostname appears in `To` using ports in the range [MinPort, MaxPort]

type ConnectionSlice

type ConnectionSlice []Connection

A ConnectionSlice allows for slices of Collections to be used in joins

func (ConnectionSlice) Get

func (cs ConnectionSlice) Get(ii int) interface{}

Get returns the value contained at the given index

func (ConnectionSlice) Len

func (cs ConnectionSlice) Len() int

Len returns the number of items in the slice

type Container

type Container struct {
	ID                string                    `json:",omitempty"`
	Image             Image                     `json:",omitempty"`
	Command           []string                  `json:",omitempty"`
	Env               map[string]ContainerValue `json:",omitempty"`
	FilepathToContent map[string]ContainerValue `json:",omitempty"`
	Hostname          string                    `json:",omitempty"`
	Privileged        bool                      `json:",omitempty"`
	VolumeMounts      []VolumeMount             `json:",omitempty"`
}

A Container may be instantiated in the blueprint and queried by users.

type ContainerValue

type ContainerValue struct {
	Value interface{}
}

ContainerValue is a wrapper for the possible values that can be used in the container Env and FilepathToContent maps. The only permissible types are Secret and string.

func NewSecret

func NewSecret(name string) ContainerValue

NewSecret returns a ContainerValue representing a secret.

func NewString

func NewString(str string) ContainerValue

NewString returns a ContainerValue representing a string.

func (ContainerValue) MarshalJSON

func (cv ContainerValue) MarshalJSON() ([]byte, error)

MarshalJSON implements the Go interface for automatically serializing structs into JSON.

func (ContainerValue) String

func (cv ContainerValue) String() string

String returns a human-readable representation of the ContainerValue. This makes the database logs easier to read.

func (*ContainerValue) UnmarshalJSON

func (cv *ContainerValue) UnmarshalJSON(jsonBytes []byte) error

UnmarshalJSON implements the unmarshal interface for converting JSON into Go structs. A custom unmarshaller is necessary because ContainerValue contains an interface, so the default Go unmarshaller cannot infer what type the JSON should be unmarshalled to.

type Image

type Image struct {
	Name       string `json:",omitempty"`
	Dockerfile string `json:",omitempty"`
}

An Image represents a Docker image that can be run. If the Dockerfile is non-empty, the image should be built and hosted by Kelda.

type LoadBalancer

type LoadBalancer struct {
	Name      string   `json:",omitempty"`
	Hostnames []string `json:",omitempty"`
}

A LoadBalancer represents a load balanced group of containers.

type Machine

type Machine struct {
	Provider    string   `json:",omitempty"`
	Role        string   `json:",omitempty"`
	Size        string   `json:",omitempty"`
	DiskSize    int      `json:",omitempty"`
	Region      string   `json:",omitempty"`
	SSHKeys     []string `json:",omitempty"`
	FloatingIP  string   `json:",omitempty"`
	Preemptible bool     `json:",omitempty"`
}

A Machine specifies the type of VM that should be booted.

type Placement

type Placement struct {
	TargetContainer string `json:",omitempty"`

	Exclusive bool `json:",omitempty"`

	// Machine Constraints
	Provider   string `json:",omitempty"`
	Size       string `json:",omitempty"`
	Region     string `json:",omitempty"`
	FloatingIP string `json:",omitempty"`
}

A Placement constraint guides on what type of machine a container can be scheduled.

type Secret

type Secret struct {
	NameOfSecret string
}

Secret represents the name of a secret whose value is stored in Vault. The caller is expected to query Vault to resolve the secret value.

type Volume

type Volume struct {
	Name string            `json:",omitempty"`
	Type string            `json:",omitempty"`
	Conf map[string]string `json:",omitempty"`
}

A Volume allows users to defined storage for containers. Volumes are useful both for persisting storage outside the lifecycle of a container, and for sharing files between multiple containers.

type VolumeMount

type VolumeMount struct {
	VolumeName string `json:",omitempty"`
	MountPath  string `json:",omitempty"`
}

VolumeMount defines how a volume should be mounted into a container.

Jump to

Keyboard shortcuts

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