controller-managerk8s.io/controller-manager/pkg/clientbuilder Index | Files

package clientbuilder

import "k8s.io/controller-manager/pkg/clientbuilder"

Index

Types

type ControllerClientBuilder

type ControllerClientBuilder interface {
	Config(name string) (*restclient.Config, error)
	ConfigOrDie(name string) *restclient.Config
	Client(name string) (clientset.Interface, error)
	ClientOrDie(name string) clientset.Interface
	DiscoveryClient(name string) (discovery.DiscoveryInterface, error)
	DiscoveryClientOrDie(name string) discovery.DiscoveryInterface
}

ControllerClientBuilder allows you to get clients and configs for controllers Please note a copy also exists in staging/src/k8s.io/cloud-provider/cloud.go TODO: Extract this into a separate controller utilities repo (issues/68947)

func NewDynamicClientBuilder

func NewDynamicClientBuilder(clientConfig *restclient.Config, coreClient v1core.CoreV1Interface, ns string) ControllerClientBuilder

NewDynamicClientBuilder returns client builder which uses TokenRequest feature and refresh service account token periodically

func NewTestDynamicClientBuilder

func NewTestDynamicClientBuilder(clientConfig *restclient.Config, coreClient v1core.CoreV1Interface, ns string, expirationSeconds int64, leewayPercent int) ControllerClientBuilder

this function only for test purpose, don't call it

type DynamicControllerClientBuilder

type DynamicControllerClientBuilder struct {
	// ClientConfig is a skeleton config to clone and use as the basis for each controller client
	ClientConfig *restclient.Config

	// CoreClient is used to provision service accounts if needed and watch for their associated tokens
	// to construct a controller client
	CoreClient v1core.CoreV1Interface

	// Namespace is the namespace used to host the service accounts that will back the
	// controllers.  It must be highly privileged namespace which normal users cannot inspect.
	Namespace string
	// contains filtered or unexported fields
}

func (*DynamicControllerClientBuilder) Client

func (*DynamicControllerClientBuilder) ClientOrDie

func (*DynamicControllerClientBuilder) Config

func (*DynamicControllerClientBuilder) ConfigOrDie

func (*DynamicControllerClientBuilder) DiscoveryClient

func (*DynamicControllerClientBuilder) DiscoveryClientOrDie

func (t *DynamicControllerClientBuilder) DiscoveryClientOrDie(name string) discovery.DiscoveryInterface

type SimpleControllerClientBuilder

type SimpleControllerClientBuilder struct {
	// ClientConfig is a skeleton config to clone and use as the basis for each controller client
	ClientConfig *restclient.Config
}

SimpleControllerClientBuilder returns a fixed client with different user agents

func (SimpleControllerClientBuilder) Client

Client returns a clientset.Interface built from the ClientBuilder

func (SimpleControllerClientBuilder) ClientOrDie

ClientOrDie returns a clientset.interface built from the ClientBuilder with no error. If it gets an error getting the client, it will log the error and kill the process it's running in.

func (SimpleControllerClientBuilder) Config

Config returns a client config for a fixed client

func (SimpleControllerClientBuilder) ConfigOrDie

ConfigOrDie returns a client config if no error from previous config func. If it gets an error getting the client, it will log the error and kill the process it's running in.

func (SimpleControllerClientBuilder) DiscoveryClient

DiscoveryClient returns a discovery.DiscoveryInterface built from the ClientBuilder Discovery is special because it will artificially pump the burst quite high to handle the many discovery requests.

func (SimpleControllerClientBuilder) DiscoveryClientOrDie

DiscoveryClientOrDie returns a discovery.DiscoveryInterface built from the ClientBuilder with no error. Discovery is special because it will artificially pump the burst quite high to handle the many discovery requests. If it gets an error getting the client, it will log the error and kill the process it's running in.

Source Files

client_builder.go client_builder_dynamic.go

Version
v0.32.2 (latest)
Published
Feb 13, 2025
Platform
linux/amd64
Imports
20 packages
Last checked
2 months ago

Tools for package owners.