config

package
v0.23.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DriverName to be registered
	CSINodeLabelKey      = "app"
	CSINodeLabelValue    = "juicefs-csi-node"
	PodTypeKey           = "app.kubernetes.io/name"
	PodTypeValue         = "juicefs-mount"
	PodUniqueIdLabelKey  = "volume-id"
	PodJuiceHashLabelKey = "juicefs-hash"
	Finalizer            = "juicefs.com/finalizer"
	JuiceFSUUID          = "juicefs-uuid"
	UniqueId             = "juicefs-uniqueid"
	CleanCache           = "juicefs-clean-cache"
	MountContainerName   = "jfs-mount"
	JobTypeValue         = "juicefs-job"
	JfsInsideContainer   = "JFS_INSIDE_CONTAINER"

	// CSI Secret
	ProvisionerSecretName           = "csi.storage.k8s.io/provisioner-secret-name"
	ProvisionerSecretNamespace      = "csi.storage.k8s.io/provisioner-secret-namespace"
	PublishSecretName               = "csi.storage.k8s.io/node-publish-secret-name"
	PublishSecretNamespace          = "csi.storage.k8s.io/node-publish-secret-namespace"
	ControllerExpandSecretName      = "csi.storage.k8s.io/controller-expand-secret-name"
	ControllerExpandSecretNamespace = "csi.storage.k8s.io/controller-expand-secret-namespace"

	// webhook
	WebhookName = "juicefs-admission-webhook"
	True        = "true"
	False       = "false"

	InjectSidecarDone    = "done" + injectSidecar
	InjectSidecarDisable = "disable" + injectSidecar

	// config in pv
	MountPodCpuLimitKey   = "juicefs/mount-cpu-limit"
	MountPodMemLimitKey   = "juicefs/mount-memory-limit"
	MountPodCpuRequestKey = "juicefs/mount-cpu-request"
	MountPodMemRequestKey = "juicefs/mount-memory-request"

	// DeleteDelayTimeKey mount pod annotation
	DeleteDelayTimeKey = "juicefs-delete-delay"
	DeleteDelayAtKey   = "juicefs-delete-at"

	// default value
	DefaultMountPodCpuLimit   = "2000m"
	DefaultMountPodMemLimit   = "5Gi"
	DefaultMountPodCpuRequest = "1000m"
	DefaultMountPodMemRequest = "1Gi"
)

Variables

View Source
var (
	WebPort            = MustGetWebPort() // web port used by metrics
	ByProcess          = false            // csi driver runs juicefs in process or not
	FormatInPod        = false            // put format/auth in pod (only in k8s)
	Provisioner        = false            // provisioner in controller
	CacheClientConf    = false            // cache client config files and use directly in mount containers
	MountManager       = false            // manage mount pod in controller (only in k8s)
	Webhook            = false            // inject juicefs client as sidecar in pod (only in k8s)
	ValidatingWebhook  = false            // start validating webhook, applicable to ee only
	Immutable          = false            // csi driver is running in an immutable environment
	EnableNodeSelector = false            // arrange mount pod to node with node selector instead nodeName

	DriverName               = "csi.juicefs.com"
	NodeName                 = ""
	Namespace                = ""
	PodName                  = ""
	CEMountImage             = "juicedata/mount:ce-nightly" // mount pod ce image
	EEMountImage             = "juicedata/mount:ee-nightly" // mount pod ee image
	MountLabels              = ""
	HostIp                   = ""
	KubeletPort              = ""
	ReconcileTimeout         = 5 * time.Minute
	ReconcilerInterval       = 5
	SecretReconcilerInterval = 1 * time.Hour

	CSIPod = corev1.Pod{}

	MountPointPath           = "/var/lib/juicefs/volume"
	JFSConfigPath            = "/var/lib/juicefs/config"
	JFSMountPriorityName     = "system-node-critical"
	JFSMountPreemptionPolicy = ""

	TmpPodMountBase       = "/tmp"
	PodMountBase          = "/jfs"
	MountBase             = "/var/lib/jfs"
	FsType                = "juicefs"
	CliPath               = "/usr/bin/juicefs"
	CeCliPath             = "/usr/local/bin/juicefs"
	CeMountPath           = "/bin/mount.juicefs"
	JfsMountPath          = "/sbin/mount.juicefs"
	DefaultClientConfPath = "/root/.juicefs"
	ROConfPath            = "/etc/juicefs"
)
View Source
var PodLocks [1024]sync.Mutex

