util

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: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigMapPrefix = "yurt-static-set-"

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

	StaticPodHashAnnotation = "openyurt.io/static-pod-hash"
)

Variables

View Source
var (
	PodGVK = corev1.SchemeGroupVersion.WithKind("Pod")
)

Functions

func ComputeHash

func ComputeHash(template *corev1.PodTemplateSpec) string

ComputeHash returns a hash value calculated from pod template

func DeepHashObject

func DeepHashObject(hasher hash.Hash, objectToWrite interface{})

DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.

func GenStaticPodManifest

func GenStaticPodManifest(tmplSpec *corev1.PodTemplateSpec, hash string) (string, error)

GenStaticPodManifest generates manifest from use-specified template

func Hyphen

func Hyphen(str1, str2 string) string

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, status corev1.ConditionStatus, pod *corev1.Pod) error

SetPodUpgradeCondition set pod condition `PodNeedUpgrade` to the specified value

func UnavailableCount

func UnavailableCount(us *appsv1alpha1.YurtStaticSetUpgradeStrategy, numberToUpgrade int) (int, error)

UnavailableCount returns 0 if unavailability is not requested, the expected unavailability number to allow out of numberToUpgrade if requested, or an error if the unavailability percentage requested is invalid.

func WithConfigMapPrefix

func WithConfigMapPrefix(str string) string

WithConfigMapPrefix add prefix `yurt-static-set-` to the given string

Types

This section is empty.

Jump to

Keyboard shortcuts

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