services

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 37 Imported by: 362

Documentation

Index

Constants

View Source
const (
	EtcdSnapshotPath         = "/opt/rke/etcd-snapshots/"
	EtcdRestorePath          = "/opt/rke/etcd-snapshots-restore/"
	EtcdDataDir              = "/var/lib/rancher/etcd/"
	EtcdInitWaitTime         = 10
	EtcdSnapshotWaitTime     = 5
	EtcdRequestWaitTimeout   = 10
	EtcdPermFixContainerName = "etcd-fix-perm"
)
View Source
const (
	HealthzAddress   = "localhost"
	HealthzEndpoint  = "/healthz"
	HTTPProtoPrefix  = "http://"
	HTTPSProtoPrefix = "https://"
)
View Source
const (
	NginxProxyImage   = "rancher/rke-nginx-proxy:0.1.0"
	NginxProxyEnvName = "CP_HOSTS"
)
View Source
const (
	ETCDRole    = "etcd"
	ControlRole = "controlplane"
	WorkerRole  = "worker"

	SidekickServiceName   = "sidekick"
	RBACAuthorizationMode = "rbac"

	KubeAPIContainerName                        = "kube-apiserver"
	KubeletContainerName                        = "kubelet"
	KubeproxyContainerName                      = "kube-proxy"
	KubeControllerContainerName                 = "kube-controller-manager"
	SchedulerContainerName                      = "kube-scheduler"
	EtcdContainerName                           = "etcd"
	EtcdSnapshotContainerName                   = "etcd-rolling-snapshots"
	EtcdSnapshotOnceContainerName               = "etcd-snapshot-once"
	EtcdSnapshotRemoveContainerName             = "etcd-remove-snapshot"
	EtcdRestoreContainerName                    = "etcd-restore"
	EtcdDownloadBackupContainerName             = "etcd-download-backup"
	EtcdServeBackupContainerName                = "etcd-Serve-backup"
	EtcdChecksumContainerName                   = "etcd-checksum-checker"
	EtcdStateFileContainerName                  = "etcd-extract-statefile"
	ControlPlaneConfigMapStateFileContainerName = "extract-statefile-configmap"
	NginxProxyContainerName                     = "nginx-proxy"
	SidekickContainerName                       = "service-sidekick"
	LogLinkContainerName                        = "rke-log-linker"
	LogCleanerContainerName                     = "rke-log-cleaner"

	KubeAPIPort               = 6443
	SchedulerPortMaxV122      = 10251
	SchedulerPort             = 10259
	KubeControllerPortMaxV121 = 10252
	KubeControllerPort        = 10257
	KubeletPort               = 10248
	KubeproxyPort             = 10256

	WorkerThreads = util.WorkerThreads

	ContainerNameLabel = "io.rancher.rke.container.name"
	MCSLabel           = "label=level:s0:c1000,c1001"
	SELinuxLabel       = "label=type:rke_container_t"
)

Variables

This section is empty.

Functions

func AddEtcdMember

func AddEtcdMember(ctx context.Context, toAddEtcdHost *hosts.Host, etcdHosts []*hosts.Host, localConnDialerFactory hosts.DialerFactory,
	k8sVersion string, cert, key []byte) error

func CalculateMaxUnavailable added in v1.0.7

func CalculateMaxUnavailable(maxUnavailableVal string, numHosts int, role string) (int, error)

func CheckNodeReady added in v1.0.7

func CheckNodeReady(kubeClient *kubernetes.Clientset, runHost *hosts.Host, component, cloudProviderName string) error

func DownloadEtcdSnapshotFromBackupServer added in v0.2.0

func DownloadEtcdSnapshotFromBackupServer(ctx context.Context, etcdHost *hosts.Host, prsMap map[string]v3.PrivateRegistry, etcdSnapshotImage, name string, backupServer *hosts.Host, k8sVersion string) error

func DownloadEtcdSnapshotFromS3 added in v0.2.0

func DownloadEtcdSnapshotFromS3(ctx context.Context, etcdHost *hosts.Host, prsMap map[string]v3.PrivateRegistry, etcdSnapshotImage string, name string, es v3.ETCDService, k8sVersion string) error

