config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultKubeSpawnDir      = "/var/lib/kube-spawn"
	DefaultClusterName       = "default"
	DefaultContainerRuntime  = RuntimeDocker
	DefaultKubernetesVersion = "v1.7.5"
	DefaultBaseImage         = "coreos"

	DefaultDockerRuntimeEndpoint = "" // "unix:///var/run/docker.sock"
	DefaultRktRuntimeEndpoint    = "unix:///var/run/rktlet.sock"
	DefaultCrioRuntimeEndpoint   = "unix:///var/run/crio.sock"
	DefaultRuntimeTimeout        = "15m"
	DefaultRktStage1ImagePath    = "/usr/lib/rkt/stage1-images/stage1-coreos.aci"

	CacheDir = ".cache"
)
View Source
const (
	RuntimeDocker = "docker"
	RuntimeRkt    = "rkt"
	RuntimeCrio   = "crio"
)
View Source
const (
	Filename = "kspawn.toml"
)

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

func MachineName

func MachineName(clusterName string, no int) string

func RunningMachines

func RunningMachines(cfg *ClusterConfiguration) int

TODO: this is not enough. need to always check machined or we might lose track in case of errors

func SetDefaults_BindmountConfiguration

func SetDefaults_BindmountConfiguration(cfg *ClusterConfiguration) error

func SetDefaults_CrioRuntime

func SetDefaults_CrioRuntime(cfg *ClusterConfiguration) error

func SetDefaults_DockerRuntime

func SetDefaults_DockerRuntime(cfg *ClusterConfiguration) error

func SetDefaults_Kubernetes

func SetDefaults_Kubernetes(cfg *ClusterConfiguration) error

func SetDefaults_RktRuntime

func SetDefaults_RktRuntime(cfg *ClusterConfiguration) error

func SetDefaults_RuntimeConfiguration

func SetDefaults_RuntimeConfiguration(cfg *ClusterConfiguration) error

func SetDefaults_Viper

func SetDefaults_Viper(v *viper.Viper)

func WriteConfigToFile

func WriteConfigToFile(cfg *ClusterConfiguration) error

Types

type BindmountConfiguration

type BindmountConfiguration struct {
	ReadOnly  []Pathmap `toml:"read-only" mapstructure:"read-only"`
	ReadWrite []Pathmap `toml:"read-write" mapstructure:"read-write"`
}

BindmountConfiguration contains the bind args for systemd-nspawn

type ClusterConfiguration

type ClusterConfiguration struct {
	KubeSpawnDir string `toml:"-" mapstructure:"dir"`

	Name              string `toml:"cluster-name" mapstructure:"cluster-name"`
	ContainerRuntime  string `toml:"container-runtime" mapstructure:"container-runtime"`
	KubernetesVersion string `toml:"kubernetes-version" mapstructure:"kubernetes-version"`
	Image             string `toml:"image" mapstructure:"image"`
	Nodes             int    `toml:"nodes" mapstructure:"nodes"`

	// DevCluster indicates if we should run
	// from a local kubernetes build
	DevCluster bool `toml:"dev" mapstructure:"dev"`

	RuntimeConfiguration RuntimeConfiguration `toml:"runtime-config,omitempty" mapstructure:"runtime-config"`

	// Files to be copied from host to overlay of all machines
	Copymap []Pathmap `toml:"-" mapstructure:"copymap"`

	// TODO: rename Bindmap
	Bindmount BindmountConfiguration `toml:"bindmount" comment:"syntax: <dst in container> = <src on host>" mapstructure:"bindmount"`

	// Token is the token generated on kubeadm init
	// used to join more workers to the cluster
	Token             string `toml:"token, omitempty" mapstructure:"token"`
	TokenGroupsOption string `toml:"token-groups-option, omitempty" mapstructure:"token-groups-option"`

	Machines []MachineConfiguration `toml:"machines, omitempty" mapstructure:"machines"`
}

ClusterConfiguration holds the state of a cluster with all the information needed to run kube-spawn

func LoadConfig

func LoadConfig() (*ClusterConfiguration, error)

type MachineConfiguration

type MachineConfiguration struct {
	Running   bool                   `toml:"running" comment:"autogenerated. do not edit!" mapstructure:"running"`
	Name      string                 `toml:"name" comment:"autogenerated. do not edit!" mapstructure:"name"`
	IP        string                 `toml:"ip" comment:"autogenerated. do not edit!" mapstructure:"ip"`
	Bindmount BindmountConfiguration `toml:"bindmount" comment:"syntax: <dst in container> = <src on host>" mapstructure:"bindmount"`
}

type Pathmap

type Pathmap struct {
	Src string `toml:"src" mapstructure:"src"`
	Dst string `toml:"dst" mapstructure:"dst"`
}

Pathmap represents mapping a path on one machine to a path on another machine

type RuntimeConfiguration

type RuntimeConfiguration struct {
	Endpoint              string `toml:"endpoint,omitempty" mapstructure:"endpoint"`
	Timeout               string `toml:"timeout" mapstructure:"timeout"`
	UseLegacyCgroupDriver bool   `toml:"use-legacy-cgroup-driver" mapstructure:"use-legacy-cgroup-driver"`
	CgroupPerQos          bool   `toml:"cgroup-per-qos" mapstructure:"cgroup-per-qos"`
	FailSwapOn            bool   `toml:"fail-swap-on" mapstructure:"fail-swap-on"`

	Rkt  RuntimeConfigurationRkt  `toml:"-" mapstructure:"rkt"`
	Crio RuntimeConfigurationCrio `toml:"-" mapstructure:"crio"`
}

RuntimeConfiguration holds the variables for running the cluster with a container runtime

type RuntimeConfigurationCrio

type RuntimeConfigurationCrio struct {
	CrioBin   string `toml:"crio-bin" mapstructure:"crio-bin"`
	RuncBin   string `toml:"runc-bin" mapstructure:"runc-bin"`
	ConmonBin string `toml:"conmon-bin" mapstructure:"conmon-bin"`
}

type RuntimeConfigurationRkt

type RuntimeConfigurationRkt struct {
	RktBin      string `toml:"rkt-bin" mapstructure:"rkt-bin"`
	Stage1Image string `toml:"stage1-image" mapstructure:"stage1-image"`
	RktletBin   string `toml:"rktlet-bin" mapstructure:"rktlet-bin"`
}

Jump to

Keyboard shortcuts

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