juicefs

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodTypeKey   = "app.kubernetes.io/name"
	PodTypeValue = "juicefs-mount"
	Finalizer    = "juicefs.com/finalizer"
)

Variables

View Source
var (
	NodeName   = ""
	Namespace  = ""
	PodName    = ""
	MountImage = ""

	MountPointPath       = "/var/lib/juicefs/volume"
	JFSConfigPath        = "/var/lib/juicefs/config"
	JFSMountPriorityName = ""
)
View Source
var FakeClient = &FakeK8sClient{
	PodMap: make(map[string]*corev1.Pod),
	lock:   sync.RWMutex{},
}
View Source
var JLock = sync.RWMutex{}

Functions

func GeneratePodNameByVolumeId added in v0.10.0

func GeneratePodNameByVolumeId(volumeId string) string

func NewMountPod added in v0.10.0

func NewMountPod(podName, cmd, mountPath string, resourceRequirements corev1.ResourceRequirements,
	configs, env map[string]string) *corev1.Pod

Types

type ConfigSecretVolume added in v0.10.0

type ConfigSecretVolume struct {
	SecretName string
	Key        string
	ConfigPath string
}

type FakeK8sClient added in v0.10.3

type FakeK8sClient struct {
	PodMap map[string]*corev1.Pod
	// contains filtered or unexported fields
}

FakeK8sClient creates a new mock k8s client used for testing

func (*FakeK8sClient) CreatePod added in v0.10.3

func (f *FakeK8sClient) CreatePod(pod *corev1.Pod) (*corev1.Pod, error)

func (*FakeK8sClient) DeletePod added in v0.10.3

func (f *FakeK8sClient) DeletePod(pod *corev1.Pod) error

func (*FakeK8sClient) Flush added in v0.10.3

func (f *FakeK8sClient) Flush()

func (*FakeK8sClient) GetPod added in v0.10.3

func (f *FakeK8sClient) GetPod(podName, namespace string) (*corev1.Pod, error)

func (*FakeK8sClient) PatchPod added in v0.10.3

func (f *FakeK8sClient) PatchPod(pod *corev1.Pod, data []byte) error

func (*FakeK8sClient) UpdatePod added in v0.10.3

func (f *FakeK8sClient) UpdatePod(pod *corev1.Pod) error

type Interface

type Interface interface {
	mount.Interface
	JfsMount(volumeID string, target string, secrets, volCtx map[string]string, options []string) (Jfs, error)
	JfsUnmount(mountPath string) error
	DelRefOfMountPod(volumeId, target string) error
	AuthFs(secrets map[string]string) ([]byte, error)
	MountFs(volumeID string, target string, options []string, jfsSetting *JfsSetting) (string, error)
	Version() ([]byte, error)
}

Interface of juicefs provider

func NewJfsProvider

func NewJfsProvider(mounter *mount.SafeFormatAndMount) (Interface, error)

NewJfsProvider creates a provider for JuiceFS file system

type Jfs

type Jfs interface {
	GetBasePath() string
	CreateVol(volumeID, subPath string) (string, error)
	DeleteVol(volumeID string, secrets map[string]string) error
}

Jfs is the interface of a mounted file system

type JfsSetting added in v0.10.0

type JfsSetting struct {
	IsCe bool

	Name    string `json:"name"`
	MetaUrl string `json:"metaurl"`
	Source  string `json:"source"`

	Configs map[string]string `json:"configs"`
	Envs    map[string]string `json:"envs"`

	MountPodCpuLimit   string `json:"mount_pod_cpu_limit"`
	MountPodMemLimit   string `json:"mount_pod_mem_limit"`
	MountPodCpuRequest string `json:"mount_pod_cpu_request"`
	MountPodMemRequest string `json:"mount_pod_mem_request"`
}

func ParseSetting added in v0.10.0

func ParseSetting(secrets, volCtx map[string]string) (*JfsSetting, error)

type K8sClient added in v0.10.0

type K8sClient interface {
	CreatePod(pod *corev1.Pod) (*corev1.Pod, error)
	GetPod(podName, namespace string) (*corev1.Pod, error)
	PatchPod(pod *corev1.Pod, data []byte) error
	UpdatePod(pod *corev1.Pod) error
	DeletePod(pod *corev1.Pod) error
}

func NewClient added in v0.10.0

func NewClient() (K8sClient, error)

Jump to

Keyboard shortcuts

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