Help us shape the future of Go! Take the 2026 Go Developer Survey

kubernetesupgrade

package
v0.81.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package kubernetesupgrade allows upgrading of Kubernetes clusters.

Index

Constants

View Source
const MasterPoolName = "master"

MasterPoolName pool name

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentPoolTopology

type AgentPoolTopology struct {
	Identifier       *string
	Name             *string
	AgentVMs         *[]*compute.VirtualMachine
	UpgradedAgentVMs *[]*compute.VirtualMachine
}

AgentPoolTopology contains agent VMs in a single pool

type ClusterTopology

type ClusterTopology struct {
	DataModel      *api.ContainerService
	SubscriptionID string
	Location       string
	ResourceGroup  string
	NameSuffix     string

	AgentPoolsToUpgrade map[string]bool
	AgentPools          map[string]*AgentPoolTopology

	MasterVMs         *[]*compute.VirtualMachine
	UpgradedMasterVMs *[]*compute.VirtualMachine
}

ClusterTopology contains resources of the cluster the upgrade operation is targeting

type UpgradeAgentNode

type UpgradeAgentNode struct {
	Translator *i18n.Translator

	TemplateMap             map[string]interface{}
	ParametersMap           map[string]interface{}
	UpgradeContainerService *api.ContainerService
	SubscriptionID          string
	ResourceGroup           string
	Client                  armhelpers.AKSEngineClient
	// contains filtered or unexported fields
}

UpgradeAgentNode upgrades a Kubernetes 1.5 agent node to 1.6

func (*UpgradeAgentNode) CreateNode

func (kan *UpgradeAgentNode) CreateNode(ctx context.Context, poolName string, agentNo int) error

CreateNode creates a new master/agent node with the targeted version of Kubernetes

func (*UpgradeAgentNode) DeleteNode

func (kan *UpgradeAgentNode) DeleteNode(vmName *string, drain bool) error

DeleteNode takes state/resources of the master/agent node from ListNodeResources backs up/preserves state as needed by a specific version of Kubernetes and then deletes the node The 'drain' flag is used to invoke 'cordon and drain' flow.

func (*UpgradeAgentNode) Validate

func (kan *UpgradeAgentNode) Validate(vmName *string) error

Validate will verify that agent node has been upgraded as expected.

type UpgradeCluster

type UpgradeCluster struct {
	Translator *i18n.Translator
	Logger     *logrus.Entry
	ClusterTopology
	Client             armhelpers.AKSEngineClient
	StepTimeout        *time.Duration
	CordonDrainTimeout *time.Duration
	UpgradeWorkFlow    UpgradeWorkFlow
	Force              bool
	ControlPlaneOnly   bool
	CurrentVersion     string
}

UpgradeCluster upgrades a cluster with Orchestrator version X.X to version Y.Y. Right now upgrades are supported for Kubernetes cluster only.

func (*UpgradeCluster) SetClusterAutoscalerReplicaCount

func (uc *UpgradeCluster) SetClusterAutoscalerReplicaCount(kubeClient kubernetes.Client, replicaCount int32) (int32, error)

SetClusterAutoscalerReplicaCount changes the replica count of a cluster-autoscaler deployment.

func (*UpgradeCluster) UpgradeCluster

func (uc *UpgradeCluster) UpgradeCluster(az armhelpers.AKSEngineClient, kubeConfig string, aksEngineVersion string) error

UpgradeCluster runs the workflow to upgrade a Kubernetes cluster.

type UpgradeMasterNode

type UpgradeMasterNode struct {
	Translator *i18n.Translator

	TemplateMap             map[string]interface{}
	ParametersMap           map[string]interface{}
	UpgradeContainerService *api.ContainerService
	SubscriptionID          string
	ResourceGroup           string
	Client                  armhelpers.AKSEngineClient
	// contains filtered or unexported fields
}

UpgradeMasterNode upgrades a Kubernetes 1.5 master node to 1.6

func (*UpgradeMasterNode) CreateNode

func (kmn *UpgradeMasterNode) CreateNode(ctx context.Context, poolName string, masterNo int) error

CreateNode creates a new master/agent node with the targeted version of Kubernetes

func (*UpgradeMasterNode) DeleteNode

func (kmn *UpgradeMasterNode) DeleteNode(vmName *string, drain bool) error

DeleteNode takes state/resources of the master/agent node from ListNodeResources backs up/preserves state as needed by a specific version of Kubernetes and then deletes the node. The 'drain' flag is not used for deleting master nodes.

func (*UpgradeMasterNode) Validate

func (kmn *UpgradeMasterNode) Validate(vmName *string) error

Validate will verify the that master node has been upgraded as expected.

type UpgradeNode

type UpgradeNode interface {
	// DeleteNode takes state/resources of the master/agent node from ListNodeResources
	// backs up/preserves state as needed by a specific version of Kubernetes and then deletes
	// the node.
	// the second argument is a flag to invoke 'cordon and drain' flow.
	DeleteNode(*string, bool) error

	// CreateNode creates a new master/agent node with the targeted version of Kubernetes
	CreateNode(context.Context, string, int) error

	// Validate will verify the that master/agent node has been upgraded as expected.
	Validate(*string) error
}

UpgradeNode drives work flow of deleting and replacing a master or agent node to a specified target version of Kubernetes

type UpgradeWorkFlow

type UpgradeWorkFlow interface {
	// upgrade masters
	// upgrade agent nodes
	RunUpgrade() error

	Validate() error
}

UpgradeWorkFlow outlines various individual high level steps that need to be run (one or more times) in the upgrade workflow.

type Upgrader

type Upgrader struct {
	Translator *i18n.Translator

	ClusterTopology
	Client armhelpers.AKSEngineClient

	AKSEngineVersion string
	CurrentVersion   string
	ControlPlaneOnly bool
	Force            bool
	// contains filtered or unexported fields
}

Upgrader holds information on upgrading an AKS cluster

func (*Upgrader) Init

func (ku *Upgrader) Init(translator *i18n.Translator, logger *logrus.Entry, clusterTopology ClusterTopology, client armhelpers.AKSEngineClient, kubeConfig string, stepTimeout *time.Duration, cordonDrainTimeout *time.Duration, aksEngineVersion string, controlPlaneOnly bool)

Init initializes an upgrader struct

func (*Upgrader) RunUpgrade

func (ku *Upgrader) RunUpgrade() error

RunUpgrade runs the upgrade pipeline

func (*Upgrader) Validate

func (ku *Upgrader) Validate() error

Validate will run validation post upgrade

Jump to

Keyboard shortcuts

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