util

package
v0.0.0-...-d008927 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKubeconfigFileForRestConfig

func CreateKubeconfigFileForRestConfig(restConfig *rest.Config) ([]byte, error)

func CreateSchedulerAppConfig

func CreateSchedulerAppConfig(restCfg *rest.Config) (*schedulerappconfig.Config, error)

func ExitAppWithError

func ExitAppWithError(code int, err error)

func GenerateRandomString

func GenerateRandomString(length int) (string, error)

func GetInstanceType

func GetInstanceType(labels map[string]string) string

func GetPodNames

func GetPodNames(pods []*corev1.Pod) []string

func IsSystemPod

func IsSystemPod(pod *corev1.Pod) bool

func ListNodes

func ListNodes(ctx context.Context, cl client.Client, filters ...api.NodeFilter) ([]corev1.Node, error)

func ListPods

func ListPods(ctx context.Context, cl client.Client, namespace string, filters ...api.PodFilter) ([]corev1.Pod, error)

ListPods will get all pods and apply the given filters to the pods in conjunction. If no filters are given, all pods are returned.

func NotYetScheduledPod

func NotYetScheduledPod(pod *corev1.Pod) bool

NotYetScheduledPod is a PodFilter that returns true if the pod is not yet scheduled.

func OnExit

func OnExit()

func PodSchedulingFailed

func PodSchedulingFailed(pod *corev1.Pod) bool

PodSchedulingFailed is a PodFilter that returns true if the pod scheduling has failed.

func WriteKubeConfig

func WriteKubeConfig(kubeConfigPath string, kubeConfigBytes []byte) (string, error)

Types

type Exit

type Exit struct {
	Err  error
	Code int
}

type PodBuilder

type PodBuilder struct {
	// contains filtered or unexported fields
}

func NewPodBuilder

func NewPodBuilder() *PodBuilder

func (*PodBuilder) AddLabel

func (p *PodBuilder) AddLabel(key string, value string) *PodBuilder

func (*PodBuilder) Build

func (p *PodBuilder) Build() []*corev1.Pod

func (*PodBuilder) Count

func (p *PodBuilder) Count(count int) *PodBuilder

func (*PodBuilder) Labels

func (p *PodBuilder) Labels(labels map[string]string) *PodBuilder

func (*PodBuilder) Name

func (p *PodBuilder) Name(name string) *PodBuilder

func (*PodBuilder) NominatedNodeName

func (p *PodBuilder) NominatedNodeName(nominatedNodeName string) *PodBuilder

func (*PodBuilder) SchedulerName

func (p *PodBuilder) SchedulerName(schedulerName string) *PodBuilder

func (*PodBuilder) Spec

func (p *PodBuilder) Spec(spec corev1.PodSpec) *PodBuilder

type ReferenceNodes

type ReferenceNodes []corev1.Node

func (ReferenceNodes) GetReferenceNode

func (r ReferenceNodes) GetReferenceNode(instanceType string) (*corev1.Node, error)

Jump to

Keyboard shortcuts

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