client

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOutofClusterKubeConfig

func GetOutofClusterKubeConfig()

GetOutofClusterKubeConfig creates returns a clientset for the kubeconfig & sets the env variable for the same

Types

type K8sAPIVersion

type K8sAPIVersion string

K8sAPIVersion represents valid kubernetes api version of a native or custom resource

type K8sClient

type K8sClient struct {
	// Ns refers to K8s namespace where the operation
	// will be performed
	Ns string
	// K8sCS refers to the Clientset capable of communicating
	// with the K8s cluster
	K8sCS kubernetes.Interface
	// OpenebsClientset capable of accessing the OpenEBS
	// components
	OpenebsCS openebsclientset.Interface
	// LVMCS is the client for accessing OpenEBS LVM components
	LVMCS lvmclient.Interface
	// ZFCS is the client for accessing OpenEBS ZFS components
	ZFCS zfsclient.Interface
}

K8sClient provides the necessary utility to operate over various K8s Kind objects

func NewK8sClient

func NewK8sClient(ns string) (*K8sClient, error)

NewK8sClient creates a new K8sClient TODO: improve K8sClientset instantiation. for example remove the Ns from K8sClient struct

func (K8sClient) GetBD

func (k K8sClient) GetBD(bd string) (*v1alpha1.BlockDevice, error)

GetBD returns the BlockDevice passed as name with OpenEBS's Client

func (K8sClient) GetBDCs added in v0.3.0

func (k K8sClient) GetBDCs(bdcNames []string, labelselector string) (*v1alpha1.BlockDeviceClaimList, error)

GetBDCs returns a list of BlockDeviceClaims based on the values of bdcNames slice. bdcNames slice if is nil or empty, it returns all the BDCs in the cluster. bdcNames slice if is not nil or not empty, it return the BDCs whose names are present in the slice. labelselector takes the label(key+value) and makes an api call with this filter applied. Can be empty string if label filtering is not needed.

func (K8sClient) GetBDs

func (k K8sClient) GetBDs(bdNames []string, labelselector string) (*v1alpha1.BlockDeviceList, error)

GetBDs returns a list of BlockDevices based on the values of bdNames slice. bdNames slice if is nil or empty, it returns all the BDs in the cluster. bdNames slice if is not nil or not empty, it return the BDs whose names are present in the slice. labelselector takes the label(key+value) and makes an api call with this filter applied. Can be empty string if label filtering is not needed.

func (K8sClient) GetCSIControllerSTS

func (k K8sClient) GetCSIControllerSTS(name string) (*appsv1.StatefulSet, error)

GetCSIControllerSTS returns the CSI controller sts with a specific openebs-component-name label key

func (K8sClient) GetCSPC added in v0.3.0

func (k K8sClient) GetCSPC(poolName string) (*cstorv1.CStorPoolCluster, error)

GetCSPC returns the CStorPoolCluster for cStor volume using the poolName passed.

func (K8sClient) GetCSPI

func (k K8sClient) GetCSPI(poolName string) (*cstorv1.CStorPoolInstance, error)

GetCSPI returns the CStorPoolInstance for cStor volume using the poolName passed.

func (K8sClient) GetCSPIs

func (k K8sClient) GetCSPIs(cspiNames []string, labelselector string) (*cstorv1.CStorPoolInstanceList, error)

GetCSPIs returns a list of CStorPoolInstances based on the values of cspiNames slice cspiNames slice if is nil or empty, it returns all the CSPIs in the cluster cspiNames slice if is not nil or not empty, it return the CSPIs whose names are present in the slice labelselector takes the label(key+value) and makes an api call with this filter applied. Can be empty string if label filtering is not needed.

func (K8sClient) GetCV

func (k K8sClient) GetCV(volName string) (*cstorv1.CStorVolume, error)

GetCV returns the CStorVolume passed as name with OpenEBS's Client

func (K8sClient) GetCVA

func (k K8sClient) GetCVA(labelSelector string) (*cstorv1.CStorVolumeAttachment, error)

GetCVA returns the CStorVolumeAttachment, corresponding to the label passed. Ex:- labelSelector: {cstortypes.PersistentVolumeLabelKey + "=" + pvName}

func (K8sClient) GetCVAs

