cluster

package
v0.0.0-...-854496c Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPreDir         = "/tmp/kubekey"
	DefaultSSHPort        = "22"
	DefaultDockerSockPath = "/var/run/docker.sock"
	DefaultLBPort         = "6443"
	DefaultLBDomain       = "lb.kubesphere.local"
	DefaultNetworkPlugin  = "calico"
	DefaultPodsCIDR       = "10.233.64.0/18"
	DefaultServiceCIDR    = "10.233.0.0/18"
	DefaultKubeImageRepo  = "kubekey"
	DefaultClusterName    = "cluster.local"
	DefaultArch           = "amd64"
	DefaultHostName       = "allinone"
	DefaultEtcdRepo       = "kubekey/etcd"
	DefaultEtcdVersion    = "v3.3.12"
	DefaultEtcdPort       = "2379"
	DefaultKubeVersion    = "v1.17.4"
	DefaultCniVersion     = "v0.8.2"
	DefaultHelmVersion    = "v3.1.2"
	ETCDRole              = "etcd"
	MasterRole            = "master"
	WorkerRole            = "worker"
)
View Source
const (
	DefaultSSHModel = "ssh"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterCfg

type ClusterCfg struct {
	Hosts           []HostCfg          `yaml:"hosts" json:"hosts,omitempty"`
	LBKubeApiserver LBKubeApiserverCfg `yaml:"lb_kubeapiserver" json:"lb_kubeapiserver,omitempty"`
	KubeVersion     string             `yaml:"kube_version" json:"kube_version,omitempty"`
	KubeImageRepo   string             `yaml:"kube_image_repo" json:"kube_image_repo,omitempty"`
	KubeClusterName string             `yaml:"kube_cluster_name" json:"kube_cluster_name,omitempty"`
	Network         NetworkConfig      `yaml:"network" json:"network,omitempty"`
}

func GetClusterCfg

func GetClusterCfg(clusterCfgFile string) *ClusterCfg

func GetYamlFile

func GetYamlFile(filePath string) (*ClusterCfg, error)

func ResolveClusterInfoFile

func ResolveClusterInfoFile(configFile string) (*ClusterCfg, error)

func (*ClusterCfg) GenerateCertSANs

func (cfg *ClusterCfg) GenerateCertSANs(clusterName string) []string

func (*ClusterCfg) GenerateExternalEtcdCfg

func (cfg *ClusterCfg) GenerateExternalEtcdCfg() ExternalEtcd

func (*ClusterCfg) GenerateHosts

func (cfg *ClusterCfg) GenerateHosts() []string

func (*ClusterCfg) GenerateKubeadmCfg

func (cfg *ClusterCfg) GenerateKubeadmCfg() *KubeadmCfg

func (*ClusterCfg) GroupHosts

func (cfg *ClusterCfg) GroupHosts() (*Hosts, *Hosts, *Hosts, *Hosts, *Hosts)

type ExternalEtcd

type ExternalEtcd struct {
	Endpoints []string
	CaFile    string
	CertFile  string
	KeyFile   string
}

type File

type File struct {
	Name string
	Pem  os.FileMode
	Tmpl *template.Template
}

type Host

type Host struct {
	Host         HostCfg
	IsEtcd       bool
	IsMaster     bool
	IsWorker     bool
	PrivilegeCmd string
	Cmd          string
	SShMode      string
	SysInfo      SysInfo
}

func (*Host) AddCmd

func (host *Host) AddCmd(cmd string)

func (*Host) CmdExec

func (host *Host) CmdExec(cmd string) error

func (*Host) CmdExecOut

func (host *Host) CmdExecOut(cmd string) (string, error)

func (*Host) NewSysInfo

func (host *Host) NewSysInfo() SysInfo

func (*Host) PullFile

func (host *Host) PullFile(src string, dst string)

func (*Host) PushFile

func (host *Host) PushFile(src string, dst string)

type HostCfg

type HostCfg struct {
	HostName        string   `yaml:"hostName,omitempty" json:"hostName,omitempty"`
	Address         string   `yaml:"address" json:"address,omitempty"`
	Port            string   `yaml:"port" json:"port,omitempty"`
	InternalAddress string   `yaml:"internal_address" json:"internalAddress,omitempty"`
	Role            []string `yaml:"role" json:"role,omitempty" norman:"type=array[enum],options=etcd|worker|worker"`
	//HostnameOverride string   `yaml:"hostname_override" json:"hostnameOverride,omitempty"`
	User     string `yaml:"user" json:"user,omitempty"`
	Password string `yaml:"password" json:"password,omitempty"`
	//SSHAgentAuth     bool              `yaml:"ssh_agent_auth,omitempty" json:"sshAgentAuth,omitempty"`
	//SSHKey           string            `yaml:"ssh_key" json:"sshKey,omitempty" norman:"type=password"`
	SSHKeyPath string `yaml:"ssh_key_path" json:"sshKeyPath,omitempty"`
}

type Hosts

type Hosts struct {
	Hosts []Host
}

func (*Hosts) GoExec

func (nodes *Hosts) GoExec(name string, level string)

func (*Hosts) GoPush

func (nodes *Hosts) GoPush(src, dst, name, level string)

type KubeadmCfg

type KubeadmCfg struct {
	ClusterName          string
	ControlPlaneEndpoint string
	PodSubnet            string
	ServiceSubnet        string
	ImageRepo            string
	Version              string
	CertSANs             []string
	ExternalEtcd         ExternalEtcd
}

type LBKubeApiserverCfg

type LBKubeApiserverCfg struct {
	Domain  string `yaml:"domain" json:"domain,omitempty"`
	Address string `yaml:"address" json:"address,omitempty"`
	Port    string `yaml:"port" json:"port,omitempty"`
}

type NetworkConfig

type NetworkConfig struct {
	Plugin          string `yaml:"plugin" json:"plugin,omitempty"`
	KubePodsCIDR    string `yaml:"kube_pods_cidr" json:"kube_pods_cidr,omitempty"`
	KubeServiceCIDR string `yaml:"kube_service_cidr" json:"kube_service_cidr,omitempty"`
}

type NodeInfo

type NodeInfo struct {
	HostName string
}

type SysInfo

type SysInfo struct {
	PM     string
	CpuNum string
	MemNum string
}

type Taint

type Taint struct {
	Key    string      `json:"key,omitempty" yaml:"key"`
	Value  string      `json:"value,omitempty" yaml:"value"`
	Effect TaintEffect `json:"effect,omitempty" yaml:"effect"`
}

type TaintEffect

type TaintEffect string
const (
	TaintEffectNoSchedule       TaintEffect = "NoSchedule"
	TaintEffectPreferNoSchedule TaintEffect = "PreferNoSchedule"
	TaintEffectNoExecute        TaintEffect = "NoExecute"
)

Directories

Path Synopsis
container-engine

Jump to

Keyboard shortcuts

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