resources

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package resources contains various utilities for dealing with Kubernetes resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyMap

func CopyMap(a map[string]string) map[string]string

CopyMap makes a copy of the map.

func FilterMap

func FilterMap(in map[string]string, filter func(string) bool) map[string]string

FilterMap creates a copy of the provided map, filtering out the elements that match `filter`. nil `filter` is accepted.

func GetScaleResource added in v0.7.0

func GetScaleResource(namespace string, ref corev1.ObjectReference, psInformerFactory duck.InformerFactory) (*pav1alpha1.PodScalable, error)

GetScaleResource returns the current scale resource for the PA. TODO(markusthoemmes): We shouldn't need to pass namespace here.

func NewNotRunningPodsCounter added in v0.13.0

func NewNotRunningPodsCounter(lister corev1listers.PodLister, namespace, revisionName string) notRunningPodCounter

NewNotRunningPodsCounter creates a NotRunningPodCounter that counts pods for a namespace/serviceNam. The values returned by TerminatingCount() and PendingCount() will vary over time.

func NotReadyAddressCount added in v0.13.0

func NotReadyAddressCount(endpoints *corev1.Endpoints) int

NotReadyAddressCount returns the total number of addresses ready for the given endpoint.

func ReadyAddressCount

func ReadyAddressCount(endpoints *corev1.Endpoints) int

ReadyAddressCount returns the total number of addresses ready for the given endpoint.

func ScaleResourceArguments added in v0.7.0

func ScaleResourceArguments(ref corev1.ObjectReference) (*schema.GroupVersionResource, string, error)

ScaleResourceArguments returns GroupResource and the resource name.

func UnionMaps

func UnionMaps(a, b map[string]string) map[string]string

UnionMaps returns a map constructed from the union of `a` and `b`, where value from `b` wins.

Types

type EndpointsCounter added in v0.13.0

type EndpointsCounter interface {
	ReadyCount() (int, error)
	NotReadyCount() (int, error)
}

EndpointsCounter provides a count of currently ready and notReady pods. This information is used by UniScaler implementations to make scaling decisions. The interface prevents the UniScaler from needing to know how counts are performed. The int return value represents the number of pods that are ready to handle incoming requests. The error value is returned if the EndpointsCounter is unable to calculate a value.

func NewScopedEndpointsCounter added in v0.7.0

func NewScopedEndpointsCounter(lister corev1listers.EndpointsLister, namespace, serviceName string) EndpointsCounter

NewScopedEndpointsCounter creates a EndpointsCounter that uses a count of endpoints for a namespace/serviceName as the value of ready pods. The values returned by ReadyCount() will vary over time. lister is used to retrieve endpoints for counting with the scope of namespace/serviceName.

Jump to

Keyboard shortcuts

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