Documentation ¶
Overview ¶
Package resources contains various utilities for dealing with Kubernetes resources.
Package resources contains various utilities for dealing with Kubernetes resources.
Index ¶
- func CopyMap(a map[string]string) map[string]string
- func FilterMap(in map[string]string, filter func(string) bool) map[string]string
- func GetScaleResource(namespace string, ref corev1.ObjectReference, ...) (*pav1alpha1.PodScalable, error)
- func NewPodScalableInformerFactory(ctx context.Context) duck.InformerFactory
- func ParentResourceFromService(name string) string
- func ReadyAddressCount(endpoints *corev1.Endpoints) int
- func ScaleResourceArguments(ref corev1.ObjectReference) (*schema.GroupVersionResource, string, error)
- func UnionMaps(a, b map[string]string) map[string]string
- type ReadyPodCounter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterMap ¶
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 NewPodScalableInformerFactory ¶ added in v0.7.0
func NewPodScalableInformerFactory(ctx context.Context) duck.InformerFactory
NewPodScalableInformerFactory produces an informer factory for PodScalable resources.
func ParentResourceFromService ¶
ParentResourceFromService returns the parent resource name from endpoints or k8s service resource. The function is based upon knowledge that all knative built services have `parent-resource-<svc-unique-suffix` format.
func ReadyAddressCount ¶
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.
Types ¶
type ReadyPodCounter ¶ added in v0.7.0
ReadyPodCounter provides a count of currently ready 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 ReadyPodCounter is unable to calculate a value.
func NewScopedEndpointsCounter ¶ added in v0.7.0
func NewScopedEndpointsCounter(lister corev1listers.EndpointsLister, namespace, serviceName string) ReadyPodCounter
NewScopedEndpointsCounter creates a ReadyPodCounter 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.