Documentation ¶
Index ¶
- Constants
- func AbsInt32(x int32) int32
- func AddPodCondition(status *corev1.PodStatus, condition *corev1.PodCondition) bool
- func AddPodReadinessGate(spec *corev1.PodSpec, conditionType corev1.PodConditionType) bool
- func ConvertPromLabelSetToMap(in prommodel.LabelSet) map[string]string
- func CopyMapValues(dst, src map[string]string)
- func ExponentialBackoffWithContext(ctx context.Context, backoff wait.Backoff, ...) error
- func GetPodNames(pods []*corev1.Pod) []string
- func IsCronActive(t time.Time, startCron, endCron string) (bool, time.Time, error)
- func IsMapValueChanged(oldValues, newValues map[string]string) bool
- func IsPodActive(pod *corev1.Pod) bool
- func IsPodRunning(pod *corev1.Pod) bool
- func MaxInt32(a, b int32) int32
- func MinInt32(a, b int32) int32
- func NewControllerRef(obj client.Object) *metav1.OwnerReference
- func NewCtrlPodLister(client client.Client) corev1listers.PodLister
- func ParseScaleSelector(selector string) (labels.Selector, error)
- func SetConditionInList(inputList []metav1.Condition, conditionType string, ...) []metav1.Condition
Constants ¶
const (
UserAgent = "kapacity-manager"
)
Variables ¶
This section is empty.
Functions ¶
func AddPodCondition ¶
func AddPodCondition(status *corev1.PodStatus, condition *corev1.PodCondition) bool
AddPodCondition adds a pod condition if not exists. Sets LastTransitionTime to now if not exists. Returns true if pod condition has been added.
func AddPodReadinessGate ¶
func AddPodReadinessGate(spec *corev1.PodSpec, conditionType corev1.PodConditionType) bool
AddPodReadinessGate adds the provided condition to the pod's readiness gates. Returns true if the readiness gate has been added.
func ConvertPromLabelSetToMap ¶ added in v0.2.0
func CopyMapValues ¶ added in v0.2.0
CopyMapValues copies all the values from src map to dst map, overwriting any existing one.
func ExponentialBackoffWithContext ¶ added in v0.2.0
func ExponentialBackoffWithContext(ctx context.Context, backoff wait.Backoff, condition wait.ConditionWithContextFunc) error
ExponentialBackoffWithContext works similar like wait.ExponentialBackoffWithContext but with below differences: * It does not stop when the cap of backoff is reached. * It does not return the error of ctx when done.
func GetPodNames ¶
GetPodNames generate a list of pod names from a list of pod objects.
func IsCronActive ¶
IsCronActive returns if the given time is in the range specified by the start cron and end cron as well as the next time of the end cron.
func IsMapValueChanged ¶ added in v0.2.0
IsMapValueChanged compares two maps' values key by key, if any value in oldValues map differs from the one in newValues map, it returns true, otherwise returns false.
func IsPodActive ¶
IsPodActive returns if the given pod has not terminated.
func IsPodRunning ¶
IsPodRunning returns if the given pod's phase is running and is not being deleted.
func NewControllerRef ¶ added in v0.2.0
func NewControllerRef(obj client.Object) *metav1.OwnerReference
NewControllerRef creates a controller owner reference pointing to the given owner.
func NewCtrlPodLister ¶ added in v0.2.0
func NewCtrlPodLister(client client.Client) corev1listers.PodLister
NewCtrlPodLister creates a corev1listers.PodLister wrapper for given controller-runtime client.
func ParseScaleSelector ¶
ParseScaleSelector parses the selector string got from Kubernetes scale API to labels.Selector.
func SetConditionInList ¶
func SetConditionInList(inputList []metav1.Condition, conditionType string, status metav1.ConditionStatus, observedGeneration int64, reason, message string) []metav1.Condition
SetConditionInList sets the specific condition type on the given condition list to the specified value with the given reason and message. The condition will be added if it is not present. The new list will be returned.
Types ¶
This section is empty.