k8s

package
v0.15.9 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKubeconfigNotSet = errors.New("kubeconfig is not set")

ErrKubeconfigNotSet represents error when kubeconfig is empty string.

Functions

func NewCustomTransport added in v0.12.0

func NewCustomTransport(config *rest.Config, semaphore chan struct{}, logger logging.Logger) *customTransport

Types

type Client

type Client struct {

	// exported services that K8S provides
	ConfigMap      *configmap.Client
	Ingress        *ingress.Client
	Namespace      *namespace.Client
	Pods           *pod.Client
	PVC            *persistentvolumeclaim.Client
	Secret         *secret.Client
	ServiceAccount *serviceaccount.Client
	Service        *service.Client
	StatefulSet    *statefulset.Client
	IngressRoute   *ingressroute.Client
	// contains filtered or unexported fields
}

Client manages communication with the Kubernetes.

func NewClient

func NewClient(opts ...ClientOption) (c *Client, err error)

NewClient returns a new Kubernetes client.

type ClientConfig added in v0.12.3

type ClientConfig struct {
	NewForConfig                   func(c *rest.Config) (*kubernetes.Clientset, error)                 // kubernetes.NewForConfig
	NewIngressRouteClientForConfig func(c *rest.Config) (*ingressroute.CustomResourceClient, error)    // ingressroute.NewForConfig
	InClusterConfig                func() (*rest.Config, error)                                        // rest.InClusterConfig
	BuildConfigFromFlags           func(masterUrl string, kubeconfigPath string) (*rest.Config, error) // clientcmd.BuildConfigFromFlags
	FlagString                     func(name string, value string, usage string) *string               // flag.String
	FlagParse                      func()                                                              // flag.Parse
	OsUserHomeDir                  func() (string, error)                                              // os.UserHomeDir
}

ClientConfig holds functions for configration of the Kubernetes client. Functions are extracted to be able to mock them in tests.

type ClientOption added in v0.12.3

type ClientOption func(*Client)

ClientOption holds optional parameters for the Client.

func WithInCluster added in v0.12.3

func WithInCluster(inCluster bool) ClientOption

WithInCluster sets the inCluster flag for the Client.

func WithKubeconfigPath added in v0.12.3

func WithKubeconfigPath(kubeconfigPath string) ClientOption

WithKubeconfigPath sets the kubeconfigPath for the Client.

func WithLogger added in v0.12.3

func WithLogger(logger logging.Logger) ClientOption

WithLogger sets the logger for the Client.

func WithMockClientConfig added in v0.12.3

func WithMockClientConfig(cs *ClientConfig) ClientOption

WithMockClientConfig sets the ClientConfig function, which is used for only when mocking.

func WithRequestLimiter added in v0.12.3

func WithRequestLimiter(rateLimiter flowcontrol.RateLimiter, maxConcurentRequests int) ClientOption

WithRequestLimiter sets the rateLimiter and maxConcurentRequests for the Client.

Directories

Path Synopsis
customresource

Jump to

Keyboard shortcuts

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