Documentation ¶
Index ¶
- func DeleteScaledObject(ctx context.Context, name string, namespace string, cl client.Client) error
- 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 GetConfigMap(ctx context.Context, cl client.Client, namespace string, name string) (*corev1.ConfigMap, error)
- func Int32P(i int32) *int32
- func Labels(name string) map[string]string
- func NewClientset() (*kubernetes.Clientset, dynamic.Interface, error)
- func NewScaledObject(namespace, name, deploymentName, scalerAddress, host string, ...) (*unstructured.Unstructured, error)
- func ObjKey(ns, name string) client.ObjectKey
- func PatchConfigMap(ctx context.Context, logger logr.Logger, cl client.Writer, ...) (*corev1.ConfigMap, error)
- type ConfigMapGetter
- type ConfigMapGetterWatcher
- type ConfigMapWatcher
- type DeploymentCache
- type FakeConfigMapGetter
- 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
- type FakeRuntimeClient
- type FakeRuntimeClientReader
- type FakeRuntimeClientWriter
- func (f *FakeRuntimeClientWriter) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (f *FakeRuntimeClientWriter) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
- func (f *FakeRuntimeClientWriter) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
- func (f *FakeRuntimeClientWriter) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) error
- func (f *FakeRuntimeClientWriter) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
- type FakeRuntimeStatusClient
- type GetCall
- 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
- type InformerConfigMapUpdater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteScaledObject ¶
DeleteScaledObject deletes a scaled object with the given name
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 GetConfigMap ¶ added in v0.2.0
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 NewClientset ¶
func NewClientset() (*kubernetes.Clientset, dynamic.Interface, error)
NewClientset gets a new Kubernetes clientset, or calls log.Fatal if it couldn't
func NewScaledObject ¶
func NewScaledObject( namespace, name, deploymentName, scalerAddress, host string, minReplicas, maxReplicas int32, ) (*unstructured.Unstructured, error)
NewScaledObject creates a new ScaledObject in memory
Types ¶
type ConfigMapGetter ¶ added in v0.2.0
type ConfigMapGetter interface {
Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.ConfigMap, error)
}
ConfigMapGetter is a pared down version of a ConfigMapInterface (found here: https://pkg.go.dev/k8s.io/client-go@v0.21.3/kubernetes/typed/core/v1#ConfigMapInterface).
Pass this whenever possible to functions that only need to get individual ConfigMaps from Kubernetes, and nothing else.
type ConfigMapGetterWatcher ¶ added in v0.2.0
type ConfigMapGetterWatcher interface { ConfigMapGetter ConfigMapWatcher }
ConfigMapGetterWatcher is a pared down version of a ConfigMapInterface (found here: https://pkg.go.dev/k8s.io/client-go@v0.21.3/kubernetes/typed/core/v1#ConfigMapInterface).
Pass this whenever possible to functions that only need to watch for ConfigMaps from Kubernetes, and nothing else.
type ConfigMapWatcher ¶ added in v0.2.0
type ConfigMapWatcher interface {
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
}
ConfigMapWatcher is a pared down version of a ConfigMapInterface (found here: https://pkg.go.dev/k8s.io/client-go@v0.21.3/kubernetes/typed/core/v1#ConfigMapInterface).
Pass this whenever possible to functions that only need to watch for ConfigMaps from Kubernetes, and nothing else.
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 }
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 FakeConfigMapGetter ¶ added in v0.2.0
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 FakeRuntimeClient ¶ added in v0.2.0
type FakeRuntimeClient struct { *FakeRuntimeClientReader *FakeRuntimeClientWriter *FakeRuntimeStatusClient }
FakeRuntimeClient is a fake implementation of (k8s.io/controller-runtime/pkg/client).Client
func NewFakeRuntimeClient ¶ added in v0.2.0
func NewFakeRuntimeClient() *FakeRuntimeClient
type FakeRuntimeClientReader ¶ added in v0.2.0
type FakeRuntimeClientReader struct { GetCalls []GetCall GetFunc func() client.Object ListCalls []client.ObjectList ListFunc func() client.ObjectList }
FakeRuntimeClientReader is a fake implementation of (k8s.io/controller-runtime/pkg/client).ClientReader
func (*FakeRuntimeClientReader) List ¶ added in v0.2.0
func (f *FakeRuntimeClientReader) List( ctx context.Context, list client.ObjectList, opts ...client.ListOption, ) error
func (*FakeRuntimeClientReader) RESTMapper ¶ added in v0.2.0
func (f *FakeRuntimeClientReader) RESTMapper() meta.RESTMapper
RESTMapper implements the controller-runtime Client interface.
NOTE: this method is not implemented and always returns nil.
type FakeRuntimeClientWriter ¶ added in v0.2.0
type FakeRuntimeClientWriter struct { Creates []client.Object Deletes []client.Object Updates []client.Object Patches []client.Object DeleteAllOfs []client.Object }
FakeRuntimeClientWriter is a fake implementation of (k8s.io/controller-runtime/pkg/client).ClientWriter
It stores all method calls in the respective struct fields. Instances of FakeRuntimeClientWriter are not concurrency-safe
func (*FakeRuntimeClientWriter) Create ¶ added in v0.2.0
func (f *FakeRuntimeClientWriter) Create( ctx context.Context, obj client.Object, opts ...client.CreateOption, ) error
func (*FakeRuntimeClientWriter) Delete ¶ added in v0.2.0
func (f *FakeRuntimeClientWriter) Delete( ctx context.Context, obj client.Object, opts ...client.DeleteOption, ) error
func (*FakeRuntimeClientWriter) DeleteAllOf ¶ added in v0.2.0
func (f *FakeRuntimeClientWriter) DeleteAllOf( ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption, ) error
func (*FakeRuntimeClientWriter) Patch ¶ added in v0.2.0
func (f *FakeRuntimeClientWriter) Patch( ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption, ) error
func (*FakeRuntimeClientWriter) Update ¶ added in v0.2.0
func (f *FakeRuntimeClientWriter) Update( ctx context.Context, obj client.Object, opts ...client.UpdateOption, ) error
type FakeRuntimeStatusClient ¶ added in v0.2.0
type FakeRuntimeStatusClient struct { }
FakeRuntimeStatusClient is a fake implementation of (k8s.io/controller-runtime/pkg/client).StatusClient
func (*FakeRuntimeStatusClient) Scheme ¶ added in v0.2.0
func (f *FakeRuntimeStatusClient) Scheme() *runtime.Scheme
Scheme implements the controller-runtime Client interface.
NOTE: this method is not implemented and always returns nil.
func (*FakeRuntimeStatusClient) Status ¶ added in v0.2.0
func (f *FakeRuntimeStatusClient) Status() client.StatusWriter
Status implements the controller-runtime StatusClient interface.
NOTE: this function isn't implemented and always returns nil.
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)
type InformerConfigMapUpdater ¶ added in v0.3.0
type InformerConfigMapUpdater struct {
// contains filtered or unexported fields
}
func NewInformerConfigMapUpdater ¶ added in v0.3.0
func NewInformerConfigMapUpdater( lggr logr.Logger, cl kubernetes.Interface, defaultResync time.Duration, ) *InformerConfigMapUpdater
func (*InformerConfigMapUpdater) Get ¶ added in v0.3.0
func (i *InformerConfigMapUpdater) Get( ns, name string, ) (corev1.ConfigMap, error)
func (*InformerConfigMapUpdater) MarshalJSON ¶ added in v0.3.0
func (i *InformerConfigMapUpdater) MarshalJSON() ([]byte, error)