Documentation ¶
Index ¶
- Constants
- Variables
- func AppInstall(url string)
- func BuildClean(deleteNodes, deleteMasters []string)
- func BuildInit()
- func BuildJoin(joinMasters, joinNodes []string)
- func CloudInstall(c *Cluster)
- func CmdWorkSpace(node, cmd, workdir string)
- func Cmp(a, b net.IP) int
- func Config()
- func Confirm(prompt string) bool
- func DecodeIPs(ips []string) []string
- func Dump(path string, content interface{}) error
- func Exec(c *PkgConfig, config SealConfig)
- func FetchSealosAbsPath() string
- func GetConfirmResult(str string) bool
- func GetRemoteHostName(hostIP string) string
- func IpFormat(host string) string
- func Load(path string, content interface{}) error
- func NewCommands(cmds []Command) (Runner, Runner)
- 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 SliceRemoveStr(ss []string, s string) (result []string)
- func Template() []byte
- func TemplateFromTemplateContent(templateContent string) []byte
- func VersionToInt(version string) int
- type Apply
- type Check
- type Clean
- type CleanCluster
- type Cluster
- type Command
- type CommandType
- type Flags
- type Init
- type Install
- type Join
- type JoinNodeAndMaster
- type KubeadmType
- type PkgConfig
- type PreInit
- type Print
- type RunOnEveryNodes
- type RunOnMaster
- type Runner
- type SealConfig
- type SealosClean
- type SealosInstaller
- func (s *SealosInstaller) CheckValid()
- func (s *SealosInstaller) Command(version string, name CommandType) (cmd string)
- func (s *SealosInstaller) CreateKubeconfig()
- func (s *SealosInstaller) GenerateCert()
- func (s *SealosInstaller) GeneratorCerts()
- func (s *SealosInstaller) GeneratorToken()
- func (s *SealosInstaller) InstallMaster0()
- func (s *SealosInstaller) JoinMasters(masters []string)
- func (s *SealosInstaller) JoinNodes()
- func (s *SealosInstaller) KubeadmConfigInstall()
- func (s *SealosInstaller) Print(process ...string)
- func (s *SealosInstaller) PrintFinish()
- func (s *SealosInstaller) SendKubeConfigs(masters []string, isMaster0 bool)
- func (s *SealosInstaller) SendPackage()
- type Send
Constants ¶
const TemplateText = string(`apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: {{.Version}}
controlPlaneEndpoint: "{{.ApiServer}}:6443"
imageRepository: {{.Repo}}
networking:
# dnsDomain: cluster.local
podSubnet: {{.PodCIDR}}
serviceSubnet: {{.SvcCIDR}}
apiServer:
certSANs:
- 127.0.0.1
- {{.ApiServer}}
{{range .Masters -}}
- {{.}}
{{end -}}
- {{.VIP}}
extraArgs:
feature-gates: TTLAfterFinished=true
extraVolumes:
- name: localtime
hostPath: /etc/localtime
mountPath: /etc/localtime
readOnly: true
pathType: File
controllerManager:
extraArgs:
feature-gates: TTLAfterFinished=true
experimental-cluster-signing-duration: 876000h
extraVolumes:
- hostPath: /etc/localtime
mountPath: /etc/localtime
name: localtime
readOnly: true
pathType: File
scheduler:
extraArgs:
feature-gates: TTLAfterFinished=true
extraVolumes:
- hostPath: /etc/localtime
mountPath: /etc/localtime
name: localtime
readOnly: true
pathType: File
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
mode: "ipvs"
ipvs:
excludeCIDRs:
- "{{.VIP}}/32"`)
Variables ¶
var ( VersionURL string URLmap map[string]string DefaultURL = "https://sealyun.oss-cn-beijing.aliyuncs.com/37374d999dbadb788ef0461844a70151-1.16.0/kube1.16.0.tar.gz" )
VersionURL is base64 encode k8s version and offline package url
var ( JoinToken string TokenCaCertHash string CertificateKey string )
var ( MasterIPs []string NodeIPs []string //config from kubeadm.cfg DnsDomain string ApiServerCertSANs []string // SSHConfig sshutil.SSH ApiServer string //cert abs path CertPath = "/root/.sealos/pki" CertEtcdPath = "/root/.sealos/pki/etcd" VIP string PkgUrl string Version string Repo string PodCIDR string SvcCIDR string // Ipvs care.LvsCare LvscareImage ipvs.LvscareImage KubeadmFile string // network type, calico or flannel etc.. Network string // if true don't install cni plugin WithoutCNI bool //network interface name, like "eth.*|en.*" Interface string // the ipip mode of the calico IPIP bool // mtu size MTU string YesRx = regexp.MustCompile("^(?i:y(?:es)?)$") CleanForce bool CleanAll bool )
var ClusterDir = "/root/.sealos/clusters/"
var ConfigType string
Functions ¶
func CloudInstall ¶
func CloudInstall(c *Cluster)
2019.11.28 今天刚修完陪产假,在新装修的公寓中写代码,刚配的眼镜感觉带着有点不舒服,看屏幕不是很清楚
配眼镜的人也不是很专业,二宝还是个女儿,非常可爱而且非常乖,不像大宝那么吵。 一直很想写日记但是不知道往哪里写合适 既然github要把代码存两千年那为啥不写到代码里,如此这便成为我第一篇代码日记。 碳纤维地暖开了半天还是冰凉的,感觉是被忽悠了。 一写代码就精神万分,一搞管理上的杂事就效率很低,所以做技术还是要专注些。
func CmdWorkSpace ¶
func CmdWorkSpace(node, cmd, workdir string)
func Exec ¶
func Exec(c *PkgConfig, config SealConfig)
func GetRemoteHostName ¶
func NewCommands ¶
return command run on every nodes and run only on master node
func SendPackage ¶
location : url md5 dst: /root hook: cd /root && rm -rf kube && tar zxvf %s && cd /root/kube/shell && sh init.sh
func SliceRemoveStr ¶
Types ¶
type CleanCluster ¶
type Cluster ¶
type Cluster struct { cloud.Config Flags Name string Masters []cloud.VM Nodes []cloud.VM VPCID string SwitchID string SecuretyGroupID string }
Cluster is cluster metadata
var C Cluster
Global config
type Command ¶
type Command struct { Name string // LOAD START APPLY DELETE STOP REMOVE Cmd string // kubectl apply -k Type string }
Command is
type CommandType ¶
type CommandType string
const InitMaster CommandType = "initMaster"
command type
const JoinMaster CommandType = "joinMaster"
const JoinNode CommandType = "joinNode"
type Flags ¶
type Flags struct { Master int MasterType string Node int NodeType string Version string Flavor string Passwd string Zone string Interaction bool Image string }
Flags is command line paras
type JoinNodeAndMaster ¶
type KubeadmType ¶
type PkgConfig ¶
func LoadConfig ¶
LoadConfig from tar package
kube.tar
config images.tar
config content:
LOAD docker load -i images.tar START systemctl start docker DELETE docker rmi STOP systemctl top APPLY kubectl apply -f
type RunOnEveryNodes ¶
type RunOnEveryNodes struct {
Cmd []Command
}
func (*RunOnEveryNodes) Run ¶
func (r *RunOnEveryNodes) Run(config SealConfig, url, pkgName string)
type RunOnMaster ¶
type RunOnMaster struct {
Cmd []Command
}
func (*RunOnMaster) Run ¶
func (r *RunOnMaster) Run(config SealConfig, url, pkgName string)
type Runner ¶
type Runner interface {
Run(config SealConfig, url, pkgName string)
}
type SealConfig ¶
type SealConfig struct { Masters []string Nodes []string //config from kubeadm.cfg. ex. cluster.local DnsDomain string ApiServerCertSANs []string //SSHConfig User string Passwd string PrivateKey string //ApiServer ex. apiserver.cluster.local ApiServerDomian 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 }
SealConfig for ~/.sealos/config.yaml
func (*SealConfig) ShowDefaultConfig ¶
func (c *SealConfig) ShowDefaultConfig()
type SealosClean ¶
type SealosClean struct { SealosInstaller // contains filtered or unexported fields }
type SealosInstaller ¶
SealosInstaller is
func (*SealosInstaller) Command ¶
func (s *SealosInstaller) Command(version string, name CommandType) (cmd string)
func (*SealosInstaller) CreateKubeconfig ¶
func (s *SealosInstaller) CreateKubeconfig()
func (*SealosInstaller) GenerateCert ¶
func (s *SealosInstaller) GenerateCert()
func (*SealosInstaller) GeneratorCerts ¶
func (s *SealosInstaller) GeneratorCerts()
GeneratorToken is 这里主要是为了获取CertificateKey
func (*SealosInstaller) GeneratorToken ¶
func (s *SealosInstaller) GeneratorToken()
GeneratorToken is
func (*SealosInstaller) InstallMaster0 ¶
func (s *SealosInstaller) InstallMaster0()
InstallMaster0 is
func (*SealosInstaller) JoinMasters ¶
func (s *SealosInstaller) JoinMasters(masters []string)
JoinMasters is
func (*SealosInstaller) KubeadmConfigInstall ¶
func (s *SealosInstaller) KubeadmConfigInstall()
KubeadmConfigInstall is
func (*SealosInstaller) PrintFinish ¶
func (s *SealosInstaller) PrintFinish()
func (*SealosInstaller) SendKubeConfigs ¶
func (s *SealosInstaller) SendKubeConfigs(masters []string, isMaster0 bool)
SendKubeConfigs