Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update data_migrate.go #4137

Open
wants to merge 99 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
ee71a4c
Update data_migrate.go
Ametsuji-akiya May 27, 2024
2918a34
Build docker images for dataflow, To #55315018 (#4135)
cheyang May 28, 2024
78eeac5
modify License of cmd/goosefs/app/version.go (#4047)
JJjjxx May 29, 2024
e763252
Bump golang.org/x/time from 0.3.0 to 0.5.0 (#4111)
dependabot[bot] May 29, 2024
43b7c03
Fix the inconsistent rpc socket port with assigned port in vineyard w…
dashanji May 29, 2024
ea03462
refactor: remove deprecated data operation interface (#4130)
xliuqq May 29, 2024
d94d389
Build docker image for code refactoring, To #54583165 (#4143)
cheyang May 29, 2024
48e108b
no.154 (#4049)
tzwo May 30, 2024
53e168a
Fix NPE of runtime controller (#4139)
cheyang May 30, 2024
9bad344
this pr is to fix a wrong time of Copyright (#4044)
VictorChen77 May 30, 2024
c5b8cf7
task168 (#4051)
Axnco May 30, 2024
2141a42
This pr is to add a Copyright to normalize the License (#4075)
ljyzzZ May 30, 2024
9502fc2
Standardize License Information (#4053)
njuqj May 30, 2024
81e7110
This pr is to add license to ./pkg/common/constants.go (#4056)
melldy May 30, 2024
a9c11e2
This pr is to add the modification of the year of pkg/base/base/opera…
whatAboutluv May 30, 2024
c53c446
changing 2023 to correct time 2020-s (#4046)
DREAMINGtimezero May 30, 2024
bb3eeb3
corrected a word (#4060)
211820252 May 31, 2024
8c0c3e7
Bump github.com/onsi/gomega from 1.27.10 to 1.33.1 (#4142)
dependabot[bot] May 31, 2024
6c1f776
add license (#4061)
xACE123 May 31, 2024
477b063
modify year of license in pkg/ddc/alluxio/engine.go (#4062)
HistoriaY May 31, 2024
3046f3f
This pr is to change the time of Copyright (#4064)
ttkyhy May 31, 2024
1d7077c
This pr is to correct the year of the License (#4065)
DestroyFlag May 31, 2024
d13dbf8
Changed Copyright date from 2023 to 2020. (#4066)
littledoublelin May 31, 2024
f327b24
Standardized license information of cmd/thin/app/thin.go (#4069)
same-pxt May 31, 2024
3361df9
add License to ./pkg/common/alluxio.go (#4074)
NightStar808 May 31, 2024
11131ee
修改日期 (#4076)
kangkanghanhan May 31, 2024
9d923b0
Fix copyright year in api_gateway.go (#4079)
River-Jumper May 31, 2024
6bf4656
task199 (#4089)
langankazuha May 31, 2024
7677978
change 2023 to 2020 in copyright (#4090)
starrydreamawa May 31, 2024
acb7d7b
change the time in pkg/ddc/alluxio/transform_fuse_test.go lab1 151 (…
Sigger9303 May 31, 2024
23883f4
This pr is to change the time of the file transform_hadoop_config.go …
Wang-githubUsername May 31, 2024
b5ec9dd
Build docker image for fixing NPE, To #54583165 (#4146)
cheyang May 31, 2024
59168d2
Add or normalize License information of Task158 (#4106)
resautu6 Jun 1, 2024
2902c1b
Bump github.com/prometheus/client_golang from 1.16.0 to 1.19.1 (#4147)
dependabot[bot] Jun 2, 2024
92a7e28
change copyright 2023 to 2024 (#4084)
wusland Jun 3, 2024
dfc83f8
Change the image registry of vineyard runtime from docker hub to aliy…
dashanji Jun 3, 2024
4e3bfdf
Add license information to health_check.go (#4109)
zhanghuahua1224 Jun 4, 2024
860f685
fix default value (#4144)
frankleaf Jun 4, 2024
44ba8a5
Build docker images for fixing jindo cache performance issue, To #542…
cheyang Jun 5, 2024
eaf6c73
Bump up the vineyard to v0.22.2 (#4153)
dashanji Jun 6, 2024
f731d90
Bump github.com/agiledragon/gomonkey/v2 from 2.10.1 to 2.11.0 (#4151)
dependabot[bot] Jun 6, 2024
7806de8
date (#4110)
Lumen002 Jun 7, 2024
8558846
Add apache license_format in fluid_ufs_scheme_test.go (#4120)
MaVeRiCk1227 Jun 8, 2024
18fdb16
111 (#4121)
lianwg Jun 9, 2024
5c6a7cf
Bump golang.org/x/net from 0.25.0 to 0.26.0 (#4156)
dependabot[bot] Jun 10, 2024
e95656f
modified the incorrect copyright time in file pkg/ddc/efc/cache.go (#…
yun-ni-2024 Jun 11, 2024
56938c8
--- (#4123)
dependabot[bot] Jun 11, 2024
4f71d9e
Build docker images for vineyard 0.22, To #54250932 (#4159)
cheyang Jun 12, 2024
a64e3fb
Bump sigs.k8s.io/yaml from 1.3.0 to 1.4.0 (#4157)
dependabot[bot] Jun 12, 2024
b263279
Fix typo of transformer, To #54583165 (#4150)
cheyang Jun 12, 2024
aa8c5fa
Build docker images for fixing transformers, To #54583162 (#4161)
cheyang Jun 13, 2024
30e887e
change transfromer to transformers in load_data.go (#4118)
yayaaaaaaaaa Jun 14, 2024
c891db6
addons: add dynamic mount examples (#4148)
TrafalgarZZZ Jun 14, 2024
0dd9e35
change copyright year from 2022 to 2020 (#4132)
FluorescenceLight Jun 14, 2024
f517e2e
bugfix: check corrupted mount point in utils.RemoveSymlink (#4163)
TrafalgarZZZ Jun 14, 2024
39c77a4
Bump github.com/spf13/cobra from 1.7.0 to 1.8.0 (#4158)
dependabot[bot] Jun 15, 2024
96c71d3
modify copyright time (#4128)
liuyun-0002 Jun 16, 2024
996df45
change time from 2022 to 2020 (#4134)
remakesoon Jun 17, 2024
cc85666
changed the time of Copyright in the operation.go file to 2023 (#4145)
sishijiang Jun 17, 2024
2cb1fa9
Bump go.uber.org/zap from 1.24.0 to 1.27.0 (#3727)
dependabot[bot] Jun 19, 2024
04c72f2
refactor: rename `CreateUpdatePodForSchedulingHandler` to `FluidMutat…
TrafalgarZZZ Jun 19, 2024
c423bb8
minorfix: pin libfuse version in dynamic mount example (#4167)
TrafalgarZZZ Jun 19, 2024
228b677
Refactor admission webhook handler registration for better error hand…
cheyang Jun 19, 2024
7dbe0f6
Assign pod.namespace before mutation (#4171)
TrafalgarZZZ Jun 19, 2024
b34a65b
minorfix: carefully handle pod.namespace to avoid side effect (#4172)
TrafalgarZZZ Jun 19, 2024
96488f7
Build docker images for refactoring webhook, To #57240825 (#4173)
cheyang Jun 19, 2024
2ba1947
Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#4164)
dependabot[bot] Jun 20, 2024
547d5dc
feat: support multiround sidecar injection (#4175)
TrafalgarZZZ Jun 22, 2024
6fa5433
description (简单描述你的修改) (#4149)
bc-ace Jun 23, 2024
61778bd
docs: Correcting the usage steps of the CONTABUTING.md document (#4176)
Wercurial Jun 23, 2024
e717541
move dataflow affinity logic to fluidapp controller (#4138)
xliuqq Jun 24, 2024
d173184
Build docker images for refactoring dataflow controller, To #57240825…
cheyang Jun 26, 2024
8db6420
wjl (#4039)
wjlwjlwjlwjlwjlwjlwjl Jun 27, 2024
9c86707
Bump github.com/spf13/cobra from 1.8.0 to 1.8.1 (#4166)
dependabot[bot] Jun 27, 2024
5731ec3
Update utils.go (#4116)
shengdewo Jun 28, 2024
b0c7d65
Do not skip mutation for fluid pods (#4184)
TrafalgarZZZ Jun 28, 2024
d0a9dc2
Bump github.com/felixge/fgprof from 0.9.3 to 0.9.4 (#4169)
dependabot[bot] Jun 28, 2024
f3f89cb
bugfix: fix application controller manage pod lifecycle (#4185)
TrafalgarZZZ Jun 28, 2024
1c7f248
Bump github.com/go-logr/logr from 1.4.1 to 1.4.2 (#4174)
dependabot[bot] Jun 29, 2024
df3e360
cm1 (#4114)
KlarkeZ Jun 30, 2024
453952f
dataset add storageSize (#4178)
wangshulei098 Jul 1, 2024
097dffb
Build docker images for specifying pvc storage size, To #54250932 (#4…
cheyang Jul 1, 2024
cf2d629
docs: dev guide for en missing GOPATH setup (#4188)
backsapce Jul 2, 2024
ca0ac92
Update operation_helm.go (#4129)
rodestexas Jul 3, 2024
cd47b6e
Bump k8s.io/klog/v2 from 2.120.1 to 2.130.1 (#4183)
dependabot[bot] Jul 3, 2024
543b18e
bugfix: allow users to override juicefs attr-cache and entry-cache op…
TrafalgarZZZ Jul 4, 2024
d379ecc
Bump google.golang.org/grpc from 1.64.0 to 1.65.0 (#4191)
dependabot[bot] Jul 4, 2024
ba5ef52
Update go.mod to comply with Go 1.21 toolchain syntax (#4196)
cheyang Jul 4, 2024
2808a59
Build docker images for fixing juicefs timeout, To #57240825 (#4197)
cheyang Jul 4, 2024
6f91cfb
bugfix: fix early break when cleaning mount point in NodeUnpublishVol…
TrafalgarZZZ Jul 5, 2024
7aa74a6
This pr is to add the translation of the Apache License notice (#4078)
zrywby Jul 6, 2024
4c497d3
Bump github.com/agiledragon/gomonkey/v2 from 2.11.0 to 2.12.0 (#4199)
dependabot[bot] Jul 9, 2024
cd6570e
bugfix: fix jindoruntime name cannot contain jindofs (#4202)
TrafalgarZZZ Jul 9, 2024
19af9b8
revert: "upgrade jindocache to 6.4.0 version (#4126)" and downgrade J…
TrafalgarZZZ Jul 10, 2024
85a18bd
Build docker images for reverting jindoruntime from 6.4 to 6.2, To #5…
cheyang Jul 10, 2024
4eb7c35
Bump golang.org/x/net from 0.26.0 to 0.27.0 (#4200)
dependabot[bot] Jul 11, 2024
78b21d1
Prepare 1.0.2, To #57978385 (#4207)
cheyang Jul 12, 2024
cfcd07c
Delete the unused rbac roles for vineyard runtime. (#4208)
dashanji Jul 12, 2024
80c60e6
Update docker image to fluid 1.0.2, To #54250932 (#4210)
cheyang Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
docker:
# specify the version
- image: cimg/go:1.21.8
- image: cimg/go:1.21.10
working_directory: ~/project/src/github.com/fluid-cloudnative/fluid
environment:
TEST_FLAGS: '-race -coverprofile=coverage.txt -covermode=atomic'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ master, release-* ]

env:
GO_VERSION: 1.21
GO_VERSION: 1.21.10

# Declare default permissions as read only.
permissions: read-all
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ matrix:
include:
- language: go
go:
- "1.21"
- "1.21.10"
os:
- linux
go_import_path: github.com/fluid-cloudnative/fluid
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ We assume you've got a Github ID. If then, all you need to do can be summarized

3. **Set remote upstream**
```shell
cd fluid
git remote add upstream https://github.com/fluid-cloudnative/fluid.git
git remote set-url --push upstream no-pushing
```

4. **Update local working directory**
```shell
cd fluid
git fetch upstream
git checkout master
git rebase upstream/master
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ else
endif

CURRENT_DIR=$(shell pwd)
VERSION=v1.0.1
VERSION=v1.0.2
BUILD_DATE=$(shell date -u +'%Y-%m-%d_%H:%M:%S')
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
Expand Down
25 changes: 25 additions & 0 deletions addons/dynamic-mount/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM debian:bullseye@sha256:a165446a88794db4fec31e35e9441433f9552ae048fb1ed26df352d2b537cb96 as builder

RUN apt update && apt install -y build-essential libfuse3-dev pkg-config git python3-pip

RUN pip install meson ninja

RUN git clone https://github.com/libfuse/libfuse.git && cd libfuse && git checkout fuse-3.16.2 && cd ..

RUN mkdir -p libfuse/build && cd libfuse/build && meson setup .. && ninja install

RUN cd libfuse/example && gcc -Wall passthrough.c `pkg-config fuse3 --cflags --libs` -o passthrough

FROM debian:bullseye-slim@sha256:a165446a88794db4fec31e35e9441433f9552ae048fb1ed26df352d2b537cb96

RUN apt update && apt install -y python3 fuse tini supervisor inotify-tools jq && rm -rf /var/cache/apt/* && ln -s /usr/bin/python3 /usr/local/bin/python
COPY inotify-fluid-config.ini /tmp/inotify-fluid-config.ini
RUN cat /tmp/inotify-fluid-config.ini >> /etc/supervisor/supervisord.conf && rm /tmp/inotify-fluid-config.ini

COPY reconcile_mount_program_settings.py mount-helper.sh inotify.sh mount-passthrough-fuse.sh prestop.sh entrypoint.sh /usr/local/bin/
RUN chmod u+x /usr/local/bin/mount-helper.sh /usr/local/bin/inotify.sh /usr/local/bin/mount-passthrough-fuse.sh /usr/local/bin/prestop.sh /usr/local/bin/entrypoint.sh

RUN apt update && apt install -y libfuse3-3 fuse3
COPY --from=builder libfuse/example/passthrough /usr/local/bin/passthrough

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
6 changes: 6 additions & 0 deletions addons/dynamic-mount/base/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set +x

docker build . --network=host -f Dockerfile -t fluidcloudnative/dynamic-mount:base

docker push fluidcloudnative/dynamic-mount:base
21 changes: 21 additions & 0 deletions addons/dynamic-mount/base/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e

trap "/usr/local/bin/prestop.sh" SIGTERM

if [[ "$USE_PASSTHROUGH_FUSE" == "True" ]]; then
mkdir -p $MOUNT_POINT
cat << EOF >> /etc/supervisor/supervisord.conf

[program:passthrough-fuse]
command=/usr/local/bin/mount-passthrough-fuse.sh
redirect_stderr=true
stdout_logfile=/proc/1/fd/1
stdout_logfile_maxbytes=0
autorestart=true
startretries=9999
EOF
fi

supervisord -n
7 changes: 7 additions & 0 deletions addons/dynamic-mount/base/inotify-fluid-config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[program:inotify-fluid-config]
command=/usr/local/bin/inotify.sh
redirect_stderr=true
stdout_logfile=/proc/1/fd/1
stdout_logfile_maxbytes=0
autorestart=true
startretries=9999
18 changes: 18 additions & 0 deletions addons/dynamic-mount/base/inotify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -xe

FUSE_CONFIG="/etc/fluid/config"

python /usr/local/bin/reconcile_mount_program_settings.py
supervisorctl update

# if fuse-config(/etc/fluid/config/config.json) is modified, reconcile setting files under /etc/supervisor.d and use `supervisorctl update` to start/stop new/old fuse daemon process.
# config.json is mounted by configmap, it is actually a symlink point to actual file, and kubernetes would atomically rename ..data_tmp to ..data, which triggers an inotify moved_to event.
# Please see https://github.com/kubernetes/kubernetes/blob/master/pkg/volume/util/atomic_writer.go#L93-L138 for more information
inotifywait -m -r -e moved_to "${FUSE_CONFIG}" |
while read -r directory event file; do
echo "${directory} ${file} changed (event: ${event})"
# mount_and_umount
python /usr/local/bin/reconcile_mount_program_settings.py
supervisorctl update
done
88 changes: 88 additions & 0 deletions addons/dynamic-mount/base/mount-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash
set -ex

function help() {
echo "Usage: "
echo " bash mount-helper.sh mount|umount [args...]"
echo "Examples: "
echo " 1. mount filesystem [mount_src] to [mount_target] with options defined in [mount_opt_file]"
echo " bash mount-helper.sh mount [mount_src] [mount_target] [mount_opt_file]"
echo " 2. umount filesystem mounted at [mount_target]"
echo " bash mount-helper.sh umount [mount_target]"
}

function error_msg() {
help
echo
echo $1
exit 1
}

function clean_up() {
# Ignore any possible error in clean up process
set +e
mount_target=$1
if [[ -z "$mount_target" ]]; then
return
fi
umount $mount_target
sleep 3 # umount may be asynchronous
rmdir $mount_target
}

function mount_fn() {
if [[ $# -ne 4 ]]; then
error_msg "Error: mount-helper.sh mount expects 4 arguments, but got $# arguments."
fi
mount_src=$1
mount_target=$2
fs_type=$3
mount_opt_file=$4

# NOTES.1: umount $mount_target here to avoid [[ -d $mount_target ]] returning "Transport Endpoint is not connected" error.
# NOTES.2: Use "cat /proc/self/mountinfo" instead of the "mount" command because Alpine has some issue on printing mount info with "mount".
if cat /proc/self/mountinfo | grep " ${mount_target} " > /dev/null; then
echo "found mount point on ${mount_target}, umount it before re-mount."
umount ${mount_target}
fi

if [[ ! -d "$mount_target" ]]; then
mkdir -p "$mount_target"
fi

# mount-helper.sh should be wrapped in `tini -s -g` so trap will be triggered
trap "clean_up $mount_target" SIGTERM EXIT
/opt/mount.sh $mount_src $mount_target $fs_type $mount_opt_file
}

function umount_fn() {
if [[ $# -ne 1 ]]; then
error_msg "Error: mount-helper.sh umount expects 1 argument, but got $# arguments."
fi
umount $1 || true
}

function main() {
if [[ $# -eq 0 ]]; then
error_msg "Error: not enough arguments, require at least 1 argument"
fi

if [[ $# -gt 0 ]]; then
case $1 in
mount)
shift
mount_fn $@
;;
unmount|umount)
shift
umount_fn $@
;;
*)
error_msg "Error: unknown option: $1"
;;
esac
fi
}

main $@

5 changes: 5 additions & 0 deletions addons/dynamic-mount/base/mount-passthrough-fuse.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -ex

umount $MOUNT_POINT || true
passthrough -o modules=subdir,subdir=/mnt,auto_unmount -f $MOUNT_POINT
20 changes: 20 additions & 0 deletions addons/dynamic-mount/base/prestop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -e

mount_points=$(cat /proc/self/mountinfo | grep " ${MOUNT_POINT}" | awk '{print $5}')

echo "prestop.sh: umounting mountpoints under ${MOUNT_POINT}"
for mount_point in ${mount_points}; do
echo ">> mount-helper.sh umount ${mount_point}"
mount-helper.sh umount ${mount_point}
done

# from now on, we clean sub dirs in a best-effort manner.
set +e
echo "prestop.sh: clean sub directories under ${MOUNT_POINT}"
sub_dirs=$(ls "${MOUNT_POINT}/")
for sub_dir in ${sub_dirs}; do
rmdir "${MOUNT_POINT}/${sub_dir}" || echo "WARNING: failed to rmdir ${sub_dir}, maybe filesystem still mounting on it."
done

exit 0
90 changes: 90 additions & 0 deletions addons/dynamic-mount/base/reconcile_mount_program_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import json
import glob
import os

USE_PASSTHROUGH_FUSE = os.environ.get("USE_PASSTHROUGH_FUSE", 'False') == 'True'

FLUID_RUNTIME_MNT = os.environ.get("MOUNT_POINT")
FLUID_MOUNT_OPT_DIR = "/etc/fluid/mount-opts"
FLUID_CONFIG_FILE = "/etc/fluid/config/config.json"
SUPERVISORD_SETTING_DIR = "/etc/supervisor/conf.d"
SUPERVISORD_SETTING_TEMPLATE = """[program:{name}]
command=tini -s -g -- mount-helper.sh mount {mount_src} {mount_target} {fs_type} {mount_opt_file}
stdout_logfile=/var/log/fluid/{name}.out
stderr_logfile=/var/log/fluid/{name}.err
autorestart=true
startretries=9999"""

def prepare_dirs():
os.makedirs(SUPERVISORD_SETTING_DIR, exist_ok=True)
os.makedirs("/var/log/fluid", exist_ok=True)
os.makedirs(FLUID_MOUNT_OPT_DIR, exist_ok=True)

def write_mount_opts(mount_opts, opt_file):
with open(opt_file, "w") as f:
f.write(json.dumps(mount_opts))

def reconcile_supervisord_settings():
rawStr = ""
with open(FLUID_CONFIG_FILE, "r") as f:
rawStr = f.readlines()

print(f"{FLUID_CONFIG_FILE}: {rawStr[0]}") # config.json only have one line in json format

setting_files = glob.glob(os.path.join(SUPERVISORD_SETTING_DIR, "*.conf"))

# obj["mounts"] is like [{"mountPoint": "s3://mybucket", "name": "mybucket", "path": "/mybucket", "options":{...}}, {"mountPoint": "s3://mybucket2", "name": "mybucket2", "path": "/mybucket2", "options":{...}}]
obj = json.loads(rawStr[0])
expected_mounts = [mount["name"] for mount in obj["mounts"]]
current_mounts = [os.path.basename(file).removesuffix(".conf") for file in setting_files]

need_mount = list(set(expected_mounts).difference(set(current_mounts)))
need_unmount = list(set(current_mounts).difference(set(expected_mounts)))
print(f"need mount: {need_mount}, need umount: {need_unmount}")

for name in need_unmount:
setting_file = os.path.join(SUPERVISORD_SETTING_DIR, f"{name}.conf")
if os.path.isfile(setting_file):
os.remove(setting_file)
print(f"Mount \"{name}\"'s settings has been removed.")


access_mode = "ro"
if "ReadWriteMany" in obj["accessModes"]:
access_mode = "rw"
mount_info_dict = {mount["name"]: mount for mount in obj["mounts"]}
for name in need_mount:
if name not in mount_info_dict:
print(f"WARNING: mount \"{name}\" is not found in {FLUID_CONFIG_FILE}.")
continue
mount_info = mount_info_dict[name]
mount_src: str = mount_info["mountPoint"]
fs_type = "unknown"
if len(mount_src.split("://")) == 2:
fs_type = mount_src.split("://")[0] # e.g. mount_src="nfs://xxxx/yyyy" => fs_type=nfs
mount_dir_name = name
if "path" in mount_info:
if mount_info["path"] != "/":
mount_dir_name = mount_info["path"].lstrip("/")
else:
print(f"WARNING: mounting \"{name}\" at \"/\" is not allowed, fall back to mount at \"/{name}\"")
if USE_PASSTHROUGH_FUSE:
mount_target = os.path.join("/mnt", mount_dir_name)
else:
mount_target = os.path.join(FLUID_RUNTIME_MNT, mount_dir_name)
mount_opt_file = os.path.join(FLUID_MOUNT_OPT_DIR, f"{name}.opts")

mount_opts = mount_info["options"]
mount_opts["name"] = name
mount_opts["access_mode"] = access_mode
write_mount_opts(mount_opts, mount_opt_file)

setting_file = os.path.join(SUPERVISORD_SETTING_DIR, f"{name}.conf")
with open(setting_file, 'w') as f:
f.write(SUPERVISORD_SETTING_TEMPLATE.format(name=name, mount_src=mount_src, mount_target=mount_target, fs_type=fs_type, mount_opt_file=mount_opt_file))

print(f"Mount \"{name}\"'s setting is successfully written to {setting_file}")

if __name__=="__main__":
prepare_dirs()
reconcile_supervisord_settings()
29 changes: 29 additions & 0 deletions addons/dynamic-mount/juicefs/docker/Dockerfile.juicefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM fluidcloudnative/fluid-dynamic-mount-base:v0.4

# Install Juicefs
WORKDIR /app

ARG TARGETARCH
ENV JUICEFS_CLI=/usr/bin/juicefs
ENV JFS_MOUNT_PATH=/usr/local/juicefs/mount/jfsmount

RUN apt update && apt install -y software-properties-common wget gnupg gnupg2 && bash -c "if [[ '${TARGETARCH}' == amd64 ]]; then wget -O - https://download.gluster.org/pub/gluster/glusterfs/10/rsa.pub | apt-key add - && \
echo deb [arch=${TARGETARCH}] https://download.gluster.org/pub/gluster/glusterfs/10/LATEST/Debian/buster/${TARGETARCH}/apt buster main > /etc/apt/sources.list.d/gluster.list && \
apt-get update && apt-get install -y uuid-dev libglusterfs-dev glusterfs-common; fi"

RUN apt-get update && apt-get install -y librados2 curl fuse procps iputils-ping strace iproute2 net-tools tcpdump lsof librados-dev libcephfs-dev librbd-dev && \
rm -rf /var/cache/apt/* && \
bash -c "curl -o ${JUICEFS_CLI} https://juicefs.com/static/juicefs.4.9 && \
chmod a+x ${JUICEFS_CLI} && mkdir -p /usr/local/juicefs/mount && curl -o ${JFS_MOUNT_PATH} https://juicefs.com/static/Linux/mount.4.9 && chmod a+x ${JFS_MOUNT_PATH};" && \
chmod +x ${JUICEFS_CLI} && \
mkdir -p /root/.juicefs && \
ln -s /usr/local/bin/python /usr/bin/python && \
mkdir /root/.acl && cp /etc/passwd /root/.acl/passwd && cp /etc/group /root/.acl/group && \
ln -sf /root/.acl/passwd /etc/passwd && ln -sf /root/.acl/group /etc/group

RUN /usr/bin/juicefs version

# Install mount script for dynamic mount
RUN apt install -y jq
COPY mount.sh /opt/mount.sh
RUN chmod u+x /opt/mount.sh
23 changes: 23 additions & 0 deletions addons/dynamic-mount/juicefs/docker/mount.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

if [[ $# -ne 4 ]]; then
echo "Error: require 3 arguments, but got $# arguments"
exit 1
fi

mount_src=$1 # e.g. juicefs://mybucket
mount_target=$2 # e.g. /runtime-mnt/thin/default/thin-demo/thin-fuse/mybucket
fs_type=$3
mount_opt_file=$4 # e.g. /etc/fluid/mount-opts/mybucket.opts (mount options in json format)

filesystem_name=${mount_src#juicefs://}
token_file=$(cat ${mount_opt_file} | jq -r '.["token"]')
access_key_file=$(cat ${mount_opt_file} | jq -r '.["access-key"]')
secret_key_file=$(cat ${mount_opt_file} | jq -r '.["secret-key"]')
bucket=$(cat ${mount_opt_file} | jq -r '.["bucket"]')

juicefs auth $filesystem_name --token `cat $token_file` --access-key `cat $access_key_file` --secret-key `cat $secret_key_file` --bucket "$bucket"

exec juicefs mount -f $filesystem_name $mount_target
Loading
Loading