actions

package
v0.0.0-...-435808f Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package actions implements kinder actions executed by the Kinder cluster manager

Index

Constants

View Source
const (
	// TokenDiscovery for kubeadm join
	TokenDiscovery = DiscoveryMode("token")

	// FileDiscoveryWithoutCredentials for kubeadm join
	FileDiscoveryWithoutCredentials = DiscoveryMode("file")

	// FileDiscoveryWithToken for kubeadm join
	FileDiscoveryWithToken = DiscoveryMode("file-with-token")

	// FileDiscoveryWithEmbeddedClientCerts for kubeadm join
	FileDiscoveryWithEmbeddedClientCerts = DiscoveryMode("file-with-embedded-client-certificates")

	// FileDiscoveryWithExternalClientCerts for kubeadm join
	FileDiscoveryWithExternalClientCerts = DiscoveryMode("file-with-external-client-certificates")
)
View Source
const (
	// CopyCertsModeNone results in no certs being copied
	CopyCertsModeNone = CopyCertsMode("none")

	// CopyCertsModeManual manually copies certs
	CopyCertsModeManual = CopyCertsMode("manual")

	// CopyCertsModeAuto copies certs using the --upload-certs / --certificate-key functionality
	CopyCertsModeAuto = CopyCertsMode("auto")
)

Variables

This section is empty.

Functions

func CluterInfo

func CluterInfo(c *status.Cluster) error

CluterInfo actions prints the summary information about the cluster: list of nodes, list of pods, pods images, etcd members

func CopyCertificates

func CopyCertificates(c *status.Cluster) error

CopyCertificates actions automate the manual copy of certificates from the bootstrap control-plane to the secondary control-plane nodes

func KnownActions

func KnownActions() []string

KnownActions returns the list of known actions

func KnownCopyCertsMode

func KnownCopyCertsMode() []string

KnownCopyCertsMode returns the list of known CopyCertsMode

func KnownDiscoveryMode

func KnownDiscoveryMode() []string

KnownDiscoveryMode returns the list of known DiscoveryMode

func KubeadmConfig

func KubeadmConfig(c *status.Cluster, kubeadmConfigVersion string, copyCertsMode CopyCertsMode, discoveryMode DiscoveryMode, featureGate string, nodes ...*status.Node) error

KubeadmConfig action writes the /kind/kubeadm.conf file on all the K8s nodes in the cluster. Please note that this action is automatically executed at create time, but it is possible to invoke it separately as well.

func KubeadmInit

func KubeadmInit(c *status.Cluster, usePhases bool, copyCertsMode CopyCertsMode, kubeadmConfigVersion, patchesDir, ignorePreflightErrors, featureGates string, wait time.Duration, vLevel int) (err error)

KubeadmInit executes the kubeadm init workflow including also post init task like installing the CNI network plugin

func KubeadmInitConfig

func KubeadmInitConfig(c *status.Cluster, kubeadmConfigVersion string, copyCertsMode CopyCertsMode, featureGate string, nodes ...*status.Node) error

KubeadmInitConfig action writes the InitConfiguration into /kind/kubeadm.conf file on all the K8s nodes in the cluster. Please note that this action is automatically executed at create time, but it is possible to invoke it separately as well.

func KubeadmJoin

func KubeadmJoin(c *status.Cluster, usePhases bool, copyCertsMode CopyCertsMode, discoveryMode DiscoveryMode, kubeadmConfigVersion, patchesDir, ignorePreflightErrors string, wait time.Duration, vLevel int) (err error)

KubeadmJoin executes the kubeadm join workflow both for control-plane nodes and worker nodes

func KubeadmJoinConfig

func KubeadmJoinConfig(c *status.Cluster, kubeadmConfigVersion string, copyCertsMode CopyCertsMode, discoveryMode DiscoveryMode, nodes ...*status.Node) error

KubeadmJoinConfig action writes the JoinConfiguration into /kind/kubeadm.conf file on all the K8s nodes in the cluster. Please note that this action is automatically executed at create time, but it is possible to invoke it separately as well.