Functions

func GetPodLock

func GetPodLock(podName string) *sync.Mutex

func MustGetWebPort added in v0.23.4

func MustGetWebPort() int

func ParsePodResources added in v0.23.4

func ParsePodResources(cpuLimit, memoryLimit, cpuRequest, memoryRequest string) (corev1.ResourceRequirements, error)

func ParseYamlOrJson added in v0.23.4

func ParseYamlOrJson(source string, dst interface{}) error

Types

type AppInfo added in v0.21.0

type AppInfo struct {
	Name      string
	Namespace string
}

info of app pod

func ParseAppInfo added in v0.21.0

func ParseAppInfo(volCtx map[string]string) (*AppInfo, error)

type CacheEmptyDir added in v0.23.1

type CacheEmptyDir struct {
	Medium    string
	SizeLimit resource.Quantity
	Path      string
}

type CacheInlineVolume added in v0.23.1

type CacheInlineVolume struct {
	CSI  *corev1.CSIVolumeSource
	Path string
}

type CachePVC added in v0.15.1

type CachePVC struct {
	PVCName string
	Path    string
}

type JfsSetting

type JfsSetting struct {
	IsCe   bool
	UsePod bool

	UUID               string
	Name               string               `json:"name"`
	MetaUrl            string               `json:"metaurl"`
	Source             string               `json:"source"`
	Storage            string               `json:"storage"`
	FormatOptions      string               `json:"format-options"`
	CachePVCs          []CachePVC           // PVC using by mount pod
	CacheEmptyDir      *CacheEmptyDir       // EmptyDir using by mount pod
	CacheInlineVolumes []*CacheInlineVolume // InlineVolume using by mount pod
	CacheDirs          []string             // hostPath using by mount pod
	ClientConfPath     string               `json:"-"`

	// put in secret
	SecretKey     string            `json:"secret-key,omitempty"`
	SecretKey2    string            `json:"secret-key2,omitempty"`
	Token         string            `json:"token,omitempty"`
	Passphrase    string            `json:"passphrase,omitempty"`
	Envs          map[string]string `json:"envs_map,omitempty"`
	EncryptRsaKey string            `json:"encrypt_rsa_key,omitempty"`
	InitConfig    string            `json:"initconfig,omitempty"`
	Configs       map[string]string `json:"configs_map,omitempty"`

	// put in volCtx
	MountPodLabels      map[string]string `json:"mount_pod_labels"`
	MountPodAnnotations map[string]string `json:"mount_pod_annotations"`
	DeletedDelay        string            `json:"deleted_delay"`
	CleanCache          bool              `json:"clean_cache"`
	HostPath            []string          `json:"host_path"`
	ServiceAccountName  string
	Resources           corev1.ResourceRequirements

	// mount
	VolumeId   string   // volumeHandle of PV
	UniqueId   string   // mount pod name is generated by uniqueId
	MountPath  string   // mountPath of mount pod or process mount
	TargetPath string   // which bind to container path
	Options    []string // mount options
	FormatCmd  string   // format or auth
	SubPath    string   // subPath which is to be created or deleted
	SecretName string   // secret with JuiceFS volume credentials

	Attr PodAttr
}

func ParseSetting

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

func (*JfsSetting) ParseFormatOptions added in v0.17.1

func (s *JfsSetting) ParseFormatOptions() ([][]string, error)

func (*JfsSetting) RepresentFormatOptions added in v0.17.1

func (s *JfsSetting) RepresentFormatOptions(parsedOptions [][]string) []string

func (*JfsSetting) StripFormatOptions added in v0.17.1

func (s *JfsSetting) StripFormatOptions(parsedOptions [][]string, strippedKeys []string) []string

type PodAttr added in v0.16.0

type PodAttr struct {
	Namespace            string
	MountPointPath       string
	JFSConfigPath        string
	JFSMountPriorityName string

	// inherit from csi
	Image            string
	HostNetwork      bool
	HostAliases      []corev1.HostAlias
	HostPID          bool
	HostIPC          bool
	DNSConfig        *corev1.PodDNSConfig
	DNSPolicy        corev1.DNSPolicy
	ImagePullSecrets []corev1.LocalObjectReference
	PreemptionPolicy *corev1.PreemptionPolicy
	Tolerations      []corev1.Toleration
}

Jump to

Keyboard shortcuts

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