Documentation ¶
Index ¶
- 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 Labels(name string) map[string]string
- func NamespacedNameFromObject(obj client.Object) *types.NamespacedName
- func NamespacedNameFromScaledObjectRef(sor *externalscaler.ScaledObjectRef) *types.NamespacedName
- func NewScaledObject(namespace string, name string, deploymentName string, scalerAddress string, ...) *kedav1alpha1.ScaledObject
- func ObjectKind(obj runtime.Object) string
- type DeploymentCache
- type FakeDeploymentCache
- func (f *FakeDeploymentCache) AddDeployment(depl appsv1.Deployment)
- func (f *FakeDeploymentCache) CurrentDeployments() map[string]appsv1.Deployment
- func (f *FakeDeploymentCache) Get(ns string, name string) (appsv1.Deployment, error)
- func (f *FakeDeploymentCache) GetWatcher(ns, name string) *watch.RaceFreeFakeWatcher
- func (f *FakeDeploymentCache) MarshalJSON() ([]byte, error)
- func (f *FakeDeploymentCache) Set(ns, name string, deployment appsv1.Deployment)
- func (f *FakeDeploymentCache) SetReplicas(ns, name string, num int32) error
- func (f *FakeDeploymentCache) SetWatcher(ns, name string) *watch.RaceFreeFakeWatcher
- func (f *FakeDeploymentCache) Watch(ns, name string) (watch.Interface, error)
- type GetEndpointsFunc
- type InformerBackedDeploymentCache
- func (i *InformerBackedDeploymentCache) Get(ns, name string) (appsv1.Deployment, error)
- func (i *InformerBackedDeploymentCache) MarshalJSON() ([]byte, error)
- func (i *InformerBackedDeploymentCache) Start(ctx context.Context) error
- func (i *InformerBackedDeploymentCache) Watch(ns, name string) (watch.Interface, error)
Constants ¶
This section is empty.
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, deploymentName string, scalerAddress string, hosts []string, pathPrefixes []string, minReplicas *int32, maxReplicas *int32, cooldownPeriod *int32, ) *kedav1alpha1.ScaledObject
NewScaledObject creates a new ScaledObject in memory
func ObjectKind ¶ added in v0.5.0
Types ¶
type DeploymentCache ¶ added in v0.1.0
type DeploymentCache interface { json.Marshaler // Get gets the a deployment with the given name // in the given namespace from the cache. // // If the deployment doesn't exist in the cache, it // will be requested from the backing store (most commonly // the Kubernetes API server) Get(namespace, name string) (appsv1.Deployment, error) // Watch opens a watch stream for the deployment with // the given name in the given namespace from the cache. // // If the deployment doesn'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) }
DeploymentCache is a simple cache of deployments. It allows callers to quickly get a given deployment in a given namespace, or watch for changes to a specific deployment, all without incurring the cost of issuing a network request to the Kubernetes API
type FakeDeploymentCache ¶ added in v0.2.0
FakeDeploymentCache is a fake implementation of DeploymentCache, suitable for testing interceptor-level logic, without requiring any real Kubernetes client or API interaction
func NewFakeDeploymentCache ¶ added in v0.2.0
func NewFakeDeploymentCache() *FakeDeploymentCache
func (*FakeDeploymentCache) AddDeployment ¶ added in v0.3.0
func (f *FakeDeploymentCache) AddDeployment(depl appsv1.Deployment)
AddDeployment adds a deployment to the current in-memory cache without sending an event to any of the watchers
func (*FakeDeploymentCache) CurrentDeployments ¶ added in v0.3.0
func (f *FakeDeploymentCache) CurrentDeployments() map[string]appsv1.Deployment
CurrentDeployments returns a map of all the current deployments.
The key in the map is a combination of the namespace and name of the corresponding deployment, but the format of the key is not guaranteed
func (*FakeDeploymentCache) Get ¶ added in v0.2.0
func (f *FakeDeploymentCache) Get(ns string, name string) (appsv1.Deployment, error)
func (*FakeDeploymentCache) GetWatcher ¶ added in v0.3.0
func (f *FakeDeploymentCache) 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 (*FakeDeploymentCache) MarshalJSON ¶ added in v0.2.0
func (f *FakeDeploymentCache) MarshalJSON() ([]byte, error)
func (*FakeDeploymentCache) Set ¶ added in v0.2.0
func (f *FakeDeploymentCache) Set(ns, name string, deployment appsv1.Deployment)
func (*FakeDeploymentCache) SetReplicas ¶ added in v0.2.0
func (f *FakeDeploymentCache) SetReplicas(ns, name string, num int32) error
func (*FakeDeploymentCache) SetWatcher ¶ added in v0.2.0
func (f *FakeDeploymentCache) 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 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 InformerBackedDeploymentCache ¶ added in v0.3.0
type InformerBackedDeploymentCache struct {
// contains filtered or unexported fields
}
func NewInformerBackedDeploymentCache ¶ added in v0.3.0
func NewInformerBackedDeploymentCache( lggr logr.Logger, cl kubernetes.Interface, defaultResync time.Duration, ) *InformerBackedDeploymentCache
func (*InformerBackedDeploymentCache) Get ¶ added in v0.3.0
func (i *InformerBackedDeploymentCache) Get( ns, name string, ) (appsv1.Deployment, error)
func (*InformerBackedDeploymentCache) MarshalJSON ¶ added in v0.3.0
func (i *InformerBackedDeploymentCache) MarshalJSON() ([]byte, error)