scale

package
v0.31.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 22 Imported by: 771

Documentation

Overview

Package scale provides a polymorphic scale client capable of fetching and updating Scale for any resource which implements the `scale` subresource, as long as that subresource operates on a version of scale convertable to autoscaling.Scale.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PreferredResourceMapper

type PreferredResourceMapper interface {
	// ResourceFor takes a partial resource and returns the preferred resource.
	ResourceFor(resource schema.GroupVersionResource) (preferredResource schema.GroupVersionResource, err error)
}

PreferredResourceMapper determines the preferred version of a resource to scale

type ScaleConverter

type ScaleConverter struct {
	// contains filtered or unexported fields
}

ScaleConverter knows how to convert between external scale versions.

func NewScaleConverter

func NewScaleConverter() *ScaleConverter

NewScaleConverter creates a new ScaleConverter for converting between Scales in autoscaling/v1 and extensions/v1beta1.

func (*ScaleConverter) Codecs

func (*ScaleConverter) ConvertToVersion

func (c *ScaleConverter) ConvertToVersion(in runtime.Object, outVersion schema.GroupVersion) (runtime.Object, error)

ConvertToVersion converts the given *external* input object to the given output *external* output group-version.

func (*ScaleConverter) ScaleVersions

func (c *ScaleConverter) ScaleVersions() []schema.GroupVersion

func (*ScaleConverter) Scheme

func (c *ScaleConverter) Scheme() *runtime.Scheme

Scheme returns the scheme used by this scale converter.

type ScaleInterface

type ScaleInterface interface {
	// Get fetches the scale of the given scalable resource.
	Get(ctx context.Context, resource schema.GroupResource, name string, opts metav1.GetOptions) (*autoscalingapi.Scale, error)

	// Update updates the scale of the given scalable resource.
	Update(ctx context.Context, resource schema.GroupResource, scale *autoscalingapi.Scale, opts metav1.UpdateOptions) (*autoscalingapi.Scale, error)

	// Patch patches the scale of the given scalable resource.
	Patch(ctx context.Context, gvr schema.GroupVersionResource, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (*autoscalingapi.Scale, error)
}

ScaleInterface can fetch and update scales for resources in a particular namespace which implement the scale subresource.

type ScaleKindResolver

type ScaleKindResolver interface {
	// ScaleForResource returns the GroupVersionKind of the
	// scale subresource for the given GroupVersionResource.
	ScaleForResource(resource schema.GroupVersionResource) (scaleVersion schema.GroupVersionKind, err error)
}

ScaleKindResolver knows about the relationship between resources and the GroupVersionKind of their scale subresources.

func NewDiscoveryScaleKindResolver

func NewDiscoveryScaleKindResolver(client discovery.ServerResourcesInterface) ScaleKindResolver

NewDiscoveryScaleKindResolver creates a new ScaleKindResolver which uses information from the given disovery client to resolve the correct Scale GroupVersionKind for different resources.

type ScalesGetter

type ScalesGetter interface {
	// Scales produces a ScaleInterface for a particular namespace.
	// Set namespace to the empty string for non-namespaced resources.
	Scales(namespace string) ScaleInterface
}

ScalesGetter can produce a ScaleInterface

func New

func New(baseClient restclient.Interface, mapper PreferredResourceMapper, resolver dynamic.APIPathResolverFunc, scaleKindResolver ScaleKindResolver) ScalesGetter

New creates a new ScalesGetter using the given client to make requests. The GroupVersion on the client is ignored.

func NewForConfig

func NewForConfig(cfg *restclient.Config, mapper PreferredResourceMapper, resolver dynamic.APIPathResolverFunc, scaleKindResolver ScaleKindResolver) (ScalesGetter, error)

NewForConfig creates a new ScalesGetter which resolves kinds to resources using the given RESTMapper, and API paths using the given dynamic.APIPathResolverFunc.

Directories

Path Synopsis
Package fake provides a fake client interface to arbitrary Kubernetes APIs that exposes common high level operations and exposes common metadata.
Package fake provides a fake client interface to arbitrary Kubernetes APIs that exposes common high level operations and exposes common metadata.
Package scheme contains a runtime.Scheme to be used for serializing and deserializing different versions of Scale, and for converting in between them.
Package scheme contains a runtime.Scheme to be used for serializing and deserializing different versions of Scale, and for converting in between them.
appsint
Package appsint contains the necessary scaffolding of the internal version of extensions as required by conversion logic.
Package appsint contains the necessary scaffolding of the internal version of extensions as required by conversion logic.
extensionsint
Package extensionsint contains the necessary scaffolding of the internal version of extensions as required by conversion logic.
Package extensionsint contains the necessary scaffolding of the internal version of extensions as required by conversion logic.

Jump to

Keyboard shortcuts

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