Documentation ¶
Index ¶
- func BuildPersistentVolumeClaim(namespace, pvcName, scName, capacity string, ...) (*corev1.PersistentVolumeClaim, error)
- func BuildPod(namespace, podName, pvcName string, labelselector map[string]string) (*corev1.Pod, error)
- type Operations
- func (ops *Operations) BuildAndDeployBusyBoxPod(appName, pvcName, namespace string, labels map[string]string) (*appsv1.Deployment, error)
- func (ops *Operations) CheckPodStatusEventually(namespace, podName string, expectedPodPhase corev1.PodPhase) corev1.PodPhase
- func (ops *Operations) DeletePersistentVolumeClaim(name, namespace string)
- func (ops *Operations) ExecPod(opts *Options) (string, string, error)
- func (ops *Operations) ExecuteCMDEventually(podObj *corev1.Pod, containerName, cmd string, expectStdout bool) string
- func (ops *Operations) GetBDCCount(lSelector, namespace string) int
- func (ops *Operations) GetBDCCountEventually(listOptions metav1.ListOptions, expectedBDCCount int, namespace string) int
- func (ops *Operations) GetBDNameFromBDCName(bdcName, namespace string) string
- func (ops *Operations) GetNdmConfigMap(clientset *kubernetes.Clientset, namespace string, ...) (*corev1.ConfigMap, error)
- func (ops *Operations) GetNodeAffinityLabelKeysFromPv(pvName string) ([]string, error)
- func (ops *Operations) GetPVNameFromPVCName(namespace, pvcName string) string
- func (ops *Operations) GetPodCompletedCount(namespace, lselector string) int
- func (ops *Operations) GetPodCompletedCountEventually(namespace, lselector string, expectedPodCount int) int
- func (ops *Operations) GetPodCount(namespace, lselector string) int
- func (ops *Operations) GetPodCountEventually(namespace, lselector string, predicateList pod.PredicateList, ...) int
- func (ops *Operations) GetPodList(namespace, lselector string, predicateList pod.PredicateList) *pod.PodList
- func (ops *Operations) GetPodRunningCount(namespace, lselector string) int
- func (ops *Operations) GetPodRunningCountEventually(namespace, lselector string, expectedPodCount int) int
- func (ops *Operations) GetReadyNodes() *corev1.NodeList
- func (ops *Operations) GetSVCClusterIP(ns, lselector string) ([]string, error)
- func (ops *Operations) IsBDCDeletedEventually(bdcName, namespace string) bool
- func (ops *Operations) IsBdCleanedUpEventually(namespace, bdName, bdcName string) bool
- func (ops *Operations) IsFinalizerExistsOnBDC(bdcName, finalizer string) bool
- func (ops *Operations) IsNdmPrerequisiteMet(namespace string, ndmLabelSelector string, ndmOperatorLabelSelector string) bool
- func (ops *Operations) IsPVCBound(namespace, pvcName string) bool
- func (ops *Operations) IsPVCBoundEventually(namespace string, pvcName string) bool
- func (ops *Operations) IsPVCDeleted(pvcName, namespace string) bool
- func (ops *Operations) IsPVCDeletedEventually(pvcName, namespace string) bool
- func (ops *Operations) IsPVDeleted(pvName string) bool
- func (ops *Operations) IsPVDeletedEventually(pvName string) bool
- func (ops *Operations) IsPodDeletedEventually(namespace, podName string) bool
- func (ops *Operations) IsPodRunningEventually(namespace, podName string) bool
- func (ops *Operations) PathFilterExclude(option PathFilterOption, namespace string, ndmConfigLabelSelector string, ...) error
- func (ops *Operations) PodDeleteCollection(ns string, lopts metav1.ListOptions) error
- func (ops *Operations) VerifyCapacity(namespace, pvcName, capacity string) bool
- type OperationsOptions
- type Options
- type PathFilterOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPersistentVolumeClaim ¶
func BuildPersistentVolumeClaim(namespace, pvcName, scName, capacity string, accessModes []corev1.PersistentVolumeAccessMode) (*corev1.PersistentVolumeClaim, error)
BuildPersistentVolumeClaim builds the PVC object
Types ¶
type Operations ¶
type Operations struct { KubeClient *kubeclient.Client NodeClient *node.Kubeclient EventClient *event.KubeClient PodClient *pod.KubeClient PVCClient *pvc.Kubeclient PVClient *pv.Kubeclient SCClient *sc.Kubeclient NSClient *ns.Kubeclient SVCClient *svc.Kubeclient UnstructClient *unstruct.Kubeclient DeployClient *deploy.Kubeclient BDClient *bd.Kubeclient BDCClient *bdc.Kubeclient KubeConfigPath string NameSpace string Config interface{} }
Operations provides clients amd methods to perform operations
func NewOperations ¶
func NewOperations(opts ...OperationsOptions) *Operations
NewOperations returns a new instance of kubeclient meant for cstor volume replica operations
func (*Operations) BuildAndDeployBusyBoxPod ¶
func (ops *Operations) BuildAndDeployBusyBoxPod( appName, pvcName, namespace string, labels map[string]string) (*appsv1.Deployment, error)
func (*Operations) CheckPodStatusEventually ¶
func (ops *Operations) CheckPodStatusEventually(namespace, podName string, expectedPodPhase corev1.PodPhase) corev1.PodPhase
CheckPodStatusEventually gives the phase of the pod eventually
func (*Operations) DeletePersistentVolumeClaim ¶
func (ops *Operations) DeletePersistentVolumeClaim(name, namespace string)
DeletePersistentVolumeClaim deletes PVC from cluster based on provided argument
func (*Operations) ExecPod ¶
func (ops *Operations) ExecPod(opts *Options) (string, string, error)
func (ops *Operations) GetBDCStatusAfterAge(bdcName string, namespace string, untilAge time.Duration) bdcExitStatus { bdcObj, err := ops.BDCClient.WithNamespace(namespace).Get(context.TODO(), bdcName, metav1.GetOptions{}) Expect(err).To( BeNil(), "when geting BDC {%s} initally to calculate Age", bdcName, ) initialCreationTimestamp := bdcObj.CreationTimestamp.Time untilTimestamp := initialCreationTimestamp.Add(untilAge) time.Sleep(time.Until(untilTimestamp)) bdcObj, err = ops.BDCClient.WithNamespace(namespace).Get(context.TODO(), bdcName, metav1.GetOptions{}) finalCreationTimestamp := bdcObj.CreationTimestamp.Time if isNotFound(err) || finalCreationTimestamp.After(initialCreationTimestamp) { return deleted } else if bdcObj.Status.Phase == "Pending" { return pending } else if bdcObj.Status.Phase == "Bound" { return bound } else { return invalid } }
ExecPod executes arbitrary command inside the pod
func (*Operations) ExecuteCMDEventually ¶
func (ops *Operations) ExecuteCMDEventually( podObj *corev1.Pod, containerName, cmd string, expectStdout bool, ) string
ExecuteCMDEventually executes the command on pod container and returns stdout
func (*Operations) GetBDCCount ¶
func (ops *Operations) GetBDCCount(lSelector, namespace string) int
GetBDCCount gets BDC resource count based on provided label selector
func (*Operations) GetBDCCountEventually ¶
func (ops *Operations) GetBDCCountEventually(listOptions metav1.ListOptions, expectedBDCCount int, namespace string) int
GetBDCCountEventually gets BDC resource count based on provided list option.
func (*Operations) GetBDNameFromBDCName ¶
func (ops *Operations) GetBDNameFromBDCName(bdcName, namespace string) string
func (*Operations) GetNdmConfigMap ¶
func (ops *Operations) GetNdmConfigMap( clientset *kubernetes.Clientset, namespace string, ndmConfigLabelSelector string, ) (*corev1.ConfigMap, error)
func (*Operations) GetNodeAffinityLabelKeysFromPv ¶
func (ops *Operations) GetNodeAffinityLabelKeysFromPv(pvName string) ([]string, error)
GetNodeAffinityLabelKeysFromPv returns the label keys for NodeSelector MatchExpressions in a PV.
func (*Operations) GetPVNameFromPVCName ¶
func (ops *Operations) GetPVNameFromPVCName(namespace, pvcName string) string
GetPVNameFromPVCName gives the pv name for the given pvc
func (*Operations) GetPodCompletedCount ¶
func (ops *Operations) GetPodCompletedCount(namespace, lselector string) int
GetPodCompletedCount gives number of pods running currently
func (*Operations) GetPodCompletedCountEventually ¶
func (ops *Operations) GetPodCompletedCountEventually(namespace, lselector string, expectedPodCount int) int
GetPodCompletedCountEventually gives the number of pods running eventually
func (*Operations) GetPodCount ¶
func (ops *Operations) GetPodCount(namespace, lselector string) int
GetPodCount gives number of current pods
func (*Operations) GetPodCountEventually ¶
func (ops *Operations) GetPodCountEventually( namespace, lselector string, predicateList pod.PredicateList, expectedCount int) int
GetPodCountEventually returns the no.of pods exists with specified labelselector
func (*Operations) GetPodList ¶
func (ops *Operations) GetPodList(namespace, lselector string, predicateList pod.PredicateList) *pod.PodList
GetPodList gives list of running pods for given namespace + label
func (*Operations) GetPodRunningCount ¶
func (ops *Operations) GetPodRunningCount(namespace, lselector string) int
GetPodRunningCount gives number of pods running currently
func (*Operations) GetPodRunningCountEventually ¶
func (ops *Operations) GetPodRunningCountEventually(namespace, lselector string, expectedPodCount int) int
GetPodRunningCountEventually gives the number of pods running eventually
func (*Operations) GetReadyNodes ¶
func (ops *Operations) GetReadyNodes() *corev1.NodeList
GetReadyNodes gives cstorvolumereplica healthy count currently based on selecter
func (*Operations) GetSVCClusterIP ¶
func (ops *Operations) GetSVCClusterIP(ns, lselector string) ([]string, error)
GetSVCClusterIP returns list of IP address of the services, having given label and namespace
func (*Operations) IsBDCDeletedEventually ¶
func (ops *Operations) IsBDCDeletedEventually(bdcName, namespace string) bool
IsBDCDeletedEventually tries to get the deleted BDC and returns true if BDC is not found else returns false
func (*Operations) IsBdCleanedUpEventually ¶
func (ops *Operations) IsBdCleanedUpEventually(namespace, bdName, bdcName string) bool
IsBdCleanedUpEventually tries to get the deleted BDC and returns true if BDC is not found else returns false
func (*Operations) IsFinalizerExistsOnBDC ¶
func (ops *Operations) IsFinalizerExistsOnBDC(bdcName, finalizer string) bool
IsFinalizerExistsOnBDC returns true if the object with provided name contains the finalizer.
func (*Operations) IsNdmPrerequisiteMet ¶
func (ops *Operations) IsNdmPrerequisiteMet( namespace string, ndmLabelSelector string, ndmOperatorLabelSelector string, ) bool
This function returns true if: 1. The Pod count for the NDM Daemonset Pod, the NDM Operator are greater than 1 2. Only a single blockdevice without a filesystem in Unclaimed and Active state is available
func (*Operations) IsPVCBound ¶
func (ops *Operations) IsPVCBound(namespace, pvcName string) bool
IsPVCBound checks if the pvc is bound or not
func (*Operations) IsPVCBoundEventually ¶
func (ops *Operations) IsPVCBoundEventually(namespace string, pvcName string) bool
IsPVCBoundEventually checks if the pvc is bound or not eventually
func (*Operations) IsPVCDeleted ¶
func (ops *Operations) IsPVCDeleted(pvcName, namespace string) bool
IsPVCDeleted tries to get the deleted pvc and returns true if pvc is not found else returns false
func (*Operations) IsPVCDeletedEventually ¶
func (ops *Operations) IsPVCDeletedEventually(pvcName, namespace string) bool
IsPVCDeletedEventually tries to get the deleted pvc and returns true if pvc is not found else returns false
func (*Operations) IsPVDeleted ¶
func (ops *Operations) IsPVDeleted(pvName string) bool
IsPVDeleted tries to get the deleted pvc and returns true if PV is not found else returns false
func (*Operations) IsPVDeletedEventually ¶
func (ops *Operations) IsPVDeletedEventually(pvName string) bool
IsPVDeletedEventually tries to get the deleted pvc and returns true if PV is not found else returns false
func (*Operations) IsPodDeletedEventually ¶
func (ops *Operations) IsPodDeletedEventually(namespace, podName string) bool
IsPodDeletedEventually checks if the pod is deleted or not eventually
func (*Operations) IsPodRunningEventually ¶
func (ops *Operations) IsPodRunningEventually(namespace, podName string) bool
IsPodRunningEventually return true if the pod comes to running state
func (*Operations) PathFilterExclude ¶
func (ops *Operations) PathFilterExclude( option PathFilterOption, namespace string, ndmConfigLabelSelector string, ndmLabelSelector string, diskPath string, ) error
func (*Operations) PodDeleteCollection ¶
func (ops *Operations) PodDeleteCollection(ns string, lopts metav1.ListOptions) error
PodDeleteCollection deletes all the pods in a namespace matched the given labelselector
func (*Operations) VerifyCapacity ¶
func (ops *Operations) VerifyCapacity(namespace, pvcName, capacity string) bool
VerifyCapacity checks if the pvc capacity has been updated
type OperationsOptions ¶
type OperationsOptions func(*Operations)
OperationsOptions abstracts creating an instance of operations
func WithKubeConfigPath ¶
func WithKubeConfigPath(path string) OperationsOptions
WithKubeConfigPath sets the kubeConfig path against operations instance
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options holds the args used for exec'ing into the pod
func (*Options) WithCommand ¶
WithCommand fills the cmd field in Options struct
func (*Options) WithContainer ¶
WithContainer fills the container field in Options struct
func (*Options) WithNamespace ¶
WithNamespace fills the namespace field in Options struct
func (*Options) WithPodName ¶
WithPodName fills the podName field in Options struct
type PathFilterOption ¶
type PathFilterOption string
NDM Path-Filter options
const ( APPEND PathFilterOption = "Append" REMOVE PathFilterOption = "Remove" )