config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: Apache-2.0 Imports: 12 Imported by: 12

Documentation

Index

Constants

View Source
const (
	OsConfigFile    = "/etc/k3os-config.yml"
	CloudConfigDir  = "/var/lib/rancher/k3os/conf/cloud-config.d"
	CloudConfigFile = "/var/lib/rancher/k3os/conf/cloud-config.yml"
	K3OSPasswordKey = "k3os.password"
)

Variables

View Source
var (
	OSVersion   string
	OSBuildDate string
	SSHUsers    = []string{
		"rancher",
	}
	Additional = []string{
		"EXTRA_CMDLINE",
	}
)

Functions

func Export

func Export(prefix string, full bool) (string, error)

func Get

func Get(key string) (interface{}, error)

func KeysToStrings

func KeysToStrings(item interface{}) interface{}

func LoadRawConfig

func LoadRawConfig(prefix string, full bool) (map[interface{}]interface{}, []error)

func Merge

func Merge(bytes []byte) error

func ReadConfigFile

func ReadConfigFile(file string) ([]byte, error)

func ReadConfigFiles

func ReadConfigFiles(bytes []byte, files ...string) (map[interface{}]interface{}, []error)

func Set

func Set(key string, value interface{}) error

func ValidateBytes

func ValidateBytes(bytes []byte) (*gojsonschema.Result, error)

func ValidateCfg

func ValidateCfg(rawCfg interface{}) (*gojsonschema.Result, error)

Types

type CloudConfig

type CloudConfig struct {
	Hostname   string     `yaml:"hostname,omitempty"`
	K3S        K3SConfig  `yaml:"k3s,omitempty"`
	K3OS       K3OSConfig `yaml:"k3os,omitempty"`
	Runcmd     []Command  `yaml:"runcmd,omitempty"`
	WriteFiles []File     `yaml:"write_files,omitempty"`
}

func LoadConfig

func LoadConfig(prefix string, terminate bool) *CloudConfig

type Command

type Command struct {
	String  string
	Strings []string
}

func (*Command) UnmarshalYAML

func (c *Command) UnmarshalYAML(unmarshal func(interface{}) error) error

type DNSConfig

type DNSConfig struct {
	Nameservers []string `yaml:"nameservers,flow,omitempty"`
	Searches    []string `yaml:"searches,flow,omitempty"`
}

type Defaults

type Defaults struct {
	Modules []string `yaml:"modules,omitempty"`
}

type File

type File struct {
	Content            string `yaml:"content"`
	Encoding           string `yaml:"encoding" valid:"^(base64|b64|gz|gzip|gz\\+base64|gzip\\+base64|gz\\+b64|gzip\\+b64)$"`
	Owner              string `yaml:"owner"`
	Path               string `yaml:"path"`
	RawFilePermissions string `yaml:"permissions" valid:"^0?[0-7]{3,4}$"`
}

func (*File) Permissions

func (f *File) Permissions() (os.FileMode, error)

type InterfaceConfig

type InterfaceConfig struct {
	Addresses []string `yaml:"addresses,flow,omitempty"`
	Gateway   string   `yaml:"gateway,omitempty"`
	IPV4LL    bool     `yaml:"ipv4ll,omitempty"`
	Metric    int      `yaml:"metric,omitempty"`
}

type K3OSConfig

type K3OSConfig struct {
	Defaults    Defaults          `yaml:"defaults,omitempty"`
	Environment map[string]string `yaml:"environment,omitempty"`
	Modules     []string          `yaml:"modules,omitempty"`
	Network     NetworkConfig     `yaml:"network,omitempty"`
	SSH         SSHConfig         `yaml:"ssh,omitempty"`
	Sysctl      map[string]string `yaml:"sysctl,omitempty"`
	Upgrade     UpgradeConfig     `yaml:"upgrade,omitempty"`
	Password    string            `yaml:"password,omitempty"`
}

type K3SConfig

type K3SConfig struct {
	Role      string   `yaml:"role,omitempty"`
	ExtraArgs []string `yaml:"extra_args,omitempty"`
}

type NetworkConfig

type NetworkConfig struct {
	DNS        DNSConfig                  `yaml:"dns,omitempty"`
	Interfaces map[string]InterfaceConfig `yaml:"interfaces,omitempty"`
	Proxy      ProxyConfig                `yaml:"proxy,omitempty"`
}

type ProxyConfig

type ProxyConfig struct {
	HTTPProxy  string `yaml:"http_proxy,omitempty"`
	HTTPSProxy string `yaml:"https_proxy,omitempty"`
	NoProxy    string `yaml:"no_proxy,omitempty"`
}

type SSHConfig

type SSHConfig struct {
	Address        string   `yaml:"address,omitempty"`
	AuthorizedKeys []string `yaml:"authorized_keys,omitempty"`
	Daemon         bool     `yaml:"daemon,omitempty"`
	Port           int      `yaml:"port,omitempty"`
}

type UpgradeConfig

type UpgradeConfig struct {
	URL      string `yaml:"url,omitempty"`
	Rollback string `yaml:"rollback,omitempty"`
	Policy   string `yaml:"policy,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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