func KubeadmReset

func KubeadmReset(c *status.Cluster, vLevel int) error

KubeadmReset executes the kubeadm reset workflow

func KubeadmUpgrade

func KubeadmUpgrade(c *status.Cluster, upgradeVersion *K8sVersion.Version, patchesDir string, featureGate string, wait time.Duration, vLevel int) (err error)

KubeadmUpgrade executes the kubeadm upgrade workflow, including also deployment of new kubeadm/kubelet/kubectl binaries; for sake of simplicity, drain/uncordon when upgrading nodes is not executed.

The implementation assumes that the kubeadm/kubelet/kubectl binaries and all the necessary images for the new kubernetes version are available in the /kinder/upgrade/{version} folder.

func LoadBalancer

func LoadBalancer(c *status.Cluster, nodes ...*status.Node) error

LoadBalancer action writes the loadbalancer configuration file on the load balancer node. Please note that this action is automatically executed at create time, but it is possible to invoke it separately as well.

func Run

func Run(c *status.Cluster, action string, options ...Option) error

Run executes one action

func SetupExternalCA

func SetupExternalCA(c *status.Cluster, vLevel int) error

SetupExternalCA setups certificates and kubeconfig files to be able to create a cluster without CA keys.

func SmokeTest

func SmokeTest(c *status.Cluster, wait time.Duration) error

SmokeTest actions execute a set of simple test checking proper functioning of deployments, services/type node port, kubectl logs & exec & DNS resolution

func ValidateCopyCertsMode

func ValidateCopyCertsMode(t CopyCertsMode) error

ValidateCopyCertsMode validates a CopyCertsMode

func ValidateDiscoveryMode

func ValidateDiscoveryMode(t DiscoveryMode) error

ValidateDiscoveryMode validates a DiscoveryMode

Types

type CopyCertsMode

type CopyCertsMode string

CopyCertsMode defines the mode used to copy certs on kubeadm join

type DiscoveryMode

type DiscoveryMode string

DiscoveryMode defines discovery mode supported by kubeadm join

type Option

type Option func(*RunOptions)

Option is configuration option supplied to actions.Run

func CopyCerts

func CopyCerts(copyCertsMode CopyCertsMode) Option

CopyCerts option instructs kubeadm init/join actions to use use different methods for copying certs when initializing the cluster and when joining control-plane nodes

func Discovery

func Discovery(discoveryMode DiscoveryMode) Option

Discovery option instructs kubeadm join to use a specific discovery mode

func FeatureGate

func FeatureGate(featureGate string) Option

FeatureGate option sets a single kubeadm feature-gate for the kubeadm commands

func IgnorePreflightErrors

func IgnorePreflightErrors(ignorePreflightErrors string) Option

IgnorePreflightErrors sets which errors to ignore during kubeadm preflight

func KubeadmConfigVersion

func KubeadmConfigVersion(kubeadmConfigVersion string) Option

KubeadmConfigVersion option sets the kubeadm config version for the kubeadm commands

func PatchesDir

func PatchesDir(patchesDir string) Option

PatchesDir option sets the patches dir for the kubeadm commands

func UpgradeVersion

func UpgradeVersion(upgradeVersion *K8sVersion.Version) Option

UpgradeVersion option instructs kubeadm actions to use wait for cluster state (nodes, pods) to converge to the desired state

func UsePhases

func UsePhases(usePhases bool) Option

UsePhases option instructs kubeadm actions to use kubeadm phases when supported

func VLevel

func VLevel(vLevel int) Option

VLevel option sets the number for the log level verbosity for the kubeadm commands

func Wait

func Wait(wait time.Duration) Option

Wait option instructs actions to use wait for cluster state (nodes, pods) to converge to the desired state

type RunOptions

type RunOptions struct {
	// contains filtered or unexported fields
}

RunOptions holds options supplied to actions.Run

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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