config

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Docker       *DockerConfiguration       `ngx:"docker"`
	Containerd   *ContainerdConfiguration   `ngx:"containerd"`
	K8S          *K8SConfiguration          `ngx:"k8s"`
	ETCD         *ETCDConfiguration         `ngx:"etcd"`
	ExternalETCD *ExternalETCDConfiguration `ngx:"external_etcd"`
	Hosts        *hosts.Manager             `ngx:"-"`
	// contains filtered or unexported fields
}

func Load

func Load(filename string) (cfg *Configuration, err error)

Load 加载vik8s.conf配置,如果配置文件不存在,直接返回空配置

func (*Configuration) IsDockerCri

func (cfg *Configuration) IsDockerCri() bool

func (*Configuration) IsExternalETCD added in v0.6.0

func (cfg *Configuration) IsExternalETCD() bool

func (*Configuration) Write

func (cfg *Configuration) Write() error

type ContainerdConfiguration

type ContainerdConfiguration struct {
	Version         string   `ngx:"version"`
	DataRoot        string   `ngx:"data-root"`
	RegistryMirrors []string `ngx:"registry-mirrors"`
	StraitVersion   bool     `ngx:"strait-version"`
}

func DefaultContainerdConfiguration

func DefaultContainerdConfiguration() *ContainerdConfiguration

type DockerCertsConfiguration

type DockerCertsConfiguration struct {
	Enable bool `ngx:"enable" help:"Use TLS"`
	Custom bool `flag:"-"`

	CaCertPath       string `ngx:"ca" flag:"ca" help:"Trust certs signed only by this CA"`
	CaPrivateKeyPath string `ngx:"ca-key" flag:"-"`

	ServerCertPath string `ngx:"server" flag:"cert" help:"Path to TLS certificate file"`
	ServerKeyPath  string `ngx:"server-key" flag:"key" help:"Path to TLS key file"`

	ClientCertPath string `ngx:"cert" flag:"-"`
	ClientKeyPath  string `ngx:"key" flag:"-"`
}

type DockerConfiguration

type DockerConfiguration struct {
	Version       string   `ngx:"version" help:"docker version"`
	StraitVersion bool     `ngx:"strait-version" help:"Strict check DOCKER version if inconsistent will upgrade"`
	SkipIfExist   bool     `ngx:"skip-if-exists" help:"skip install and change anything if exists docker."`
	DataRoot      string   `ngx:"data-root" help:"docker data root"`
	Hosts         []string `ngx:"hosts" help:"Daemon socket(s) to connect to" def:"fd://"`
	DaemonJson    string   `ngx:"daemon-json" help:"docker cfg file, if set this option, other option will ignore."`

	InsecureRegistries []string `help:"it replaces the daemon insecure registries with a new set of insecure registries."`
	RegistryMirrors    []string `ngx:"registry-mirrors" help:"preferred DockerConfiguration registry mirror"`

	Storage *DockerStorageConfiguration `ngx:"storage" flag:"storage"`
	DNS     *DockerDNSConfiguration     `flag:"dns" ngx:"dns" `
	TLS     *DockerCertsConfiguration   `ngx:"tls" flag:"tls"`
}

func DefaultDockerConfiguration

func DefaultDockerConfiguration() *DockerConfiguration

type DockerDNSConfiguration

type DockerDNSConfiguration struct {
	List   []string `ngx:"list" help:"DNS server to use"`
	Opt    []string `ngx:"opt" help:"DNS options to use"`
	Search []string `ngx:"search" help:"DNS search domains to use"`
}

type DockerStorageConfiguration

type DockerStorageConfiguration struct {
	Driver string   `ngx:"driver" help:"storage driver to use"`
	Opt    []string `ngx:"opt" help:"Storage driver options"`
}

type ETCDConfiguration added in v0.6.1

type ETCDConfiguration struct {
	Token               string   `ngx:"token" flag:"token" help:"cluster token"`
	Nodes               []string `ngx:"nodes" flag:"-"`
	Version             string   `ngx:"version" help:"etcd version"`
	ServerCertExtraSans []string `` /* 159-byte string literal not displayed */

	CertsValidity time.Duration `ngx:"certs-validity" help:"Certificate validity time"`
	CertsDir      string        `ngx:"certs-dir" help:"certificates directory"`
	DataRoot      string        `ngx:"data" help:"etcd data dir"`

	Snapshot       string `ngx:"snapshot" help:"Etcd v3 snapshot (local disk) file used to initialize member"`
	RemoteSnapshot string `ngx:"remote-snapshot" help:"Etcd v3 snapshot (remote disk at first node) file used to initialize member"`

	Repo string `ngx:"repo" flag:"repo" help:"the repo url"`
}

func DefaultETCDConfiguration

func DefaultETCDConfiguration() *ETCDConfiguration

func (*ETCDConfiguration) RemoveNode added in v0.6.1

func (this *ETCDConfiguration) RemoveNode(node string) bool

type ExternalETCDConfiguration added in v0.6.1

type ExternalETCDConfiguration struct {
	Endpoints []string `ngx:"endpoints" flag:"endpoint"`
	CaFile    string   `ngx:"ca" flag:"ca"`
	Cert      string   `ngx:"cert" flag:"cert"`
	Key       string   `ngx:"key" flag:"key"`
}

func (*ExternalETCDConfiguration) Set added in v0.6.1

func (this *ExternalETCDConfiguration) Set(name, value string)

type K8SConfiguration

type K8SConfiguration struct {
	Masters       []string `ngx:"masters" flag:"-"`
	Nodes         []string `ngx:"nodes" flag:"-"`
	Version       string   `ngx:"version" help:"Specify k8s version"`
	KubeadmConfig string   `ngx:"kubeadm-config" help:"Path to a kubeadm configuration file. see kubeadm --config"`

	ApiServer              string   `` /* 142-byte string literal not displayed */
	ApiServerVIP           string   `flag:"-" ngx:"api-server-vip"`
	ApiServerCertExtraSans []string `ngx:"api-server-cert-extra-sans" help:"see kubeadm init --apiserver-cert-extra-sans"`

	Repo string `` /* 166-byte string literal not displayed */

	Interface string `ngx:"network-interface" def:"eth.*|en.*|em.*" help:"name of network interface"`
	PodCIDR   string `ngx:"pod-cidr" flag:"pod-cidr" def:"100.64.0.0/24" help:"Specify range of IP addresses for the pod network"`
	SvcCIDR   string `ngx:"svc-cidr" flag:"svc-cidr" def:"10.96.0.0/12" help:"Use alternative range of IP address for service VIPs"`

	CertsValidity time.Duration `ngx:"certs-validity" def:"876000h" help:"Certificate validity time"`
	Timezone      string        `ngx:"timezone" def:"Asia/Shanghai"`
	NTPServices   []string      `ngx:"ntp-services" flag:"ntp-services" def:"ntp1.aliyun.com,ntp2.aliyun.com,ntp3.aliyun.com" help:"time server\n"`
}

func DefaultK8SConfiguration

func DefaultK8SConfiguration() *K8SConfiguration

func (*K8SConfiguration) ExistsNode

func (cfg *K8SConfiguration) ExistsNode(ip string) (exists bool, master bool)

func (*K8SConfiguration) JoinNode

func (cfg *K8SConfiguration) JoinNode(master bool, ip string)

func (*K8SConfiguration) RemoveNode

func (cfg *K8SConfiguration) RemoveNode(ip string)

Jump to

Keyboard shortcuts

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