kubernetesupgrade

package
v0.38.5 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package kubernetesupgrade allows upgrading of Kubernetes clusters.

Index

Constants

View Source
const MasterPoolName = "master"

MasterPoolName pool name

View Source
const MasterVMNamePrefix = "k8s-master-"

MasterVMNamePrefix is the prefix for all master VM names for Kubernetes clusters

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentPoolScaleSet

type AgentPoolScaleSet struct {
	Name         string
	Sku          compute.Sku
	Location     string
	IsWindows    bool
	VMsToUpgrade []AgentPoolScaleSetVM
}

AgentPoolScaleSet contains necessary data required to upgrade a VMSS

type AgentPoolScaleSetVM

type AgentPoolScaleSetVM struct {
	Name       string
	InstanceID string
}

AgentPoolScaleSetVM represents a VM in a VMSS

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

	AgentPoolScaleSetsToUpgrade []AgentPoolScaleSet

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

	IsVMSSToBeUpgraded IsVMSSToBeUpgradedCb
}

ClusterTopology contains resources of the cluster the upgrade operation is targeting

type IsVMSSToBeUpgradedCb added in v0.32.1

type IsVMSSToBeUpgradedCb func(vmss string, cs *api.ContainerService) bool

IsVMSSToBeUpgradedCb - Call back for checking whether the given vmss is to be upgraded or not.

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
}

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 added in v0.37.0

func (uc *UpgradeCluster) SetClusterAutoscalerReplicaCount(kubeClient armhelpers.KubernetesClient, 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
	// 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)

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