client

package
v1.15.4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 42 Imported by: 2

Documentation

Index

Constants

This section is empty.

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

func NewStandaloneClientset

func NewStandaloneClientset(cfg Config) (Clientset, error)

NewStandaloneClientset creates a clientset outside hive. To be removed once remaining uses of k8s.Init()/k8s.Client()/etc. have been converted.

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

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