upgradeinfo

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StaticPodHashAnnotation = "openyurt.io/static-pod-hash"
)

Variables

This section is empty.

Functions

func CalculateOperateInfoFromUpgradeInfoMap

func CalculateOperateInfoFromUpgradeInfoMap(infos map[string]*UpgradeInfo) (int32, int32, bool, []*corev1.Pod)

CalculateOperateInfoFromUpgradeInfoMap calculate the number of ready static pods, upgraded nodes, the delete pods and whether all worker is finished.

func ListOutUpgradeNeededNodesAndUpgradedNodes

func ListOutUpgradeNeededNodesAndUpgradedNodes(infos map[string]*UpgradeInfo) ([]string, []string)

ListOutUpgradeNeededNodesAndUpgradedNodes gets nodes that are not running the latest static pods and running the latest static pods

func New

func New(c client.Client, instance *appsv1alpha1.YurtStaticSet, workerPodName, hash string) (map[string]*UpgradeInfo, error)

New constructs the upgrade information for nodes which have the target static pod

func ReadyUpgradeWaitingNodes

func ReadyUpgradeWaitingNodes(infos map[string]*UpgradeInfo) []string

ReadyUpgradeWaitingNodes gets those nodes that satisfied 1. node is ready 2. node needs to be upgraded 3. no latest worker pod running on the node On these nodes, new worker pods need to be created for AdvancedRollingUpdate mode

Types

type UpgradeInfo

type UpgradeInfo struct {
	// Static pod running on the node
	StaticPod *corev1.Pod

	// Upgrade worker pod running on the node
	WorkerPod *corev1.Pod

	// Indicate whether the static pod is ready
	StaticPodReady bool

	// Indicate whether the static pod on the node needs to be upgraded.
	// If true, the static pod is not up-to-date and needs to be upgraded.
	UpgradeNeeded bool

	// Indicate whether the worker pod on the node is running.
	// If true, then the upgrade operation is in progress and does not
	// need to create a new worker pod.
	WorkerPodRunning bool

	// Indicate the worker pod status
	WorkerPodStatusPhase corev1.PodPhase

	// Indicate whether the worker pod need to be delete
	WorkerPodDeleteNeeded bool

	// Indicate whether the node is ready. It's used in AdvancedRollingUpdate mode.
	NodeReady bool
}

UpgradeInfo is a structure that stores some information used by YurtStaticSet to upgrade.

Jump to

Keyboard shortcuts

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