diff options
| author | Gradlon von Känel <gradlon@integral-systems.ch> | 2024-07-13 19:38:19 +0200 |
|---|---|---|
| committer | Chris Lu <chrislusf@users.noreply.github.com> | 2024-07-18 09:02:27 -0700 |
| commit | 6129d9ca744aba3e2d8559f073424f227eb56f91 (patch) | |
| tree | 97ffe010d1909ffcc06b7f54a3631d582acf6526 /cmd | |
| parent | ca10c3e636e5493cf37141a5c2b56454c693e968 (diff) | |
| download | seaweedfs-csi-driver-6129d9ca744aba3e2d8559f073424f227eb56f91.tar.xz seaweedfs-csi-driver-6129d9ca744aba3e2d8559f073424f227eb56f91.zip | |
initial files
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/seaweedfs-csi-driver/swarm/Dockerfile | 7 | ||||
| -rw-r--r-- | cmd/seaweedfs-csi-driver/swarm/README.md | 1 | ||||
| -rwxr-xr-x | cmd/seaweedfs-csi-driver/swarm/build.sh | 20 | ||||
| -rw-r--r-- | cmd/seaweedfs-csi-driver/swarm/config.json | 95 | ||||
| -rw-r--r-- | cmd/seaweedfs-csi-driver/swarm/entrypoint.sh | 14 |
5 files changed, 137 insertions, 0 deletions
diff --git a/cmd/seaweedfs-csi-driver/swarm/Dockerfile b/cmd/seaweedfs-csi-driver/swarm/Dockerfile new file mode 100644 index 0000000..51eefd5 --- /dev/null +++ b/cmd/seaweedfs-csi-driver/swarm/Dockerfile @@ -0,0 +1,7 @@ +ARG BASE_IMAGE=chrislusf/seaweedfs-csi-driver:latest +ARG ARCH=linux/amd64 +FROM --platform=${ARCH} ${BASE_IMAGE} + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/cmd/seaweedfs-csi-driver/swarm/README.md b/cmd/seaweedfs-csi-driver/swarm/README.md new file mode 100644 index 0000000..304ae22 --- /dev/null +++ b/cmd/seaweedfs-csi-driver/swarm/README.md @@ -0,0 +1 @@ +# swarm-csi-swaweedfs diff --git a/cmd/seaweedfs-csi-driver/swarm/build.sh b/cmd/seaweedfs-csi-driver/swarm/build.sh new file mode 100755 index 0000000..019954d --- /dev/null +++ b/cmd/seaweedfs-csi-driver/swarm/build.sh @@ -0,0 +1,20 @@ +#!/bin/bash +VERSION=${1:-latest} +ARCH=${2:-linux/amd64} +PLUGIN_NAME=${3:-swarm-csi-swaweedfs} +PLUGIN_TAG=${4:-v1.2.0} +PREFIX=${5:-gradlon} + +docker build --platform ${ARCH} --build-arg BASE_IMAGE=chrislusf/seaweedfs-csi-driver:${VERSION} --build-arg ARCH=$ARCH -t seawadd-csi_tmp_img . +mkdir -p ./plugin/rootfs +cp config.json ./plugin/ +docker container create --name seawadd-csi_tmp seawadd-csi_tmp_img +docker container export seawadd-csi_tmp | tar -x -C ./plugin/rootfs +docker container rm -vf seawadd-csi_tmp +docker image rm seawadd-csi_tmp_img + +docker plugin disable gradlon/swarm-csi-swaweedfs:v1.2.0 +docker plugin rm ${PREFIX}/${PLUGIN_NAME}:${PLUGIN_TAG} 2> /dev/null || true +docker plugin create ${PREFIX}/${PLUGIN_NAME}:${PLUGIN_TAG} ./plugin +docker plugin push ${PREFIX}/${PLUGIN_NAME}:${PLUGIN_TAG} +rm -rf ./plugin/ diff --git a/cmd/seaweedfs-csi-driver/swarm/config.json b/cmd/seaweedfs-csi-driver/swarm/config.json new file mode 100644 index 0000000..3fc5445 --- /dev/null +++ b/cmd/seaweedfs-csi-driver/swarm/config.json @@ -0,0 +1,95 @@ + +{ + "description": "SeaweedFS csi-driver plugin for Docker", + "documentation": "https://github.com/seaweedfs/seaweedfs-csi-driver", + "entrypoint": ["/entrypoint.sh"], + "env": [ + { + "name": "FILER", + "description": "Filer endpoint/s, Fromat <IP1>:<PORT>,<IP2>:<PORT2>", + "settable": [ + "value" + ], + "value": "" + }, + { + "name": "CACHE_SIZE", + "description": "The size of the cache to use in MB. Default: 256MB", + "settable": [ + "value" + ], + "value": "256" + }, + { + "name": "CACHE_DIR", + "description": "The cache directory.", + "settable": [ + "value" + ], + "value": "" + }, + { + "name": "C_WRITER", + "description": "Limit concurrent goroutine writers if not 0. Default 32", + "settable": [ + "value" + ], + "value": "" + }, + { + "name": "DATACENTER", + "description": "dataCenter this node is running in (locality-definition)", + "settable": [ + "value" + ], + "value": "DefaultDataCenter" + }, + { + "name": "UID_MAP", + "description": "map local uid to uid on filer, comma-separated <local_uid>:<filer_uid>", + "settable": [ + "value" + ], + "value": "" + }, + { + "name": "GID_MAP", + "description": "map local gid to gid on filer, comma-separated <local_gid>:<filer_gid>", + "settable": [ + "value" + ], + "value": "" + }, + { + "name": "FORCE_STAGING_SUPPORT", + "description": "workaround: force staging support to make Docker 23.0.0 work without https://github.com/moby/swarmkit/pull/3116", + "settable": ["value"], + "value": "true" + } + ], + "interface": { + "socket": "seaweed.sock", + "types": ["docker.csicontroller/1.0", "docker.csinode/1.0"] + }, + "linux": { + "allowAllDevices": true, + "capabilities": ["CAP_SYS_ADMIN"], + "devices": [ + { + "path": "/dev/fuse" + } + ] + }, + "mounts": [ + { + "destination": "/node_hostname", + "source": "/etc/hostname", + "type": "bind", + "options":["bind"] + } + ], + "network": { + "type": "host" + }, + "propagatedmount": "/data/published" +} diff --git a/cmd/seaweedfs-csi-driver/swarm/entrypoint.sh b/cmd/seaweedfs-csi-driver/swarm/entrypoint.sh new file mode 100644 index 0000000..c7f9e20 --- /dev/null +++ b/cmd/seaweedfs-csi-driver/swarm/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ -z "$FILER" ]; then + echo "FILER is not set!" + exit 1 +fi + +NODE_ID=$(cat /node_hostname) +CACHE_DIR=${CACHE_DIR:-$(mktemp -d)} +C_WRITER=${C_WRITER:-32} + +CMD="/seaweedfs-csi-driver --filer=$FILER --nodeid=${NODE_ID} --endpoint=unix://run/docker/plugins/seaweed.sock --concurrentWriters=${C_WRITER} --dataCenter=${DATACENTER} --dataLocality=none --logtostderr --map.uid=${UID_MAP} --map.gid=${GID_MAP} --cacheCapacityMB=${CACHE_SIZE} --cacheDir=${CACHE_DIR}" + +exec $CMD |
