k8s

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PFSPrefix = "pfs-"
	PVCSuffix = "-pvc"
)

Variables

This section is empty.

Functions

func GetBmlVolumeIDByPVCName

func GetBmlVolumeIDByPVCName(claimName string) string

Types

type K8SClient

type K8SClient struct {
	Clientset kubernetes.Interface
	Config    *rest.Config
}

func New

func New(k8sConfigPath string, k8sClientTimeout int) (*K8SClient, error)

func (*K8SClient) CreatePod

func (c *K8SClient) CreatePod(pod *v1.Pod) (*v1.Pod, error)

func (*K8SClient) DeletePod

func (c *K8SClient) DeletePod(pod *v1.Pod) error

func (*K8SClient) GetPersistentVolumeClaim

func (c *K8SClient) GetPersistentVolumeClaim(namespace, name string,
	getOptions metav1.GetOptions) (*v1.PersistentVolumeClaim, error)

func (*K8SClient) GetPod

func (c *K8SClient) GetPod(podName, namespace string) (*v1.Pod, error)

func (*K8SClient) GetPodLog

func (c *K8SClient) GetPodLog(podName, namespace, containerName string) (string, error)

func (*K8SClient) ListPersistentVolume

func (c *K8SClient) ListPersistentVolume(listOptions metav1.ListOptions) (*v1.PersistentVolumeList, error)

func (*K8SClient) ProxyGetPods

func (c *K8SClient) ProxyGetPods(nodeID string) (result *v1.PodList, err error)

ProxyGetPods returns all pods on the node with nodeName, and the api server will forward this request to the kubelet proxy on the node. Therefore, the pods information comes from kubelet cache, not etcd

type K8SInterface

type K8SInterface interface {
	ProxyGetPods(nodeID string) (result *v1.PodList, err error)
	GetPersistentVolumeClaim(namespace, name string,
		getOptions metav1.GetOptions) (*v1.PersistentVolumeClaim, error)
	ListPersistentVolume(listOptions metav1.ListOptions) (*v1.PersistentVolumeList, error)
	CreatePod(pod *v1.Pod) (*v1.Pod, error)
	GetPod(podName, namespace string) (*v1.Pod, error)
	GetPodLog(podName, namespace, containerName string) (string, error)
	DeletePod(pod *v1.Pod) error
}

func GetK8sClient

func GetK8sClient() (K8SInterface, error)

type VolumeMount

type VolumeMount struct {
	// POD UID is the unique in time and space value for the Pod
	PodUID string

	// PFSID is the unique identifies for volume in paddle flow storage service
	PFSID string

	// VolumeName is the PV's name
	VolumeName string

	// ClaimName is the PVC's name
	ClaimName string

	// ReadOnly which setting in pod's volumes
	ReadOnly bool
}

VolumeMount is a struct that contains volume information and its mounts in the pod spec

func GetVolumeMounts

func GetVolumeMounts(pod *v1.Pod) []VolumeMount

GetVolumeMounts Get volume mounts information from the pod spec

Jump to

Keyboard shortcuts

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