util

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Scheme is the default instance of runtime.Scheme to which types in the Kubernetes API are already registered.
	// NOTE: If you are copying this file to start a new api group, STOP! Copy the
	// extensions group instead. This Scheme is special and should appear ONLY in
	// the api group, unless you really know what you're doing.
	// TODO(lavalamp): make the above error impossible.
	Scheme = runtime.NewScheme()

	// Codecs provides access to encoding and decoding for the scheme
	Codecs = serializer.NewCodecFactory(Scheme)
)

Functions

func BuildHandlerChain

func BuildHandlerChain(handler http.Handler, authn authenticator.Request, authz authorizer.Authorizer) http.Handler

BuildHandlerChain wraps the given handler with the standard filters.

func CreateLeaderElectionConfig

func CreateLeaderElectionConfig(
	name string,
	k8sClient kubernetes.Interface,
	eventRecorder events.EventRecorder,
	LeaderElection componentconfig.LeaderElectionConfiguration) (*leaderelection.LeaderElectionConfig, error)

CreateLeaderElectionConfig creates a LeaderElectionConfig.

func GetInstanceType

func GetInstanceType(labels map[string]string) (string, bool)

func GetOperatingSystem

func GetOperatingSystem(labels map[string]string) (string, bool)

func GetRegion

func GetRegion(labels map[string]string) (string, bool)

func GetZone

func GetZone(labels map[string]string) (string, bool)

func NewBaseHandler

func NewBaseHandler(
	name string,
	debugging componentconfig.DebuggingConfiguration,
	checks ...healthz.HealthChecker) *mux.PathRecorderMux

NewBaseHandler creates healthz and metrics handlers.

func NewK8sConfig

func NewK8sConfig(c componentconfig.ClientConnectionConfiguration, maxIdleConnsPerHost int) (*rest.Config, error)

NewK8sConfig creates a cluster config of kubernetes.

func NodesResourceTotal added in v0.3.0

func NodesResourceTotal(nodes []*v1.Node, filter NodeFilterFunc, reverse bool) v1.ResourceList

func PodsRequestsAndLimitsTotal added in v0.3.0

func PodsRequestsAndLimitsTotal(pods []*v1.Pod, filter PodFilterFunc, reverse bool) (v1.ResourceList, v1.ResourceList)

func PodsSpecRequestsAndLimitsTotal added in v0.3.0

func PodsSpecRequestsAndLimitsTotal(specs []spec.CloudPodSpec) (v1.ResourceList, v1.ResourceList)

Types

type ClientCreator

type ClientCreator func(name string) kubernetes.Interface

func CreateK8sClient

func CreateK8sClient(c componentconfig.ClientConnectionConfiguration, maxIdleConnsPerHost int) (ClientCreator, error)

CreateK8sClient creates the k8s build in core client and custom client.

type EventRecorderSet

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

ClientSet is a set of k8s EventRecorder.

func NewEventRecorderSet

func NewEventRecorderSet(name string, num int, creator events.EventBroadcasterAdapter) *EventRecorderSet

NewEventRecorderSet creates a EventRecorderSet.

func (*EventRecorderSet) Eventf

func (ers *EventRecorderSet) Eventf(regarding runtime.Object, related runtime.Object, eventType, reason, action, note string, args ...interface{})

type NodeFilterFunc added in v0.3.0

type NodeFilterFunc func(node *v1.Node) bool

type PodFilterFunc added in v0.3.0

type PodFilterFunc func(pod *v1.Pod) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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