helper

package
v0.0.0-...-d57715f Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B   float64 = 1
	KiB         = 1024 * B
	MiB         = 1024 * KiB
	GiB         = 1024 * MiB
)

Variables

This section is empty.

Functions

func ArePodsAllReady

func ArePodsAllReady(pods []corev1.Pod) bool

func ArePodsAllScheduled

func ArePodsAllScheduled(pods []corev1.Pod) bool

func BuildPodMap

func BuildPodMap(pods []corev1.Pod, keyFunc func(pod *corev1.Pod) string) map[string]*corev1.Pod

func ContainsOnlyFinalizer

func ContainsOnlyFinalizer(obj client.Object, finalizer string) bool

func FilterPodsBy

func FilterPodsBy(pods []corev1.Pod, filter func(pod *corev1.Pod) bool) []corev1.Pod

func GB

func GB(m *resource.Quantity) float64

func GenerateResource

func GenerateResource(cpu float64, mem float64) (re map[corev1.ResourceName]resource.Quantity)

func GetContainerFromPod

func GetContainerFromPod(pod *corev1.Pod, name string) *corev1.Container

func GetContainerFromPodSpec

func GetContainerFromPodSpec(podSpec *corev1.PodSpec, name string) *corev1.Container

func GetEnvVarFromSecret

func GetEnvVarFromSecret(sctName, name, key string, opt bool) corev1.EnvVar

func IsAllPodsReady

func IsAllPodsReady(pods []corev1.Pod) bool

func IsPodDeleted

func IsPodDeleted(po *corev1.Pod) bool

func IsPodDeletedOrFailed

func IsPodDeletedOrFailed(po *corev1.Pod) bool

func IsPodFailed

func IsPodFailed(po *corev1.Pod) bool

func IsPodReady

func IsPodReady(pod *corev1.Pod) bool

func IsPodRunning

func IsPodRunning(pod *corev1.Pod) bool

func IsPodScheduled

func IsPodScheduled(po *corev1.Pod) bool

func ParseCPUWithUnit

func ParseCPUWithUnit(cpu float64, unit string) (re resource.Quantity, err error)

func ParseMemoryWithUnit

func ParseMemoryWithUnit(mem float64, unit string) (re resource.Quantity, err error)

Types

type JSON6902

type JSON6902 []interface{}

JSON6902 represents a JSON Patch according to RFC 6902; the same as k8s.io/apimachinery/pkg/types.JSONPatchType.

func NewJSONPatch

func NewJSONPatch() *JSON6902

NewJSONPatch creates a new JSON Patch according to RFC 6902; the same as k8s.io/apimachinery/pkg/types.JSONPatchType.

func (*JSON6902) Add

func (patch *JSON6902) Add(path ...string) func(value interface{}) *JSON6902

Add appends an "add" operation to patch.

> The "add" operation performs one of the following functions, > depending upon what the target location references: > > o If the target location specifies an array index, a new value is > inserted into the array at the specified index. > > o If the target location specifies an object member that does not > already exist, a new member is added to the object. > > o If the target location specifies an object member that does exist, > that member's value is replaced.

func (JSON6902) Bytes

func (patch JSON6902) Bytes() ([]byte, error)

Bytes returns the JSON representation of patch.

func (JSON6902) Data

func (patch JSON6902) Data(client.Object) ([]byte, error)

Data returns the JSON representation of patch.

func (JSON6902) IsEmpty

func (patch JSON6902) IsEmpty() bool

IsEmpty returns true when patch has no operations.

func (*JSON6902) Remove

func (patch *JSON6902) Remove(path ...string) *JSON6902

Remove appends a "remove" operation to patch.

> The "remove" operation removes the value at the target location. > > The target location MUST exist for the operation to be successful.

func (*JSON6902) Replace

func (patch *JSON6902) Replace(path ...string) func(value interface{}) *JSON6902

Replace appends a "replace" operation to patch.

> The "replace" operation replaces the value at the target location > with a new value. > > The target location MUST exist for the operation to be successful.

func (JSON6902) Type

func (patch JSON6902) Type() types.PatchType

Type returns k8s.io/apimachinery/pkg/types.JSONPatchType.

type Merge7386

type Merge7386 map[string]interface{}

Merge7386 represents a JSON Merge Patch according to RFC 7386; the same as k8s.io/apimachinery/pkg/types.MergePatchType.

func NewMergePatch

func NewMergePatch() *Merge7386

NewMergePatch creates a new JSON Merge Patch according to RFC 7386; the same as k8s.io/apimachinery/pkg/types.MergePatchType.

func (*Merge7386) Add

func (patch *Merge7386) Add(path ...string) func(value interface{}) *Merge7386

Add modifies patch to indicate that the member at path should be added or replaced with value.

> If the provided merge patch contains members that do not appear > within the target, those members are added. If the target does > contain the member, the value is replaced. Null values in the merge > patch are given special meaning to indicate the removal of existing > values in the target.

func (Merge7386) Bytes

func (patch Merge7386) Bytes() ([]byte, error)

Bytes returns the JSON representation of patch.

func (Merge7386) Data

func (patch Merge7386) Data(client.Object) ([]byte, error)

Data returns the JSON representation of patch.

func (Merge7386) IsEmpty

func (patch Merge7386) IsEmpty() bool

IsEmpty returns true when patch has no modifications.

func (*Merge7386) PatchAnnos

func (patch *Merge7386) PatchAnnos(actual, old map[string]string)

func (*Merge7386) PatchByteMap

func (patch *Merge7386) PatchByteMap(path []string, actual, old map[string][]byte)

func (*Merge7386) PatchLabels

func (patch *Merge7386) PatchLabels(actual, old map[string]string)

func (*Merge7386) PatchStringMap

func (patch *Merge7386) PatchStringMap(path []string, actual, old map[string]string)

func (*Merge7386) Remove

func (patch *Merge7386) Remove(path ...string) *Merge7386

Remove modifies patch to indicate that the member at path should be removed if it exists.

func (Merge7386) Type

func (patch Merge7386) Type() types.PatchType

Type returns k8s.io/apimachinery/pkg/types.MergePatchType.

Jump to

Keyboard shortcuts

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