kubernetes

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCustomResourceDefinitionFromManifest

func CreateCustomResourceDefinitionFromManifest(ctx context.Context, embedFiles embed.FS, fileName string) error

CreateCustomResourceDefinitionFromManifest creates custom resource definition spec from manifest file.

func CreateCustomResourceDefinitionFromSpec

func CreateCustomResourceDefinitionFromSpec(ctx context.Context, crdName string, crdSingular string, crdPlural string,
	crdKind string, crdGroup string, crdVersion string, crdScope apiextensionsv1.ResourceScope) error

CreateCustomResourceDefinitionFromSpec creates the custom resource definition from given spec. If there is error, function will do the clean up.

func CreateKubernetesClientFromConfig

func CreateKubernetesClientFromConfig(kubeConfigPath string) (clientset.Interface, error)

CreateKubernetesClientFromConfig creaates a newk8s client from given kubeConfig file.

func GetDynamicInformer

func GetDynamicInformer(ctx context.Context, crdGroup, crdVersion, crdName, namespace string,
	cfg *restclient.Config, isInCluster bool) (informers.GenericInformer, error)

GetDynamicInformer returns informer for specified CRD group, version, name and namespace.

isInCluster should be set to true if the resource is present in the same cluster, otherwise set false if the resource is present in the supervisor cluster in TKG flavor.

Takes an input configuration to create a client for the dynamic informer. If isInCluster is set to true, the config contains credentials to the in cluster API server. If isInCluster is set to false, config contains credentials to the supervisor cluster.

func GetKubeConfig

func GetKubeConfig(ctx context.Context) (*restclient.Config, error)

GetKubeConfig helps retrieve Kubernetes Config.

func GetNodeIdFromCSINode

func GetNodeIdFromCSINode(csiNode *storagev1.CSINode) string

GetNodeIdFromCSINode gets the UUID from CSINode object

func GetNodeUUID

func GetNodeUUID(ctx context.Context,
	k8sclient clientset.Interface, nodeName string) (string, error)

GetNodeUUID returns node UUID set by CCM on the Kubernetes Node API object if is set to true. If not set, returns node UUID from K8s CSINode API object.

func GetRestClientConfigForSupervisor

func GetRestClientConfigForSupervisor(ctx context.Context, endpoint string, port string) *restclient.Config

GetRestClientConfigForSupervisor returns restclient config for given endpoint, port, certificate and token.

func NewCSINodeTopologyWatcher

func NewCSINodeTopologyWatcher(ctx context.Context, config *restclient.Config) (*cache.ListWatch, error)

NewCSINodeTopologyWatcher creates a new ListWatch for CSINodeTopology objects given rest client config.

func NewClient

func NewClient(ctx context.Context) (clientset.Interface, error)

NewClient creates a newk8s client based on a service account.

func NewClientForGroup

func NewClientForGroup(ctx context.Context, config *restclient.Config, groupName string) (client.Client, error)

NewClientForGroup creates a new controller-runtime client for a new scheme. The input Group is added to this scheme.

func NewCnsFileAccessConfigWatcher

func NewCnsFileAccessConfigWatcher(ctx context.Context, config *restclient.Config,
	namespace string) (*cache.ListWatch, error)

NewCnsFileAccessConfigWatcher creates a new ListWatch for VirtualMachines given rest client config.

func NewSnapshotterClient

func NewSnapshotterClient(ctx context.Context) (snapshotterClientSet.Interface, error)

NewSnapshotterClient creates a new external-snapshotter client based on a service account.

func NewSupervisorClient

func NewSupervisorClient(ctx context.Context, config *restclient.Config) (clientset.Interface, error)

NewSupervisorClient creates a new supervisor client for given restClient config.

func NewSupervisorSnapshotClient

func NewSupervisorSnapshotClient(ctx context.Context, config *restclient.Config) (
	snapshotterClientSet.Interface, error)

NewSupervisorSnapshotClient creates a new supervisor client for handling snapshot related objects

func NewVirtualMachineWatcher

func NewVirtualMachineWatcher(ctx context.Context, config *restclient.Config,
	namespace string) (*cache.ListWatch, error)

NewVirtualMachineWatcher creates a new ListWatch for VirtualMachines given rest client config.

Types

type InformerManager

type InformerManager struct {
	// contains filtered or unexported fields
}

InformerManager is a service that notifies subscribers about changes to well-defined information in the Kubernetes API server.

func NewInformer

func NewInformer(ctx context.Context, client clientset.Interface, inClusterClnt bool) *InformerManager

NewInformer creates a new K8S client based on a service account. NOTE: This function expects caller function to pass appropriate client as per config to be created Informer for. This function creates shared informer factory against the client provided.

func (*InformerManager) AddCSINodeListener

func (im *InformerManager) AddCSINodeListener(ctx context.Context, add func(obj interface{}),
	update func(oldObj, newObj interface{}), remove func(obj interface{})) error

AddCSINodeListener hooks up add, update, delete callbacks.

func (*InformerManager) AddConfigMapListener

func (im *InformerManager) AddConfigMapListener(ctx context.Context, client clientset.Interface, namespace string,
	add func(obj interface{}), update func(oldObj, newObj interface{}), remove func(obj interface{})) error

AddConfigMapListener hooks up add, update, delete callbacks.

func (*InformerManager) AddNamespaceListener

func (im *InformerManager) AddNamespaceListener(ctx context.Context, add func(obj interface{}),
	update func(oldObj, newObj interface{}), remove func(obj interface{})) error

AddNamespaceListener hooks up add, update, delete callbacks.

func (*InformerManager) AddNodeListener

func (im *InformerManager) AddNodeListener(ctx context.Context, add func(obj interface{}),
	update func(oldObj, newObj interface{}), remove func(obj interface{})) error

AddNodeListener hooks up add, update, delete callbacks.

func (*InformerManager) AddPVCListener

func (im *InformerManager) AddPVCListener(ctx context.Context, add func(obj interface{}),
	update func(oldObj, newObj interface{}), remove func(obj interface{})) error

AddPVCListener hooks up add, update, delete callbacks.

func (*InformerManager) AddPVListener

func (im *InformerManager) AddPVListener(ctx context.Context, add func(obj interface{}),
	update func(oldObj, newObj interface{}), remove func(obj interface{})) error

AddPVListener hooks up add, update, delete callbacks.

func (*InformerManager) AddPodListener

func (im *InformerManager) AddPodListener(ctx context.Context, add func(obj interface{}),
	update func(oldObj, newObj interface{}), remove func(obj interface{})) error

AddPodListener hooks up add, update, delete callbacks.

func (*InformerManager) AddVolumeAttachmentListener

func (im *InformerManager) AddVolumeAttachmentListener(ctx context.Context, add func(obj interface{}),
	update func(oldObj, newObj interface{}), remove func(obj interface{})) error

AddVolumeAttachmentListener hooks up add, update, delete callbacks.

func (*InformerManager) GetConfigMapLister

func (im *InformerManager) GetConfigMapLister() corelisters.ConfigMapLister

GetConfigMapLister returns ConfigMap Lister for the calling informer manager.

func (*InformerManager) GetPVCLister

GetPVCLister returns PVC Lister for the calling informer manager.

func (*InformerManager) GetPVLister

GetPVLister returns PV Lister for the calling informer manager.

func (*InformerManager) GetPodLister

func (im *InformerManager) GetPodLister() corelisters.PodLister

GetPodLister returns Pod Lister for the calling informer manager.

func (*InformerManager) Listen

func (im *InformerManager) Listen() (stopCh <-chan struct{})

Listen starts the Informers.

Jump to

Keyboard shortcuts

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