footloose: github.com/weaveworks/footloose/pkg/config Index | Files

package config

import "github.com/weaveworks/footloose/pkg/config"

Index

Package Files

cluster.go get.go machine.go

func GetValueFromConfig Uses

func GetValueFromConfig(stringPath string, object interface{}) (interface{}, error)

GetValueFromConfig returns specific value from object given a string path

type Cluster Uses

type Cluster struct {
    // Name is the cluster name. Defaults to "cluster".
    Name string `json:"name"`

    // PrivateKey is the path to the private SSH key used to login into the cluster
    // machines. Can be expanded to user homedir if ~ is found. Ex. ~/.ssh/id_rsa
    PrivateKey string `json:"privateKey"`
}

Cluster is a set of Machines.

type Config Uses

type Config struct {
    // Cluster describes cluster-wide configuration.
    Cluster Cluster `json:"cluster"`
    // Machines describe the machines we want created for this cluster.
    Machines []MachineReplicas `json:"machines"`
}

Config is the top level config object.

func NewConfigFromFile Uses

func NewConfigFromFile(path string) (*Config, error)

func NewConfigFromYAML Uses

func NewConfigFromYAML(data []byte) (*Config, error)

func (Config) Validate Uses

func (conf Config) Validate() error

Validate checks basic rules for Config's fields

type Machine Uses

type Machine struct {
    // Name is the machine name. This is a format string with %d as the machine
    // index, a number between 0 and N-1, N being the number of machines in the
    // cluster. This name will also be used as the machine hostname. Defaults to
    // "node%d".
    Name string `json:"name"`
    // Image is the container image to use for this machine.
    Image string `json:"image"`
    // Privileged controls whether to start the Machine as a privileged container
    // or not. Defaults to false.
    Privileged bool `json:"privileged,omitempty"`
    // Volumes is the list of volumes attached to this machine.
    Volumes []Volume `json:"volumes,omitempty"`
    // Networks is the list of user-defined docker networks this machine is
    // attached to. These networks have to be created manually before creating the
    // containers via "docker network create mynetwork"
    Networks []string `json:"networks,omitempty"`
    // PortMappings is the list of ports to expose to the host.
    PortMappings []PortMapping `json:"portMappings,omitempty"`
    // Cmd is a cmd which will be run in the container.
    Cmd string `json:"cmd,omitempty"`
}

Machine is the machine configuration.

type MachineReplicas Uses

type MachineReplicas struct {
    Spec  Machine `json:"spec"`
    Count int     `json:"count"`
}

MachineReplicas are a number of machine following the same specification.

type PortMapping Uses

type PortMapping struct {
    // Protocol is the layer 4 protocol for this mapping. One of "tcp" or "udp".
    // Defaults to "tcp".
    Protocol string `json:"protocol,omitempty"`
    // Address is the host address to bind to. Defaults to "0.0.0.0".
    Address string `json:"address,omitempty"`
    // HostPort is the base host port to map the containers ports to. As we
    // configure a number of machine replicas, each machine will use HostPort+i
    // where i is between 0 and N-1, N being the number of machine replicas. If 0,
    // a local port will be automatically allocated.
    HostPort uint16 `json:"hostPort,omitempty"`
    // ContainerPort is the container port to map.
    ContainerPort uint16 `json:"containerPort"`
}

PortMapping describes mapping a port from the machine onto the host.

type Volume Uses

type Volume struct {
    // Type is the volume type. One of "bind" or "volume".
    Type string `json:"type"`
    // Source is the volume source.
    // With type=bind, the volume source is a directory or a file in the host
    // filesystem.
    // With type=volume, source is either the name of a docker volume or "" for
    // anonymous volumes.
    Source string `json:"source"`
    // Destination is the mount point inside the container.
    Destination string `json:"destination"`
    // ReadOnly specifies if the volume should be read-only or not.
    ReadOnly bool `json:"readOnly"`
}

Volume is a volume that can be attached to a Machine.

Package config imports 7 packages (graph) and is imported by 4 packages. Updated 2019-05-09. Refresh now. Tools for package owners.