client

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 19 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
	// 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

NewK8sClient is a wrapper around newK8sClient to handle errors in creating clients implicitilty and simulating namespace as an optional parameter ns: kubernetes namespace

func (K8sClient) GetAllPods added in v0.5.0

func (k K8sClient) GetAllPods(namespace string) (*corev1.PodList, error)

GetAllPods returns all corev1 Pods

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) 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) 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) GetNodes added in v0.5.0

func (k K8sClient) GetNodes(nodes []string, label, field string) (*corev1.NodeList, error)

GetNodes returns a list of nodes with the name of nodes

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[zfs] = zfs-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)

* CORE RESOURCES

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

func (K8sClient) GetPvByCasType added in v0.5.0

func (k K8sClient) GetPvByCasType(casTypes []string, labelselector string) (*corev1.PersistentVolumeList, error)

GetPvByCasType returns a list of PersistentVolumes based on cas-type slice casTypes slice if is nil or empty, it returns all the PVs in the cluster. casTypes slice if is not nil or not empty, it return the PVs with cas-types 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) 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