...

Package scale

import "k8s.io/client-go/scale"
Overview
Index
Subdirectories

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.

type PreferredResourceMapper

PreferredResourceMapper determines the preferred version of a resource to scale

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

type ScaleConverter

ScaleConverter knows how to convert between external scale versions.

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

func NewScaleConverter

func NewScaleConverter() *ScaleConverter

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

func (*ScaleConverter) Codecs

func (c *ScaleConverter) Codecs() serializer.CodecFactory

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

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

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)
}

type ScaleKindResolver

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

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

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

ScalesGetter can produce a ScaleInterface

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
}

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.

Subdirectories

Name Synopsis
..
fake Package fake provides a fake client interface to arbitrary Kubernetes APIs that exposes common high level operations and exposes common metadata.
scheme 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.
appsv1beta1
appsv1beta2
autoscalingv1
extensionsint Package extensionsint contains the necessary scaffolding of the internal version of extensions as required by conversion logic.
extensionsv1beta1