Documentation
¶
Index ¶
- Constants
- func EndpointsForService(ctx context.Context, ns, serviceName, servicePort string, ...) ([]*url.URL, error)
- func FakeEndpointsForURL(u *url.URL, namespace, name string, num int) (*v1.Endpoints, error)
- func FakeEndpointsForURLs(urls []*url.URL, namespace, name string) (*v1.Endpoints, error)
- func Int32P(i int32) *int32
- func NamespacedNameFromObject(obj client.Object) *types.NamespacedName
- func NamespacedNameFromScaledObjectRef(sor *externalscaler.ScaledObjectRef) *types.NamespacedName
- func NewScaledObject(namespace string, name string, labels map[string]string, ...) *kedav1alpha1.ScaledObject
- func ObjectKind(obj runtime.Object) string
- type EndpointsCache
- type FakeEndpointsCache
- func (f *FakeEndpointsCache) Get(ns string, name string) (v1.Endpoints, error)
- func (f *FakeEndpointsCache) GetWatcher(ns, name string) *watch.RaceFreeFakeWatcher
- func (f *FakeEndpointsCache) MarshalJSON() ([]byte, error)
- func (f *FakeEndpointsCache) Set(endp v1.Endpoints)
- func (f *FakeEndpointsCache) SetSubsets(ns, name string, num int) error
- func (f *FakeEndpointsCache) SetWatcher(ns, name string) *watch.RaceFreeFakeWatcher
- func (f *FakeEndpointsCache) Watch(ns, name string) (watch.Interface, error)
- type FakeServiceCache
- type GetEndpointsFunc
- type InformerBackedEndpointsCache
- func (i *InformerBackedEndpointsCache) Get(ns, name string) (v1.Endpoints, error)
- func (i *InformerBackedEndpointsCache) MarshalJSON() ([]byte, error)
- func (i *InformerBackedEndpointsCache) Start(ctx context.Context)
- func (i *InformerBackedEndpointsCache) Watch(ns, name string) (watch.Interface, error)
- type InformerBackedServicesCache
- type ServiceCache
Constants ¶
const ( ScalerAddressKey = "scalerAddress" HTTPScaledObjectKey = "httpScaledObject" )
Variables ¶
This section is empty.
Functions ¶
func EndpointsForService ¶ added in v0.2.0
func FakeEndpointsForURL ¶ added in v0.2.0
FakeEndpointsForURL creates and returns a new *v1.Endpoints with a single v1.EndpointSubset in it, which has num v1.EndpointAddresses in it. Each of those EndpointAddresses has a Hostname and IP both equal to u.Hostname()
func FakeEndpointsForURLs ¶ added in v0.2.0
FakeEndpointsForURLs creates and returns a new *v1.Endpoints with a single v1.EndpointSubset in it that has each url in the urls parameter in it.
func Int32P ¶ added in v0.1.0
Int32P converts an int32 into an *int32. It's a convenience function for various values in Kubernetes API types
func NamespacedNameFromObject ¶ added in v0.5.0
func NamespacedNameFromObject(obj client.Object) *types.NamespacedName
func NamespacedNameFromScaledObjectRef ¶ added in v0.5.0
func NamespacedNameFromScaledObjectRef(sor *externalscaler.ScaledObjectRef) *types.NamespacedName
func NewScaledObject ¶
func NewScaledObject( namespace string, name string, labels map[string]string, annotations map[string]string, workloadRef v1alpha1.ScaleTargetRef, scalerAddress string, minReplicas *int32, maxReplicas *int32, cooldownPeriod *int32, initialCooldownPeriod *int32, ) *kedav1alpha1.ScaledObject
NewScaledObject creates a new ScaledObject in memory
func ObjectKind ¶ added in v0.5.0
Types ¶
type EndpointsCache ¶ added in v0.7.0
type EndpointsCache interface { json.Marshaler // Get gets the endpoints with the given name // in the given namespace from the cache. // // If the endpoints doesn't exist in the cache, it // will be requested from the backing store (most commonly // the Kubernetes API server) Get(namespace, name string) (v1.Endpoints, error) // Watch opens a watch stream for the endpoints with // the given name in the given namespace from the cache. // // If the endpoints don't exist in the cache, it // will be requested from the backing store (most commonly // the Kubernetes API server) Watch(namespace, name string) (watch.Interface, error) }
EndpointsCache is a simple cache of endpoints. It allows callers to quickly get given endpoints in a given namespace, or watch for changes to specific endpoints, all without incurring the cost of issuing a network request to the Kubernetes API
type FakeEndpointsCache ¶ added in v0.7.0
FakeEndpointsCache is a fake implementation of EndpointsCache, suitable for testing interceptor-level logic, without requiring any real Kubernetes client or API interaction
func NewFakeEndpointsCache ¶ added in v0.7.0
func NewFakeEndpointsCache() *FakeEndpointsCache
func (*FakeEndpointsCache) GetWatcher ¶ added in v0.7.0
func (f *FakeEndpointsCache) GetWatcher(ns, name string) *watch.RaceFreeFakeWatcher
GetWatcher gets the watcher for the given namespace and name, or nil if there wasn't one registered.
Watchers are registered by the .Watch() method
func (*FakeEndpointsCache) MarshalJSON ¶ added in v0.7.0
func (f *FakeEndpointsCache) MarshalJSON() ([]byte, error)
func (*FakeEndpointsCache) Set ¶ added in v0.7.0
func (f *FakeEndpointsCache) Set(endp v1.Endpoints)
Set adds a endpoints to the current in-memory cache without sending an event to any of the watchers
func (*FakeEndpointsCache) SetSubsets ¶ added in v0.7.0
func (f *FakeEndpointsCache) SetSubsets(ns, name string, num int) error
func (*FakeEndpointsCache) SetWatcher ¶ added in v0.7.0
func (f *FakeEndpointsCache) SetWatcher(ns, name string) *watch.RaceFreeFakeWatcher
SetWatcher creates a new race-free fake watcher and sets it into the internal watchers map. After this call, a call to Watch() with the same namespace and name values will return a valid watcher
type FakeServiceCache ¶ added in v0.9.0
type FakeServiceCache struct {
// contains filtered or unexported fields
}
FakeServiceCache is a fake implementation of a ServiceCache for testing
func NewFakeServiceCache ¶ added in v0.9.0
func NewFakeServiceCache() *FakeServiceCache
NewFakeServiceCache creates a new FakeServiceCache
func (*FakeServiceCache) Add ¶ added in v0.9.0
func (c *FakeServiceCache) Add(svc v1.Service)
Add adds a service to the cache
type GetEndpointsFunc ¶ added in v0.2.0
type GetEndpointsFunc func( ctx context.Context, namespace, serviceName string, ) (*v1.Endpoints, error)
GetEndpointsFunc is a type that represents a function that can fetch endpoints
func EndpointsFuncForControllerClient ¶ added in v0.2.0
func EndpointsFuncForControllerClient( cl client.Client, ) GetEndpointsFunc
EndpointsFuncForControllerClient returns a new GetEndpointsFunc that uses the controller-runtime client.Client to fetch endpoints
func EndpointsFuncForK8sClientset ¶ added in v0.2.0
func EndpointsFuncForK8sClientset( cl *kubernetes.Clientset, ) GetEndpointsFunc
type InformerBackedEndpointsCache ¶ added in v0.7.0
type InformerBackedEndpointsCache struct {
// contains filtered or unexported fields
}
func NewInformerBackedEndpointsCache ¶ added in v0.7.0
func NewInformerBackedEndpointsCache( lggr logr.Logger, cl kubernetes.Interface, defaultResync time.Duration, ) *InformerBackedEndpointsCache
func (*InformerBackedEndpointsCache) Get ¶ added in v0.7.0
func (i *InformerBackedEndpointsCache) Get( ns, name string, ) (v1.Endpoints, error)
func (*InformerBackedEndpointsCache) MarshalJSON ¶ added in v0.7.0
func (i *InformerBackedEndpointsCache) MarshalJSON() ([]byte, error)
func (*InformerBackedEndpointsCache) Start ¶ added in v0.7.0
func (i *InformerBackedEndpointsCache) Start(ctx context.Context)
type InformerBackedServicesCache ¶ added in v0.9.0
type InformerBackedServicesCache struct {
// contains filtered or unexported fields
}
InformerBackedServicesCache is a cache of services backed by a shared informer
func NewInformerBackedServiceCache ¶ added in v0.9.0
func NewInformerBackedServiceCache(lggr logr.Logger, cl kubernetes.Interface, factory informers.SharedInformerFactory) *InformerBackedServicesCache
NewInformerBackedServiceCache creates a new InformerBackedServicesCache
type ServiceCache ¶ added in v0.9.0
type ServiceCache interface { // Get gets a service with the given namespace and name from the cache // If the service doesn't exist in the cache, it will be fetched from the API server Get(ctx context.Context, namespace, name string) (*v1.Service, error) }
ServiceCache is an interface for caching service objects