Documentation ¶
Index ¶
- Constants
- Variables
- func BuildInit()
- func BuildJoin(joinMasters, joinNodes []string)
- func CanUpgradeByNewVersion(new, old string) error
- func Cmp(a, b net.IP) int
- func CompressTar(srcDirPath string, destFilePath string) error
- func CompressZip(fileDir string, outputPath string) error
- func Confirm(prompt string) bool
- func DecodeIPs(ips []string) []string
- func DownloadFile(location string) (filePATH, md5 string)
- func Dump(path string, content interface{}) error
- func ExitDeleteCase(pkgURL string) bool
- func ExitInitCase() bool
- func ExitInstallCase(pkgURL string) bool
- func ExitUpgradeCase(version, pkgURL, cfgFile string) error
- func FetchAbsPath() string
- func FileExist(path string) bool
- func For120(version string) bool
- func GetConfirmResult(str string) bool
- func GetMajorMinorInt(version string) (major, minor int)
- func GetRemoteHostName(hostIP string) string
- func IPFormat(host string) string
- func JoinTemplate(ip string, cgroup string) []byte
- func JoinTemplateFromTemplateContent(templateContent, ip, cgroup string) []byte
- func KubeadmConfig()
- func Load(path string, content interface{}) error
- func NextIP(ip net.IP) net.IP
- func ParseIPs(ips []string) []string
- func RandString(len int) string
- func SendPackage(location string, hosts []string, dst string, before, after *string) string
- func SetHosts(hostIP, hostName string)
- func SliceRemoveStr(ss []string, s string) (result []string)
- func Template() []byte
- func TemplateFromTemplateContent(templateContent string) []byte
- func VersionToInt(version string) int
- func VersionToIntAll(version string) int
- type Apply
- type Check
- type Clean
- type CleanCluster
- type CommandType
- type Config
- type Init
- type Install
- type Installer
- func (s *Installer) CheckValid()
- func (s *Installer) Command(version string, name CommandType) (cmd string)
- func (s *Installer) CreateKubeconfig()
- func (s *Installer) GenerateCert()
- func (s *Installer) GeneratorCerts()
- func (s *Installer) GeneratorToken()
- func (s *Installer) InstallMaster0()
- func (s *Installer) JoinMasters(masters []string)
- func (s *Installer) JoinNodes()
- func (s *Installer) KubeadmConfigInstall()
- func (s *Installer) Print(process ...string)
- func (s *Installer) PrintFinish()
- func (s *Installer) Send()
- func (s *Installer) SendJoinMasterKubeConfigs(masters []string)
- func (s *Installer) SendKubeConfigs(masters []string)
- func (s *Installer) SendPackage()
- type Join
- type JoinNodeAndMaster
- type KubeadmType
- type Pool
- type PreInit
- type Print
- type Send
- type Upgrade
- func (u *Upgrade) GetHostNamesFromIps(ips []string) []string
- func (u *Upgrade) GetIPByHostname(host string) string
- func (u *Upgrade) SendPackage()
- func (u *Upgrade) SetIPtoHostName()
- func (u *Upgrade) SetUP()
- func (u *Upgrade) UpgradeMaster0()
- func (u *Upgrade) UpgradeNodes()
- func (u *Upgrade) UpgradeOtherMaster()
Constants ¶
View Source
const ( ErrorExitOSCase = -1 // 错误直接退出类型 ErrorMasterEmpty = "your master is empty." // master节点ip为空 ErrorVersionEmpty = "your kubernetes version is empty." // kubernetes 版本号为空 ErrorFileNotExist = "your package file is not exist." // 离线安装包为空 ErrorPkgURLNotExist = "Your package url is incorrect." // 离线安装包为http路径不对 // etcd backup ETCDSNAPSHOTDEFAULTNAME = "snapshot" ETCDDEFAULTBACKUPDIR = "/data/supkube/etcd-backup" ETCDDEFAULTRESTOREDIR = "/opt/supkube/etcd-restore" ETCDDATADIR = "/var/lib/etcd" TMPDIR = "/tmp" // kube file KUBECONTROLLERCONFIGFILE = "/etc/kubernetes/controller-manager.conf" KUBESCHEDULERCONFIGFILE = "/etc/kubernetes/scheduler.conf" // CriSocket DefaultDockerCRISocket = "/var/run/dockershim.sock" DefaultContainerdCRISocket = "/run/containerd/containerd.sock" DefaultCgroupDriver = "cgroupfs" DefaultSystemdCgroupDriver = "systemd" KubeadmV1beta1 = "kubeadm.k8s.io/v1beta1" KubeadmV1beta2 = "kubeadm.k8s.io/v1beta2" KubeadmV1beta3 = "kubeadm.k8s.io/v1beta3" )
View Source
const ( InitTemplateText = string(InitConfigurationDefault + ClusterConfigurationDefault + kubeproxyConfigDefault + kubeletConfigDefault) JoinCPTemplateText = string(bootstrapTokenDefault + JoinConfigurationDefault + kubeletConfigDefault) InitConfigurationDefault = `` /* 166-byte string literal not displayed */ JoinConfigurationDefault = `` /* 186-byte string literal not displayed */ ClusterConfigurationDefault = `` /* 1137-byte string literal not displayed */ ContainerdShell = `` /* 132-byte string literal not displayed */ DockerShell = `driver=$(docker info -f "{{.CgroupDriver}}") echo "${driver}"` )
Variables ¶
View Source
var ( JoinToken string TokenCaCertHash string CertificateKey string )
View Source
var ( MasterIPs []string NodeIPs []string CertSANS []string DNSDomain string APIServerCertSANs []string SSHConfig sshutil.SSH APIServer string CertPath = cert.ConfigDir + "/pki" CertEtcdPath = cert.ConfigDir + "/pki/etcd" EtcdCacart = cert.ConfigDir + "/pki/etcd/ca.crt" EtcdCert = cert.ConfigDir + "/pki/etcd/healthcheck-client.crt" EtcdKey = cert.ConfigDir + "/pki/etcd/healthcheck-client.key" CriSocket string CgroupDriver string KubeadmAPI string VIP string PkgURL string Version string Repo string PodCIDR string SvcCIDR string Envs []string // read env from -e PackageConfig string // install/delete package config Values string // values for install package values.yaml WorkDir string // workdir for install/delete package home Ipvs care.LvsCare LvscareImage ipvs.LvscareImage KubeadmFile string Network string // network type, calico or flannel etc.. WithoutCNI bool // if true don't install cni plugin Interface string //network interface name, like "eth.*|en.*" BGP bool // the ipip mode of the calico MTU string // mtu size YesRx = regexp.MustCompile("^(?i:y(?:es)?)$") CleanForce bool CleanAll bool Vlog int InDocker bool SnapshotName string EtcdBackDir string RestorePath string OssEndpoint string AccessKeyID string AccessKeySecrets string BucketName string ObjectPath string )
View Source
var ConfigType string
Functions ¶
func CanUpgradeByNewVersion ¶
func CompressTar ¶
func CompressZip ¶
CompressZip is compress all file in fileDir , and zip to outputPath like unix zip ./ -r a.zip
func DownloadFile ¶
func ExitDeleteCase ¶
func ExitInstallCase ¶
func ExitUpgradeCase ¶
func GetRemoteHostName ¶
func JoinTemplate ¶
JoinTemplate is generate JoinCP nodes configuration by master ip.
func KubeadmConfig ¶
func KubeadmConfig()
func SendPackage ¶
location : url md5 dst: /root hook: cd /root && rm -rf kube && tar zxvf %s && cd /root/kube/shell && sh init.sh
func SetHosts ¶
func SetHosts(hostIP, hostName string)
SetHosts set hosts. if can't access to hostName, set /etc/hosts
func SliceRemoveStr ¶
Types ¶
type CleanCluster ¶
type CommandType ¶
type CommandType string
const InitMaster CommandType = "initMaster"
command type
const JoinMaster CommandType = "joinMaster"
const JoinNode CommandType = "joinNode"
type Config ¶
type Config struct { Masters []string Nodes []string //config from kubeadm.cfg. ex. cluster.local DNSDomain string APIServerCertSANs []string //SSHConfig User string Passwd string PrivateKey string PkPassword string //ApiServer ex. apiserver.cluster.local APIServerDomain string Network string VIP string PkgURL string Version string Repo string PodCIDR string SvcCIDR string //certs location CertPath string CertEtcdPath string //lvscare images LvscareName string LvscareTag string }
Config for ~/.supkube/config.yaml
func (*Config) ShowDefaultConfig ¶
func (c *Config) ShowDefaultConfig()
type Installer ¶
type Installer struct { Hosts []string Masters []string Nodes []string Network string APIServer string }
Installer is
func (*Installer) Command ¶
func (s *Installer) Command(version string, name CommandType) (cmd string)
func (*Installer) CreateKubeconfig ¶
func (s *Installer) CreateKubeconfig()
func (*Installer) GenerateCert ¶
func (s *Installer) GenerateCert()
func (*Installer) GeneratorCerts ¶
func (s *Installer) GeneratorCerts()
GeneratorToken is 这里主要是为了获取CertificateKey
func (*Installer) KubeadmConfigInstall ¶
func (s *Installer) KubeadmConfigInstall()
KubeadmConfigInstall is
func (*Installer) PrintFinish ¶
func (s *Installer) PrintFinish()
func (*Installer) SendJoinMasterKubeConfigs ¶
func (*Installer) SendKubeConfigs ¶
SendKubeConfigs
type JoinNodeAndMaster ¶
type KubeadmType ¶
type Upgrade ¶
type Upgrade struct { Config NewVersion string NewPkgURL string IPtoHostName map[string]string Client *kubernetes.Clientset }
func NewUpgrade ¶
func (*Upgrade) GetHostNamesFromIps ¶
func (*Upgrade) GetIPByHostname ¶
func (*Upgrade) SendPackage ¶
func (u *Upgrade) SendPackage()
SendPackage is send new pkg to all nodes.
func (*Upgrade) SetIPtoHostName ¶
func (u *Upgrade) SetIPtoHostName()
func (*Upgrade) UpgradeMaster0 ¶
func (u *Upgrade) UpgradeMaster0()
UpgradeMaster0 is upgrade master first.
func (*Upgrade) UpgradeOtherMaster ¶
func (u *Upgrade) UpgradeOtherMaster()
UpgradeOtherMaster is upgrade other master.
Click to show internal directories.
Click to hide internal directories.