GetCVAs returns a list or map of CStorVolumeAttachments based on the values of options. rType takes the return type of the method, can either be List or Map. labelselector takes the label(key+value) and makes a api call with this filter applied, can be empty string if label filtering is not needed. options takes a MapOptions object which defines how to create a map, refer to types for more info. Can be empty in case of rType is List. Only one type can be returned at a time, please define the other type as '_' while calling.

func (K8sClient) GetCVBackups

func (k K8sClient) GetCVBackups(labelselector string) (*cstorv1.CStorBackupList, error)

GetCVBackups returns the CStorVolumeBackup, corresponding to the label passed. Ex:- labelSelector: {cstortypes.PersistentVolumeLabelKey + "=" + pvName}

func (K8sClient) GetCVC

func (k K8sClient) GetCVC(name string) (*cstorv1.CStorVolumeConfig, error)

GetCVC returns the CStorVolumeConfig for cStor volume using the PV/CV/CVC name.

func (K8sClient) GetCVCompletedBackups

func (k K8sClient) GetCVCompletedBackups(labelselector string) (*cstorv1.CStorCompletedBackupList, error)

GetCVCompletedBackups returns the CStorCompletedBackups, corresponding to the label passed. Ex:- labelSelector: {cstortypes.PersistentVolumeLabelKey + "=" + pvName}

func (K8sClient) GetCVInfoMap

func (k K8sClient) GetCVInfoMap() (map[string]*util.Volume, error)

GetCVInfoMap returns a Volume object, filled using corresponding CVA and PV.

func (K8sClient) GetCVRestores

func (k K8sClient) GetCVRestores(labelselector string) (*cstorv1.CStorRestoreList, error)

GetCVRestores returns the CStorRestores, corresponding to the label passed. Ex:- labelSelector: {cstortypes.PersistentVolumeLabelKey + "=" + pvName}

func (K8sClient) GetCVRs

func (k K8sClient) GetCVRs(labelselector string) (*cstorv1.CStorVolumeReplicaList, error)

GetCVRs returns the list CStorVolumeReplica, corresponding to the label passed. For ex:- labelselector : {"cstorvolume.openebs.io/name" + "=" + name} , {"cstorpoolinstance.openebs.io/name" + "=" + poolName}

func (K8sClient) GetCVTargetPod

func (k K8sClient) GetCVTargetPod(volumeClaim string, volumeName string) (*corev1.Pod, error)

GetCVTargetPod returns the Cstor Volume Target Pod, corresponding to the volumeClaim and volumeName.

func (K8sClient) GetCVs

func (k K8sClient) GetCVs(volNames []string, rType util.ReturnType, labelSelector string, options util.MapOptions) (*cstorv1.CStorVolumeList, map[string]cstorv1.CStorVolume, error)

GetCVs returns a list or map of CStorVolumes based on the values of volNames slice, and options. volNames slice if is nil or empty, it returns all the CVs in the cluster. volNames slice if is not nil or not empty, it return the CVs whose names are present in the slice. rType takes the return type of the method, can be either List or Map. labelselector takes the label(key+value) and makes an api call with this filter applied, can be empty string if label filtering is not needed. options takes a MapOptions object which defines how to create a map, refer to types for more info. Can be empty in case of rType is List. Only one type can be returned at a time, please define the other type as '_' while calling.

func (K8sClient) GetDeploymentList added in v0.4.0

func (k K8sClient) GetDeploymentList(labelSelector string) (*appsv1.DeploymentList, error)

GetDeploymentList returns the deployment-list with a specific label selector query

func (K8sClient) GetEvents added in v0.3.0

func (k K8sClient) GetEvents(fieldSelector string) (*corev1.EventList, error)

GetEvents returns the corev1 events based on the fieldSelectors

func (K8sClient) GetJV

func (k K8sClient) GetJV(jv string) (*jiva.JivaVolume, error)

GetJV returns the JivaVolume passed as name with REST Client

func (K8sClient) GetJVTargetPod

func (k K8sClient) GetJVTargetPod(volumeName string) (*corev1.PodList, error)

GetJVTargetPod returns the Jiva Volume Controller and Replica Pods, corresponding to the volumeName.

func (K8sClient) GetJVs

func (k K8sClient) GetJVs(volNames []string, rType util.ReturnType, labelSelector string, options util.MapOptions) (*jiva.JivaVolumeList, map[string]jiva.JivaVolume, error)

