client

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0 Imports: 47 Imported by: 15

Documentation

Index

Constants

View Source
const OptUserAgent = "user-agent"

Variables

View Source
var Cell = cell.Module(
	"k8s-client",
	"Kubernetes Client",

	cell.Config(defaultSharedConfig),
	cell.Config(defaultClientParams),
	cell.Provide(NewClientConfig),
	cell.Provide(newClientset),

	cell.Invoke(registerMappingsUpdater),
)

client.Cell provides Clientset, a composition of clientsets to Kubernetes resources used by Cilium.

View Source
var ClientBuilderCell = cell.Module(
	"k8s-client-builder",
	"Kubernetes Client Builder",

	cell.Config(defaultSharedConfig),
	cell.Provide(NewClientConfig),
	cell.Provide(NewClientBuilder),
)

client.ClientBuilderCell provides a function to create a new composite Clientset, allowing a controller to use its own Clientset with a different user agent.

View Source
var (
	// K8sAPIServerFilePath is the file path for storing kube-apiserver service and
	// endpoints for high availability failover.
	K8sAPIServerFilePath = filepath.Join(option.Config.StateDir, "k8sapi_server_state.json")
)

Functions

This section is empty.

Types

type APIExtClientset

type APIExtClientset = slim_apiext_clientset.Clientset

Type aliases for the clientsets to avoid name collision on 'Clientset' when composing them.

type CiliumClientset

type CiliumClientset = cilium_clientset.Clientset

Type aliases for the clientsets to avoid name collision on 'Clientset' when composing them.

type ClientBuilderFunc added in v1.16.0

type ClientBuilderFunc func(name string) (Clientset, error)

func NewClientBuilder added in v1.16.0

func NewClientBuilder(params compositeClientsetParams) ClientBuilderFunc

NewClientBuilder returns a function that creates a new Clientset with the given name appended to the user agent, or returns an error if the Clientset cannot be created.

type ClientParams added in v1.17.0

type ClientParams struct {
	// K8sClientQPS is the queries per second limit for the K8s client. Defaults to k8s client defaults.
	K8sClientQPS float32

	// K8sClientBurst is the burst value allowed for the K8s client. Defaults to k8s client defaults.
	K8sClientBurst int
}

func (ClientParams) Flags added in v1.17.0

func (def ClientParams) Flags(flags *pflag.FlagSet)

type Clientset

type Clientset interface {
	mcsapi_clientset.Interface
	kubernetes.Interface
	apiext_clientset.Interface
	cilium_clientset.Interface
	Getters

	// Slim returns the slim client, which contains some of the same APIs as the
	// normal kubernetes client, but with slimmed down messages to reduce memory
	// usage. Prefer the slim version when caching messages.
	Slim() slim_clientset.Interface

	// IsEnabled returns true if Kubernetes support is enabled and the
	// clientset can be used.
	IsEnabled() bool

	// Config returns the configuration used to create this client.
	Config() Config

	// RestConfig returns the deep copy of rest configuration.
	RestConfig() *rest.Config
}

Clientset is a composition of the different client sets used by Cilium.

type ClientsetGetters added in v1.18.0

type ClientsetGetters struct {
	Clientset
}

ClientsetGetters implements the Getters interface in terms of the clientset.

func (*ClientsetGetters) GetSecrets added in v1.18.0

func (cs *ClientsetGetters) GetSecrets(ctx context.Context, ns, name string) (map[string][]byte, error)

GetSecrets returns the secrets found in the given namespace and name.

type Config

type Config struct {
	ClientParams
	SharedConfig
}

func NewClientConfig added in v1.17.0

func NewClientConfig(cfg SharedConfig, params ClientParams) Config

func (Config) IsEnabled added in v1.19.0

func (cfg Config) IsEnabled() bool

type ConfigureK8sClientsetDialer added in v1.19.0

type ConfigureK8sClientsetDialer interface {
	ConfigureK8sClientsetDialer(dialer *net.Dialer)
}

ConfigureK8sClientsetDialer provides an optional extension point to configure the dialer used by the clientset.

type Getters

type Getters interface {
	GetSecrets(ctx context.Context, namespace, name string) (map[string][]byte, error)
}

Getters is a set of methods for retrieving common objects.

type K8sServiceEndpointMapping added in v1.18.0

type K8sServiceEndpointMapping struct {
	Service   string   `json:"service"`
	Endpoints []string `json:"endpoints"`
}

func (K8sServiceEndpointMapping) Equal added in v1.18.0

type KubernetesClientset

type KubernetesClientset = kubernetes.Clientset

Type aliases for the clientsets to avoid name collision on 'Clientset' when composing them.

type MCSAPIClientset added in v1.17.0

type MCSAPIClientset = mcsapi_clientset.Clientset

Type aliases for the clientsets to avoid name collision on 'Clientset' when composing them.

type SharedConfig added in v1.17.0

type SharedConfig struct {
	// EnableK8s is a flag that, when set to false, forcibly disables the clientset, to let cilium
	// operates with CNI-compatible orchestrators other than Kubernetes. Default to true.
	EnableK8s bool

	// K8sAPIServerURLs is the list of API server instances
	K8sAPIServerURLs []string

	// K8sAPIServer is the kubernetes api address server (for https use --k8s-kubeconfig-path instead)
	K8sAPIServer string

	// K8sKubeConfigPath is the absolute path of the kubernetes kubeconfig file
	K8sKubeConfigPath string

	// K8sClientConnectionTimeout configures the timeout for K8s client connections.
	K8sClientConnectionTimeout time.Duration

	// K8sClientConnectionKeepAlive configures the keep alive duration for K8s client connections.
	K8sClientConnectionKeepAlive time.Duration

	// K8sHeartbeatTimeout configures the timeout for apiserver heartbeat
	K8sHeartbeatTimeout time.Duration

	// EnableAPIDiscovery enables Kubernetes API discovery
	EnableK8sAPIDiscovery bool
}

func (SharedConfig) Flags added in v1.17.0

func (def SharedConfig) Flags(flags *pflag.FlagSet)

type SlimClientset

type SlimClientset = slim_clientset.Clientset

Type aliases for the clientsets to avoid name collision on 'Clientset' when composing them.

Directories

Path Synopsis
applyconfiguration
clientset
versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
versioned/typed/cilium.io/v2
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
versioned/typed/cilium.io/v2/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
versioned/typed/cilium.io/v2alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
versioned/typed/cilium.io/v2alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
informers
listers

Jump to

Keyboard shortcuts

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