kubernetes

package
v0.14.0-27b1d10 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package kubernetes is an util library to deal with kubernetes.

Package kubernetes is an util library to deal with kubernetes.

Package kubernetes is an util library to deal with kubernetes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(config RestClientConfiguration) *rest.Config

Config creates rest client configuration with TokenBucketRateLimiter.

Types

type Client

type Client interface {
	ctrlClient.Client

	Start(ctx context.Context) error

	GetUncached(ctx context.Context, key ctrlClient.ObjectKey, obj ctrlClient.Object, opts ...ctrlClient.GetOption) error
	ListUncached(ctx context.Context, list ctrlClient.ObjectList, opts ...ctrlClient.ListOption) error
}

Client is an interface that extends "ctrlClient.Client" and adds additional methods for starting and retrieving uncached objects.

func NewClient

func NewClient(config *rest.Config, logger logging.Logger, options Options) (Client, error)

NewClient instantiates a new kubernetes client with a logger and provided options This creates a cached client and an uncached reader.

type Options

type Options struct {
	// Scheme is the scheme used to resolve runtime.Objects to GroupVersionKinds / Resources
	// Defaults to the kubernetes/client-go scheme.Scheme, but it's almost always better
	// idea to pass your own scheme in.  See the documentation in pkg/scheme for more information.
	Scheme *runtime.Scheme

	// SyncPeriod determines the minimum frequency at which watched resources are
	// reconciled. A lower period will correct entropy more quickly, but reduce
	// responsiveness to change if there are many watched resources. Change this
	// value only if you know what you are doing. Defaults to 10 hours if unset.
	// there will a 10 percent jitter between the SyncPeriod of all controllers
	// so that all controllers will not send list requests simultaneously.
	SyncPeriod *time.Duration

	// DisableCacheFor tells the client that, if any cache is used, to bypass it
	// for the given objects.
	DisableCacheFor []ctrlClient.Object
}

Options are the possible options that can be configured in a kubernetes Client.

type RestClientConfiguration

type RestClientConfiguration struct {
	ClientQPS   float32 `envconfig:"K8S_REST_CLIENT_QPS" default:"100"`
	ClientBurst int     `envconfig:"K8S_REST_CLIENT_BURST" default:"500"`
}

RestClientConfiguration defines required variables to configure the environment

func (*RestClientConfiguration) LoadFromEnvVars

func (c *RestClientConfiguration) LoadFromEnvVars() error

LoadFromEnvVars for RestClientConfiguration.

Jump to

Keyboard shortcuts

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