Documentation ¶
Index ¶
- Constants
- Variables
- func ComputeHash(template *corev1.PodTemplateSpec) string
- func DeepHashObject(hasher hash.Hash, objectToWrite interface{})
- func GenStaticPodManifest(tmplSpec *corev1.PodTemplateSpec, hash string) (string, error)
- func GetNodeCondition(status *corev1.NodeStatus, conditionType corev1.NodeConditionType) (int, *corev1.NodeCondition)
- func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
- func GetPodConditionFromList(conditions []corev1.PodCondition, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
- func Hyphen(str1, str2 string) string
- func IsStaticPod(pod *corev1.Pod) bool
- func NodeReadyByName(c client.Client, nodeName string) (bool, error)
- func SetPodUpgradeCondition(c client.Client, status corev1.ConditionStatus, pod *corev1.Pod) error
- func UnavailableCount(us *appsv1alpha1.YurtStaticSetUpgradeStrategy, numberToUpgrade int) (int, error)
- func UpdatePodCondition(status *corev1.PodStatus, condition *corev1.PodCondition) bool
- func WithConfigMapPrefix(str string) string
Constants ¶
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 ¶
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 ¶
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 GetNodeCondition ¶
func GetNodeCondition(status *corev1.NodeStatus, conditionType corev1.NodeConditionType) (int, *corev1.NodeCondition)
GetNodeCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetPodCondition ¶
func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetPodConditionFromList ¶
func GetPodConditionFromList(conditions []corev1.PodCondition, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
GetPodConditionFromList extracts the provided condition from the given list of condition and returns the index of the condition and the condition. Returns -1 and nil if the condition is not present.
func IsStaticPod ¶
IsStaticPod judges whether a pod is static by its OwnerReference
func NodeReadyByName ¶
NodeReadyByName check if the given node is ready
func SetPodUpgradeCondition ¶
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 UpdatePodCondition ¶
func UpdatePodCondition(status *corev1.PodStatus, condition *corev1.PodCondition) bool
UpdatePodCondition updates existing pod condition or creates a new one. Sets LastTransitionTime to now if the status has changed. Returns true if pod condition has changed or has been added.
func WithConfigMapPrefix ¶
WithConfigMapPrefix add prefix `yurt-static-set-` to the given string
Types ¶
This section is empty.