GetJVs returns a list or map of JivaVolumes based on the values of volNames slice, and options. volNames slice if is nil or empty, it returns all the JVs in the cluster. volNames slice if is not nil or not empty, it return the JVs whose names are present in the slice. rType takes the return type of the method, can either List or Map. labelselector takes the label(key+value) and makes an api call with this filter applied, can be empty string if label filtering is not needed. options takes a MapOptions object which defines how to create a map, refer to types for more info. Can be empty in case of rType is List. Only one type can be returned at a time, please define the other type as '_' while calling.

func (K8sClient) GetLVMNodes

func (k K8sClient) GetLVMNodes(lVols []string, rType util.ReturnType, labelSelector string, options util.MapOptions) (*lvm.LVMNodeList, map[string]lvm.LVMNode, error)

GetLVMNodes return a list or map of LVMNodes or an error

func (K8sClient) GetLVMvol

func (k K8sClient) GetLVMvol(lVols []string, rType util.ReturnType, labelSelector string, options util.MapOptions) (*lvm.LVMVolumeList, map[string]lvm.LVMVolume, error)

GetLVMvol returns a list or a map of LVMVolume depending upon rType & options

func (K8sClient) GetOpenEBSNamespace

func (k K8sClient) GetOpenEBSNamespace(casType string) (string, error)

GetOpenEBSNamespace from the specific engine component based on cas-type NOTE: This will not work correctly if CSI controller pod runs in kube-system NS

func (K8sClient) GetOpenEBSNamespaceMap

func (k K8sClient) GetOpenEBSNamespaceMap() (map[string]string, error)

GetOpenEBSNamespaceMap maps the cas-type to it's namespace, e.g. n[cstor] = cstor-ns NOTE: This will not work correctly if CSI controller pod runs in kube-system NS

func (K8sClient) GetPV

func (k K8sClient) GetPV(name string) (*corev1.PersistentVolume, error)

GetPV returns a PersistentVolume object using the pv name passed.

func (K8sClient) GetPVC

func (k K8sClient) GetPVC(name string, namespace string) (*corev1.PersistentVolumeClaim, error)

GetPVC returns a PersistentVolumeClaim object using the pvc name passed.

func (K8sClient) GetPVCs

func (k K8sClient) GetPVCs(namespace string, pvcNames []string, labelselector string) (*corev1.PersistentVolumeClaimList, error)

GetPVCs returns a list of PersistentVolumeClaims based on the values of pvcNames slice. namespace takes the namespace in which PVCs are present. pvcNames slice if is nil or empty, it returns all the PVCs in the cluster, in the namespace. pvcNames slice if is not nil or not empty, it return the PVCs whose names are present in the slice, in the namespace. labelselector takes the label(key+value) and makes an api call with this filter applied. Can be empty string if label filtering is not needed.

func (K8sClient) GetPVs

func (k K8sClient) GetPVs(volNames []string, labelselector string) (*corev1.PersistentVolumeList, error)

GetPVs returns a list of PersistentVolumes based on the values of volNames slice. volNames slice if is nil or empty, it returns all the PVs in the cluster. volNames slice if is not nil or not empty, it return the PVs whose names are present in the slice. labelselector takes the label(key+value) and makes an api call with this filter applied. Can be empty string if label filtering is not needed.

func (K8sClient) GetPods added in v0.4.0

func (k K8sClient) GetPods(labelSelector string, fieldSelector string, namespace string) (*corev1.PodList, error)

GetPods returns the corev1 Pods based on the label and field selectors

func (K8sClient) GetSC

func (k K8sClient) GetSC(scName string) (*v1.StorageClass, error)

GetSC returns a StorageClass object using the scName passed.

func (K8sClient) GetVersionMapOfComponents added in v0.4.0

func (k K8sClient) GetVersionMapOfComponents() (map[string]string, error)

Get Versions of different components running in K8s

func (K8sClient) GetZFSNodes

func (k K8sClient) GetZFSNodes(volNames []string, rType util.ReturnType, labelSelector string, options util.MapOptions) (*zfs.ZFSNodeList, map[string]zfs.ZFSNode, error)

GetZFSNodes return a list of ZFSNodes

func (K8sClient) GetZFSVols

func (k K8sClient) GetZFSVols(volNames []string, rType util.ReturnType, labelSelector string, options util.MapOptions) (*zfs.ZFSVolumeList, map[string]zfs.ZFSVolume, error)

GetZFSVols returns a list or a map of ZFSVolume depending upon rType & options

Jump to

Keyboard shortcuts

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