client

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0 Imports: 28 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRateLimiterLatencyMetric deprecated

func NewRateLimiterLatencyMetric(metricStorage MetricStorage) metrics.LatencyMetric

Deprecated: to be removed since it is not a part of the client to support

func NewRequestResultMetric deprecated

func NewRequestResultMetric(metricStorage MetricStorage, labels map[string]string) metrics.ResultMetric

Deprecated: to be removed since it is not a part of the client to support

func RegisterKubernetesClientMetrics deprecated

func RegisterKubernetesClientMetrics(metricStorage MetricStorage, metricLabels map[string]string)

Deprecated: RegisterKubernetesClientMetrics defines metrics in Prometheus client.

Types

type Client

type Client struct {
	kubernetes.Interface
	// contains filtered or unexported fields
}

func New

func New() *Client

func NewFake

func NewFake(gvr map[schema.GroupVersionResource]string) *Client

func (*Client) APIResource

func (c *Client) APIResource(apiVersion, kind string) (*metav1.APIResource, error)

APIResource fetches APIResource object from cluster that specifies the name of a resource and whether it is namespaced. if resource not found, we try to invalidate cache and

NOTE that fetching with empty apiVersion can give errors if there are non-working api controllers in cluster.

func (*Client) APIResourceList

func (c *Client) APIResourceList(apiVersion string) (lists []*metav1.APIResourceList, err error)

APIResourceList fetches lists of APIResource objects from cluster. It returns all preferred resources if apiVersion is empty. An array with one list is returned if apiVersion is valid.

NOTE that fetching all preferred resources can give errors if there are non-working api controllers in cluster.

func (*Client) ApiExt

func (*Client) DefaultNamespace

func (c *Client) DefaultNamespace() string

func (*Client) Dynamic

func (c *Client) Dynamic() dynamic.Interface

func (*Client) GroupVersionResource

func (c *Client) GroupVersionResource(apiVersion, kind string) (gvr schema.GroupVersionResource, err error)

GroupVersionResource returns a GroupVersionResource object to use with dynamic informer.

This method is borrowed from kubectl and kubedog. The difference are: - lower case comparison with kind, name and all short names

func (*Client) Init

func (c *Client) Init() error

func (*Client) InvalidateDiscoveryCache

func (c *Client) InvalidateDiscoveryCache()

InvalidateDiscoveryCache allows you to invalidate cache manually, for example, when you are deploying CRD KubeClient tries to invalidate cache automatically when needed, but you can save a few resources to call this manually

func (*Client) Metadata

func (c *Client) Metadata() metadata.Interface

func (*Client) ReloadDynamic

func (c *Client) ReloadDynamic(gvrList map[schema.GroupVersionResource]string)

ReloadDynamic creates new dynamic client with the new set of CRDs.

func (*Client) RestConfig

func (c *Client) RestConfig() *rest.Config

RestConfig returns kubernetes Config with the common attributes that was passed on initialization.

func (*Client) WithConfigPath

func (c *Client) WithConfigPath(path string)

func (*Client) WithContextName

func (c *Client) WithContextName(name string)

func (*Client) WithMetricLabels

func (c *Client) WithMetricLabels(labels map[string]string)

func (*Client) WithMetricStorage

func (c *Client) WithMetricStorage(metricStorage MetricStorage)

func (*Client) WithRateLimiterSettings

func (c *Client) WithRateLimiterSettings(qps float32, burst int)

func (*Client) WithServer

func (c *Client) WithServer(server string)

func (*Client) WithTimeout

func (c *Client) WithTimeout(timeout time.Duration)

type ClientRateLimiterLatencyMetric deprecated

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

Deprecated: to be removed since it is not a part of the client to support

func (ClientRateLimiterLatencyMetric) Observe deprecated

func (c ClientRateLimiterLatencyMetric) Observe(_ context.Context, verb string, u url.URL, latency time.Duration)

Deprecated: to be removed since it is not a part of the client to support

type ClientRequestResultMetric

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

func (ClientRequestResultMetric) Increment deprecated

func (c ClientRequestResultMetric) Increment(_ context.Context, code, method, host string)

Deprecated: ClientRequestResultMetric

type MetricStorage deprecated

type MetricStorage interface {
	RegisterCounter(metric string, labels map[string]string) *prometheus.CounterVec
	CounterAdd(metric string, value float64, labels map[string]string)
	RegisterHistogram(metric string, labels map[string]string, buckets []float64) *prometheus.HistogramVec
	HistogramObserve(metric string, value float64, labels map[string]string, buckets []float64)
}

Deprecated: MetricStorage contains methods from flant/shell-operator metric storage. The metrics support is to be deleted from this library. It is left for the time being.

Jump to

Keyboard shortcuts

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