Skip to content

Commit 555cdfd

Browse files
committed
juicefs: support extra options in dataload
Signed-off-by: zwwhdls <zww@hdls.me>
1 parent 2e29093 commit 555cdfd

4 files changed

Lines changed: 24 additions & 10 deletions

File tree

charts/fluid-dataloader/juicefs/templates/configmap.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ data:
3838
local pod="${podNames[i]}"
3939
4040
echo -e "juicefs warmup on $pod $targetPath starts"
41-
/usr/local/bin/kubectl -n $ns exec -it $pod -- timeout $TIMEOUT /usr/local/bin/juicefs warmup $targetPath
41+
/usr/local/bin/kubectl -n $ns exec -it $pod -- timeout $TIMEOUT /usr/local/bin/juicefs warmup $targetPath $OPTION
4242
echo -e "juicefs warmup on $pod $targetPath ends"
4343
done
4444
fi
@@ -47,7 +47,7 @@ data:
4747
then
4848
echo -e "juicefs warmup $targetPath starts"
4949
local pod="${podNames[0]}"
50-
/usr/local/bin/kubectl -n $ns exec -it $pod -- timeout $TIMEOUT /usr/bin/juicefs warmup $targetPath
50+
/usr/local/bin/kubectl -n $ns exec -it $pod -- timeout $TIMEOUT /usr/bin/juicefs warmup $targetPath $OPTION
5151
echo -e "juicefs warmup $targetPath ends"
5252
fi
5353
}

charts/fluid-dataloader/juicefs/templates/cronjob.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ spec:
111111
- name: TIMEOUT
112112
value: {{ $val | quote }}
113113
{{- end }}
114+
{{- if eq $key "option" }}
115+
- name: OPTION
116+
value: {{ $val | quote }}
117+
{{- end }}
114118
{{- if eq $key "edition" }}
115119
- name: EDITION
116120
value: {{ $val | quote }}

charts/fluid-dataloader/juicefs/templates/job.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ spec:
124124
- name: TIMEOUT
125125
value: {{ $val | quote }}
126126
{{- end }}
127+
{{- if eq $key "option" }}
128+
- name: OPTION
129+
value: {{ $val | quote }}
130+
{{- end }}
127131
{{- if eq $key "edition" }}
128132
- name: EDITION
129133
value: {{ $val | quote }}

pkg/ddc/juicefs/data_load.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,6 @@ func (j *JuiceFSEngine) genDataLoadValue(image string, cacheinfo map[string]stri
179179
dataloadInfo.TargetPaths = targetPaths
180180

181181
options := map[string]string{}
182-
// resolve spec options
183-
if dataload.Spec.Options != nil {
184-
for key, value := range dataload.Spec.Options {
185-
options[key] = value
186-
}
187-
}
188182

189183
for key, value := range cacheinfo {
190184
options[key] = value
@@ -201,9 +195,21 @@ func (j *JuiceFSEngine) genDataLoadValue(image string, cacheinfo map[string]stri
201195
}
202196
options["edition"] = cacheinfo[Edition]
203197
options["runtimeName"] = j.name
204-
if _, ok := options["timeout"]; !ok {
205-
options["timeout"] = DefaultDataLoadTimeout
198+
timeout := dataload.Spec.Options["timeout"]
199+
delete(dataload.Spec.Options, "timeout")
200+
if timeout == "" {
201+
timeout = DefaultDataLoadTimeout
202+
}
203+
warmupOtions := []string{}
204+
for k, v := range dataload.Spec.Options {
205+
if v != "" {
206+
warmupOtions = append(warmupOtions, fmt.Sprintf("--%s=%s", k, v))
207+
} else {
208+
warmupOtions = append(warmupOtions, fmt.Sprintf("--%s", k))
209+
}
206210
}
211+
options["option"] = strings.Join(warmupOtions, " ")
212+
options["timeout"] = timeout
207213

208214
dataloadInfo.Options = options
209215

0 commit comments

Comments
 (0)