daemonpodupdater

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 34 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 "AdvancedRollingUpdate" 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"
	AdvancedRollingUpdate = "AdvancedRollingUpdate"

	// 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=AdvancedRollingUpdate".
	// 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 Add

Add creates a new Daemonpodupdater Controller and adds it to the Manager with default RBAC. The Manager will set fields on the Controller and Start it when the Manager is Started.

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 Format

func Format(format string, args ...interface{}) string

func GetDaemonsetPods

func GetDaemonsetPods(c client.Client, 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(c client.Client, nodeName string) (bool, error)

NodeReadyByName check if the given node is ready

func SetPodUpgradeCondition

func SetPodUpgradeCondition(c client.Client, ds *appsv1.DaemonSet, pod *corev1.Pod) error

SetPodUpgradeCondition calculate and set pod condition "PodNeedUpgrade"

Types

type ReconcileDaemonpodupdater

type ReconcileDaemonpodupdater struct {
	client.Client
	// contains filtered or unexported fields
}

ReconcileDaemonpodupdater reconciles a DaemonSet object

func (*ReconcileDaemonpodupdater) InjectConfig

func (r *ReconcileDaemonpodupdater) InjectConfig(cfg *rest.Config) error

func (*ReconcileDaemonpodupdater) Reconcile

Reconcile reads that state of the cluster for a DaemonSet object and makes changes based on the state read and what is in the DaemonSet.Spec

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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