Skip to content

Commit

Permalink
fix_mountpod_priority (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
molei20021 authored Jun 25, 2023
1 parent c44d6db commit e9e3bf6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions cmd/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func parseNodeConfig() {
config.HostIp = os.Getenv("HOST_IP")
config.KubeletPort = os.Getenv("KUBELET_PORT")
jfsMountPriorityName := os.Getenv("JUICEFS_MOUNT_PRIORITY_NAME")
jfsMountPreemptionPolicy := os.Getenv("JUICEFS_MOUNT_PREEMPTION_POLICY")
if timeout := os.Getenv("JUICEFS_RECONCILE_TIMEOUT"); timeout != "" {
duration, _ := time.ParseDuration(timeout)
if duration > config.ReconcileTimeout {
Expand All @@ -60,6 +61,10 @@ func parseNodeConfig() {
config.JFSMountPriorityName = jfsMountPriorityName
}

if jfsMountPreemptionPolicy != "" {
config.JFSMountPreemptionPolicy = jfsMountPreemptionPolicy
}

if mountPodImage := os.Getenv("JUICEFS_CE_MOUNT_IMAGE"); mountPodImage != "" {
config.CEMountImage = mountPodImage
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ var (

CSIPod = corev1.Pod{}

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

TmpPodMountBase = "/tmp"
PodMountBase = "/jfs"
Expand Down
8 changes: 7 additions & 1 deletion pkg/config/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ func ParseSetting(secrets, volCtx map[string]string, options []string, usePod bo
}

jfsSetting.ServiceAccountName = CSIPod.Spec.ServiceAccountName

var preemptionPolicy = CSIPod.Spec.PreemptionPolicy
if JFSMountPreemptionPolicy != "" {
policy := corev1.PreemptionPolicy(JFSMountPreemptionPolicy)
preemptionPolicy = &policy
}
// inherit attr from csi
jfsSetting.Attr = PodAttr{
Namespace: Namespace,
Expand All @@ -238,7 +244,7 @@ func ParseSetting(secrets, volCtx map[string]string, options []string, usePod bo
DNSConfig: CSIPod.Spec.DNSConfig,
DNSPolicy: CSIPod.Spec.DNSPolicy,
ImagePullSecrets: CSIPod.Spec.ImagePullSecrets,
PreemptionPolicy: CSIPod.Spec.PreemptionPolicy,
PreemptionPolicy: preemptionPolicy,
Tolerations: CSIPod.Spec.Tolerations,
}
if jfsSetting.IsCe {
Expand Down

0 comments on commit e9e3bf6

Please sign in to comment.