func GetEtcdConnString

func GetEtcdConnString(hosts []*hosts.Host, hostAddress string) string

func GetEtcdInitialCluster added in v0.1.2

func GetEtcdInitialCluster(hosts []*hosts.Host) string

func GetEtcdSnapshotChecksum added in v0.2.0

func GetEtcdSnapshotChecksum(ctx context.Context, etcdHost *hosts.Host, prsMap map[string]v3.PrivateRegistry, alpineImage, snapshotName, k8sVersion string) (string, error)

func GetHealthCheckURL added in v0.1.2

func GetHealthCheckURL(useTLS bool, port int) string

func GetProcessConfig added in v0.1.2

func GetProcessConfig(process v3.Process, host *hosts.Host, k8sVersion string) (*container.Config, *container.HostConfig, string)

func IsEtcdMember added in v0.1.2

func IsEtcdMember(ctx context.Context, etcdHost *hosts.Host, etcdHosts []*hosts.Host, localConnDialerFactory hosts.DialerFactory,
	k8sVersion string, cert, key []byte) (bool, error)

func ReloadEtcdCluster

func ReloadEtcdCluster(ctx context.Context, readyEtcdHosts []*hosts.Host, newHost *hosts.Host, localConnDialerFactory hosts.DialerFactory, cert, key []byte, prsMap map[string]v3.PrivateRegistry, etcdNodePlanMap map[string]v3.RKEConfigNodePlan, alpineImage, k8sVersion string) error

func RemoveControlPlane

func RemoveControlPlane(ctx context.Context, controlHosts []*hosts.Host, force bool) error

func RemoveEtcdMember

func RemoveEtcdMember(ctx context.Context, toDeleteEtcdHost *hosts.Host, etcdHosts []*hosts.Host, localConnDialerFactory hosts.DialerFactory,
	k8sVersion string, cert, key []byte, etcdNodePlanMap map[string]v3.RKEConfigNodePlan) error

func RemoveEtcdPlane

func RemoveEtcdPlane(ctx context.Context, etcdHosts []*hosts.Host, force bool) error

func RemoveWorkerPlane

func RemoveWorkerPlane(ctx context.Context, workerHosts []*hosts.Host, force bool) error

func ResetMaxUnavailable added in v1.0.7

func ResetMaxUnavailable(maxUnavailable, lenInactiveHosts int, component string) (int, error)

func RestartControlPlane added in v0.1.18

func RestartControlPlane(ctx context.Context, controlHosts []*hosts.Host) error

func RestartEtcdPlane added in v0.2.0

func RestartEtcdPlane(ctx context.Context, etcdHosts []*hosts.Host) error

func RestartKubeAPI added in v0.1.18

func RestartKubeAPI(ctx context.Context, host *hosts.Host) error

func RestartKubeAPIWithHealthcheck added in v1.0.0

func RestartKubeAPIWithHealthcheck(ctx context.Context, hostList []*hosts.Host, df hosts.DialerFactory, certMap map[string]pki.CertificatePKI) error

func RestartKubeController added in v0.1.18

func RestartKubeController(ctx context.Context, host *hosts.Host) error

func RestartKubelet added in v0.1.18

func RestartKubelet(ctx context.Context, host *hosts.Host) error

func RestartKubeproxy added in v0.1.18

func RestartKubeproxy(ctx context.Context, host *hosts.Host) error

func RestartNginxProxy added in v0.1.18

func RestartNginxProxy(ctx context.Context, host *hosts.Host) error

func RestartScheduler added in v0.1.18

func RestartScheduler(ctx context.Context, host *hosts.Host) error

func RestartWorkerPlane added in v0.1.18

func RestartWorkerPlane(ctx context.Context, workerHosts []*hosts.Host) error

func RestoreEtcdSnapshot added in v0.1.7

func RestoreEtcdSnapshot(ctx context.Context, etcdHost *hosts.Host, prsMap map[string]v3.PrivateRegistry,
	etcdRestoreImage, etcdBackupImage, snapshotName, initCluster string, es v3.ETCDService, k8sVersion string) error

func RunControlPlane

