common

package
v3.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 22 Imported by: 52

Documentation

Index

Constants

View Source
const (
	K3s        = "k3s"
	K8e        = "k8e"
	Kubernetes = "kubernetes"

	LocalHost = "localhost"

	AllInOne = "allInOne"
	File     = "file"
	Operator = "operator"

	Master        = "master"
	Worker        = "worker"
	ETCD          = "etcd"
	K8s           = "k8s"
	Registry      = "registry"
	KubeKey       = "kubekey"
	Harbor        = "harbor"
	DockerCompose = "compose"

	KubeBinaries = "KubeBinaries"

	TmpDir                       = "/tmp/kubekey"
	BinDir                       = "/usr/local/bin"
	KubeConfigDir                = "/etc/kubernetes"
	KubeAddonsDir                = "/etc/kubernetes/addons"
	KubeCertDir                  = "/etc/kubernetes/pki"
	KubeManifestDir              = "/etc/kubernetes/manifests"
	KubeScriptDir                = "/usr/local/bin/kube-scripts"
	KubeletFlexvolumesPluginsDir = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec"

	ETCDCertDir     = "/etc/ssl/etcd/ssl"
	RegistryCertDir = "/etc/ssl/registry/ssl"

	HaproxyDir = "/etc/kubekey/haproxy"

	IPv4Regexp = "[\\d]+\\.[\\d]+\\.[\\d]+\\.[\\d]+"
	IPv6Regexp = "[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){0,7}::[a-f0-9]{0,4}(:[a-f0-9]{1,4}){0,7}"

	Calico    = "calico"
	Flannel   = "flannel"
	Cilium    = "cilium"
	Kubeovn   = "kubeovn"
	Hybridnet = "hybridnet"

	Docker     = "docker"
	CriDockerd = "cri-dockerd"
	Crictl     = "crictl"
	Containerd = "containerd"
	Crio       = "crio"
	Isula      = "isula"
	Runc       = "runc"

	// global cache key
	// PreCheckModule
	NodePreCheck           = "nodePreCheck"
	K8sVersion             = "k8sVersion"        // current k8s version
	MaxK8sVersion          = "maxK8sVersion"     // max k8s version of nodes
	KubeSphereVersion      = "kubeSphereVersion" // current KubeSphere version
	ClusterNodeStatus      = "clusterNodeStatus"
	ClusterNodeCRIRuntimes = "ClusterNodeCRIRuntimes"
	ClusterFeatureGates    = "ClusterFeatureGates"
	DesiredK8sVersion      = "desiredK8sVersion"
	PlanK8sVersion         = "planK8sVersion"
	NodeK8sVersion         = "NodeK8sVersion"

	// ETCDModule
	ETCDCluster = "etcdCluster"
	ETCDName    = "etcdName"
	ETCDExist   = "etcdExist"

	// KubernetesModule
	ClusterStatus = "clusterStatus"
	ClusterExist  = "clusterExist"

	// CertsModule
	Certificate   = "certificate"
	CaCertificate = "caCertificate"

	// Artifact pipeline
	Artifact = "artifact"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument

type Argument struct {
	NodeName            string
	FilePath            string
	KubernetesVersion   string
	KsEnable            bool
	KsVersion           string
	Debug               bool
	IgnoreErr           bool
	SkipPullImages      bool
	SkipPushImages      bool
	SkipDependencyCheck bool
	SecurityEnhancement bool
	DeployLocalStorage  *bool
	DownloadCommand     func(path, url string) string
	SkipConfirmCheck    bool
	ContainerManager    string
	FromCluster         bool
	KubeConfig          string
	Artifact            string
	InstallPackages     bool
	ImagesDir           string
	Namespace           string
	DeleteCRI           bool
	Role                string
	Type                string
}

type ArtifactAction

type ArtifactAction struct {
	action.BaseAction
	Manifest *ArtifactManifest
}

func (*ArtifactAction) AutoAssert

func (a *ArtifactAction) AutoAssert(runtime connector.Runtime)

type ArtifactArgument

type ArtifactArgument struct {
	ManifestFile    string
	Output          string
	CriSocket       string
	Debug           bool
	IgnoreErr       bool
	DownloadCommand func(path, url string) string
}

type ArtifactManifest

type ArtifactManifest struct {
	Spec *kubekeyv1alpha2.ManifestSpec
	Arg  ArtifactArgument
}

type ArtifactModule

type ArtifactModule struct {
	module.BaseTaskModule
	Manifest *ArtifactManifest
}

func (*ArtifactModule) AutoAssert

func (a *ArtifactModule) AutoAssert()

func (*ArtifactModule) IsSkip

func (a *ArtifactModule) IsSkip() bool

type ArtifactPrepare

type ArtifactPrepare struct {
	prepare.BasePrepare
	Manifest *ArtifactManifest
}

func (*ArtifactPrepare) AutoAssert

func (a *ArtifactPrepare) AutoAssert(runtime connector.Runtime)

type ArtifactRuntime

type ArtifactRuntime struct {
	LocalRuntime
	Spec *kubekeyv1alpha2.ManifestSpec
	Arg  ArtifactArgument
}

func NewArtifactRuntime

func NewArtifactRuntime(arg ArtifactArgument) (*ArtifactRuntime, error)

func (*ArtifactRuntime) Copy

func (a *ArtifactRuntime) Copy() connector.Runtime

Copy is used to create a copy for Runtime.

type AtLeastV124 added in v3.1.0

type AtLeastV124 struct {
	KubePrepare
}

func (*AtLeastV124) PreCheck added in v3.1.0

func (a *AtLeastV124) PreCheck(_ connector.Runtime) (bool, error)

type ConfigMapLoader

type ConfigMapLoader struct {
}

func (ConfigMapLoader) Load

type DefaultLoader

type DefaultLoader struct {
	KubernetesVersion string
	KubeSphereVersion string
	KubeSphereEnable  bool
	// contains filtered or unexported fields
}

func NewDefaultLoader

func NewDefaultLoader(arg Argument) *DefaultLoader

func (*DefaultLoader) Load

type EnableAudit added in v3.0.8

type EnableAudit struct {
	KubePrepare
}

func (*EnableAudit) PreCheck added in v3.0.8

func (e *EnableAudit) PreCheck(_ connector.Runtime) (bool, error)

type EnableKubeProxy

type EnableKubeProxy struct {
	KubePrepare
}

func (*EnableKubeProxy) PreCheck

func (e *EnableKubeProxy) PreCheck(_ connector.Runtime) (bool, error)

type FileLoader

type FileLoader struct {
	FilePath          string
	KubernetesVersion string
	KubeSphereVersion string
	KubeSphereEnable  bool
	// contains filtered or unexported fields
}

func NewFileLoader

func NewFileLoader(arg Argument) *FileLoader

func (FileLoader) Load

type IsMaster

type IsMaster struct {
	KubePrepare
}

func (*IsMaster) PreCheck

func (i *IsMaster) PreCheck(runtime connector.Runtime) (bool, error)

type IsWorker

type IsWorker struct {
	KubePrepare
	Not bool
}

func (*IsWorker) PreCheck

func (i *IsWorker) PreCheck(runtime connector.Runtime) (bool, error)

type KubeAction

type KubeAction struct {
	action.BaseAction
	KubeConf *KubeConf
}

func (*KubeAction) AutoAssert

func (k *KubeAction) AutoAssert(runtime connector.Runtime)

type KubeConf

type KubeConf struct {
	ClusterHosts []string
	ClusterName  string
	Cluster      *kubekeyapiv1alpha2.ClusterSpec
	Kubeconfig   string
	Arg          Argument
}

type KubeCustomModule

type KubeCustomModule struct {
	module.CustomModule
	KubeConf *KubeConf
}

func (*KubeCustomModule) AutoAssert

func (k *KubeCustomModule) AutoAssert()

type KubeModule

type KubeModule struct {
	module.BaseTaskModule
	KubeConf *KubeConf
}

func (*KubeModule) AutoAssert

func (k *KubeModule) AutoAssert()

func (*KubeModule) IsSkip

func (k *KubeModule) IsSkip() bool

type KubePrepare

type KubePrepare struct {
	prepare.BasePrepare
	KubeConf *KubeConf
}

func (*KubePrepare) AutoAssert

func (k *KubePrepare) AutoAssert(runtime connector.Runtime)

type KubeRollback

type KubeRollback struct {
	rollback.BaseRollback
	KubeConf *KubeConf
}

func (*KubeRollback) AutoAssert

func (k *KubeRollback) AutoAssert(runtime connector.Runtime)

type KubeRuntime

type KubeRuntime struct {
	connector.BaseRuntime
	ClusterName string
	Cluster     *kubekeyapiv1alpha2.ClusterSpec
	Kubeconfig  string
	Arg         Argument
}

func NewKubeRuntime

func NewKubeRuntime(flag string, arg Argument) (*KubeRuntime, error)

func (*KubeRuntime) Copy

func (k *KubeRuntime) Copy() connector.Runtime

Copy is used to create a copy for Runtime.

type Loader

type Loader interface {
	Load() (*kubekeyapiv1alpha2.Cluster, error)
}

func NewLoader

func NewLoader(flag string, arg Argument) Loader

type LocalRuntime

type LocalRuntime struct {
	connector.BaseRuntime
}

func NewLocalRuntime

func NewLocalRuntime(debug, ingoreErr bool) (LocalRuntime, error)

type OnlyETCD

type OnlyETCD struct {
	KubePrepare
	Not bool
}

func (*OnlyETCD) PreCheck

func (o *OnlyETCD) PreCheck(runtime connector.Runtime) (bool, error)

type OnlyFirstMaster

type OnlyFirstMaster struct {
	KubePrepare
	Not bool
}

func (*OnlyFirstMaster) PreCheck

func (o *OnlyFirstMaster) PreCheck(runtime connector.Runtime) (bool, error)

type OnlyK3s

type OnlyK3s struct {
	KubePrepare
}

func (*OnlyK3s) PreCheck

func (o *OnlyK3s) PreCheck(_ connector.Runtime) (bool, error)

type OnlyKubernetes

type OnlyKubernetes struct {
	KubePrepare
}

func (*OnlyKubernetes) PreCheck

func (o *OnlyKubernetes) PreCheck(_ connector.Runtime) (bool, error)

type OnlyWorker

type OnlyWorker struct {
	KubePrepare
}

func (*OnlyWorker) PreCheck

func (o *OnlyWorker) PreCheck(runtime connector.Runtime) (bool, error)

type Options

type Options map[string]interface{}

Jump to

Keyboard shortcuts

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