daemonpodupdater

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UpdateAnnotation is the annotation key used in daemonset spec to indicate
	// which update strategy is selected. Currently, "ota" and "auto" are supported.
	UpdateAnnotation = "apps.openyurt.io/update-strategy"

	// OTAUpdate set daemonset to over-the-air update mode.
	// In daemonPodUpdater controller, we add PodNeedUpgrade condition to pods.
	OTAUpdate = "ota"
	// AutoUpdate set daemonset to auto update mode.
	// In this mode, daemonset will keep updating even if there are not-ready nodes.
	// For more details, see https://github.com/openyurtio/openyurt/pull/921.
	AutoUpdate = "auto"

	// PodNeedUpgrade indicates whether the pod is able to upgrade.
	PodNeedUpgrade corev1.PodConditionType = "PodNeedUpgrade"

	// MaxUnavailableAnnotation is the annotation key added to daemonset to indicate
	// the max unavailable pods number. It's used with "apps.openyurt.io/update-strategy=auto".
	// If this annotation is not explicitly stated, it will be set to the default value 1.
	MaxUnavailableAnnotation = "apps.openyurt.io/max-unavailable"
	DefaultMaxUnavailable    = "10%"

	// BurstReplicas is a rate limiter for booting pods on a lot of pods.
	// The value of 250 is chosen b/c values that are too high can cause registry DoS issues.
	BurstReplicas = 250
)

Variables

This section is empty.

Functions

func CloneAndAddLabel

func CloneAndAddLabel(labels map[string]string, labelKey, labelValue string) map[string]string

CloneAndAddLabel clones the given map and returns a new map with the given key and value added. Returns the given map, if labelKey is empty.

func GetDaemonsetPods

func GetDaemonsetPods(podLister corelisters.PodLister, ds *appsv1.DaemonSet) ([]*corev1.Pod, error)

GetDaemonsetPods get all pods belong to the given daemonset

func GetPodUpgradeCondition

func GetPodUpgradeCondition(status corev1.PodStatus) *corev1.PodCondition

GetPodUpgradeCondition extracts the pod upgrade condition from the given status and returns that. Returns nil if the condition is not present.

func GetTargetNodeName

func GetTargetNodeName(pod *corev1.Pod) (string, error)

GetTargetNodeName get the target node name of DaemonSet pods. If `.spec.NodeName` is not empty (nil), return `.spec.NodeName`; otherwise, retrieve node name of pending pods from NodeAffinity. Return error if failed to retrieve node name from `.spec.NodeName` and NodeAffinity.

func GetTemplateGeneration

func GetTemplateGeneration(ds *appsv1.DaemonSet) (*int64, error)

GetTemplateGeneration get annotation "deprecated.daemonset.template.generation" of the given daemonset

func IsDaemonsetPodLatest

func IsDaemonsetPodLatest(ds *appsv1.DaemonSet, pod *corev1.Pod) bool

IsDaemonsetPodLatest check whether pod is the latest by comparing its Spec with daemonset's If pod is latest, return true, otherwise return false

func IsPodUpdatable

func IsPodUpdatable(pod *corev1.Pod) bool

IsPodUpdatable returns true if a pod is updatable; false otherwise.

func IsPodUpgradeConditionTrue

func IsPodUpgradeConditionTrue(status corev1.PodStatus) bool

IsPodUpgradeConditionTrue returns true if a pod is updatable; false otherwise.

func NodeReady

func NodeReady(nodeStatus *corev1.NodeStatus) bool

NodeReady check if the given node status is ready

func NodeReadyByName

func NodeReadyByName(nodeList corelisters.NodeLister, nodeName string) (bool, error)

NodeReadyByName check if the given node is ready

func SetPodUpgradeCondition

func SetPodUpgradeCondition(clientset client.Interface, ds *appsv1.DaemonSet, pod *corev1.Pod) error

SetPodUpgradeCondition calculate and set pod condition "PodNeedUpgrade"

Types

type Controller

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

func NewController

func NewController(kc client.Interface, daemonsetInformer appsinformers.DaemonSetInformer,
	nodeInformer coreinformers.NodeInformer, podInformer coreinformers.PodInformer) *Controller

func (*Controller) Run

func (c *Controller) Run(threadiness int, stopCh <-chan struct{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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