Documentation ¶
Overview ¶
Package file defines the operations on the binaries.
Index ¶
- Constants
- Variables
- type Binary
- func (b *Binary) AppendChecksum(c checksum.Interface)
- func (b *Binary) Arch() string
- func (b *Binary) Chmod(option string) error
- func (b *Binary) CompareChecksum() error
- func (b *Binary) Copy(override bool) error
- func (b *Binary) Fetch(override bool) error
- func (b *Binary) Get(timeout time.Duration) error
- func (b *Binary) ID() string
- func (b *Binary) LocalExist() bool
- func (b *Binary) LocalPath() string
- func (b *Binary) Name() string
- func (b *Binary) RemoteExist() bool
- func (b *Binary) RemotePath() string
- func (b *Binary) SHA256() (string, error)
- func (b *Binary) SetHost(host string)
- func (b *Binary) SetPath(pathStr string)
- func (b *Binary) SetURL(urlStr string)
- func (b *Binary) SetZone(zone string)
- func (b *Binary) Type() Type
- func (b *Binary) URL() *url.URL
- func (b *Binary) Version() string
- type BinaryParams
- type CRIDockerd
- type Containerd
- type Crictl
- type Data
- type Docker
- type File
- func (s *File) Chmod(option string) error
- func (s *File) Copy(override bool) error
- func (s *File) Fetch(override bool) error
- func (s *File) LocalExist() bool
- func (s *File) LocalPath() string
- func (s *File) Name() string
- func (s *File) RemoteExist() bool
- func (s *File) RemotePath() string
- func (s *File) SetLocalPath(path string)
- func (s *File) SetRemotePath(path string)
- func (s *File) Type() Type
- type ISO
- type K3s
- type Kubeadm
- type Kubecni
- type Kubectl
- type Kubelet
- type Params
- type Runc
- type Template
- type Type
Constants ¶
const ( ZONE = "cn" DefaultDownloadHost = "https://github.com" DefaultDownloadHostGoogle = "https://storage.googleapis.com" DefaultDownloadHostQingStor = "https://kubernetes-release.pek3b.qingstor.com" )
Default
const ( BinDir = "/usr/local/bin" OptCniBinDir = "/opt/cni/bin" SystemdDir = "/etc/systemd/system" MntDir = "/mnt/kubekey" )
Common dir
const ( ContainerdName = "containerd-%s-linux-%s.tar.gz" ContainerdID = "containerd" ContainerdURLPathTmpl = "/containerd/containerd/releases/download/v%s/containerd-%s-linux-%s.tar.gz" )
Containerd info
const ( CrictlName = "crictl-%s-linux-%s.tar.gz" CrictlID = "crictl" CrictlURLPathTmpl = "/kubernetes-sigs/cri-tools/releases/download/%s/crictl-%s-linux-%s.tar.gz" CrictlURLPathTmplCN = "/cri-tools/releases/download/%s/crictl-%s-linux-%s.tar.gz" )
Crictl info
const ( DockerName = "docker-%s.tgz" DockerID = "docker" DockerURL = "https://download.docker.com" DockerURLPathTmpl = "/linux/static/stable/%s/docker-%s.tgz" DockerURLCN = "https://mirrors.aliyun.com" DockerURLPathTmplCN = "/docker-ce/linux/static/stable/%s/docker-%s.tgz" DockerDefaultVersion = "20.10.8" )
Docker info
const ( CRIDockerdName = "cri-dockerd-%s.%s.tgz" CRIDockerdID = "cri-dockerd" CRIDockerdURL = "https://github.com/Mirantis/cri-dockerd/releases/download" CRIDockerdURLPathTmpl = "/v%s/cri-dockerd-%s.%s.tgz" DefaultCRIDockerdVersion = "0.2.6" )
CRI-Dockerd Info
const ( K3sName = "k3s" K3sID = "k3s" K3sURLPathTmpl = "/k3s-io/k3s/releases/download/%s+k3s1/k3s%s" K3sURLPathTmplCN = "/k3s/releases/download/%s+k3s1/linux/%s/k3s" )
K3s info
const ( KubeadmName = "kubeadm" KubeadmID = "kubeadm" KubeadmURLPathTmpl = "/kubernetes-release/release/%s/bin/linux/%s/kubeadm" KubeadmURLPathTmplCN = "/release/%s/bin/linux/%s/kubeadm" )
Kubeadm info
const ( KubecniName = "cni-plugins-linux-%s-%s.tgz" KubecniID = "kubecni" KubecniURLPathTmpl = "/containernetworking/plugins/releases/download/%s/cni-plugins-linux-%s-%s.tgz" KubecniURLCN = "https://containernetworking.pek3b.qingstor.com" KubecniURLPathTmplCN = "/plugins/releases/download/%s/cni-plugins-linux-%s-%s.tgz" KubecniDefaultVersion = "v1.2.0" )
Kubecni info
const ( KubectlName = "kubectl" KubectlID = "kubectl" KubectlURLPathTmpl = "/kubernetes-release/release/%s/bin/linux/%s/kubectl" KubectlURLPathTmplCN = "/release/%s/bin/linux/%s/kubectl" )
Kubectl info
const ( KubeletName = "kubelet" KubeletID = "kubelet" KubeletURLPathTmpl = "/kubernetes-release/release/%s/bin/linux/%s/kubelet" KubeletURLPathTmplCN = "/release/%s/bin/linux/%s/kubelet" )
kubelet info
const ( ISOName = "%s.iso" ISOID = "iso" ISOURLPathTmpl = "/kubesphere/kubekey/releases/download/v2.2.2/%s" )
ISO info
const ( RuncName = "runc.%s" RuncID = "runc" RuncURLPathTmpl = "/opencontainers/runc/releases/download/%s/runc.%s" RuncDefaultVersion = "v1.1.1" )
runc info
Variables ¶
var ( // FileBinary represents a binary file. FileBinary = Type("fileBinary") // FileText represents a text file. FileText = Type("fileText") // FileTemplate represents a template file. FileTemplate = Type("fileTemplate") )
Functions ¶
This section is empty.
Types ¶
type Binary ¶
type Binary struct {
// contains filtered or unexported fields
}
Binary is a binary implementation of Binary interface.
func (*Binary) AppendChecksum ¶
AppendChecksum appends a checksum to the checksum list.
func (*Binary) CompareChecksum ¶
CompareChecksum compares the checksum of the binary.
func (*Binary) LocalExist ¶
LocalExist returns true if the Binary file is existed in the local path.
func (*Binary) RemoteExist ¶
RemoteExist returns true if the Binary file is existed (and the SHA256 check passes) in the remote path.
func (*Binary) RemotePath ¶
RemotePath returns the remote path of the Binary file.
type BinaryParams ¶
type BinaryParams struct { File *File ID string Version string Arch string URL *url.URL ChecksumList []checksum.Interface }
BinaryParams represents the parameters of a Binary.
type CRIDockerd ¶
type CRIDockerd struct {
*Binary
}
CRIDockerd is a Binary for cri-dockerd.
func NewCRIDockerd ¶
func NewCRIDockerd(sshClient ssh.Interface, rootFs rootfs.Interface, version, arch string) (*CRIDockerd, error)
NewCRIDockerd returns a new CRIDockerd.
func (*CRIDockerd) SetZone ¶
func (d *CRIDockerd) SetZone(zone string)
SetZone override Binary's SetZone method.
type Containerd ¶
type Containerd struct {
*Binary
}
Containerd is a Binary for containerd.
func NewContainerd ¶
func NewContainerd(sshClient ssh.Interface, rootFs rootfs.Interface, version, arch string) (*Containerd, error)
NewContainerd returns a new Containerd.
type Crictl ¶
type Crictl struct {
*Binary
}
Crictl is a Binary for crictl.
type Docker ¶
type Docker struct {
*Binary
}
Docker is a Binary for docker.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is an implementation of the File interface.
func (*File) LocalExist ¶
LocalExist returns true if the file exists in the local path.
func (*File) RemoteExist ¶
RemoteExist returns true if the file exists in the remote path.
func (*File) RemotePath ¶
RemotePath returns the remote path of the file.
func (*File) SetLocalPath ¶
SetLocalPath sets the local path of the file.
func (*File) SetRemotePath ¶
SetRemotePath sets the remote path of the file.
type ISO ¶
type ISO struct { *Binary HTTPChecksum *checksum.HTTPChecksum }
ISO is a Binary for repository ISO file.
type K3s ¶
type K3s struct {
*Binary
}
K3s is a Binary for k3s.
type Kubeadm ¶
type Kubeadm struct {
*Binary
}
Kubeadm is a Binary for kubeadm.
type Kubecni ¶
type Kubecni struct {
*Binary
}
Kubecni is a Binary for kubecni.
type Kubectl ¶
type Kubectl struct {
*Binary
}
Kubectl is a Binary for kubectl.
type Kubelet ¶
type Kubelet struct {
*Binary
}
Kubelet is a Binary for kubelet.
type Params ¶
type Params struct { SSHClient ssh.Interface Name string Type Type LocalFullPath string RemoteFullPath string RootFs rootfs.Interface }
Params represents the parameters of a file.
type Template ¶
type Template struct { *File // contains filtered or unexported fields }
Template is an implementation of the Template interface.
func NewTemplate ¶
func NewTemplate(sshClient ssh.Interface, rootFs rootfs.Interface, template *template.Template, data Data, dst string) (*Template, error)
NewTemplate returns a new Template.
func (*Template) RenderToLocal ¶
RenderToLocal renders the template to the local filesystem.