kubernetes

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuditPolicyYml = "audit-policy.yml"
	KubeadmFileYml = "/etc/kubernetes/kubeadm.yaml"
	AdminConf      = "admin.conf"
	ControllerConf = "controller-manager.conf"
	SchedulerConf  = "scheduler.conf"
	KubeletConf    = "kubelet.conf"

	// kube file
	KUBECONTROLLERCONFIGFILE = "/etc/kubernetes/controller-manager.conf"
	KUBESCHEDULERCONFIGFILE  = "/etc/kubernetes/scheduler.conf"
	AdminKubeConfPath        = "/etc/kubernetes/admin.conf"
	LvscarePodFileName       = "kube-lvscare.yaml"
)
View Source
const (
	GetCustomizeCRISocket         = "cat /etc/sealerio/cri/socket-path"
	RemoteCleanCustomizeCRISocket = "rm -f /etc/sealerio/cri/socket-path"
	RemoteAddEtcHosts             = "cat /etc/hosts |grep '%s' || echo '%s' >> /etc/hosts"
	RemoteReplaceKubeConfig       = `` /* 128-byte string literal not displayed */
	RemoveKubeConfig              = "rm -rf /usr/bin/kube* && rm -rf ~/.kube/"
	RemoteCleanK8sOnHost          = `` /* 529-byte string literal not displayed */

	RemoteRemoveAPIServerEtcHost = "echo \"$(sed \"/%s/d\" /etc/hosts)\" > /etc/hosts"
	KubeDeleteNode               = "kubectl delete node %s"

	RemoteCheckRoute = "seautil route check --host %s"
	RemoteAddRoute   = "seautil route add --host %s --gateway %s"
	RemoteDelRoute   = "if command -v seautil > /dev/null 2>&1; then seautil route del --host %s --gateway %s; fi"
)

Variables

View Source
var MasterStaticFiles = []*StaticFile{
	{
		DestinationDir: "/etc/kubernetes",
		Name:           AuditPolicyYml,
	},
}

MasterStaticFiles Put static files here, can be moved to all master nodes before kubeadm execution

Functions

func GetClientFromConfig

func GetClientFromConfig(adminConfPath string) (runtimeClient.Client, error)

func NewKubeDriver

func NewKubeDriver(kubeConfig string) (runtime.Driver, error)

func NewKubeadmRuntime

func NewKubeadmRuntime(clusterFileKubeConfig kubeadm.KubeadmConfig, infra infradriver.InfraDriver, containerRuntimeInfo containerruntime.Info, registryInfo registry.Info) (runtime.Installer, error)

Types

type CommandType

type CommandType string
const InitMaster CommandType = "initMaster"
const JoinMaster CommandType = "joinMaster"
const JoinNode CommandType = "joinNode"

type Config

type Config struct {
	Vlog         int
	VIP          string
	RegistryInfo registry.Info

	KubeadmConfigFromClusterFile kubeadm.KubeadmConfig
	APIServerDomain              string
	// contains filtered or unexported fields
}

type Runtime

type Runtime struct {
	Config *Config
	// contains filtered or unexported fields
}

Runtime struct is the runtime interface for kubernetes

func (*Runtime) Command

func (k *Runtime) Command(name CommandType, nodeNameOverride string) (string, error)

func (*Runtime) GetCurrentRuntimeDriver

func (k *Runtime) GetCurrentRuntimeDriver() (runtime.Driver, error)

func (*Runtime) Install

func (k *Runtime) Install() error

func (*Runtime) Reset

func (k *Runtime) Reset() error

func (*Runtime) ScaleDown

func (k *Runtime) ScaleDown(mastersToDelete, workersToDelete []net.IP) error

func (*Runtime) ScaleUp

func (k *Runtime) ScaleUp(newMasters, newWorkers []net.IP) error

func (*Runtime) Upgrade

func (k *Runtime) Upgrade() error

type StaticFile

type StaticFile struct {
	DestinationDir string
	Name           string
}

StaticFile :static file should not be template, will never be changed while initialization.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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