k8s

package
v3.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKubeClient

func NewKubeClient(ca *apiconfig.CalicoAPIConfigSpec) (api.Client, error)

Types

type KubeClient

type KubeClient struct {
	// Main Kubernetes clients.
	ClientSet *kubernetes.Clientset
	// contains filtered or unexported fields
}

func (*KubeClient) Apply

func (c *KubeClient) Apply(ctx context.Context, kvp *model.KVPair) (*model.KVPair, error)

Set an existing entry in the datastore. This ignores whether an entry already exists. This is not exposed in the main client - but we keep here for the backend API.

func (*KubeClient) Clean

func (c *KubeClient) Clean() error

Remove Calico-creatable data from the datastore. This is purely used for the test framework.

func (*KubeClient) Create

func (c *KubeClient) Create(ctx context.Context, d *model.KVPair) (*model.KVPair, error)

Create an entry in the datastore. This errors if the entry already exists.

func (*KubeClient) Delete

func (c *KubeClient) Delete(ctx context.Context, k model.Key, revision string) (*model.KVPair, error)

Delete an entry in the datastore by key.

func (*KubeClient) DeleteKVP

func (c *KubeClient) DeleteKVP(ctx context.Context, kvp *model.KVPair) (*model.KVPair, error)

Delete an entry in the datastore.

func (*KubeClient) EnsureInitialized

func (c *KubeClient) EnsureInitialized() error

EnsureInitialized checks that the necessary custom resource definitions exist in the backend. This usually passes when using etcd as a backend but can often fail when using KDD as it relies on various custom resources existing. To ensure the datastore is initialized, this function checks that a known custom resource is defined: GlobalFelixConfig. It accomplishes this by trying to set the ClusterType (an instance of GlobalFelixConfig).

func (*KubeClient) Get

func (c *KubeClient) Get(ctx context.Context, k model.Key, revision string) (*model.KVPair, error)

Get an entry from the datastore. This errors if the entry does not exist.

func (*KubeClient) GetResourceClientFromResourceKind

func (c *KubeClient) GetResourceClientFromResourceKind(kind string) resources.K8sResourceClient

getResourceClientFromKey returns the appropriate resource client for the v3 resource kind.

func (*KubeClient) List

func (c *KubeClient) List(ctx context.Context, l model.ListInterface, revision string) (*model.KVPairList, error)

List entries in the datastore. This may return an empty list if there are no entries matching the request in the ListInterface.

func (*KubeClient) Update

func (c *KubeClient) Update(ctx context.Context, d *model.KVPair) (*model.KVPair, error)

Update an existing entry in the datastore. This errors if the entry does not exist.

func (*KubeClient) Watch

func (c *KubeClient) Watch(ctx context.Context, l model.ListInterface, revision string) (api.WatchInterface, error)

List entries in the datastore. This may return an empty list if there are no entries matching the request in the ListInterface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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