Documentation
¶
Index ¶
- Constants
- type CCMStatus
- type Cluster
- func (c *Cluster) BrokenHosts() []string
- func (c *Cluster) CertsToExpireInLessThen90Days() bool
- func (c *Cluster) CustomEncryptionEnabled() bool
- func (c *Cluster) EncryptionEnabled() bool
- func (c *Cluster) EtcdToleranceRemain() int
- func (c *Cluster) Healthy() bool
- func (c *Cluster) IsProvisioned() bool
- func (c *Cluster) SafeToDeleteHosts() []string
- func (c *Cluster) SafeToRepair(targetVersion string) (bool, string)
- func (c *Cluster) UpgradeNeeded() (bool, error)
- type ComponentStatus
- type ContainerStatus
- type EncryptionConfiguration
- type Host
- type NodeTask
- type Option
- type RunModeEnum
- type State
- func (s *State) Clone() *State
- func (s *State) EncryptionEnabled() bool
- func (s *State) GetEncryptionProviderConfigName() string
- func (s *State) GetKMSSocketPath() (string, error)
- func (s *State) KubeadmVerboseFlag() string
- func (s *State) RunTaskOnAllNodes(task NodeTask, parallel RunModeEnum) error
- func (s *State) RunTaskOnControlPlane(task NodeTask, parallel RunModeEnum) error
- func (s *State) RunTaskOnFollowers(task NodeTask, parallel RunModeEnum) error
- func (s *State) RunTaskOnLeader(task NodeTask) error
- func (s *State) RunTaskOnNodes(nodes []kubeoneapi.HostConfig, task NodeTask, parallel RunModeEnum) error
- func (s *State) RunTaskOnStaticWorkers(task NodeTask, parallel RunModeEnum) error
- func (s *State) ShouldDisableEncryption() bool
- func (s *State) ShouldEnableCSIMigration() bool
- func (s *State) ShouldEnableEncryption() bool
- func (s *State) ShouldEnableInTreeCloudProvider() bool
- func (s *State) ShouldUnregisterInTreeCloudProvider() bool
Constants ¶
const ( SystemDStatusUnknown = 1 << iota // systemd unit unknown SystemdDStatusDead // systemd unit dead SystemDStatusRestarting // systemd unit restarting ComponentInstalled // installed (package, or direct download) SystemDStatusActive // systemd unit is activated SystemDStatusRunning // systemd unit is running KubeletInitialized // kubelet config found (means node is initialized) PodRunning // pod is running )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct { ControlPlane []Host StaticWorkers []Host ExpectedVersion *semver.Version EncryptionConfiguration *EncryptionConfiguration CCMClusterName string CCMStatus *CCMStatus Lock sync.Mutex }
func (*Cluster) BrokenHosts ¶
BrokenHosts returns a list of broken hosts that needs to be removed manually
func (*Cluster) CertsToExpireInLessThen90Days ¶ added in v1.3.0
CertsToExpireInLessThen90Days will return true if any of the control plane certificates are to be expired soon (90 days).
func (*Cluster) CustomEncryptionEnabled ¶ added in v1.3.0
func (*Cluster) EncryptionEnabled ¶ added in v1.3.0
func (*Cluster) EtcdToleranceRemain ¶
EtcdToleranceRemain returns how many non-working nodes can be removed at the same time.
func (*Cluster) IsProvisioned ¶
IsProvisioned returns is the target cluster provisioned. The cluster is consider provisioned if there is at least one initialized host
func (*Cluster) SafeToDeleteHosts ¶
func (*Cluster) UpgradeNeeded ¶
UpgradeNeeded compares actual and expected Kubernetes versions for control plane and static worker nodes
type ComponentStatus ¶
func (*ComponentStatus) Healthy ¶
func (cs *ComponentStatus) Healthy() bool
Healthy checks is a component running and not restarting
func (*ComponentStatus) IsProvisioned ¶
func (cs *ComponentStatus) IsProvisioned() bool
IsProvisioned checks is a component running, installed and active
type ContainerStatus ¶
type ContainerStatus struct {
Status uint64
}
func (*ContainerStatus) Healthy ¶
func (cs *ContainerStatus) Healthy() bool
Healthy checks is a pod running
type EncryptionConfiguration ¶ added in v1.3.0
type EncryptionConfiguration struct { Enable bool Config *apiserverconfigv1.EncryptionConfiguration Custom bool }
type Host ¶
type Host struct { Config *kubeoneapi.HostConfig ContainerRuntimeDocker ComponentStatus ContainerRuntimeContainerd ComponentStatus Kubelet ComponentStatus // Applicable only for CP nodes APIServer ContainerStatus Etcd ContainerStatus EarliestCertExpiry time.Time IsInCluster bool Kubeconfig []byte }
func (*Host) ControlPlaneHealthy ¶
ControlPlaneHealthy checks is a control-plane host part of the cluster and are CRI, Kubelet, and API server healthy
func (*Host) Initialized ¶
Initialized checks is a host provisioned and is kubelet initialized
func (*Host) IsProvisioned ¶
IsProvisioned checks are CRI and Kubelet provisioned on a host
func (*Host) RestConfig ¶
RestConfig grabs Kubeconfig from a node
func (*Host) WorkerHealthy ¶
WorkerHealthy checks is a worker host part of the cluster and are CRI and Kubelet healthy
type NodeTask ¶
type NodeTask func(ctx *State, node *kubeoneapi.HostConfig, conn executor.Interface) error
NodeTask is a task that is specifically tailored to run on a single node.
type RunModeEnum ¶
type RunModeEnum bool
const ( RunSequentially RunModeEnum = false RunParallel RunModeEnum = true )
type State ¶
type State struct { Cluster *kubeoneapi.KubeOneCluster LiveCluster *Cluster Logger logrus.FieldLogger Executor executor.Adapter Configuration *configupload.Configuration Images *images.Resolver Runner *runner.Runner Context context.Context WorkDir string JoinCommand string JoinToken string RESTConfig *rest.Config DynamicClient dynclient.Client Verbose bool BackupFile string DestroyWorkers bool RemoveBinaries bool ForceUpgrade bool ForceInstall bool UpgradeMachineDeployments bool CreateMachineDeployments bool CCMMigration bool CCMMigrationComplete bool CredentialsFilePath string ManifestFilePath string PauseImage string }
State holds together currently test flags and parsed info, along with utilities like logger
func (*State) EncryptionEnabled ¶ added in v1.3.0
func (*State) GetEncryptionProviderConfigName ¶ added in v1.3.0
func (*State) GetKMSSocketPath ¶ added in v1.3.0
func (*State) KubeadmVerboseFlag ¶
func (*State) RunTaskOnAllNodes ¶
func (s *State) RunTaskOnAllNodes(task NodeTask, parallel RunModeEnum) error
RunTaskOnAllNodes runs the given task on all hosts.
func (*State) RunTaskOnControlPlane ¶
func (s *State) RunTaskOnControlPlane(task NodeTask, parallel RunModeEnum) error
func (*State) RunTaskOnFollowers ¶
func (s *State) RunTaskOnFollowers(task NodeTask, parallel RunModeEnum) error
RunTaskOnFollowers runs the given task on the follower hosts.
func (*State) RunTaskOnLeader ¶
RunTaskOnLeader runs the given task on the leader host.
func (*State) RunTaskOnNodes ¶
func (s *State) RunTaskOnNodes(nodes []kubeoneapi.HostConfig, task NodeTask, parallel RunModeEnum) error
RunTaskOnNodes runs the given task on the given selection of hosts.
func (*State) RunTaskOnStaticWorkers ¶
func (s *State) RunTaskOnStaticWorkers(task NodeTask, parallel RunModeEnum) error
func (*State) ShouldDisableEncryption ¶ added in v1.3.0
func (*State) ShouldEnableCSIMigration ¶ added in v1.3.0
ShouldEnableCSIMigration returns if CSI migration feature gates should be enabled. This function ensures we'll keep CSI migration feature gates enabled for existing clusters if they're already enabled or if we're starting the CCM/CSI migration process
func (*State) ShouldEnableEncryption ¶ added in v1.3.0
func (*State) ShouldEnableInTreeCloudProvider ¶ added in v1.3.0
ShouldEnableInTreeCloudProvider returns if in-tree cloud provider should be enabled. This function ensures we'll keep in-tree cloud provider enabled for existing clusters if it's already enabled, or disable it if we're completing the CCM/CSI migration process
func (*State) ShouldUnregisterInTreeCloudProvider ¶ added in v1.3.0
ShouldUnregisterInTreeCloudProvider returns if the in-tree cloud provider should be unregistered. This function ensures we'll keep the in-tree cloud provider registered for existing clusters if it's already registered, or unregister it if we're completing the CCM/CSI migration process NB: We're intentionally using a dedicated function instead of reusing ShouldEnableInTreeCloudProvider because the provider should be unregistered only if we support and completed CSI migration.