kubernetes

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 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 added in v2.5.0

func GetNodeIdFromCSINode(csiNode *storagev1.CSINode) string

GetNodeIdFromCSINode gets the UUID from CSINode object

func GetNodeUUID added in v2.5.0

func GetNodeUUID(ctx context.Context,
	k8sclient clientset.Interface, nodeName string,
	useK8sCSINodeObj bool) (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 added in v2.7.0

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(client clientset.Interface) *InformerManager

NewInformer creates a new K8S client based on a service account.

func (*InformerManager) AddCSINodeListener added in v2.5.0

func (im *InformerManager) AddCSINodeListener(
	add func(obj interface{}), update func(oldObj, newObj interface{}), remove func(obj interface{}))

AddCSINodeNodeListener 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{}))

AddConfigMapListener hooks up add, update, delete callbacks.

func (*InformerManager) AddNamespaceListener

func (im *InformerManager) AddNamespaceListener(
	add func(obj interface{}), update func(oldObj, newObj interface{}), remove func(obj interface{}))

AddNamespaceListener hooks up add, update, delete callbacks.

func (*InformerManager) AddNodeListener

func (im *InformerManager) AddNodeListener(
	add func(obj interface{}), update func(oldObj, newObj interface{}), remove func(obj interface{}))

AddNodeListener hooks up add, update, delete callbacks.

func (*InformerManager) AddPVCListener

func (im *InformerManager) AddPVCListener(
	add func(obj interface{}), update func(oldObj, newObj interface{}), remove func(obj interface{}))

AddPVCListener hooks up add, update, delete callbacks.

func (*InformerManager) AddPVListener

func (im *InformerManager) AddPVListener(
	add func(obj interface{}), update func(oldObj, newObj interface{}), remove func(obj interface{}))

AddPVListener hooks up add, update, delete callbacks.

func (*InformerManager) AddPodListener

func (im *InformerManager) AddPodListener(
	add func(obj interface{}), update func(oldObj, newObj interface{}), remove func(obj interface{}))

AddPodListener hooks up add, update, delete callbacks.

func (*InformerManager) AddVolumeAttachmentListener added in v2.6.0

func (im *InformerManager) AddVolumeAttachmentListener(
	add func(obj interface{}), update func(oldObj, newObj interface{}), remove func(obj interface{}))

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