func RunControlPlane(ctx context.Context, controlHosts []*hosts.Host, localConnDialerFactory hosts.DialerFactory, prsMap map[string]v3.PrivateRegistry, cpNodePlanMap map[string]v3.RKEConfigNodePlan, updateWorkersOnly bool, alpineImage string, certMap map[string]pki.CertificatePKI, k8sVersion string) error

func RunEtcdPlane

func RunEtcdPlane(
	ctx context.Context,
	etcdHosts []*hosts.Host,
	etcdNodePlanMap map[string]v3.RKEConfigNodePlan,
	localConnDialerFactory hosts.DialerFactory,
	prsMap map[string]v3.PrivateRegistry,
	updateWorkersOnly bool,
	alpineImage string,
	es v3.ETCDService,
	certMap map[string]pki.CertificatePKI,
	k8sVersion string) error

func RunEtcdSnapshotRemove added in v0.2.3

func RunEtcdSnapshotRemove(ctx context.Context, etcdHost *hosts.Host, prsMap map[string]v3.PrivateRegistry, etcdSnapshotImage string, name string, cleanupRestore bool, es v3.ETCDService, k8sVersion string) error

func RunEtcdSnapshotSave added in v0.1.7

func RunEtcdSnapshotSave(ctx context.Context, etcdHost *hosts.Host, prsMap map[string]v3.PrivateRegistry, etcdSnapshotImage string, name string, once bool, es v3.ETCDService, k8sVersion string) error

func RunGetStateFileFromConfigMap added in v1.2.5

func RunGetStateFileFromConfigMap(ctx context.Context, controlPlaneHost *hosts.Host, prsMap map[string]v3.PrivateRegistry, dockerImage, k8sVersion string) (string, error)

func RunGetStateFileFromSnapshot added in v1.1.5

func RunGetStateFileFromSnapshot(ctx context.Context, etcdHost *hosts.Host, prsMap map[string]v3.PrivateRegistry, etcdSnapshotImage string, name string, es v3.ETCDService, k8sVersion string) (string, error)

func RunWorkerPlane

func RunWorkerPlane(ctx context.Context, allHosts []*hosts.Host, localConnDialerFactory hosts.DialerFactory, prsMap map[string]v3.PrivateRegistry, workerNodePlanMap map[string]v3.RKEConfigNodePlan, certMap map[string]pki.CertificatePKI, updateWorkersOnly bool, alpineImage, k8sVersion string) error

func StartBackupServer added in v0.2.0

func StartBackupServer(ctx context.Context, etcdHost *hosts.Host, prsMap map[string]v3.PrivateRegistry, etcdSnapshotImage, name, k8sVersion string) error

func UpgradeControlPlaneNodes added in v1.0.7

func UpgradeControlPlaneNodes(ctx context.Context, kubeClient *kubernetes.Clientset, controlHosts []*hosts.Host, localConnDialerFactory hosts.DialerFactory,
	prsMap map[string]v3.PrivateRegistry, cpNodePlanMap map[string]v3.RKEConfigNodePlan, updateWorkersOnly bool, alpineImage string, certMap map[string]pki.CertificatePKI,
	upgradeStrategy *v3.NodeUpgradeStrategy, newHosts, inactiveHosts map[string]bool, maxUnavailable int, k8sVersion, cloudProviderName string) (string, error)

func UpgradeWorkerPlaneForWorkerAndEtcdNodes added in v1.0.7

func UpgradeWorkerPlaneForWorkerAndEtcdNodes(ctx context.Context, kubeClient *kubernetes.Clientset, mixedRolesHosts []*hosts.Host, workerOnlyHosts []*hosts.Host, inactiveHosts map[string]bool, localConnDialerFactory hosts.DialerFactory, prsMap map[string]v3.PrivateRegistry, workerNodePlanMap map[string]v3.RKEConfigNodePlan, certMap map[string]pki.CertificatePKI,
	updateWorkersOnly bool, alpineImage string, upgradeStrategy *v3.NodeUpgradeStrategy,
	newHosts map[string]bool, maxUnavailable int, k8sVersion, cloudProviderName string) (string, error)

Types

type RestartFunc added in v0.2.0

type RestartFunc func(context.Context, *hosts.Host) error

Jump to

Keyboard shortcuts

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