client

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 42 Imported by: 3

Documentation

Index

Constants

View Source
const OptUserAgent = "user-agent"

Variables

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

	cell.Config(defaultConfig),
	cell.Provide(newClientset),
)

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.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 FakeClientBuilderCell = cell.Provide(FakeClientBuilder)
View Source
var FakeClientCell = cell.Provide(NewFakeClientset)

Functions

func NewFakeClientset

func NewFakeClientset() (*FakeClientset, Clientset)

Types

type APIExtClientset

type APIExtClientset = slim_apiext_clientset.Clientset

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

type APIExtFakeClientset

type APIExtFakeClientset = apiext_fake.Clientset

type CiliumClientset

type CiliumClientset = cilium_clientset.Clientset

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

type CiliumFakeClientset

type CiliumFakeClientset = cilium_fake.Clientset

type ClientBuilderFunc added in v1.16.0

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

func FakeClientBuilder added in v1.16.0

func FakeClientBuilder() ClientBuilderFunc

func NewClientBuilder added in v1.16.0

func NewClientBuilder(lc cell.Lifecycle, log logrus.FieldLogger, cfg Config) 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 Clientset

type 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

	// Disable disables the client. Panics if called after the clientset has been
	// started.
	Disable()

	// 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 Config

type Config 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

	// 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

	// 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

	// 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

	// K8sEnableAPIDiscovery enables Kubernetes API discovery
	EnableK8sAPIDiscovery bool
}

func (Config) Flags

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

type FakeClientset

type FakeClientset struct {
	*KubernetesFakeClientset
	*CiliumFakeClientset
	*APIExtFakeClientset

	SlimFakeClientset *SlimFakeClientset
	// contains filtered or unexported fields
}

func (*FakeClientset) Config

func (c *FakeClientset) Config() Config

func (*FakeClientset) Disable

func (c *FakeClientset) Disable()

func (*FakeClientset) Discovery

func (*FakeClientset) GetCiliumNode

func (cs *FakeClientset) GetCiliumNode(ctx context.Context, nodeName string) (*cilium_v2.CiliumNode, error)

GetCiliumNode returns the CiliumNode with the given nodeName.

func (*FakeClientset) GetK8sNode

func (cs *FakeClientset) GetK8sNode(ctx context.Context, nodeName string) (*slim_corev1.Node, error)

GetK8sNode returns the node with the given nodeName.

func (*FakeClientset) GetSecrets

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

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

func (*FakeClientset) IsEnabled

func (c *FakeClientset) IsEnabled() bool

func (*FakeClientset) RestConfig

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

func (*FakeClientset) Slim

type Getters

type Getters interface {
	GetSecrets(ctx context.Context, namespace, name string) (map[string][]byte, error)
	GetK8sNode(ctx context.Context, nodeName string) (*slim_corev1.Node, error)
	GetCiliumNode(ctx context.Context, nodeName string) (*cilium_v2.CiliumNode, error)
}

Getters is a set of methods for retrieving common objects.

type KubernetesClientset

type KubernetesClientset = kubernetes.Clientset

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

type KubernetesFakeClientset

type KubernetesFakeClientset = fake.Clientset

type SlimClientset

type SlimClientset = slim_clientset.Clientset

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

type SlimFakeClientset

type SlimFakeClientset = slim_fake.Clientset

Directories

Path Synopsis
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