bingoohuang
4 years ago
720 changed files with 80558 additions and 15208 deletions
-
2.github/ISSUE_TEMPLATE/bug_report.md
-
22.github/workflows/cleanup.yml
-
37.github/workflows/go.yml
-
64.github/workflows/release.yml
-
7.travis.yml
-
24Makefile
-
244README.md
-
3backers.md
-
30docker/Dockerfile
-
25docker/Dockerfile.go_build
-
42docker/Dockerfile.go_build_large
-
32docker/Dockerfile.local
-
31docker/Dockerfile.s3tests
-
63docker/Makefile
-
22docker/README.md
-
0docker/compose/dev.env
-
75docker/compose/local-cluster-compose.yml
-
28docker/compose/local-clusters-compose.yml
-
67docker/compose/local-dev-compose.yml
-
94docker/compose/local-k8s-compose.yml
-
50docker/compose/local-minio-gateway-compose.yml
-
46docker/compose/local-mount-compose.yml
-
47docker/compose/local-mount-profile-compose.yml
-
85docker/compose/local-registry-compose.yml
-
61docker/compose/local-replicate-compose.yml
-
45docker/compose/local-s3tests-compose.yml
-
30docker/compose/master-cloud.toml
-
17docker/compose/notification.toml
-
11docker/compose/replication.toml
-
105docker/compose/s3.json
-
70docker/compose/s3tests.conf
-
84docker/compose/swarm-etcd.yml
-
14docker/compose/tls.env
-
43docker/dev-compose.yml
-
67docker/entrypoint.sh
-
30docker/nginx/proxy.conf
-
13docker/prometheus/prometheus.yml
-
57docker/seaweedfs-compose.yml
-
44docker/seaweedfs-dev-compose.yml
-
12docker/seaweedfs.sql
-
117go.mod
-
895go.sum
-
48k8s/README.md
-
22k8s/seaweedfs/.helmignore
-
5k8s/seaweedfs/Chart.yaml
-
1856k8s/seaweedfs/dashboards/seaweedfs-grafana-dashboard.json
-
151k8s/seaweedfs/templates/_helpers.tpl
-
14k8s/seaweedfs/templates/ca-cert.yaml
-
8k8s/seaweedfs/templates/cert-clusterissuer.yaml
-
33k8s/seaweedfs/templates/client-cert.yaml
-
58k8s/seaweedfs/templates/cronjob.yaml
-
33k8s/seaweedfs/templates/filer-cert.yaml
-
31k8s/seaweedfs/templates/filer-service-client.yaml
-
25k8s/seaweedfs/templates/filer-service.yaml
-
18k8s/seaweedfs/templates/filer-servicemonitor.yaml
-
267k8s/seaweedfs/templates/filer-statefulset.yaml
-
59k8s/seaweedfs/templates/ingress.yaml
-
33k8s/seaweedfs/templates/master-cert.yaml
-
25k8s/seaweedfs/templates/master-service.yaml
-
227k8s/seaweedfs/templates/master-statefulset.yaml
-
188k8s/seaweedfs/templates/s3-deployment.yaml
-
23k8s/seaweedfs/templates/s3-service.yaml
-
18k8s/seaweedfs/templates/s3-servicemonitor.yaml
-
20k8s/seaweedfs/templates/seaweedfs-grafana-dashboard.yaml
-
21k8s/seaweedfs/templates/seaweedfs-s3-secret.yaml
-
14k8s/seaweedfs/templates/secret-seaweedfs-db.yaml
-
52k8s/seaweedfs/templates/security-configmap.yaml
-
29k8s/seaweedfs/templates/service-account.yaml
-
33k8s/seaweedfs/templates/volume-cert.yaml
-
28k8s/seaweedfs/templates/volume-service.yaml
-
18k8s/seaweedfs/templates/volume-servicemonitor.yaml
-
276k8s/seaweedfs/templates/volume-statefulset.yaml
-
418k8s/seaweedfs/values.yaml
-
BINnote/SeaweedFS_Architecture.png
-
BINnote/SeaweedFS_Cluster_Backup.png
-
BINnote/SeaweedFS_XDR.png
-
BINnote/shuguang.png
-
24other/java/client/pom.xml
-
170other/java/client/pom.xml.deploy
-
144other/java/client/pom_debug.xml
-
42other/java/client/src/main/java/seaweedfs/client/ByteBufferPool.java
-
36other/java/client/src/main/java/seaweedfs/client/ChunkCache.java
-
140other/java/client/src/main/java/seaweedfs/client/FileChunkManifest.java
-
170other/java/client/src/main/java/seaweedfs/client/FilerClient.java
-
84other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java
-
41other/java/client/src/main/java/seaweedfs/client/Gzip.java
-
55other/java/client/src/main/java/seaweedfs/client/SeaweedCipher.java
-
208other/java/client/src/main/java/seaweedfs/client/SeaweedInputStream.java
-
181other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java
-
300other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java
-
30other/java/client/src/main/java/seaweedfs/client/SeaweedUtil.java
-
121other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java
-
36other/java/client/src/main/java/seaweedfs/client/VolumeIdCache.java
-
152other/java/client/src/main/proto/filer.proto
-
42other/java/client/src/test/java/seaweedfs/client/SeaweedCipherTest.java
-
5other/java/client/src/test/java/seaweedfs/client/SeaweedReadTest.java
-
32other/java/examples/pom.xml
-
48other/java/examples/src/main/java/com/seaweedfs/examples/ExampleReadFile.java
-
46other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWatchFileChanges.java
-
47other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWriteFile.java
@ -0,0 +1,22 @@ |
|||||
|
name: Cleanup |
||||
|
|
||||
|
on: |
||||
|
push: |
||||
|
branches: [ master ] |
||||
|
|
||||
|
jobs: |
||||
|
|
||||
|
build: |
||||
|
name: Build |
||||
|
runs-on: ubuntu-latest |
||||
|
|
||||
|
steps: |
||||
|
|
||||
|
- name: Delete old release assets |
||||
|
uses: mknejp/delete-release-assets@v1 |
||||
|
with: |
||||
|
token: ${{ github.token }} |
||||
|
tag: dev |
||||
|
fail-if-no-assets: false |
||||
|
assets: | |
||||
|
weed-* |
@ -0,0 +1,37 @@ |
|||||
|
name: Go |
||||
|
|
||||
|
on: |
||||
|
push: |
||||
|
branches: [ master ] |
||||
|
pull_request: |
||||
|
branches: [ master ] |
||||
|
|
||||
|
jobs: |
||||
|
|
||||
|
build: |
||||
|
name: Build |
||||
|
runs-on: ubuntu-latest |
||||
|
steps: |
||||
|
|
||||
|
- name: Set up Go 1.x |
||||
|
uses: actions/setup-go@v2 |
||||
|
with: |
||||
|
go-version: ^1.13 |
||||
|
id: go |
||||
|
|
||||
|
- name: Check out code into the Go module directory |
||||
|
uses: actions/checkout@v2 |
||||
|
|
||||
|
- name: Get dependencies |
||||
|
run: | |
||||
|
cd weed; go get -v -t -d ./... |
||||
|
if [ -f Gopkg.toml ]; then |
||||
|
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh |
||||
|
dep ensure |
||||
|
fi |
||||
|
|
||||
|
- name: Build |
||||
|
run: cd weed; go build -v . |
||||
|
|
||||
|
- name: Test |
||||
|
run: cd weed; go test -v ./... |
@ -0,0 +1,64 @@ |
|||||
|
name: Release |
||||
|
|
||||
|
on: |
||||
|
push: |
||||
|
branches: [ master ] |
||||
|
|
||||
|
jobs: |
||||
|
|
||||
|
build: |
||||
|
name: Build |
||||
|
runs-on: ubuntu-latest |
||||
|
strategy: |
||||
|
matrix: |
||||
|
goos: [linux, windows, darwin, freebsd ] |
||||
|
goarch: [amd64, arm] |
||||
|
exclude: |
||||
|
- goarch: arm |
||||
|
goos: darwin |
||||
|
- goarch: arm |
||||
|
goos: windows |
||||
|
|
||||
|
steps: |
||||
|
|
||||
|
- name: Check out code into the Go module directory |
||||
|
uses: actions/checkout@v2 |
||||
|
|
||||
|
- name: Wait for the deletion |
||||
|
uses: jakejarvis/wait-action@master |
||||
|
with: |
||||
|
time: '30s' |
||||
|
|
||||
|
- name: Set BUILD_TIME env |
||||
|
run: echo BUILD_TIME=$(date -u +%Y-%m-%d-%H-%M) >> ${GITHUB_ENV} |
||||
|
|
||||
|
- name: Go Release Binaries |
||||
|
uses: wangyoucao577/go-release-action@v1.14 |
||||
|
with: |
||||
|
github_token: ${{ secrets.GITHUB_TOKEN }} |
||||
|
goos: ${{ matrix.goos }} |
||||
|
goarch: ${{ matrix.goarch }} |
||||
|
release_tag: dev |
||||
|
overwrite: true |
||||
|
pre_command: export CGO_ENABLED=0 |
||||
|
build_flags: -tags 5BytesOffset # optional, default is |
||||
|
ldflags: -extldflags -static -X github.com/chrislusf/seaweedfs/weed/util.COMMIT=${{github.sha}} |
||||
|
# Where to run `go build .` |
||||
|
project_path: weed |
||||
|
binary_name: weed-large-disk |
||||
|
asset_name: "weed-large-disk-${{ env.BUILD_TIME }}-${{ matrix.goos }}-${{ matrix.goarch }}" |
||||
|
|
||||
|
- name: Go Release Binaries |
||||
|
uses: wangyoucao577/go-release-action@v1.14 |
||||
|
with: |
||||
|
github_token: ${{ secrets.GITHUB_TOKEN }} |
||||
|
goos: ${{ matrix.goos }} |
||||
|
goarch: ${{ matrix.goarch }} |
||||
|
release_tag: dev |
||||
|
overwrite: true |
||||
|
pre_command: export CGO_ENABLED=0 |
||||
|
ldflags: -extldflags -static -X github.com/chrislusf/seaweedfs/weed/util.COMMIT=${{github.sha}} |
||||
|
# Where to run `go build .` |
||||
|
project_path: weed |
||||
|
binary_name: weed |
||||
|
asset_name: "weed-${{ env.BUILD_TIME }}-${{ matrix.goos }}-${{ matrix.goarch }}" |
@ -0,0 +1,42 @@ |
|||||
|
FROM frolvlad/alpine-glibc as builder |
||||
|
RUN apk add git go g++ fuse |
||||
|
RUN mkdir -p /go/src/github.com/chrislusf/ |
||||
|
RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs |
||||
|
ARG BRANCH=${BRANCH:-master} |
||||
|
RUN cd /go/src/github.com/chrislusf/seaweedfs && git checkout $BRANCH |
||||
|
RUN cd /go/src/github.com/chrislusf/seaweedfs/weed \ |
||||
|
&& export LDFLAGS="-X github.com/chrislusf/seaweedfs/weed/util.COMMIT=$(git rev-parse --short HEAD)" \ |
||||
|
&& CGO_ENABLED=0 go install -tags 5BytesOffset -ldflags "-extldflags -static ${LDFLAGS}" |
||||
|
|
||||
|
FROM alpine AS final |
||||
|
LABEL author="Chris Lu" |
||||
|
COPY --from=builder /root/go/bin/weed /usr/bin/ |
||||
|
RUN mkdir -p /etc/seaweedfs |
||||
|
COPY --from=builder /go/src/github.com/chrislusf/seaweedfs/docker/filer.toml /etc/seaweedfs/filer.toml |
||||
|
COPY --from=builder /go/src/github.com/chrislusf/seaweedfs/docker/entrypoint.sh /entrypoint.sh |
||||
|
RUN apk add fuse # for weed mount |
||||
|
|
||||
|
# volume server gprc port |
||||
|
EXPOSE 18080 |
||||
|
# volume server http port |
||||
|
EXPOSE 8080 |
||||
|
# filer server gprc port |
||||
|
EXPOSE 18888 |
||||
|
# filer server http port |
||||
|
EXPOSE 8888 |
||||
|
# master server shared gprc port |
||||
|
EXPOSE 19333 |
||||
|
# master server shared http port |
||||
|
EXPOSE 9333 |
||||
|
# s3 server http port |
||||
|
EXPOSE 8333 |
||||
|
# webdav server http port |
||||
|
EXPOSE 7333 |
||||
|
|
||||
|
RUN mkdir -p /data/filerldb2 |
||||
|
|
||||
|
VOLUME /data |
||||
|
|
||||
|
RUN chmod +x /entrypoint.sh |
||||
|
|
||||
|
ENTRYPOINT ["/entrypoint.sh"] |
@ -0,0 +1,32 @@ |
|||||
|
FROM alpine AS final |
||||
|
LABEL author="Chris Lu" |
||||
|
COPY ./weed /usr/bin/ |
||||
|
RUN mkdir -p /etc/seaweedfs |
||||
|
COPY ./filer.toml /etc/seaweedfs/filer.toml |
||||
|
COPY ./entrypoint.sh /entrypoint.sh |
||||
|
RUN apk add fuse # for weed mount |
||||
|
|
||||
|
# volume server grpc port |
||||
|
EXPOSE 18080 |
||||
|
# volume server http port |
||||
|
EXPOSE 8080 |
||||
|
# filer server grpc port |
||||
|
EXPOSE 18888 |
||||
|
# filer server http port |
||||
|
EXPOSE 8888 |
||||
|
# master server shared grpc port |
||||
|
EXPOSE 19333 |
||||
|
# master server shared http port |
||||
|
EXPOSE 9333 |
||||
|
# s3 server http port |
||||
|
EXPOSE 8333 |
||||
|
# webdav server http port |
||||
|
EXPOSE 7333 |
||||
|
|
||||
|
RUN mkdir -p /data/filerldb2 |
||||
|
|
||||
|
VOLUME /data |
||||
|
|
||||
|
RUN chmod +x /entrypoint.sh |
||||
|
|
||||
|
ENTRYPOINT ["/entrypoint.sh"] |
@ -0,0 +1,31 @@ |
|||||
|
FROM ubuntu:20.04 |
||||
|
|
||||
|
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ |
||||
|
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \ |
||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
||||
|
git \ |
||||
|
sudo \ |
||||
|
debianutils \ |
||||
|
python3-pip \ |
||||
|
python3-virtualenv \ |
||||
|
python3-dev \ |
||||
|
libevent-dev \ |
||||
|
libffi-dev \ |
||||
|
libxml2-dev \ |
||||
|
libxslt-dev \ |
||||
|
zlib1g-dev && \ |
||||
|
DEBIAN_FRONTEND=noninteractive apt-get clean && \ |
||||
|
rm -rf /var/lib/apt/lists/* && \ |
||||
|
git clone https://github.com/ceph/s3-tests.git /opt/s3-tests |
||||
|
|
||||
|
WORKDIR /opt/s3-tests |
||||
|
RUN ./bootstrap |
||||
|
|
||||
|
ENV \ |
||||
|
NOSETESTS_EXCLUDE="" \ |
||||
|
NOSETESTS_ATTR="" \ |
||||
|
NOSETESTS_OPTIONS="" \ |
||||
|
S3TEST_CONF="/s3test.conf" |
||||
|
|
||||
|
ENTRYPOINT ["/bin/bash", "-c"] |
||||
|
CMD ["sleep 10 && exec ./virtualenv/bin/nosetests ${NOSETESTS_OPTIONS-} ${NOSETESTS_ATTR:+-a $NOSETESTS_ATTR} ${NOSETESTS_EXCLUDE:+-e $NOSETESTS_EXCLUDE}"] |
@ -0,0 +1,63 @@ |
|||||
|
all: gen |
||||
|
|
||||
|
.PHONY : gen |
||||
|
|
||||
|
gen: dev |
||||
|
|
||||
|
binary: |
||||
|
cd ../weed; CGO_ENABLED=0 GOOS=linux go build -ldflags "-extldflags -static"; mv weed ../docker/ |
||||
|
|
||||
|
build: binary |
||||
|
docker build --no-cache -t chrislusf/seaweedfs:local -f Dockerfile.local . |
||||
|
rm ./weed |
||||
|
|
||||
|
s3tests_build: |
||||
|
docker build --no-cache -t chrislusf/ceph-s3-tests:local -f Dockerfile.s3tests . |
||||
|
|
||||
|
dev: build |
||||
|
docker-compose -f compose/local-dev-compose.yml -p seaweedfs up |
||||
|
|
||||
|
dev_tls: build certstrap |
||||
|
ENV_FILE="tls.env" docker-compose -f compose/local-dev-compose.yml -p seaweedfs up |
||||
|
|
||||
|
dev_mount: build |
||||
|
docker-compose -f compose/local-mount-compose.yml -p seaweedfs up |
||||
|
|
||||
|
profile_mount: build |
||||
|
docker-compose -f compose/local-mount-profile-compose.yml -p seaweedfs up |
||||
|
|
||||
|
k8s: build |
||||
|
docker-compose -f compose/local-k8s-compose.yml -p seaweedfs up |
||||
|
|
||||
|
dev_registry: build |
||||
|
docker-compose -f compose/local-registry-compose.yml -p seaweedfs up |
||||
|
|
||||
|
dev_replicate: build |
||||
|
docker-compose -f compose/local-replicate-compose.yml -p seaweedfs up |
||||
|
|
||||
|
cluster: build |
||||
|
docker-compose -f compose/local-cluster-compose.yml -p seaweedfs up |
||||
|
|
||||
|
2clusters: build |
||||
|
docker-compose -f compose/local-clusters-compose.yml -p seaweedfs up |
||||
|
|
||||
|
s3tests: build s3tests_build |
||||
|
docker-compose -f compose/local-s3tests-compose.yml -p seaweedfs up |
||||
|
|
||||
|
filer_etcd: build |
||||
|
docker stack deploy -c compose/swarm-etcd.yml fs |
||||
|
|
||||
|
clean: |
||||
|
rm ./weed |
||||
|
|
||||
|
certstrap: |
||||
|
go get github.com/square/certstrap |
||||
|
certstrap --depot-path compose/tls init --passphrase "" --common-name "SeaweedFS CA" || true |
||||
|
certstrap --depot-path compose/tls request-cert --passphrase "" --common-name volume01.dev || true |
||||
|
certstrap --depot-path compose/tls request-cert --passphrase "" --common-name master01.dev || true |
||||
|
certstrap --depot-path compose/tls request-cert --passphrase "" --common-name filer01.dev || true |
||||
|
certstrap --depot-path compose/tls request-cert --passphrase "" --common-name client01.dev || true |
||||
|
certstrap --depot-path compose/tls sign --CA "SeaweedFS CA" volume01.dev || true |
||||
|
certstrap --depot-path compose/tls sign --CA "SeaweedFS CA" master01.dev || true |
||||
|
certstrap --depot-path compose/tls sign --CA "SeaweedFS CA" filer01.dev || true |
||||
|
certstrap --depot-path compose/tls sign --CA "SeaweedFS CA" client01.dev || true |
@ -0,0 +1,75 @@ |
|||||
|
version: '2' |
||||
|
|
||||
|
services: |
||||
|
master0: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9333:9333 |
||||
|
- 19333:19333 |
||||
|
command: "master -ip=master0 -port=9333 -peers=master0:9333,master1:9334,master2:9335 -mdir=/data/m1" |
||||
|
master1: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9334:9334 |
||||
|
- 19334:19334 |
||||
|
command: "master -ip=master1 -port=9334 -peers=master0:9333,master1:9334,master2:9335 -mdir=/data/m2" |
||||
|
master2: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9335:9335 |
||||
|
- 19335:19335 |
||||
|
command: "master -ip=master2 -port=9335 -peers=master0:9333,master1:9334,master2:9335 -mdir=/data/m3" |
||||
|
volume1: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8080:8080 |
||||
|
- 18080:18080 |
||||
|
command: 'volume -mserver="master0:9333,master1:9334,master2:9335" -port=8080 -ip=volume1 -publicUrl=localhost:8080 -preStopSeconds=1 -disk=ssd1' |
||||
|
depends_on: |
||||
|
- master0 |
||||
|
- master1 |
||||
|
- master2 |
||||
|
volume2: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8082:8082 |
||||
|
- 18082:18082 |
||||
|
command: 'volume -mserver="master0:9333,master1:9334,master2:9335" -port=8082 -ip=volume2 -publicUrl=localhost:8082 -preStopSeconds=1 -disk=ssd1' |
||||
|
depends_on: |
||||
|
- master0 |
||||
|
- master1 |
||||
|
- master2 |
||||
|
volume3: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8083:8083 |
||||
|
- 18083:18083 |
||||
|
command: 'volume -mserver="master0:9333,master1:9334,master2:9335" -port=8083 -ip=volume3 -publicUrl=localhost:8083 -preStopSeconds=1' |
||||
|
depends_on: |
||||
|
- master0 |
||||
|
- master1 |
||||
|
- master2 |
||||
|
filer: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8888:8888 |
||||
|
- 18888:18888 |
||||
|
command: 'filer -master="master0:9333,master1:9334,master2:9335"' |
||||
|
depends_on: |
||||
|
- master0 |
||||
|
- master1 |
||||
|
- master2 |
||||
|
- volume1 |
||||
|
- volume2 |
||||
|
s3: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8333:8333 |
||||
|
command: 's3 -filer="filer:8888"' |
||||
|
depends_on: |
||||
|
- master0 |
||||
|
- master1 |
||||
|
- master2 |
||||
|
- volume1 |
||||
|
- volume2 |
||||
|
- filer |
@ -0,0 +1,28 @@ |
|||||
|
version: '2' |
||||
|
|
||||
|
services: |
||||
|
server1: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9333:9333 |
||||
|
- 19333:19333 |
||||
|
- 8084:8080 |
||||
|
- 18084:18080 |
||||
|
- 8888:8888 |
||||
|
- 18888:18888 |
||||
|
command: "server -ip=server1 -filer -volume.max=0 -master.volumeSizeLimitMB=1024 -volume.preStopSeconds=1" |
||||
|
volumes: |
||||
|
- ./master-cloud.toml:/etc/seaweedfs/master.toml |
||||
|
depends_on: |
||||
|
- server2 |
||||
|
server2: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9334:9333 |
||||
|
- 19334:19333 |
||||
|
- 8085:8080 |
||||
|
- 18085:18080 |
||||
|
- 8889:8888 |
||||
|
- 18889:18888 |
||||
|
- 8334:8333 |
||||
|
command: "server -ip=server2 -filer -s3 -volume.max=0 -master.volumeSizeLimitMB=1024 -volume.preStopSeconds=1" |
@ -0,0 +1,67 @@ |
|||||
|
version: '2' |
||||
|
|
||||
|
services: |
||||
|
master: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9333:9333 |
||||
|
- 19333:19333 |
||||
|
command: "-v=1 master -ip=master" |
||||
|
volumes: |
||||
|
- ./tls:/etc/seaweedfs/tls |
||||
|
env_file: |
||||
|
- ${ENV_FILE:-dev.env} |
||||
|
volume: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8080:8080 |
||||
|
- 18080:18080 |
||||
|
command: "-v=1 volume -mserver=master:9333 -port=8080 -ip=volume -preStopSeconds=1" |
||||
|
depends_on: |
||||
|
- master |
||||
|
volumes: |
||||
|
- ./tls:/etc/seaweedfs/tls |
||||
|
env_file: |
||||
|
- ${ENV_FILE:-dev.env} |
||||
|
filer: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8111:8111 |
||||
|
- 8888:8888 |
||||
|
- 18888:18888 |
||||
|
command: '-v=1 filer -master="master:9333" -iam' |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
volumes: |
||||
|
- ./tls:/etc/seaweedfs/tls |
||||
|
env_file: |
||||
|
- ${ENV_FILE:-dev.env} |
||||
|
s3: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8333:8333 |
||||
|
command: '-v=1 s3 -filer="filer:8888"' |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- filer |
||||
|
volumes: |
||||
|
- ./tls:/etc/seaweedfs/tls |
||||
|
env_file: |
||||
|
- ${ENV_FILE:-dev.env} |
||||
|
mount: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
privileged: true |
||||
|
cap_add: |
||||
|
- SYS_ADMIN |
||||
|
mem_limit: 4096m |
||||
|
command: '-v=4 mount -filer="filer:8888" -dirAutoCreate -dir=/mnt/seaweedfs -cacheCapacityMB=100 -concurrentWriters=128' |
||||
|
volumes: |
||||
|
- ./tls:/etc/seaweedfs/tls |
||||
|
env_file: |
||||
|
- ${ENV_FILE:-dev.env} |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- filer |
@ -0,0 +1,94 @@ |
|||||
|
version: '2' |
||||
|
|
||||
|
services: |
||||
|
master: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9333:9333 |
||||
|
- 19333:19333 |
||||
|
command: "master -ip=master" |
||||
|
volume: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8080:8080 |
||||
|
- 18080:18080 |
||||
|
command: "volume -mserver=master:9333 -port=8080 -ip=volume" |
||||
|
depends_on: |
||||
|
- master |
||||
|
mysql: |
||||
|
image: percona/percona-server:5.7 |
||||
|
ports: |
||||
|
- 3306:3306 |
||||
|
volumes: |
||||
|
- ./seaweedfs.sql:/docker-entrypoint-initdb.d/seaweedfs.sql |
||||
|
environment: |
||||
|
- MYSQL_ROOT_PASSWORD=secret |
||||
|
- MYSQL_DATABASE=seaweedfs |
||||
|
- MYSQL_PASSWORD=secret |
||||
|
- MYSQL_USER=seaweedfs |
||||
|
filer: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8888:8888 |
||||
|
- 18888:18888 |
||||
|
environment: |
||||
|
- WEED_MYSQL_HOSTNAME=mysql |
||||
|
- WEED_MYSQL_PORT=3306 |
||||
|
- WEED_MYSQL_DATABASE=seaweedfs |
||||
|
- WEED_MYSQL_USERNAME=seaweedfs |
||||
|
- WEED_MYSQL_PASSWORD=secret |
||||
|
- WEED_MYSQL_ENABLED=true |
||||
|
- WEED_MYSQL_CONNECTION_MAX_IDLE=5 |
||||
|
- WEED_MYSQL_CONNECTION_MAX_OPEN=75 |
||||
|
# "refresh" connection every 10 minutes, eliminating mysql closing "old" connections |
||||
|
- WEED_MYSQL_CONNECTION_MAX_LIFETIME_SECONDS=600 |
||||
|
# enable usage of memsql as filer backend |
||||
|
- WEED_MYSQL_INTERPOLATEPARAMS=true |
||||
|
- WEED_LEVELDB2_ENABLED=false |
||||
|
command: '-v 9 filer -master="master:9333"' |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- mysql |
||||
|
ingress: |
||||
|
image: jwilder/nginx-proxy:alpine |
||||
|
ports: |
||||
|
- "80:80" |
||||
|
volumes: |
||||
|
- /var/run/docker.sock:/tmp/docker.sock:ro |
||||
|
- ./nginx/proxy.conf:/etc/nginx/proxy.conf |
||||
|
s3: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8333:8333 |
||||
|
command: '-v 9 s3 -filer="filer:8888"' |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- filer |
||||
|
environment: |
||||
|
- VIRTUAL_HOST=ingress |
||||
|
- VIRTUAL_PORT=8333 |
||||
|
registry: |
||||
|
image: registry:2 |
||||
|
environment: |
||||
|
REGISTRY_HTTP_ADDR: "0.0.0.0:5001" # seaweedfs s3 |
||||
|
REGISTRY_LOG_LEVEL: "debug" |
||||
|
REGISTRY_STORAGE: "s3" |
||||
|
REGISTRY_STORAGE_S3_REGION: "us-east-1" |
||||
|
REGISTRY_STORAGE_S3_REGIONENDPOINT: "http://ingress" |
||||
|
REGISTRY_STORAGE_S3_BUCKET: "registry" |
||||
|
REGISTRY_STORAGE_S3_ACCESSKEY: "some_access_key1" |
||||
|
REGISTRY_STORAGE_S3_SECRETKEY: "some_secret_key1" |
||||
|
REGISTRY_STORAGE_S3_V4AUTH: "true" |
||||
|
REGISTRY_STORAGE_S3_SECURE: "false" |
||||
|
REGISTRY_STORAGE_S3_SKIPVERIFY: "true" |
||||
|
REGISTRY_STORAGE_S3_ROOTDIRECTORY: "/" |
||||
|
REGISTRY_STORAGE_DELETE_ENABLED: "true" |
||||
|
REGISTRY_STORAGE_REDIRECT_DISABLE: "true" |
||||
|
REGISTRY_VALIDATION_DISABLED: "true" |
||||
|
ports: |
||||
|
- 5001:5001 |
||||
|
depends_on: |
||||
|
- s3 |
||||
|
- ingress |
@ -0,0 +1,50 @@ |
|||||
|
version: '2' |
||||
|
|
||||
|
services: |
||||
|
master: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9333:9333 |
||||
|
- 19333:19333 |
||||
|
command: "master -ip=master -volumeSizeLimitMB=1024" |
||||
|
volume: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8080:8080 |
||||
|
- 18080:18080 |
||||
|
command: "volume -mserver=master:9333 -port=8080 -ip=volume -max=0 -preStopSeconds=1" |
||||
|
depends_on: |
||||
|
- master |
||||
|
s3: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8888:8888 |
||||
|
- 18888:18888 |
||||
|
- 8333:8333 |
||||
|
command: '-v 1 filer -master="master:9333" -s3 -s3.config=/etc/seaweedfs/s3.json -s3.port=8333' |
||||
|
volumes: |
||||
|
- ./s3.json:/etc/seaweedfs/s3.json |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
minio-gateway-s3: |
||||
|
image: minio/minio |
||||
|
ports: |
||||
|
- 9000:9000 |
||||
|
command: 'minio gateway s3 http://s3:8333' |
||||
|
restart: on-failure |
||||
|
environment: |
||||
|
MINIO_ACCESS_KEY: "some_access_key1" |
||||
|
MINIO_SECRET_KEY: "some_secret_key1" |
||||
|
depends_on: |
||||
|
- s3 |
||||
|
minio-warp: |
||||
|
image: minio/warp |
||||
|
command: 'mixed --duration=5m --obj.size=3mb --autoterm' |
||||
|
restart: on-failure |
||||
|
environment: |
||||
|
WARP_HOST: "minio-gateway-s3:9000" |
||||
|
WARP_ACCESS_KEY: "some_access_key1" |
||||
|
WARP_SECRET_KEY: "some_secret_key1" |
||||
|
depends_on: |
||||
|
- minio-gateway-s3 |
@ -0,0 +1,46 @@ |
|||||
|
version: '2' |
||||
|
|
||||
|
services: |
||||
|
master: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9333:9333 |
||||
|
- 19333:19333 |
||||
|
command: "master -ip=master" |
||||
|
volume: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 7455:8080 |
||||
|
- 9325:9325 |
||||
|
command: 'volume -mserver="master:9333" -port=8080 -metricsPort=9325 -preStopSeconds=1 -publicUrl=localhost:7455' |
||||
|
depends_on: |
||||
|
- master |
||||
|
filer: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8888:8888 |
||||
|
- 18888:18888 |
||||
|
- 9326:9326 |
||||
|
command: 'filer -master="master:9333" -metricsPort=9326' |
||||
|
tty: true |
||||
|
stdin_open: true |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
mount_1: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
privileged: true |
||||
|
entrypoint: '/bin/sh -c "mkdir -p t1 && mkdir -p cache/t1 && weed -v=4 mount -filer=filer:8888 -cacheDir=./cache/t1 -dir=./t1 -filer.path=/c1 -volumeServerAccess=filerProxy"' |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- filer |
||||
|
mount_2: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
privileged: true |
||||
|
entrypoint: '/bin/sh -c "mkdir -p t2 && mkdir -p cache/t2 && weed -v=4 mount -filer=filer:8888 -cacheDir=./cache/t2 -dir=./t2 -filer.path=/c1 -volumeServerAcess=publicUrl"' |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- filer |
||||
|
- mount_1 |
@ -0,0 +1,47 @@ |
|||||
|
version: '2' |
||||
|
|
||||
|
services: |
||||
|
master: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9333:9333 |
||||
|
- 19333:19333 |
||||
|
command: "master -ip=master" |
||||
|
volume: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 7455:8080 |
||||
|
- 9325:9325 |
||||
|
volumes: |
||||
|
- /Volumes/mobile_disk/99:/data |
||||
|
command: 'volume -mserver="master:9333" -port=8080 -metricsPort=9325 -preStopSeconds=1 -publicUrl=localhost:7455' |
||||
|
depends_on: |
||||
|
- master |
||||
|
filer: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8888:8888 |
||||
|
- 18888:18888 |
||||
|
- 9326:9326 |
||||
|
volumes: |
||||
|
- /Volumes/mobile_disk/99:/data |
||||
|
command: 'filer -master="master:9333" -metricsPort=9326' |
||||
|
tty: true |
||||
|
stdin_open: true |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
mount: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
privileged: true |
||||
|
cap_add: |
||||
|
- SYS_ADMIN |
||||
|
devices: |
||||
|
- fuse |
||||
|
volumes: |
||||
|
- /Volumes/mobile_disk/99:/data |
||||
|
entrypoint: '/bin/sh -c "mkdir -p t1 && weed mount -filer=filer:8888 -dir=./t1 -cacheCapacityMB=0 -memprofile=/data/mount.mem.pprof"' |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- filer |
@ -0,0 +1,85 @@ |
|||||
|
version: '2' |
||||
|
|
||||
|
services: |
||||
|
master: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9333:9333 |
||||
|
- 19333:19333 |
||||
|
command: "master -ip=master -volumeSizeLimitMB=1024" |
||||
|
volume: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8080:8080 |
||||
|
- 18080:18080 |
||||
|
command: "volume -mserver=master:9333 -port=8080 -ip=volume -max=0 -preStopSeconds=1" |
||||
|
depends_on: |
||||
|
- master |
||||
|
s3: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8888:8888 |
||||
|
- 18888:18888 |
||||
|
- 8333:8333 |
||||
|
command: '-v 9 filer -master="master:9333" -s3 -s3.config=/etc/seaweedfs/s3.json -s3.port=8333' |
||||
|
volumes: |
||||
|
- ./s3.json:/etc/seaweedfs/s3.json |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
minio: |
||||
|
image: minio/minio |
||||
|
ports: |
||||
|
- 9000:9000 |
||||
|
command: 'minio server /data' |
||||
|
environment: |
||||
|
MINIO_ACCESS_KEY: "some_access_key1" |
||||
|
MINIO_SECRET_KEY: "some_secret_key1" |
||||
|
depends_on: |
||||
|
- master |
||||
|
registry1: |
||||
|
image: registry:2 |
||||
|
environment: |
||||
|
REGISTRY_HTTP_ADDR: "0.0.0.0:5001" # seaweedfs s3 |
||||
|
REGISTRY_LOG_LEVEL: "debug" |
||||
|
REGISTRY_STORAGE: "s3" |
||||
|
REGISTRY_STORAGE_S3_REGION: "us-east-1" |
||||
|
REGISTRY_STORAGE_S3_REGIONENDPOINT: "http://s3:8333" |
||||
|
REGISTRY_STORAGE_S3_BUCKET: "registry" |
||||
|
REGISTRY_STORAGE_S3_ACCESSKEY: "some_access_key1" |
||||
|
REGISTRY_STORAGE_S3_SECRETKEY: "some_secret_key1" |
||||
|
REGISTRY_STORAGE_S3_V4AUTH: "true" |
||||
|
REGISTRY_STORAGE_S3_SECURE: "false" |
||||
|
REGISTRY_STORAGE_S3_SKIPVERIFY: "true" |
||||
|
REGISTRY_STORAGE_S3_ROOTDIRECTORY: "/" |
||||
|
REGISTRY_STORAGE_DELETE_ENABLED: "true" |
||||
|
REGISTRY_STORAGE_REDIRECT_DISABLE: "true" |
||||
|
REGISTRY_VALIDATION_DISABLED: "true" |
||||
|
ports: |
||||
|
- 5001:5001 |
||||
|
depends_on: |
||||
|
- s3 |
||||
|
- minio |
||||
|
registry2: |
||||
|
image: registry:2 |
||||
|
environment: |
||||
|
REGISTRY_HTTP_ADDR: "0.0.0.0:5002" # minio |
||||
|
REGISTRY_LOG_LEVEL: "debug" |
||||
|
REGISTRY_STORAGE: "s3" |
||||
|
REGISTRY_STORAGE_S3_REGION: "us-east-1" |
||||
|
REGISTRY_STORAGE_S3_REGIONENDPOINT: "http://minio:9000" |
||||
|
REGISTRY_STORAGE_S3_BUCKET: "registry" |
||||
|
REGISTRY_STORAGE_S3_ACCESSKEY: "some_access_key1" |
||||
|
REGISTRY_STORAGE_S3_SECRETKEY: "some_secret_key1" |
||||
|
REGISTRY_STORAGE_S3_V4AUTH: "true" |
||||
|
REGISTRY_STORAGE_S3_SECURE: "false" |
||||
|
REGISTRY_STORAGE_S3_SKIPVERIFY: "true" |
||||
|
REGISTRY_STORAGE_S3_ROOTDIRECTORY: "/" |
||||
|
REGISTRY_STORAGE_DELETE_ENABLED: "true" |
||||
|
REGISTRY_STORAGE_REDIRECT_DISABLE: "true" |
||||
|
REGISTRY_VALIDATION_DISABLED: "true" |
||||
|
ports: |
||||
|
- 5002:5002 |
||||
|
depends_on: |
||||
|
- s3 |
||||
|
- minio |
@ -0,0 +1,61 @@ |
|||||
|
version: '2' |
||||
|
|
||||
|
services: |
||||
|
master: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9333:9333 |
||||
|
- 19333:19333 |
||||
|
command: "master -ip=master" |
||||
|
volume: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8080:8080 |
||||
|
- 18080:18080 |
||||
|
command: "volume -mserver=master:9333 -port=8080 -ip=volume -preStopSeconds=1" |
||||
|
depends_on: |
||||
|
- master |
||||
|
filer: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8888:8888 |
||||
|
- 18888:18888 |
||||
|
command: '-v=9 filer -master="master:9333"' |
||||
|
restart: on-failure |
||||
|
volumes: |
||||
|
- ./notification.toml:/etc/seaweedfs/notification.toml |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- rabbitmq |
||||
|
- replicate |
||||
|
environment: |
||||
|
RABBIT_SERVER_URL: "amqp://guest:guest@rabbitmq:5672/" |
||||
|
replicate: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
command: '-v=9 filer.replicate' |
||||
|
restart: on-failure |
||||
|
volumes: |
||||
|
- ./notification.toml:/etc/seaweedfs/notification.toml |
||||
|
- ./replication.toml:/etc/seaweedfs/replication.toml |
||||
|
depends_on: |
||||
|
- rabbitmq |
||||
|
environment: |
||||
|
RABBIT_SERVER_URL: "amqp://guest:guest@rabbitmq:5672/" |
||||
|
s3: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8333:8333 |
||||
|
command: 's3 -filer="filer:8888"' |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- filer |
||||
|
rabbitmq: |
||||
|
image: rabbitmq:3.8.10-management-alpine |
||||
|
ports: |
||||
|
- 5672:5672 |
||||
|
- 15671:15671 |
||||
|
- 15672:15672 |
||||
|
environment: |
||||
|
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: "-rabbit log_levels [{connection,error},{queue,debug}]" |
@ -0,0 +1,45 @@ |
|||||
|
version: '2' |
||||
|
|
||||
|
services: |
||||
|
master: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 9333:9333 |
||||
|
- 19333:19333 |
||||
|
command: "master -ip=master -volumeSizeLimitMB=16" |
||||
|
environment: |
||||
|
WEED_MASTER_VOLUME_GROWTH_COPY_1: 1 |
||||
|
WEED_MASTER_VOLUME_GROWTH_COPY_OTHER: 1 |
||||
|
volume: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8080:8080 |
||||
|
- 18080:18080 |
||||
|
command: "volume -mserver=master:9333 -port=8080 -ip=volume -preStopSeconds=1" |
||||
|
depends_on: |
||||
|
- master |
||||
|
s3: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- 8888:8888 |
||||
|
- 18888:18888 |
||||
|
- 8000:8000 |
||||
|
command: 'filer -master="master:9333" -s3 -s3.config=/etc/seaweedfs/s3.json -s3.port=8000' |
||||
|
volumes: |
||||
|
- ./s3.json:/etc/seaweedfs/s3.json |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
s3tests: |
||||
|
image: chrislusf/ceph-s3-tests:local |
||||
|
volumes: |
||||
|
- ./s3tests.conf:/opt/s3-tests/s3tests.conf |
||||
|
environment: |
||||
|
S3TEST_CONF: "s3tests.conf" |
||||
|
NOSETESTS_OPTIONS: "--verbose --logging-level=ERROR --with-xunit --failure-detail s3tests_boto3.functional.test_s3" |
||||
|
NOSETESTS_ATTR: "!tagging,!fails_on_aws,!encryption,!bucket-policy,!versioning,!fails_on_rgw,!bucket-policy,!fails_with_subdomain,!policy_status,!object-lock,!lifecycle,!cors,!user-policy" |
||||
|
NOSETESTS_EXCLUDE: "(bucket_list_delimiter_basic|bucket_listv2_delimiter_basic|bucket_listv2_encoding_basic|bucket_list_encoding_basic|bucket_list_delimiter_prefix|bucket_listv2_delimiter_prefix_ends_with_delimiter|bucket_list_delimiter_prefix_ends_with_delimiter|bucket_list_delimiter_alt|bucket_listv2_delimiter_alt|bucket_list_delimiter_prefix_underscore|bucket_list_delimiter_percentage|bucket_listv2_delimiter_percentage|bucket_list_delimiter_whitespace|bucket_listv2_delimiter_whitespace|bucket_list_delimiter_dot|bucket_listv2_delimiter_dot|bucket_list_delimiter_unreadable|bucket_listv2_delimiter_unreadable|bucket_listv2_fetchowner_defaultempty|bucket_listv2_fetchowner_empty|bucket_list_prefix_delimiter_alt|bucket_listv2_prefix_delimiter_alt|bucket_list_prefix_delimiter_prefix_not_exist|bucket_listv2_prefix_delimiter_prefix_not_exist|bucket_list_prefix_delimiter_delimiter_not_exist|bucket_listv2_prefix_delimiter_delimiter_not_exist|bucket_list_prefix_delimiter_prefix_delimiter_not_exist|bucket_listv2_prefix_delimiter_prefix_delimiter_not_exist|bucket_list_maxkeys_none|bucket_listv2_maxkeys_none|bucket_list_maxkeys_invalid|bucket_listv2_continuationtoken_empty|bucket_list_return_data|bucket_list_objects_anonymous|bucket_listv2_objects_anonymous|bucket_notexist|bucketv2_notexist|bucket_delete_nonempty|bucket_concurrent_set_canned_acl|object_write_to_nonexist_bucket|object_requestid_matches_header_on_error|object_write_cache_control|object_write_expires|object_set_get_metadata_none_to_good|object_set_get_metadata_none_to_empty|object_set_get_metadata_overwrite_to_empty|post_object_anonymous_request|post_object_authenticated_request|post_object_authenticated_no_content_type|post_object_authenticated_request_bad_access_key|post_object_set_success_code|post_object_set_invalid_success_code|post_object_upload_larger_than_chunk|post_object_set_key_from_filename|post_object_ignored_header|post_object_case_insensitive_condition_fields|post_object_escaped_field_values|post_object_success_redirect_action|post_object_invalid_signature|post_object_invalid_access_key|post_object_missing_policy_condition|post_object_user_specified_header|post_object_request_missing_policy_specified_field|post_object_expired_policy|post_object_invalid_request_field_value|get_object_ifmatch_failed|get_object_ifunmodifiedsince_good|put_object_ifmatch_failed|object_raw_get_bucket_gone|object_delete_key_bucket_gone|object_raw_get_bucket_acl|object_raw_get_object_acl|object_raw_response_headers|object_raw_authenticated_bucket_gone|object_raw_get_x_amz_expires_out_max_range|object_raw_get_x_amz_expires_out_positive_range|object_anon_put_write_access|object_raw_put_authenticated_expired|bucket_create_exists|bucket_create_naming_bad_short_one|bucket_create_naming_bad_short_two|bucket_get_location|bucket_acl_default|bucket_acl_canned|bucket_acl_canned_publicreadwrite|bucket_acl_canned_authenticatedread|object_acl_default|object_acl_canned_during_create|object_acl_canned|object_acl_canned_publicreadwrite|object_acl_canned_authenticatedread|object_acl_canned_bucketownerread|object_acl_canned_bucketownerfullcontrol|object_acl_full_control_verify_attributes|bucket_acl_canned_private_to_private|bucket_acl_grant_nonexist_user|bucket_acl_no_grants|bucket_acl_grant_email_not_exist|bucket_acl_revoke_all|bucket_recreate_not_overriding|object_copy_verify_contenttype|object_copy_to_itself_with_metadata|object_copy_not_owned_bucket|object_copy_not_owned_object_bucket|object_copy_retaining_metadata|object_copy_replacing_metadata|multipart_upload_empty|multipart_copy_invalid_range|multipart_copy_special_names|multipart_upload_resend_part|multipart_upload_size_too_small|abort_multipart_upload_not_found|multipart_upload_missing_part|multipart_upload_incorrect_etag|100_continue|ranged_request_invalid_range|ranged_request_empty_object|access_bucket)" |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- s3 |
@ -0,0 +1,30 @@ |
|||||
|
|
||||
|
# Put this file to one of the location, with descending priority |
||||
|
# ./master.toml |
||||
|
# $HOME/.seaweedfs/master.toml |
||||
|
# /etc/seaweedfs/master.toml |
||||
|
# this file is read by master |
||||
|
|
||||
|
[master.maintenance] |
||||
|
# periodically run these scripts are the same as running them from 'weed shell' |
||||
|
scripts = """ |
||||
|
lock |
||||
|
ec.encode -fullPercent=95 -quietFor=1h |
||||
|
ec.rebuild -force |
||||
|
ec.balance -force |
||||
|
volume.balance -force |
||||
|
volume.fix.replication |
||||
|
unlock |
||||
|
""" |
||||
|
sleep_minutes = 17 # sleep minutes between each script execution |
||||
|
|
||||
|
# configurations for tiered cloud storage |
||||
|
# old volumes are transparently moved to cloud for cost efficiency |
||||
|
[storage.backend] |
||||
|
[storage.backend.s3.default] |
||||
|
enabled = true |
||||
|
aws_access_key_id = "any" # if empty, loads from the shared credentials file (~/.aws/credentials). |
||||
|
aws_secret_access_key = "any" # if empty, loads from the shared credentials file (~/.aws/credentials). |
||||
|
region = "us-east-2" |
||||
|
bucket = "volume_bucket" # an existing bucket |
||||
|
endpoint = "http://server2:8333" |
@ -0,0 +1,17 @@ |
|||||
|
[notification.log] |
||||
|
# this is only for debugging perpose and does not work with "weed filer.replicate" |
||||
|
enabled = false |
||||
|
|
||||
|
|
||||
|
[notification.gocdk_pub_sub] |
||||
|
# The Go Cloud Development Kit (https://gocloud.dev). |
||||
|
# PubSub API (https://godoc.org/gocloud.dev/pubsub). |
||||
|
# Supports AWS SNS/SQS, Azure Service Bus, Google PubSub, NATS and RabbitMQ. |
||||
|
enabled = true |
||||
|
# This URL will Dial the RabbitMQ server at the URL in the environment |
||||
|
# variable RABBIT_SERVER_URL and open the exchange "myexchange". |
||||
|
# The exchange must have already been created by some other means, like |
||||
|
# the RabbitMQ management plugin. Сreate myexchange of type fanout and myqueue then |
||||
|
# create binding myexchange => myqueue |
||||
|
topic_url = "rabbit://swexchange" |
||||
|
sub_url = "rabbit://swqueue" |
@ -0,0 +1,11 @@ |
|||||
|
[source.filer] |
||||
|
enabled = true |
||||
|
grpcAddress = "filer:18888" |
||||
|
# all files under this directory tree are replicated. |
||||
|
# this is not a directory on your hard drive, but on your filer. |
||||
|
# i.e., all files with this "prefix" are sent to notification message queue. |
||||
|
directory = "/buckets" |
||||
|
|
||||
|
[sink.local_incremental] |
||||
|
enabled = true |
||||
|
directory = "/data" |
@ -0,0 +1,105 @@ |
|||||
|
{ |
||||
|
"identities": [ |
||||
|
{ |
||||
|
"name": "anonymous", |
||||
|
"actions": [ |
||||
|
"Read" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"name": "some_admin_user", |
||||
|
"credentials": [ |
||||
|
{ |
||||
|
"accessKey": "some_access_key1", |
||||
|
"secretKey": "some_secret_key1" |
||||
|
} |
||||
|
], |
||||
|
"actions": [ |
||||
|
"Admin", |
||||
|
"Read", |
||||
|
"List", |
||||
|
"Tagging", |
||||
|
"Write" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"name": "s3_tests", |
||||
|
"credentials": [ |
||||
|
{ |
||||
|
"accessKey": "ABCDEFGHIJKLMNOPQRST", |
||||
|
"secretKey": "abcdefghijklmnopqrstuvwxyzabcdefghijklmn" |
||||
|
}, |
||||
|
{ |
||||
|
"accessKey": "0555b35654ad1656d804", |
||||
|
"secretKey": "h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q==" |
||||
|
} |
||||
|
], |
||||
|
"actions": [ |
||||
|
"Admin", |
||||
|
"Read", |
||||
|
"List", |
||||
|
"Tagging", |
||||
|
"Write" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"name": "s3_tests_alt", |
||||
|
"credentials": [ |
||||
|
{ |
||||
|
"accessKey": "NOPQRSTUVWXYZABCDEFG", |
||||
|
"secretKey": "nopqrstuvwxyzabcdefghijklmnabcdefghijklm" |
||||
|
} |
||||
|
], |
||||
|
"actions": [ |
||||
|
"Admin", |
||||
|
"Read", |
||||
|
"List", |
||||
|
"Tagging", |
||||
|
"Write" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"name": "s3_tests_tenant", |
||||
|
"credentials": [ |
||||
|
{ |
||||
|
"accessKey": "HIJKLMNOPQRSTUVWXYZA", |
||||
|
"secretKey": "opqrstuvwxyzabcdefghijklmnopqrstuvwxyzab" |
||||
|
} |
||||
|
], |
||||
|
"actions": [ |
||||
|
"Admin", |
||||
|
"Read", |
||||
|
"List", |
||||
|
"Tagging", |
||||
|
"Write" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"name": "some_read_only_user", |
||||
|
"credentials": [ |
||||
|
{ |
||||
|
"accessKey": "some_access_key2", |
||||
|
"secretKey": "some_secret_key2" |
||||
|
} |
||||
|
], |
||||
|
"actions": [ |
||||
|
"Read" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"name": "some_normal_user", |
||||
|
"credentials": [ |
||||
|
{ |
||||
|
"accessKey": "some_access_key3", |
||||
|
"secretKey": "some_secret_key3" |
||||
|
} |
||||
|
], |
||||
|
"actions": [ |
||||
|
"Read", |
||||
|
"List", |
||||
|
"Tagging", |
||||
|
"Write" |
||||
|
] |
||||
|
} |
||||
|
] |
||||
|
} |
@ -0,0 +1,70 @@ |
|||||
|
[DEFAULT] |
||||
|
## this section is just used for host, port and bucket_prefix |
||||
|
|
||||
|
# host set for rgw in vstart.sh |
||||
|
host = s3 |
||||
|
|
||||
|
# port set for rgw in vstart.sh |
||||
|
port = 8000 |
||||
|
|
||||
|
## say "False" to disable TLS |
||||
|
is_secure = False |
||||
|
|
||||
|
[fixtures] |
||||
|
## all the buckets created will start with this prefix; |
||||
|
## {random} will be filled with random characters to pad |
||||
|
## the prefix to 30 characters long, and avoid collisions |
||||
|
bucket prefix = yournamehere-{random}- |
||||
|
|
||||
|
[s3 main] |
||||
|
# main display_name set in vstart.sh |
||||
|
display_name = M. Tester |
||||
|
|
||||
|
# main user_idname set in vstart.sh |
||||
|
user_id = testid |
||||
|
|
||||
|
# main email set in vstart.sh |
||||
|
email = tester@ceph.com |
||||
|
|
||||
|
# zonegroup api_name for bucket location |
||||
|
api_name = default |
||||
|
|
||||
|
## main AWS access key |
||||
|
access_key = 0555b35654ad1656d804 |
||||
|
|
||||
|
## main AWS secret key |
||||
|
secret_key = h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q== |
||||
|
|
||||
|
## replace with key id obtained when secret is created, or delete if KMS not tested |
||||
|
#kms_keyid = 01234567-89ab-cdef-0123-456789abcdef |
||||
|
|
||||
|
[s3 alt] |
||||
|
# alt display_name set in vstart.sh |
||||
|
display_name = john.doe |
||||
|
## alt email set in vstart.sh |
||||
|
email = john.doe@example.com |
||||
|
|
||||
|
# alt user_id set in vstart.sh |
||||
|
user_id = 56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234 |
||||
|
|
||||
|
# alt AWS access key set in vstart.sh |
||||
|
access_key = NOPQRSTUVWXYZABCDEFG |
||||
|
|
||||
|
# alt AWS secret key set in vstart.sh |
||||
|
secret_key = nopqrstuvwxyzabcdefghijklmnabcdefghijklm |
||||
|
|
||||
|
[s3 tenant] |
||||
|
# tenant display_name set in vstart.sh |
||||
|
display_name = testx$tenanteduser |
||||
|
|
||||
|
# tenant user_id set in vstart.sh |
||||
|
user_id = 9876543210abcdef0123456789abcdef0123456789abcdef0123456789abcdef |
||||
|
|
||||
|
# tenant AWS secret key set in vstart.sh |
||||
|
access_key = HIJKLMNOPQRSTUVWXYZA |
||||
|
|
||||
|
# tenant AWS secret key set in vstart.sh |
||||
|
secret_key = opqrstuvwxyzabcdefghijklmnopqrstuvwxyzab |
||||
|
|
||||
|
# tenant email set in vstart.sh |
||||
|
email = tenanteduser@example.com |
@ -0,0 +1,84 @@ |
|||||
|
# 2021-01-30 16:25:30 |
||||
|
version: '3.8' |
||||
|
|
||||
|
services: |
||||
|
|
||||
|
etcd: |
||||
|
image: gasparekatapy/etcd |
||||
|
networks: |
||||
|
- net |
||||
|
deploy: |
||||
|
mode: replicated |
||||
|
replicas: 3 |
||||
|
|
||||
|
master: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
environment: |
||||
|
WEED_MASTER_FILER_DEFAULT: "filer:8888" |
||||
|
WEED_MASTER_SEQUENCER_TYPE: "raft" |
||||
|
ports: |
||||
|
- "9333:9333" |
||||
|
- "19333:19333" |
||||
|
networks: |
||||
|
- net |
||||
|
command: |
||||
|
- 'master' |
||||
|
- '-resumeState=true' |
||||
|
- '-ip=master' |
||||
|
- '-port=9333' |
||||
|
deploy: |
||||
|
mode: replicated |
||||
|
replicas: 1 |
||||
|
|
||||
|
filer: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
environment: |
||||
|
WEED_LEVELDB2_ENABLED: "false" |
||||
|
WEED_ETCD_ENABLED: "true" |
||||
|
WEED_ETCD_SERVERS: "etcd:2379" |
||||
|
ports: |
||||
|
- target: 8888 |
||||
|
published: 8888 |
||||
|
protocol: tcp |
||||
|
mode: host |
||||
|
- target: 18888 |
||||
|
published: 18888 |
||||
|
protocol: tcp |
||||
|
mode: host |
||||
|
networks: |
||||
|
- net |
||||
|
command: |
||||
|
- 'filer' |
||||
|
- '-ip=filer' |
||||
|
- '-port=8888' |
||||
|
- '-port.readonly=28888' |
||||
|
- '-master=master:9333' |
||||
|
- '-disableDirListing=true' |
||||
|
deploy: |
||||
|
mode: replicated |
||||
|
replicas: 1 |
||||
|
|
||||
|
volume: |
||||
|
image: chrislusf/seaweedfs:local |
||||
|
ports: |
||||
|
- target: 8080 |
||||
|
published: 8080 |
||||
|
protocol: tcp |
||||
|
mode: host |
||||
|
- target: 18080 |
||||
|
published: 18080 |
||||
|
protocol: tcp |
||||
|
mode: host |
||||
|
networks: |
||||
|
- net |
||||
|
command: |
||||
|
- 'volume' |
||||
|
- '-mserver=master:9333' |
||||
|
- '-port=8080' |
||||
|
deploy: |
||||
|
mode: global |
||||
|
|
||||
|
########################################################################### |
||||
|
|
||||
|
networks: |
||||
|
net: |
@ -0,0 +1,14 @@ |
|||||
|
WEED_GRPC_CA=/etc/seaweedfs/tls/SeaweedFS_CA.crt |
||||
|
WEED_GRPC_ALLOWED_WILDCARD_DOMAIN=".dev" |
||||
|
WEED_GRPC_MASTER_CERT=/etc/seaweedfs/tls/master01.dev.crt |
||||
|
WEED_GRPC_MASTER_KEY=/etc/seaweedfs/tls/master01.dev.key |
||||
|
WEED_GRPC_VOLUME_CERT=/etc/seaweedfs/tls/volume01.dev.crt |
||||
|
WEED_GRPC_VOLUME_KEY=/etc/seaweedfs/tls/volume01.dev.key |
||||
|
WEED_GRPC_FILER_CERT=/etc/seaweedfs/tls/filer01.dev.crt |
||||
|
WEED_GRPC_FILER_KEY=/etc/seaweedfs/tls/filer01.dev.key |
||||
|
WEED_GRPC_CLIENT_CERT=/etc/seaweedfs/tls/client01.dev.crt |
||||
|
WEED_GRPC_CLIENT_KEY=/etc/seaweedfs/tls/client01.dev.key |
||||
|
WEED_GRPC_MASTER_ALLOWED_COMMONNAMES="volume01.dev,master01.dev,filer01.dev,client01.dev" |
||||
|
WEED_GRPC_VOLUME_ALLOWED_COMMONNAMES="volume01.dev,master01.dev,filer01.dev,client01.dev" |
||||
|
WEED_GRPC_FILER_ALLOWED_COMMONNAMES="volume01.dev,master01.dev,filer01.dev,client01.dev" |
||||
|
WEED_GRPC_CLIENT_ALLOWED_COMMONNAMES="volume01.dev,master01.dev,filer01.dev,client01.dev" |
@ -1,43 +0,0 @@ |
|||||
version: '2' |
|
||||
|
|
||||
services: |
|
||||
master: |
|
||||
build: |
|
||||
context: . |
|
||||
dockerfile: Dockerfile.go_build |
|
||||
ports: |
|
||||
- 9333:9333 |
|
||||
- 19333:19333 |
|
||||
command: "master -ip=master" |
|
||||
volume: |
|
||||
build: |
|
||||
context: . |
|
||||
dockerfile: Dockerfile.go_build |
|
||||
ports: |
|
||||
- 8080:8080 |
|
||||
- 18080:18080 |
|
||||
command: 'volume -max=5 -mserver="master:9333" -port=8080' |
|
||||
depends_on: |
|
||||
- master |
|
||||
filer: |
|
||||
build: |
|
||||
context: . |
|
||||
dockerfile: Dockerfile.go_build |
|
||||
ports: |
|
||||
- 8888:8888 |
|
||||
- 18888:18888 |
|
||||
command: 'filer -master="master:9333"' |
|
||||
depends_on: |
|
||||
- master |
|
||||
- volume |
|
||||
s3: |
|
||||
build: |
|
||||
context: . |
|
||||
dockerfile: Dockerfile.go_build |
|
||||
ports: |
|
||||
- 8333:8333 |
|
||||
command: 's3 -filer="filer:8888"' |
|
||||
depends_on: |
|
||||
- master |
|
||||
- volume |
|
||||
- filer |
|
@ -0,0 +1,30 @@ |
|||||
|
# HTTP 1.1 support |
||||
|
proxy_http_version 1.1; |
||||
|
#proxy_buffering off; |
||||
|
proxy_set_header Host $http_host; |
||||
|
proxy_set_header Upgrade $http_upgrade; |
||||
|
proxy_set_header Connection $proxy_connection; |
||||
|
proxy_set_header X-Real-IP $remote_addr; |
||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
||||
|
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto; |
||||
|
proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl; |
||||
|
proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port; |
||||
|
|
||||
|
# Mitigate httpoxy attack (see README for details) |
||||
|
proxy_set_header Proxy ""; |
||||
|
|
||||
|
# aws default max_concurrent_requests 10 |
||||
|
# aws default multipart_threshold 8MB |
||||
|
proxy_buffering on; # GET buffering or “X-Accel-Buffering” enables or disables buffering of a response; |
||||
|
proxy_buffers 64 1m; # buffers used for reading a response from the proxied server, for a single connection |
||||
|
proxy_buffer_size 8k; # maximum size of the data that nginx can receive from the server at a time is set |
||||
|
proxy_busy_buffers_size 2m; |
||||
|
|
||||
|
proxy_request_buffering on; # PUT buffering |
||||
|
client_body_buffer_size 64m; # buffer size for reading client request body |
||||
|
client_max_body_size 64m; |
||||
|
|
||||
|
proxy_next_upstream error timeout non_idempotent http_500; # PUT request should be passed to the next server: |
||||
|
proxy_connect_timeout 200ms; |
||||
|
proxy_read_timeout 3s; #timeout is set only between two successive read operations |
||||
|
proxy_send_timeout 3s; #timeout is set only between two successive write operations |
@ -0,0 +1,13 @@ |
|||||
|
global: |
||||
|
scrape_interval: 30s |
||||
|
scrape_timeout: 10s |
||||
|
|
||||
|
scrape_configs: |
||||
|
- job_name: services |
||||
|
metrics_path: /metrics |
||||
|
static_configs: |
||||
|
- targets: |
||||
|
- 'prometheus:9090' |
||||
|
- 'volume:9325' |
||||
|
- 'filer:9326' |
||||
|
- 's3:9327' |
@ -0,0 +1,44 @@ |
|||||
|
version: '2' |
||||
|
|
||||
|
services: |
||||
|
master: |
||||
|
image: chrislusf/seaweedfs:dev # use a remote dev image |
||||
|
ports: |
||||
|
- 9333:9333 |
||||
|
- 19333:19333 |
||||
|
command: "master -ip=master" |
||||
|
volume: |
||||
|
image: chrislusf/seaweedfs:dev # use a remote dev image |
||||
|
ports: |
||||
|
- 8080:8080 |
||||
|
- 18080:18080 |
||||
|
command: 'volume -mserver="master:9333" -port=8080 -ip=volume' |
||||
|
depends_on: |
||||
|
- master |
||||
|
filer: |
||||
|
image: chrislusf/seaweedfs:dev # use a remote dev image |
||||
|
ports: |
||||
|
- 8888:8888 |
||||
|
- 18888:18888 |
||||
|
command: 'filer -master="master:9333"' |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
s3: |
||||
|
image: chrislusf/seaweedfs:dev # use a remote dev image |
||||
|
ports: |
||||
|
- 8333:8333 |
||||
|
command: 's3 -filer="filer:8888"' |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- filer |
||||
|
webdav: |
||||
|
image: chrislusf/seaweedfs:dev # use a remote dev image |
||||
|
ports: |
||||
|
- 7333:7333 |
||||
|
command: 'webdav -filer="filer:8888"' |
||||
|
depends_on: |
||||
|
- master |
||||
|
- volume |
||||
|
- filer |
@ -0,0 +1,12 @@ |
|||||
|
CREATE DATABASE IF NOT EXISTS seaweedfs; |
||||
|
CREATE USER IF NOT EXISTS 'seaweedfs'@'%' IDENTIFIED BY 'secret'; |
||||
|
GRANT ALL PRIVILEGES ON seaweedfs_fast.* TO 'seaweedfs'@'%'; |
||||
|
FLUSH PRIVILEGES; |
||||
|
USE seaweedfs; |
||||
|
CREATE TABLE IF NOT EXISTS filemeta ( |
||||
|
dirhash BIGINT COMMENT 'first 64 bits of MD5 hash value of directory field', |
||||
|
name VARCHAR(1000) COMMENT 'directory or file name', |
||||
|
directory TEXT COMMENT 'full path to parent directory', |
||||
|
meta LONGBLOB, |
||||
|
PRIMARY KEY (dirhash, name) |
||||
|
) DEFAULT CHARSET=utf8; |
895
go.sum
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,48 @@ |
|||||
|
## SEAWEEDFS - helm chart (2.x) |
||||
|
|
||||
|
### info: |
||||
|
* master/filer/volume are stateful sets with anti-affinity on the hostname, |
||||
|
so your deployment will be spread/HA. |
||||
|
* chart is using memsql(mysql) as the filer backend to enable HA (multiple filer instances) |
||||
|
and backup/HA memsql can provide. |
||||
|
* mysql user/password are created in a k8s secret (secret-seaweedfs-db.yaml) and injected to the filer |
||||
|
with ENV. |
||||
|
* cert config exists and can be enabled, but not been tested. |
||||
|
|
||||
|
### prerequisites |
||||
|
kubernetes node have labels which help to define which node(Host) will run which pod. |
||||
|
|
||||
|
s3/filer/master needs the label **sw-backend=true** |
||||
|
|
||||
|
volume need the label **sw-volume=true** |
||||
|
|
||||
|
to label a node to be able to run all pod types in k8s: |
||||
|
``` |
||||
|
kubectl label node YOUR_NODE_NAME sw-volume=true,sw-backend=true |
||||
|
``` |
||||
|
|
||||
|
on production k8s deployment you will want each pod to have a different host, |
||||
|
especially the volume server & the masters, currently all pods (master/volume/filer) |
||||
|
have anti-affinity rule to disallow running multiple pod type on the same host. |
||||
|
if you still want to run multiple pods of the same type (master/volume/filer) on the same host |
||||
|
please set/update the corresponding affinity rule in values.yaml to an empty one: |
||||
|
|
||||
|
```affinity: ""``` |
||||
|
|
||||
|
### PVC - storage class ### |
||||
|
|
||||
|
on the volume stateful set added support for K8S PVC, currently example |
||||
|
with the simple local-path-provisioner from Rancher (comes included with k3d / k3s) |
||||
|
https://github.com/rancher/local-path-provisioner |
||||
|
|
||||
|
you can use ANY storage class you like, just update the correct storage-class |
||||
|
for your deployment. |
||||
|
|
||||
|
### current instances config (AIO): |
||||
|
1 instance for each type (master/filer+s3/volume) |
||||
|
|
||||
|
you can update the replicas count for each node type in values.yaml, |
||||
|
need to add more nodes with the corresponding labels. |
||||
|
|
||||
|
most of the configuration are available through values.yaml |
||||
|
|
@ -0,0 +1,22 @@ |
|||||
|
# Patterns to ignore when building packages. |
||||
|
# This supports shell glob matching, relative path matching, and |
||||
|
# negation (prefixed with !). Only one pattern per line. |
||||
|
.DS_Store |
||||
|
# Common VCS dirs |
||||
|
.git/ |
||||
|
.gitignore |
||||
|
.bzr/ |
||||
|
.bzrignore |
||||
|
.hg/ |
||||
|
.hgignore |
||||
|
.svn/ |
||||
|
# Common backup files |
||||
|
*.swp |
||||
|
*.bak |
||||
|
*.tmp |
||||
|
*~ |
||||
|
# Various IDEs |
||||
|
.project |
||||
|
.idea/ |
||||
|
*.tmproj |
||||
|
.vscode/ |
@ -0,0 +1,5 @@ |
|||||
|
apiVersion: v1 |
||||
|
description: SeaweedFS |
||||
|
name: seaweedfs |
||||
|
appVersion: "2.41" |
||||
|
version: 2.41 |
1856
k8s/seaweedfs/dashboards/seaweedfs-grafana-dashboard.json
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,151 @@ |
|||||
|
{{/* |
||||
|
Create a default fully qualified app name. |
||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to |
||||
|
this (by the DNS naming spec). If release name contains chart name it will |
||||
|
be used as a full name. |
||||
|
*/}} |
||||
|
{{- define "seaweedfs.fullname" -}} |
||||
|
{{- if .Values.fullnameOverride -}} |
||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} |
||||
|
{{- else -}} |
||||
|
{{- $name := default .Chart.Name .Values.nameOverride -}} |
||||
|
{{- if contains $name .Release.Name -}} |
||||
|
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} |
||||
|
{{- else -}} |
||||
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
|
||||
|
{{/* |
||||
|
Create chart name and version as used by the chart label. |
||||
|
*/}} |
||||
|
{{- define "seaweedfs.chart" -}} |
||||
|
{{- printf "%s-helm" .Chart.Name | replace "+" "_" | trunc 63 | trimSuffix "-" -}} |
||||
|
{{- end -}} |
||||
|
|
||||
|
{{/* |
||||
|
Expand the name of the chart. |
||||
|
*/}} |
||||
|
{{- define "seaweedfs.name" -}} |
||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} |
||||
|
{{- end -}} |
||||
|
|
||||
|
{{/* |
||||
|
Inject extra environment vars in the format key:value, if populated |
||||
|
*/}} |
||||
|
{{- define "seaweedfs.extraEnvironmentVars" -}} |
||||
|
{{- if .extraEnvironmentVars -}} |
||||
|
{{- range $key, $value := .extraEnvironmentVars }} |
||||
|
- name: {{ $key }} |
||||
|
value: {{ $value | quote }} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
|
||||
|
{{/* Return the proper filer image */}} |
||||
|
{{- define "filer.image" -}} |
||||
|
{{- if .Values.filer.imageOverride -}} |
||||
|
{{- $imageOverride := .Values.filer.imageOverride -}} |
||||
|
{{- printf "%s" $imageOverride -}} |
||||
|
{{- else -}} |
||||
|
{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} |
||||
|
{{- $repositoryName := .Values.image.repository | toString -}} |
||||
|
{{- $name := .Values.global.imageName | toString -}} |
||||
|
{{- $tag := .Chart.AppVersion | toString -}} |
||||
|
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
|
||||
|
{{/* Return the proper dbSchema image */}} |
||||
|
{{- define "filer.dbSchema.image" -}} |
||||
|
{{- if .Values.filer.dbSchema.imageOverride -}} |
||||
|
{{- $imageOverride := .Values.filer.dbSchema.imageOverride -}} |
||||
|
{{- printf "%s" $imageOverride -}} |
||||
|
{{- else -}} |
||||
|
{{- $registryName := default .Values.global.registry .Values.global.localRegistry | toString -}} |
||||
|
{{- $repositoryName := .Values.global.repository | toString -}} |
||||
|
{{- $name := .Values.filer.dbSchema.imageName | toString -}} |
||||
|
{{- $tag := .Values.filer.dbSchema.imageTag | toString -}} |
||||
|
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
|
||||
|
{{/* Return the proper master image */}} |
||||
|
{{- define "master.image" -}} |
||||
|
{{- if .Values.master.imageOverride -}} |
||||
|
{{- $imageOverride := .Values.master.imageOverride -}} |
||||
|
{{- printf "%s" $imageOverride -}} |
||||
|
{{- else -}} |
||||
|
{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} |
||||
|
{{- $repositoryName := .Values.image.repository | toString -}} |
||||
|
{{- $name := .Values.global.imageName | toString -}} |
||||
|
{{- $tag := .Chart.AppVersion | toString -}} |
||||
|
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
|
||||
|
{{/* Return the proper s3 image */}} |
||||
|
{{- define "s3.image" -}} |
||||
|
{{- if .Values.s3.imageOverride -}} |
||||
|
{{- $imageOverride := .Values.s3.imageOverride -}} |
||||
|
{{- printf "%s" $imageOverride -}} |
||||
|
{{- else -}} |
||||
|
{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} |
||||
|
{{- $repositoryName := .Values.image.repository | toString -}} |
||||
|
{{- $name := .Values.global.imageName | toString -}} |
||||
|
{{- $tag := .Chart.AppVersion | toString -}} |
||||
|
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
|
||||
|
{{/* Return the proper volume image */}} |
||||
|
{{- define "volume.image" -}} |
||||
|
{{- if .Values.volume.imageOverride -}} |
||||
|
{{- $imageOverride := .Values.volume.imageOverride -}} |
||||
|
{{- printf "%s" $imageOverride -}} |
||||
|
{{- else -}} |
||||
|
{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} |
||||
|
{{- $repositoryName := .Values.image.repository | toString -}} |
||||
|
{{- $name := .Values.global.imageName | toString -}} |
||||
|
{{- $tag := .Chart.AppVersion | toString -}} |
||||
|
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
|
||||
|
{{/* Return the proper cronjob image */}} |
||||
|
{{- define "cronjob.image" -}} |
||||
|
{{- if .Values.cronjob.imageOverride -}} |
||||
|
{{- $imageOverride := .Values.cronjob.imageOverride -}} |
||||
|
{{- printf "%s" $imageOverride -}} |
||||
|
{{- else -}} |
||||
|
{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} |
||||
|
{{- $repositoryName := .Values.image.repository | toString -}} |
||||
|
{{- $name := .Values.global.imageName | toString -}} |
||||
|
{{- $tag := .Chart.AppVersion | toString -}} |
||||
|
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
|
||||
|
|
||||
|
{{/* check if any PVC exists */}} |
||||
|
{{- define "volume.pvc_exists" -}} |
||||
|
{{- if or (or (eq .Values.volume.data.type "persistentVolumeClaim") (and (eq .Values.volume.idx.type "persistentVolumeClaim") .Values.volume.dir_idx )) (eq .Values.volume.logs.type "persistentVolumeClaim") -}} |
||||
|
{{- printf "true" -}} |
||||
|
{{- else -}} |
||||
|
{{- printf "false" -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
|
||||
|
{{/* check if any HostPath exists */}} |
||||
|
{{- define "volume.hostpath_exists" -}} |
||||
|
{{- if or (or (eq .Values.volume.data.type "hostPath") (and (eq .Values.volume.idx.type "hostPath") .Values.volume.dir_idx )) (eq .Values.volume.logs.type "hostPath") -}} |
||||
|
{{- printf "true" -}} |
||||
|
{{- else -}} |
||||
|
{{- if or .Values.global.enableSecurity .Values.volume.extraVolumes -}} |
||||
|
{{- printf "true" -}} |
||||
|
{{- else -}} |
||||
|
{{- printf "false" -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
||||
|
{{- end -}} |
@ -0,0 +1,14 @@ |
|||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
apiVersion: certmanager.k8s.io/v1alpha1 |
||||
|
kind: Certificate |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-ca-cert |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
spec: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-ca-cert |
||||
|
commonName: "{{ template "seaweedfs.name" . }}-root-ca" |
||||
|
isCA: true |
||||
|
issuerRef: |
||||
|
name: {{ template "seaweedfs.name" . }}-clusterissuer |
||||
|
kind: ClusterIssuer |
||||
|
{{- end }} |
@ -0,0 +1,8 @@ |
|||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
apiVersion: certmanager.k8s.io/v1alpha1 |
||||
|
kind: ClusterIssuer |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-clusterissuer |
||||
|
spec: |
||||
|
selfSigned: {} |
||||
|
{{- end }} |
@ -0,0 +1,33 @@ |
|||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
apiVersion: certmanager.k8s.io/v1alpha1 |
||||
|
kind: Certificate |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-client-cert |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
spec: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-client-cert |
||||
|
issuerRef: |
||||
|
name: {{ template "seaweedfs.name" . }}-clusterissuer |
||||
|
kind: ClusterIssuer |
||||
|
commonName: {{ .Values.certificates.commonName }} |
||||
|
organization: |
||||
|
- "SeaweedFS CA" |
||||
|
dnsNames: |
||||
|
- '*.{{ .Release.Namespace }}' |
||||
|
- '*.{{ .Release.Namespace }}.svc' |
||||
|
- '*.{{ .Release.Namespace }}.svc.cluster.local' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}.svc' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}.svc.cluster.local' |
||||
|
{{- if .Values.certificates.ipAddresses }} |
||||
|
ipAddresses: |
||||
|
{{- range .Values.certificates.ipAddresses }} |
||||
|
- {{ . }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
keyAlgorithm: {{ .Values.certificates.keyAlgorithm }} |
||||
|
keySize: {{ .Values.certificates.keySize }} |
||||
|
duration: {{ .Values.certificates.duration }} |
||||
|
renewBefore: {{ .Values.certificates.renewBefore }} |
||||
|
{{- end }} |
@ -0,0 +1,58 @@ |
|||||
|
{{- if .Values.cronjob }} |
||||
|
{{- if .Values.cronjob.enabled }} |
||||
|
apiVersion: batch/v1beta1 |
||||
|
kind: CronJob |
||||
|
metadata: |
||||
|
name: {{ include "seaweedfs.fullname" . }}-cronjob |
||||
|
spec: |
||||
|
schedule: "{{ .Values.cronjob.schedule }}" |
||||
|
startingDeadlineSeconds: 200 |
||||
|
concurrencyPolicy: Forbid |
||||
|
failedJobsHistoryLimit: 2 |
||||
|
successfulJobsHistoryLimit: 2 |
||||
|
jobTemplate: |
||||
|
spec: |
||||
|
backoffLimit: 2 |
||||
|
template: |
||||
|
spec: |
||||
|
{{- if .Values.cronjob.nodeSelector }} |
||||
|
nodeSelector: |
||||
|
{{ tpl .Values.cronjob.nodeSelector . | indent 12 | trim }} |
||||
|
{{- end }} |
||||
|
{{- if .Values.cronjob.tolerations }} |
||||
|
tolerations: |
||||
|
{{ tpl .Values.cronjob.tolerations . | nindent 12 | trim }} |
||||
|
{{- end }} |
||||
|
restartPolicy: OnFailure |
||||
|
containers: |
||||
|
- name: shell |
||||
|
image: {{ template "cronjob.image" . }} |
||||
|
imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }} |
||||
|
resources: |
||||
|
{{- toYaml .Values.cronjob.resources| nindent 16 }} |
||||
|
command: |
||||
|
- sh |
||||
|
- -c |
||||
|
- | |
||||
|
set -ex |
||||
|
echo -e "lock\n\ |
||||
|
volume.balance -force \ |
||||
|
{{ if .Values.volume.dataCenter }} -dataCenter {{ .Values.volume.dataCenter }}{{ end }}\ |
||||
|
{{ if .Values.cronjob.collection }} -collection {{ .Values.cronjob.collection }}{{ end }}\n\ |
||||
|
{{- if .Values.cronjob.enableFixReplication }} |
||||
|
volume.fix.replication -collectionPattern={{ .Values.cronjob.collectionPattern }} \n\ |
||||
|
{{- end }} |
||||
|
unlock\n" | \ |
||||
|
/usr/bin/weed shell \ |
||||
|
{{- if .Values.cronjob.master }} |
||||
|
-master {{ .Values.cronjob.master }} \ |
||||
|
{{- else }} |
||||
|
-master {{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}.svc:{{ .Values.master.port }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.cronjob.filer }} |
||||
|
-filer {{ .Values.cronjob.filer }} |
||||
|
{{- else }} |
||||
|
-filer {{ template "seaweedfs.name" . }}-filer.{{ .Release.Namespace }}.svc:{{ .Values.filer.port }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
@ -0,0 +1,33 @@ |
|||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
apiVersion: certmanager.k8s.io/v1alpha1 |
||||
|
kind: Certificate |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-filer-cert |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
spec: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-filer-cert |
||||
|
issuerRef: |
||||
|
name: {{ template "seaweedfs.name" . }}-clusterissuer |
||||
|
kind: ClusterIssuer |
||||
|
commonName: {{ .Values.certificates.commonName }} |
||||
|
organization: |
||||
|
- "SeaweedFS CA" |
||||
|
dnsNames: |
||||
|
- '*.{{ .Release.Namespace }}' |
||||
|
- '*.{{ .Release.Namespace }}.svc' |
||||
|
- '*.{{ .Release.Namespace }}.svc.cluster.local' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}.svc' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}.svc.cluster.local' |
||||
|
{{- if .Values.certificates.ipAddresses }} |
||||
|
ipAddresses: |
||||
|
{{- range .Values.certificates.ipAddresses }} |
||||
|
- {{ . }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
keyAlgorithm: {{ .Values.certificates.keyAlgorithm }} |
||||
|
keySize: {{ .Values.certificates.keySize }} |
||||
|
duration: {{ .Values.certificates.duration }} |
||||
|
renewBefore: {{ .Values.certificates.renewBefore }} |
||||
|
{{- end }} |
@ -0,0 +1,31 @@ |
|||||
|
apiVersion: v1 |
||||
|
kind: Service |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-filer-client |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: filer |
||||
|
{{- if .Values.filer.metricsPort }} |
||||
|
monitoring: "true" |
||||
|
{{- end }} |
||||
|
spec: |
||||
|
clusterIP: None |
||||
|
ports: |
||||
|
- name: "swfs-filer" |
||||
|
port: {{ .Values.filer.port }} |
||||
|
targetPort: {{ .Values.filer.port }} |
||||
|
protocol: TCP |
||||
|
- name: "swfs-filer-grpc" |
||||
|
port: {{ .Values.filer.grpcPort }} |
||||
|
targetPort: {{ .Values.filer.grpcPort }} |
||||
|
protocol: TCP |
||||
|
{{- if .Values.filer.metricsPort }} |
||||
|
- name: "metrics" |
||||
|
port: {{ .Values.filer.metricsPort }} |
||||
|
targetPort: {{ .Values.filer.metricsPort }} |
||||
|
protocol: TCP |
||||
|
{{- end }} |
||||
|
selector: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: filer |
@ -0,0 +1,25 @@ |
|||||
|
apiVersion: v1 |
||||
|
kind: Service |
||||
|
metadata: |
||||
|
annotations: |
||||
|
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" |
||||
|
name: {{ template "seaweedfs.name" . }}-filer |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: filer |
||||
|
spec: |
||||
|
clusterIP: None |
||||
|
publishNotReadyAddresses: true |
||||
|
ports: |
||||
|
- name: "swfs-filer" |
||||
|
port: {{ .Values.filer.port }} |
||||
|
targetPort: {{ .Values.filer.port }} |
||||
|
protocol: TCP |
||||
|
- name: "swfs-filer-grpc" |
||||
|
port: {{ .Values.filer.grpcPort }} |
||||
|
targetPort: {{ .Values.filer.grpcPort }} |
||||
|
protocol: TCP |
||||
|
selector: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: filer |
@ -0,0 +1,18 @@ |
|||||
|
{{- if .Values.filer.metricsPort }} |
||||
|
apiVersion: monitoring.coreos.com/v1 |
||||
|
kind: ServiceMonitor |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-filer |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: filer |
||||
|
spec: |
||||
|
endpoints: |
||||
|
- interval: 30s |
||||
|
port: swfs-filer-metrics |
||||
|
scrapeTimeout: 5s |
||||
|
selector: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: filer |
||||
|
{{- end }} |
@ -0,0 +1,267 @@ |
|||||
|
{{- if .Values.filer.enabled }} |
||||
|
apiVersion: apps/v1 |
||||
|
kind: StatefulSet |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-filer |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
heritage: {{ .Release.Service }} |
||||
|
release: {{ .Release.Name }} |
||||
|
spec: |
||||
|
serviceName: {{ template "seaweedfs.name" . }}-filer |
||||
|
podManagementPolicy: Parallel |
||||
|
replicas: {{ .Values.filer.replicas }} |
||||
|
{{- if (gt (int .Values.filer.updatePartition) 0) }} |
||||
|
updateStrategy: |
||||
|
type: RollingUpdate |
||||
|
rollingUpdate: |
||||
|
partition: {{ .Values.filer.updatePartition }} |
||||
|
{{- end }} |
||||
|
selector: |
||||
|
matchLabels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
release: {{ .Release.Name }} |
||||
|
component: filer |
||||
|
template: |
||||
|
metadata: |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
release: {{ .Release.Name }} |
||||
|
component: filer |
||||
|
spec: |
||||
|
restartPolicy: {{ default .Values.global.restartPolicy .Values.filer.restartPolicy }} |
||||
|
{{- if .Values.filer.affinity }} |
||||
|
affinity: |
||||
|
{{ tpl .Values.filer.affinity . | nindent 8 | trim }} |
||||
|
{{- end }} |
||||
|
{{- if .Values.filer.tolerations }} |
||||
|
tolerations: |
||||
|
{{ tpl .Values.filer.tolerations . | nindent 8 | trim }} |
||||
|
{{- end }} |
||||
|
{{- if .Values.global.imagePullSecrets }} |
||||
|
imagePullSecrets: |
||||
|
- name: {{ .Values.global.imagePullSecrets }} |
||||
|
{{- end }} |
||||
|
serviceAccountName: seaweefds-rw-sa #hack for delete pod master after migration |
||||
|
terminationGracePeriodSeconds: 60 |
||||
|
{{- if .Values.filer.priorityClassName }} |
||||
|
priorityClassName: {{ .Values.filer.priorityClassName | quote }} |
||||
|
{{- end }} |
||||
|
enableServiceLinks: false |
||||
|
containers: |
||||
|
- name: seaweedfs |
||||
|
image: {{ template "filer.image" . }} |
||||
|
imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }} |
||||
|
env: |
||||
|
- name: POD_IP |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: status.podIP |
||||
|
- name: POD_NAME |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: metadata.name |
||||
|
- name: NAMESPACE |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: metadata.namespace |
||||
|
- name: WEED_MYSQL_USERNAME |
||||
|
valueFrom: |
||||
|
secretKeyRef: |
||||
|
name: secret-seaweedfs-db |
||||
|
key: user |
||||
|
- name: WEED_MYSQL_PASSWORD |
||||
|
valueFrom: |
||||
|
secretKeyRef: |
||||
|
name: secret-seaweedfs-db |
||||
|
key: password |
||||
|
- name: SEAWEEDFS_FULLNAME |
||||
|
value: "{{ template "seaweedfs.name" . }}" |
||||
|
{{- if .Values.filer.extraEnvironmentVars }} |
||||
|
{{- range $key, $value := .Values.filer.extraEnvironmentVars }} |
||||
|
- name: {{ $key }} |
||||
|
value: {{ $value | quote }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
{{- if .Values.global.extraEnvironmentVars }} |
||||
|
{{- range $key, $value := .Values.global.extraEnvironmentVars }} |
||||
|
- name: {{ $key }} |
||||
|
value: {{ $value | quote }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
command: |
||||
|
- "/bin/sh" |
||||
|
- "-ec" |
||||
|
- | |
||||
|
exec /usr/bin/weed -logdir=/logs \ |
||||
|
{{- if .Values.filer.loggingOverrideLevel }} |
||||
|
-v={{ .Values.filer.loggingOverrideLevel }} \ |
||||
|
{{- else }} |
||||
|
-v={{ .Values.global.loggingLevel }} \ |
||||
|
{{- end }} |
||||
|
filer \ |
||||
|
-port={{ .Values.filer.port }} \ |
||||
|
{{- if .Values.filer.metricsPort }} |
||||
|
-metricsPort {{ .Values.filer.metricsPort }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.filer.redirectOnRead }} |
||||
|
-redirectOnRead \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.filer.disableHttp }} |
||||
|
-disableHttp \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.filer.disableDirListing }} |
||||
|
-disableDirListing \ |
||||
|
{{- end }} |
||||
|
-dirListLimit={{ .Values.filer.dirListLimit }} \ |
||||
|
{{- if .Values.global.enableReplication }} |
||||
|
-defaultReplicaPlacement={{ .Values.global.replicationPlacment }} \ |
||||
|
{{- else }} |
||||
|
-defaultReplicaPlacement={{ .Values.filer.defaultReplicaPlacement }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.filer.disableDirListing }} |
||||
|
-disableDirListing \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.filer.maxMB }} |
||||
|
-maxMB={{ .Values.filer.maxMB }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.filer.encryptVolumeData }} |
||||
|
-encryptVolumeData \ |
||||
|
{{- end }} |
||||
|
-ip=${POD_IP} \ |
||||
|
{{- if .Values.filer.enable_peers }} |
||||
|
{{- if gt (.Values.filer.replicas | int) 1 }} |
||||
|
-peers=$(echo -n "{{ range $index := until (.Values.filer.replicas | int) }}${SEAWEEDFS_FULLNAME}-filer-{{ $index }}.${SEAWEEDFS_FULLNAME}-filer:{{ $.Values.filer.port }}{{ if lt $index (sub ($.Values.filer.replicas | int) 1) }},{{ end }}{{ end }}" | sed "s/$HOSTNAME.${SEAWEEDFS_FULLNAME}-filer:{{ $.Values.filer.port }}//" | sed 's/,$//; 's/^,//'; s/,,/,/;' ) \ |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
{{- if .Values.filer.s3.enabled }} |
||||
|
-s3 \ |
||||
|
-s3.port={{ .Values.filer.s3.port }} \ |
||||
|
{{- if .Values.filer.s3.domainName }} |
||||
|
-s3.domainName={{ .Values.filer.s3.domainName }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
-s3.cert.file=/usr/local/share/ca-certificates/client/tls.crt \ |
||||
|
-s3.key.file=/usr/local/share/ca-certificates/client/tls.key \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.filer.s3.allowEmptyFolder }} |
||||
|
-s3.allowEmptyFolder={{ .Values.filer.s3.allowEmptyFolder }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.filer.s3.enableAuth }} |
||||
|
-s3.config=/etc/sw/seaweedfs_s3_config \ |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
-master={{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }} |
||||
|
{{- if or (.Values.global.enableSecurity) (.Values.filer.extraVolumeMounts) }} |
||||
|
volumeMounts: |
||||
|
- name: seaweedfs-filer-log-volume |
||||
|
mountPath: "/logs/" |
||||
|
- mountPath: /etc/sw |
||||
|
name: config-users |
||||
|
readOnly: true |
||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
- name: security-config |
||||
|
readOnly: true |
||||
|
mountPath: /etc/seaweedfs/security.toml |
||||
|
subPath: security.toml |
||||
|
- name: ca-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/ca/ |
||||
|
- name: master-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/master/ |
||||
|
- name: volume-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/volume/ |
||||
|
- name: filer-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/filer/ |
||||
|
- name: client-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/client/ |
||||
|
{{- end }} |
||||
|
{{ tpl .Values.filer.extraVolumeMounts . | nindent 12 | trim }} |
||||
|
{{- end }} |
||||
|
ports: |
||||
|
- containerPort: {{ .Values.filer.port }} |
||||
|
name: swfs-filer |
||||
|
- containerPort: {{ .Values.filer.grpcPort }} |
||||
|
#name: swfs-filer-grpc |
||||
|
readinessProbe: |
||||
|
httpGet: |
||||
|
path: / |
||||
|
port: {{ .Values.filer.port }} |
||||
|
scheme: HTTP |
||||
|
initialDelaySeconds: 10 |
||||
|
periodSeconds: 15 |
||||
|
successThreshold: 1 |
||||
|
failureThreshold: 100 |
||||
|
timeoutSeconds: 10 |
||||
|
livenessProbe: |
||||
|
httpGet: |
||||
|
path: / |
||||
|
port: {{ .Values.filer.port }} |
||||
|
scheme: HTTP |
||||
|
initialDelaySeconds: 20 |
||||
|
periodSeconds: 30 |
||||
|
successThreshold: 1 |
||||
|
failureThreshold: 5 |
||||
|
timeoutSeconds: 10 |
||||
|
{{- if .Values.filer.resources }} |
||||
|
resources: |
||||
|
{{ tpl .Values.filer.resources . | nindent 12 | trim }} |
||||
|
{{- end }} |
||||
|
volumes: |
||||
|
- name: seaweedfs-filer-log-volume |
||||
|
hostPath: |
||||
|
path: /storage/logs/seaweedfs/filer |
||||
|
type: DirectoryOrCreate |
||||
|
- name: db-schema-config-volume |
||||
|
configMap: |
||||
|
name: seaweedfs-db-init-config |
||||
|
- name: config-users |
||||
|
secret: |
||||
|
defaultMode: 420 |
||||
|
secretName: seaweedfs-s3-secret |
||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
- name: security-config |
||||
|
configMap: |
||||
|
name: {{ template "seaweedfs.name" . }}-security-config |
||||
|
- name: ca-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-ca-cert |
||||
|
- name: master-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-master-cert |
||||
|
- name: volume-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-volume-cert |
||||
|
- name: filer-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-filer-cert |
||||
|
- name: client-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-client-cert |
||||
|
{{- end }} |
||||
|
{{ tpl .Values.filer.extraVolumes . | indent 8 | trim }} |
||||
|
{{- if .Values.filer.nodeSelector }} |
||||
|
nodeSelector: |
||||
|
{{ tpl .Values.filer.nodeSelector . | indent 8 | trim }} |
||||
|
{{- end }} |
||||
|
{{/* volumeClaimTemplates:*/}} |
||||
|
{{/* - metadata:*/}} |
||||
|
{{/* name: data-{{ .Release.Namespace }}*/}} |
||||
|
{{/* spec:*/}} |
||||
|
{{/* accessModes:*/}} |
||||
|
{{/* - ReadWriteOnce*/}} |
||||
|
{{/* resources:*/}} |
||||
|
{{/* requests:*/}} |
||||
|
{{/* storage: {{ .Values.filer.storage }}*/}} |
||||
|
{{/* {{- if .Values.filer.storageClass }}*/}} |
||||
|
{{/* storageClassName: {{ .Values.filer.storageClass }}*/}} |
||||
|
{{/* {{- end }}*/}} |
||||
|
{{- end }} |
@ -0,0 +1,59 @@ |
|||||
|
apiVersion: extensions/v1beta1 |
||||
|
kind: Ingress |
||||
|
metadata: |
||||
|
name: ingress-{{ template "seaweedfs.name" . }}-filer |
||||
|
annotations: |
||||
|
kubernetes.io/ingress.class: "nginx" |
||||
|
nginx.ingress.kubernetes.io/auth-type: "basic" |
||||
|
nginx.ingress.kubernetes.io/auth-secret: "default/ingress-basic-auth-secret" |
||||
|
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - SW-Filer' |
||||
|
nginx.ingress.kubernetes.io/service-upstream: "true" |
||||
|
nginx.ingress.kubernetes.io/rewrite-target: /$1 |
||||
|
nginx.ingress.kubernetes.io/use-regex: "true" |
||||
|
nginx.ingress.kubernetes.io/enable-rewrite-log: "true" |
||||
|
nginx.ingress.kubernetes.io/ssl-redirect: "false" |
||||
|
nginx.ingress.kubernetes.io/force-ssl-redirect: "false" |
||||
|
nginx.ingress.kubernetes.io/configuration-snippet: | |
||||
|
sub_filter '<head>' '<head> <base href="/sw-filer/">'; #add base url |
||||
|
sub_filter '="/' '="./'; #make absolute paths to relative |
||||
|
sub_filter '=/' '=./'; |
||||
|
sub_filter '/seaweedfsstatic' './seaweedfsstatic'; |
||||
|
sub_filter_once off; |
||||
|
spec: |
||||
|
rules: |
||||
|
- http: |
||||
|
paths: |
||||
|
- path: /sw-filer/?(.*) |
||||
|
backend: |
||||
|
serviceName: {{ template "seaweedfs.name" . }}-filer |
||||
|
servicePort: {{ .Values.filer.port }} |
||||
|
--- |
||||
|
apiVersion: extensions/v1beta1 |
||||
|
kind: Ingress |
||||
|
metadata: |
||||
|
name: ingress-{{ template "seaweedfs.name" . }}-master |
||||
|
annotations: |
||||
|
kubernetes.io/ingress.class: "nginx" |
||||
|
nginx.ingress.kubernetes.io/auth-type: "basic" |
||||
|
nginx.ingress.kubernetes.io/auth-secret: "default/ingress-basic-auth-secret" |
||||
|
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - SW-Master' |
||||
|
nginx.ingress.kubernetes.io/service-upstream: "true" |
||||
|
nginx.ingress.kubernetes.io/rewrite-target: /$1 |
||||
|
nginx.ingress.kubernetes.io/use-regex: "true" |
||||
|
nginx.ingress.kubernetes.io/enable-rewrite-log: "true" |
||||
|
nginx.ingress.kubernetes.io/ssl-redirect: "false" |
||||
|
nginx.ingress.kubernetes.io/force-ssl-redirect: "false" |
||||
|
nginx.ingress.kubernetes.io/configuration-snippet: | |
||||
|
sub_filter '<head>' '<head> <base href="/sw-master/">'; #add base url |
||||
|
sub_filter '="/' '="./'; #make absolute paths to relative |
||||
|
sub_filter '=/' '=./'; |
||||
|
sub_filter '/seaweedfsstatic' './seaweedfsstatic'; |
||||
|
sub_filter_once off; |
||||
|
spec: |
||||
|
rules: |
||||
|
- http: |
||||
|
paths: |
||||
|
- path: /sw-master/?(.*) |
||||
|
backend: |
||||
|
serviceName: {{ template "seaweedfs.name" . }}-master |
||||
|
servicePort: {{ .Values.master.port }} |
@ -0,0 +1,33 @@ |
|||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
apiVersion: certmanager.k8s.io/v1alpha1 |
||||
|
kind: Certificate |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-master-cert |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
spec: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-master-cert |
||||
|
issuerRef: |
||||
|
name: {{ template "seaweedfs.name" . }}-clusterissuer |
||||
|
kind: ClusterIssuer |
||||
|
commonName: {{ .Values.certificates.commonName }} |
||||
|
organization: |
||||
|
- "SeaweedFS CA" |
||||
|
dnsNames: |
||||
|
- '*.{{ .Release.Namespace }}' |
||||
|
- '*.{{ .Release.Namespace }}.svc' |
||||
|
- '*.{{ .Release.Namespace }}.svc.cluster.local' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}.svc' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}.svc.cluster.local' |
||||
|
{{- if .Values.certificates.ipAddresses }} |
||||
|
ipAddresses: |
||||
|
{{- range .Values.certificates.ipAddresses }} |
||||
|
- {{ . }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
keyAlgorithm: {{ .Values.certificates.keyAlgorithm }} |
||||
|
keySize: {{ .Values.certificates.keySize }} |
||||
|
duration: {{ .Values.certificates.duration }} |
||||
|
renewBefore: {{ .Values.certificates.renewBefore }} |
||||
|
{{- end }} |
@ -0,0 +1,25 @@ |
|||||
|
apiVersion: v1 |
||||
|
kind: Service |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-master |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: master |
||||
|
annotations: |
||||
|
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" |
||||
|
spec: |
||||
|
clusterIP: None |
||||
|
publishNotReadyAddresses: true |
||||
|
ports: |
||||
|
- name: "swfs-master" |
||||
|
port: {{ .Values.master.port }} |
||||
|
targetPort: {{ .Values.master.port }} |
||||
|
protocol: TCP |
||||
|
- name: "swfs-master-grpc" |
||||
|
port: {{ .Values.master.grpcPort }} |
||||
|
targetPort: {{ .Values.master.grpcPort }} |
||||
|
protocol: TCP |
||||
|
selector: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: master |
@ -0,0 +1,227 @@ |
|||||
|
{{- if .Values.master.enabled }} |
||||
|
apiVersion: apps/v1 |
||||
|
kind: StatefulSet |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-master |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
heritage: {{ .Release.Service }} |
||||
|
release: {{ .Release.Name }} |
||||
|
spec: |
||||
|
serviceName: {{ template "seaweedfs.name" . }}-master |
||||
|
podManagementPolicy: Parallel |
||||
|
replicas: {{ .Values.master.replicas }} |
||||
|
{{- if (gt (int .Values.master.updatePartition) 0) }} |
||||
|
updateStrategy: |
||||
|
type: RollingUpdate |
||||
|
rollingUpdate: |
||||
|
partition: {{ .Values.master.updatePartition }} |
||||
|
{{- end }} |
||||
|
selector: |
||||
|
matchLabels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
release: {{ .Release.Name }} |
||||
|
component: master |
||||
|
template: |
||||
|
metadata: |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
release: {{ .Release.Name }} |
||||
|
component: master |
||||
|
spec: |
||||
|
restartPolicy: {{ default .Values.global.restartPolicy .Values.master.restartPolicy }} |
||||
|
{{- if .Values.master.affinity }} |
||||
|
affinity: |
||||
|
{{ tpl .Values.master.affinity . | nindent 8 | trim }} |
||||
|
{{- end }} |
||||
|
{{- if .Values.master.tolerations }} |
||||
|
tolerations: |
||||
|
{{ tpl .Values.master.tolerations . | nindent 8 | trim }} |
||||
|
{{- end }} |
||||
|
{{- if .Values.global.imagePullSecrets }} |
||||
|
imagePullSecrets: |
||||
|
- name: {{ .Values.global.imagePullSecrets }} |
||||
|
{{- end }} |
||||
|
terminationGracePeriodSeconds: 60 |
||||
|
{{- if .Values.master.priorityClassName }} |
||||
|
priorityClassName: {{ .Values.master.priorityClassName | quote }} |
||||
|
{{- end }} |
||||
|
enableServiceLinks: false |
||||
|
containers: |
||||
|
- name: seaweedfs |
||||
|
image: {{ template "master.image" . }} |
||||
|
imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }} |
||||
|
env: |
||||
|
- name: POD_IP |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: status.podIP |
||||
|
- name: POD_NAME |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: metadata.name |
||||
|
- name: NAMESPACE |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: metadata.namespace |
||||
|
- name: SEAWEEDFS_FULLNAME |
||||
|
value: "{{ template "seaweedfs.name" . }}" |
||||
|
{{- if .Values.master.extraEnvironmentVars }} |
||||
|
{{- range $key, $value := .Values.master.extraEnvironmentVars }} |
||||
|
- name: {{ $key }} |
||||
|
value: {{ $value | quote }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
{{- if .Values.global.extraEnvironmentVars }} |
||||
|
{{- range $key, $value := .Values.global.extraEnvironmentVars }} |
||||
|
- name: {{ $key }} |
||||
|
value: {{ $value | quote }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
command: |
||||
|
- "/bin/sh" |
||||
|
- "-ec" |
||||
|
- | |
||||
|
exec /usr/bin/weed -logdir=/logs \ |
||||
|
{{- if .Values.master.loggingOverrideLevel }} |
||||
|
-v={{ .Values.master.loggingOverrideLevel }} \ |
||||
|
{{- else }} |
||||
|
-v={{ .Values.global.loggingLevel }} \ |
||||
|
{{- end }} |
||||
|
master \ |
||||
|
-port={{ .Values.master.port }} \ |
||||
|
-mdir=/data \ |
||||
|
-ip.bind={{ .Values.master.ipBind }} \ |
||||
|
{{- if .Values.global.enableReplication }} |
||||
|
-defaultReplication={{ .Values.global.replicationPlacment }} \ |
||||
|
{{- else }} |
||||
|
-defaultReplication={{ .Values.master.defaultReplication }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.master.volumePreallocate }} |
||||
|
-volumePreallocate \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.global.monitoring.enabled }} |
||||
|
-metrics.address="{{ .Values.global.monitoring.gatewayHost }}:{{ .Values.global.monitoring.gatewayPort }}" \ |
||||
|
{{- end }} |
||||
|
-volumeSizeLimitMB={{ .Values.master.volumeSizeLimitMB }} \ |
||||
|
{{- if .Values.master.disableHttp }} |
||||
|
-disableHttp \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.master.pulseSeconds }} |
||||
|
-pulseSeconds={{ .Values.master.pulseSeconds }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.master.garbageThreshold }} |
||||
|
-garbageThreshold={{ .Values.master.garbageThreshold }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.master.metricsIntervalSec }} |
||||
|
-metrics.intervalSeconds={{ .Values.master.metricsIntervalSec }} \ |
||||
|
{{- end }} |
||||
|
-ip=${POD_NAME}.${SEAWEEDFS_FULLNAME}-master \ |
||||
|
-peers={{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }} |
||||
|
volumeMounts: |
||||
|
- name : data-{{ .Release.Namespace }} |
||||
|
mountPath: /data |
||||
|
- name: seaweedfs-master-log-volume |
||||
|
mountPath: "/logs/" |
||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
- name: security-config |
||||
|
readOnly: true |
||||
|
mountPath: /etc/seaweedfs/security.toml |
||||
|
subPath: security.toml |
||||
|
- name: ca-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/ca/ |
||||
|
- name: master-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/master/ |
||||
|
- name: volume-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/volume/ |
||||
|
- name: filer-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/filer/ |
||||
|
- name: client-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/client/ |
||||
|
{{- end }} |
||||
|
{{ tpl .Values.master.extraVolumeMounts . | nindent 12 | trim }} |
||||
|
ports: |
||||
|
- containerPort: {{ .Values.master.port }} |
||||
|
name: swfs-master |
||||
|
- containerPort: {{ .Values.master.grpcPort }} |
||||
|
#name: swfs-master-grpc |
||||
|
readinessProbe: |
||||
|
httpGet: |
||||
|
path: /cluster/status |
||||
|
port: {{ .Values.master.port }} |
||||
|
scheme: HTTP |
||||
|
initialDelaySeconds: 10 |
||||
|
periodSeconds: 45 |
||||
|
successThreshold: 2 |
||||
|
failureThreshold: 100 |
||||
|
timeoutSeconds: 10 |
||||
|
livenessProbe: |
||||
|
httpGet: |
||||
|
path: /cluster/status |
||||
|
port: {{ .Values.master.port }} |
||||
|
scheme: HTTP |
||||
|
initialDelaySeconds: 20 |
||||
|
periodSeconds: 30 |
||||
|
successThreshold: 1 |
||||
|
failureThreshold: 4 |
||||
|
timeoutSeconds: 10 |
||||
|
{{- if .Values.master.resources }} |
||||
|
resources: |
||||
|
{{ tpl .Values.master.resources . | nindent 12 | trim }} |
||||
|
{{- end }} |
||||
|
volumes: |
||||
|
- name: seaweedfs-master-log-volume |
||||
|
hostPath: |
||||
|
path: /storage/logs/seaweedfs/master |
||||
|
type: DirectoryOrCreate |
||||
|
- name: data-{{ .Release.Namespace }} |
||||
|
hostPath: |
||||
|
path: /ssd/seaweed-master/ |
||||
|
type: DirectoryOrCreate |
||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
- name: security-config |
||||
|
configMap: |
||||
|
name: {{ template "seaweedfs.name" . }}-security-config |
||||
|
- name: ca-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-ca-cert |
||||
|
- name: master-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-master-cert |
||||
|
- name: volume-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-volume-cert |
||||
|
- name: filer-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-filer-cert |
||||
|
- name: client-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-client-cert |
||||
|
{{- end }} |
||||
|
{{ tpl .Values.master.extraVolumes . | indent 8 | trim }} |
||||
|
{{- if .Values.master.nodeSelector }} |
||||
|
nodeSelector: |
||||
|
{{ tpl .Values.master.nodeSelector . | indent 8 | trim }} |
||||
|
{{- end }} |
||||
|
{{/* volumeClaimTemplates:*/}} |
||||
|
{{/* - metadata:*/}} |
||||
|
{{/* name: data-{{ .Release.Namespace }}*/}} |
||||
|
{{/* spec:*/}} |
||||
|
{{/* accessModes:*/}} |
||||
|
{{/* - ReadWriteOnce*/}} |
||||
|
{{/* resources:*/}} |
||||
|
{{/* requests:*/}} |
||||
|
{{/* storage: {{ .Values.master.storage }}*/}} |
||||
|
{{/* {{- if .Values.master.storageClass }}*/}} |
||||
|
{{/* storageClassName: {{ .Values.master.storageClass }}*/}} |
||||
|
{{/* {{- end }}*/}} |
||||
|
{{- end }} |
@ -0,0 +1,188 @@ |
|||||
|
{{- if .Values.s3.enabled }} |
||||
|
apiVersion: apps/v1 |
||||
|
kind: Deployment |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-s3 |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
heritage: {{ .Release.Service }} |
||||
|
release: {{ .Release.Name }} |
||||
|
spec: |
||||
|
serviceName: {{ template "seaweedfs.name" . }}-s3 |
||||
|
replicas: {{ .Values.s3.replicas }} |
||||
|
selector: |
||||
|
matchLabels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
release: {{ .Release.Name }} |
||||
|
component: s3 |
||||
|
template: |
||||
|
metadata: |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
release: {{ .Release.Name }} |
||||
|
component: s3 |
||||
|
spec: |
||||
|
restartPolicy: {{ default .Values.global.restartPolicy .Values.s3.restartPolicy }} |
||||
|
{{- if .Values.s3.tolerations }} |
||||
|
tolerations: |
||||
|
{{ tpl .Values.s3.tolerations . | nindent 8 | trim }} |
||||
|
{{- end }} |
||||
|
{{- if .Values.global.imagePullSecrets }} |
||||
|
imagePullSecrets: |
||||
|
- name: {{ .Values.global.imagePullSecrets }} |
||||
|
{{- end }} |
||||
|
terminationGracePeriodSeconds: 10 |
||||
|
{{- if .Values.s3.priorityClassName }} |
||||
|
priorityClassName: {{ .Values.s3.priorityClassName | quote }} |
||||
|
{{- end }} |
||||
|
enableServiceLinks: false |
||||
|
containers: |
||||
|
- name: seaweedfs |
||||
|
image: {{ template "s3.image" . }} |
||||
|
imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }} |
||||
|
env: |
||||
|
- name: POD_IP |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: status.podIP |
||||
|
- name: POD_NAME |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: metadata.name |
||||
|
- name: NAMESPACE |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: metadata.namespace |
||||
|
- name: SEAWEEDFS_FULLNAME |
||||
|
value: "{{ template "seaweedfs.name" . }}" |
||||
|
{{- if .Values.global.extraEnvironmentVars }} |
||||
|
{{- range $key, $value := .Values.global.extraEnvironmentVars }} |
||||
|
- name: {{ $key }} |
||||
|
value: {{ $value | quote }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
command: |
||||
|
- "/bin/sh" |
||||
|
- "-ec" |
||||
|
- | |
||||
|
exec /usr/bin/weed -logdir=/logs \ |
||||
|
{{- if .Values.s3.loggingOverrideLevel }} |
||||
|
-v={{ .Values.s3.loggingOverrideLevel }} \ |
||||
|
{{- else }} |
||||
|
-v={{ .Values.global.loggingLevel }} \ |
||||
|
{{- end }} |
||||
|
s3 \ |
||||
|
-port={{ .Values.s3.port }} \ |
||||
|
{{- if .Values.s3.metricsPort }} |
||||
|
-metricsPort {{ .Values.s3.metricsPort }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
-cert.file=/usr/local/share/ca-certificates/client/tls.crt \ |
||||
|
-key.file=/usr/local/share/ca-certificates/client/tls.key \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.s3.domainName }} |
||||
|
-domainName={{ .Values.s3.domainName }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.s3.allowEmptyFolder }} |
||||
|
-allowEmptyFolder={{ .Values.s3.allowEmptyFolder }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.s3.enableAuth }} |
||||
|
-config=/etc/sw/seaweedfs_s3_config \ |
||||
|
{{- end }} |
||||
|
-filer={{ template "seaweedfs.name" . }}-filer-client:{{ .Values.filer.port }} |
||||
|
volumeMounts: |
||||
|
- name: logs |
||||
|
mountPath: "/logs/" |
||||
|
- mountPath: /etc/sw |
||||
|
name: config-users |
||||
|
readOnly: true |
||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
- name: security-config |
||||
|
readOnly: true |
||||
|
mountPath: /etc/seaweedfs/security.toml |
||||
|
subPath: security.toml |
||||
|
- name: ca-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/ca/ |
||||
|
- name: master-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/master/ |
||||
|
- name: volume-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/volume/ |
||||
|
- name: filer-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/filer/ |
||||
|
- name: client-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/client/ |
||||
|
{{- end }} |
||||
|
{{ tpl .Values.s3.extraVolumeMounts . | nindent 12 | trim }} |
||||
|
ports: |
||||
|
- containerPort: {{ .Values.s3.port }} |
||||
|
name: swfs-s3 |
||||
|
readinessProbe: |
||||
|
httpGet: |
||||
|
path: / |
||||
|
port: {{ .Values.s3.port }} |
||||
|
scheme: HTTP |
||||
|
initialDelaySeconds: 15 |
||||
|
periodSeconds: 15 |
||||
|
successThreshold: 1 |
||||
|
failureThreshold: 100 |
||||
|
timeoutSeconds: 10 |
||||
|
livenessProbe: |
||||
|
httpGet: |
||||
|
path: / |
||||
|
port: {{ .Values.s3.port }} |
||||
|
scheme: HTTP |
||||
|
initialDelaySeconds: 20 |
||||
|
periodSeconds: 60 |
||||
|
successThreshold: 1 |
||||
|
failureThreshold: 20 |
||||
|
timeoutSeconds: 10 |
||||
|
{{- if .Values.s3.resources }} |
||||
|
resources: |
||||
|
{{ tpl .Values.s3.resources . | nindent 12 | trim }} |
||||
|
{{- end }} |
||||
|
volumes: |
||||
|
- name: config-users |
||||
|
secret: |
||||
|
defaultMode: 420 |
||||
|
secretName: seaweedfs-s3-secret |
||||
|
{{- if eq .Values.s3.logs.type "hostPath" }} |
||||
|
- name: logs |
||||
|
hostPath: |
||||
|
path: /storage/logs/seaweedfs/s3 |
||||
|
type: DirectoryOrCreate |
||||
|
{{- end }} |
||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
- name: security-config |
||||
|
configMap: |
||||
|
name: {{ template "seaweedfs.name" . }}-security-config |
||||
|
- name: ca-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-ca-cert |
||||
|
- name: master-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-master-cert |
||||
|
- name: volume-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-volume-cert |
||||
|
- name: filer-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-filer-cert |
||||
|
- name: client-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-client-cert |
||||
|
{{- end }} |
||||
|
{{ tpl .Values.s3.extraVolumes . | indent 8 | trim }} |
||||
|
{{- if .Values.s3.nodeSelector }} |
||||
|
nodeSelector: |
||||
|
{{ tpl .Values.s3.nodeSelector . | indent 8 | trim }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
@ -0,0 +1,23 @@ |
|||||
|
apiVersion: v1 |
||||
|
kind: Service |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-s3 |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: s3 |
||||
|
spec: |
||||
|
ports: |
||||
|
- name: "swfs-s3" |
||||
|
port: {{ if .Values.s3.enabled }}{{ .Values.s3.port }}{{ else }}{{ .Values.filer.s3.port }}{{ end }} |
||||
|
targetPort: {{ if .Values.s3.enabled }}{{ .Values.s3.port }}{{ else }}{{ .Values.filer.s3.port }}{{ end }} |
||||
|
protocol: TCP |
||||
|
{{- if and .Values.s3.enabled .Values.s3.metricsPort }} |
||||
|
- name: "metrics" |
||||
|
port: {{ .Values.s3.metricsPort }} |
||||
|
targetPort: {{ .Values.s3.metricsPort }} |
||||
|
protocol: TCP |
||||
|
{{- end }} |
||||
|
selector: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: {{ if .Values.s3.enabled }}s3{{ else }}filer{{ end }} |
@ -0,0 +1,18 @@ |
|||||
|
{{- if .Values.s3.metricsPort }} |
||||
|
apiVersion: monitoring.coreos.com/v1 |
||||
|
kind: ServiceMonitor |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-s3 |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: s3 |
||||
|
spec: |
||||
|
endpoints: |
||||
|
- interval: 30s |
||||
|
port: swfs-s3-metrics |
||||
|
scrapeTimeout: 5s |
||||
|
selector: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: s3 |
||||
|
{{- end }} |
@ -0,0 +1,20 @@ |
|||||
|
{{- if .Values.global.monitoring.enabled }} |
||||
|
{{- $files := .Files.Glob "dashboards/*.json" }} |
||||
|
{{- if $files }} |
||||
|
apiVersion: v1 |
||||
|
kind: ConfigMapList |
||||
|
items: |
||||
|
{{- range $path, $fileContents := $files }} |
||||
|
{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }} |
||||
|
- apiVersion: v1 |
||||
|
kind: ConfigMap |
||||
|
metadata: |
||||
|
name: {{ printf "%s" $dashboardName | lower | replace "_" "-" }} |
||||
|
namespace: {{ $.Release.Namespace }} |
||||
|
labels: |
||||
|
grafana_dashboard: "1" |
||||
|
data: |
||||
|
{{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
@ -0,0 +1,21 @@ |
|||||
|
{{- if not (or .Values.filer.s3.skipAuthSecretCreation .Values.s3.skipAuthSecretCreation) }} |
||||
|
{{- $access_key_admin := randAlphaNum 16 -}} |
||||
|
{{- $secret_key_admin := randAlphaNum 32 -}} |
||||
|
{{- $access_key_read := randAlphaNum 16 -}} |
||||
|
{{- $secret_key_read := randAlphaNum 32 -}} |
||||
|
apiVersion: v1 |
||||
|
kind: Secret |
||||
|
type: Opaque |
||||
|
metadata: |
||||
|
name: seaweedfs-s3-secret |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
annotations: |
||||
|
"helm.sh/resource-policy": keep |
||||
|
"helm.sh/hook": "pre-install" |
||||
|
stringData: |
||||
|
admin_access_key_id: {{ $access_key_admin }} |
||||
|
admin_secret_access_key: {{ $secret_key_admin }} |
||||
|
read_access_key_id: {{ $access_key_read }} |
||||
|
read_secret_access_key: {{ $secret_key_read }} |
||||
|
seaweedfs_s3_config: '{"identities":[{"name":"anvAdmin","credentials":[{"accessKey":"{{ $access_key_admin }}","secretKey":"{{ $secret_key_admin }}"}],"actions":["Admin","Read","Write"]},{"name":"anvReadOnly","credentials":[{"accessKey":"{{ $access_key_read }}","secretKey":"{{ $secret_key_read }}"}],"actions":["Read"]}]}' |
||||
|
{{- end }} |
@ -0,0 +1,14 @@ |
|||||
|
apiVersion: v1 |
||||
|
kind: Secret |
||||
|
type: Opaque |
||||
|
metadata: |
||||
|
name: secret-seaweedfs-db |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
annotations: |
||||
|
"helm.sh/resource-policy": keep |
||||
|
"helm.sh/hook": "pre-install" |
||||
|
stringData: |
||||
|
user: "YourSWUser" |
||||
|
password: "HardCodedPassword" |
||||
|
# better to random generate and create in DB |
||||
|
# password: {{ randAlphaNum 10 | sha256sum | b64enc | trunc 32 }} |
@ -0,0 +1,52 @@ |
|||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
apiVersion: v1 |
||||
|
kind: ConfigMap |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-security-config |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
heritage: {{ .Release.Service }} |
||||
|
release: {{ .Release.Name }} |
||||
|
data: |
||||
|
security.toml: |- |
||||
|
# this file is read by master, volume server, and filer |
||||
|
|
||||
|
# the jwt signing key is read by master and volume server |
||||
|
# a jwt expires in 10 seconds |
||||
|
[jwt.signing] |
||||
|
key = "{{ randAlphaNum 10 | b64enc }}" |
||||
|
|
||||
|
# all grpc tls authentications are mutual |
||||
|
# the values for the following ca, cert, and key are paths to the PERM files. |
||||
|
[grpc] |
||||
|
ca = "/usr/local/share/ca-certificates/ca/tls.crt" |
||||
|
|
||||
|
[grpc.volume] |
||||
|
cert = "/usr/local/share/ca-certificates/volume/tls.crt" |
||||
|
key = "/usr/local/share/ca-certificates/volume/tls.key" |
||||
|
|
||||
|
[grpc.master] |
||||
|
cert = "/usr/local/share/ca-certificates/master/tls.crt" |
||||
|
key = "/usr/local/share/ca-certificates/master/tls.key" |
||||
|
|
||||
|
[grpc.filer] |
||||
|
cert = "/usr/local/share/ca-certificates/filer/tls.crt" |
||||
|
key = "/usr/local/share/ca-certificates/filer/tls.key" |
||||
|
|
||||
|
# use this for any place needs a grpc client |
||||
|
# i.e., "weed backup|benchmark|filer.copy|filer.replicate|mount|s3|upload" |
||||
|
[grpc.client] |
||||
|
cert = "/usr/local/share/ca-certificates/client/tls.crt" |
||||
|
key = "/usr/local/share/ca-certificates/client/tls.key" |
||||
|
|
||||
|
# volume server https options |
||||
|
# Note: work in progress! |
||||
|
# this does not work with other clients, e.g., "weed filer|mount" etc, yet. |
||||
|
[https.client] |
||||
|
enabled = false |
||||
|
[https.volume] |
||||
|
cert = "" |
||||
|
key = "" |
||||
|
{{- end }} |
@ -0,0 +1,29 @@ |
|||||
|
#hack for delete pod master after migration |
||||
|
--- |
||||
|
kind: ClusterRole |
||||
|
apiVersion: rbac.authorization.k8s.io/v1beta1 |
||||
|
metadata: |
||||
|
name: seaweefds-rw-cr |
||||
|
rules: |
||||
|
- apiGroups: [""] |
||||
|
resources: ["pods"] |
||||
|
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] |
||||
|
--- |
||||
|
apiVersion: v1 |
||||
|
kind: ServiceAccount |
||||
|
metadata: |
||||
|
name: seaweefds-rw-sa |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
--- |
||||
|
kind: ClusterRoleBinding |
||||
|
apiVersion: rbac.authorization.k8s.io/v1beta1 |
||||
|
metadata: |
||||
|
name: system:serviceaccount:seaweefds-rw-sa:default |
||||
|
subjects: |
||||
|
- kind: ServiceAccount |
||||
|
name: seaweefds-rw-sa |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
roleRef: |
||||
|
apiGroup: rbac.authorization.k8s.io |
||||
|
kind: ClusterRole |
||||
|
name: seaweefds-rw-cr |
@ -0,0 +1,33 @@ |
|||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
apiVersion: certmanager.k8s.io/v1alpha1 |
||||
|
kind: Certificate |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-volume-cert |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
spec: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-volume-cert |
||||
|
issuerRef: |
||||
|
name: {{ template "seaweedfs.name" . }}-clusterissuer |
||||
|
kind: ClusterIssuer |
||||
|
commonName: {{ .Values.certificates.commonName }} |
||||
|
organization: |
||||
|
- "SeaweedFS CA" |
||||
|
dnsNames: |
||||
|
- '*.{{ .Release.Namespace }}' |
||||
|
- '*.{{ .Release.Namespace }}.svc' |
||||
|
- '*.{{ .Release.Namespace }}.svc.cluster.local' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}.svc' |
||||
|
- '*.{{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}.svc.cluster.local' |
||||
|
{{- if .Values.certificates.ipAddresses }} |
||||
|
ipAddresses: |
||||
|
{{- range .Values.certificates.ipAddresses }} |
||||
|
- {{ . }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
keyAlgorithm: {{ .Values.certificates.keyAlgorithm }} |
||||
|
keySize: {{ .Values.certificates.keySize }} |
||||
|
duration: {{ .Values.certificates.duration }} |
||||
|
renewBefore: {{ .Values.certificates.renewBefore }} |
||||
|
{{- end }} |
@ -0,0 +1,28 @@ |
|||||
|
apiVersion: v1 |
||||
|
kind: Service |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-volume |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: volume |
||||
|
spec: |
||||
|
clusterIP: None |
||||
|
ports: |
||||
|
- name: "swfs-volume" |
||||
|
port: {{ .Values.volume.port }} |
||||
|
targetPort: {{ .Values.volume.port }} |
||||
|
protocol: TCP |
||||
|
- name: "swfs-volume-18080" |
||||
|
port: {{ .Values.volume.grpcPort }} |
||||
|
targetPort: {{ .Values.volume.grpcPort }} |
||||
|
protocol: TCP |
||||
|
{{- if .Values.volume.metricsPort }} |
||||
|
- name: "swfs-volume-metrics" |
||||
|
port: {{ .Values.volume.metricsPort }} |
||||
|
targetPort: {{ .Values.volume.metricsPort }} |
||||
|
protocol: TCP |
||||
|
{{- end }} |
||||
|
selector: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: volume |
@ -0,0 +1,18 @@ |
|||||
|
{{- if .Values.volume.metricsPort }} |
||||
|
apiVersion: monitoring.coreos.com/v1 |
||||
|
kind: ServiceMonitor |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-volume |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: volume |
||||
|
spec: |
||||
|
endpoints: |
||||
|
- interval: 30s |
||||
|
port: swfs-volume-metrics |
||||
|
scrapeTimeout: 5s |
||||
|
selector: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
component: volume |
||||
|
{{- end }} |
@ -0,0 +1,276 @@ |
|||||
|
{{- if .Values.volume.enabled }} |
||||
|
apiVersion: apps/v1 |
||||
|
kind: StatefulSet |
||||
|
metadata: |
||||
|
name: {{ template "seaweedfs.name" . }}-volume |
||||
|
namespace: {{ .Release.Namespace }} |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
heritage: {{ .Release.Service }} |
||||
|
release: {{ .Release.Name }} |
||||
|
spec: |
||||
|
serviceName: {{ template "seaweedfs.name" . }}-volume |
||||
|
replicas: {{ .Values.volume.replicas }} |
||||
|
podManagementPolicy: Parallel |
||||
|
selector: |
||||
|
matchLabels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
release: {{ .Release.Name }} |
||||
|
component: volume |
||||
|
template: |
||||
|
metadata: |
||||
|
labels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
chart: {{ template "seaweedfs.chart" . }} |
||||
|
release: {{ .Release.Name }} |
||||
|
component: volume |
||||
|
spec: |
||||
|
{{- if .Values.volume.affinity }} |
||||
|
affinity: |
||||
|
{{ tpl .Values.volume.affinity . | nindent 8 | trim }} |
||||
|
{{- end }} |
||||
|
restartPolicy: {{ default .Values.global.restartPolicy .Values.volume.restartPolicy }} |
||||
|
{{- if .Values.volume.tolerations }} |
||||
|
tolerations: |
||||
|
{{ tpl .Values.volume.tolerations . | nindent 8 | trim }} |
||||
|
{{- end }} |
||||
|
{{- if .Values.global.imagePullSecrets }} |
||||
|
imagePullSecrets: |
||||
|
- name: {{ .Values.global.imagePullSecrets }} |
||||
|
{{- end }} |
||||
|
terminationGracePeriodSeconds: 10 |
||||
|
{{- if .Values.volume.priorityClassName }} |
||||
|
priorityClassName: {{ .Values.volume.priorityClassName | quote }} |
||||
|
{{- end }} |
||||
|
enableServiceLinks: false |
||||
|
{{- if .Values.volume.dir_idx }} |
||||
|
initContainers: |
||||
|
- name: seaweedfs-vol-move-idx |
||||
|
image: {{ template "volume.image" . }} |
||||
|
imagePullPolicy: {{ .Values.global.pullPolicy | default "IfNotPresent" }} |
||||
|
command: [ '/bin/sh', '-c' ] |
||||
|
args: ['if ls {{ .Values.volume.dir }}/*.idx >/dev/null 2>&1; then mv {{ .Values.volume.dir }}/*.idx {{ .Values.volume.dir_idx }}/; fi;'] |
||||
|
volumeMounts: |
||||
|
- name: idx |
||||
|
mountPath: {{ .Values.volume.dir_idx }} |
||||
|
- name: data |
||||
|
mountPath: {{ .Values.volume.dir }} |
||||
|
{{- end }} |
||||
|
containers: |
||||
|
- name: seaweedfs |
||||
|
image: {{ template "volume.image" . }} |
||||
|
imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }} |
||||
|
env: |
||||
|
- name: POD_NAME |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: metadata.name |
||||
|
- name: NAMESPACE |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: metadata.namespace |
||||
|
- name: HOST_IP |
||||
|
valueFrom: |
||||
|
fieldRef: |
||||
|
fieldPath: status.hostIP |
||||
|
- name: SEAWEEDFS_FULLNAME |
||||
|
value: "{{ template "seaweedfs.name" . }}" |
||||
|
{{- if .Values.global.extraEnvironmentVars }} |
||||
|
{{- range $key, $value := .Values.global.extraEnvironmentVars }} |
||||
|
- name: {{ $key }} |
||||
|
value: {{ $value | quote }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
command: |
||||
|
- "/bin/sh" |
||||
|
- "-ec" |
||||
|
- | |
||||
|
exec /usr/bin/weed -logdir=/logs \ |
||||
|
{{- if .Values.volume.loggingOverrideLevel }} |
||||
|
-v={{ .Values.volume.loggingOverrideLevel }} \ |
||||
|
{{- else }} |
||||
|
-v={{ .Values.global.loggingLevel }} \ |
||||
|
{{- end }} |
||||
|
volume \ |
||||
|
-port={{ .Values.volume.port }} \ |
||||
|
{{- if .Values.volume.metricsPort }} |
||||
|
-metricsPort {{ .Values.volume.metricsPort }} \ |
||||
|
{{- end }} |
||||
|
-dir={{ .Values.volume.dir }} \ |
||||
|
{{- if .Values.volume.dir_idx }} |
||||
|
-dir.idx={{ .Values.volume.dir_idx }} \ |
||||
|
{{- end }} |
||||
|
-max={{ .Values.volume.maxVolumes }} \ |
||||
|
{{- if .Values.volume.rack }} |
||||
|
-rack={{ .Values.volume.rack }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.volume.dataCenter }} |
||||
|
-dataCenter={{ .Values.volume.dataCenter }} \ |
||||
|
{{- end }} |
||||
|
-ip.bind={{ .Values.volume.ipBind }} \ |
||||
|
-read.redirect={{ .Values.volume.readRedirect }} \ |
||||
|
{{- if .Values.volume.whiteList }} |
||||
|
-whiteList={{ .Values.volume.whiteList }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.volume.imagesFixOrientation }} |
||||
|
-images.fix.orientation \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.volume.pulseSeconds }} |
||||
|
-pulseSeconds={{ .Values.volume.pulseSeconds }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.volume.index }} |
||||
|
-index={{ .Values.volume.index }} \ |
||||
|
{{- end }} |
||||
|
{{- if .Values.volume.fileSizeLimitMB }} |
||||
|
-fileSizeLimitMB={{ .Values.volume.fileSizeLimitMB }} \ |
||||
|
{{- end }} |
||||
|
-minFreeSpacePercent={{ .Values.volume.minFreeSpacePercent }} \ |
||||
|
-ip=${POD_NAME}.${SEAWEEDFS_FULLNAME}-volume \ |
||||
|
-compactionMBps={{ .Values.volume.compactionMBps }} \ |
||||
|
-mserver={{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }} |
||||
|
volumeMounts: |
||||
|
- name: data |
||||
|
mountPath: "{{ .Values.volume.dir }}/" |
||||
|
{{- if .Values.volume.dir_idx }} |
||||
|
- name: idx |
||||
|
mountPath: "{{ .Values.volume.dir_idx }}/" |
||||
|
{{- end }} |
||||
|
- name: logs |
||||
|
mountPath: "/logs/" |
||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
- name: security-config |
||||
|
readOnly: true |
||||
|
mountPath: /etc/seaweedfs/security.toml |
||||
|
subPath: security.toml |
||||
|
- name: ca-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/ca/ |
||||
|
- name: master-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/master/ |
||||
|
- name: volume-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/volume/ |
||||
|
- name: filer-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/filer/ |
||||
|
- name: client-cert |
||||
|
readOnly: true |
||||
|
mountPath: /usr/local/share/ca-certificates/client/ |
||||
|
{{- end }} |
||||
|
{{ tpl .Values.volume.extraVolumeMounts . | nindent 12 | trim }} |
||||
|
ports: |
||||
|
- containerPort: {{ .Values.volume.port }} |
||||
|
name: swfs-vol |
||||
|
- containerPort: {{ .Values.volume.grpcPort }} |
||||
|
#name: swfs-vol-grpc |
||||
|
readinessProbe: |
||||
|
httpGet: |
||||
|
path: /status |
||||
|
port: {{ .Values.volume.port }} |
||||
|
scheme: HTTP |
||||
|
initialDelaySeconds: 15 |
||||
|
periodSeconds: 90 |
||||
|
successThreshold: 1 |
||||
|
failureThreshold: 100 |
||||
|
timeoutSeconds: 30 |
||||
|
livenessProbe: |
||||
|
httpGet: |
||||
|
path: /status |
||||
|
port: {{ .Values.volume.port }} |
||||
|
scheme: HTTP |
||||
|
initialDelaySeconds: 20 |
||||
|
periodSeconds: 90 |
||||
|
successThreshold: 1 |
||||
|
failureThreshold: 4 |
||||
|
timeoutSeconds: 30 |
||||
|
{{- if .Values.volume.resources }} |
||||
|
resources: |
||||
|
{{ tpl .Values.volume.resources . | nindent 12 | trim }} |
||||
|
{{- end }} |
||||
|
{{- $hostpath_exists := include "volume.hostpath_exists" . -}} |
||||
|
{{- if $hostpath_exists }} |
||||
|
volumes: |
||||
|
{{- if eq .Values.volume.data.type "hostPath" }} |
||||
|
- name: data |
||||
|
hostPath: |
||||
|
path: /storage/object_store/ |
||||
|
type: DirectoryOrCreate |
||||
|
{{- end }} |
||||
|
{{- if and (eq .Values.volume.idx.type "hostPath") .Values.volume.dir_idx }} |
||||
|
- name: idx |
||||
|
hostPath: |
||||
|
path: /ssd/seaweedfs-volume-idx/ |
||||
|
type: DirectoryOrCreate |
||||
|
{{- end }} |
||||
|
{{- if eq .Values.volume.logs.type "hostPath" }} |
||||
|
- name: logs |
||||
|
hostPath: |
||||
|
path: /storage/logs/seaweedfs/volume |
||||
|
type: DirectoryOrCreate |
||||
|
{{- end }} |
||||
|
{{- if .Values.global.enableSecurity }} |
||||
|
- name: security-config |
||||
|
configMap: |
||||
|
name: {{ template "seaweedfs.name" . }}-security-config |
||||
|
- name: ca-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-ca-cert |
||||
|
- name: master-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-master-cert |
||||
|
- name: volume-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-volume-cert |
||||
|
- name: filer-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-filer-cert |
||||
|
- name: client-cert |
||||
|
secret: |
||||
|
secretName: {{ template "seaweedfs.name" . }}-client-cert |
||||
|
{{- end }} |
||||
|
{{- if .Values.volume.extraVolumes }} |
||||
|
{{ tpl .Values.volume.extraVolumes . | indent 8 | trim }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
{{- if .Values.volume.nodeSelector }} |
||||
|
nodeSelector: |
||||
|
{{ tpl .Values.volume.nodeSelector . | indent 8 | trim }} |
||||
|
{{- end }} |
||||
|
{{- $pvc_exists := include "volume.pvc_exists" . -}} |
||||
|
{{- if $pvc_exists }} |
||||
|
volumeClaimTemplates: |
||||
|
{{- if eq .Values.volume.data.type "persistentVolumeClaim"}} |
||||
|
- metadata: |
||||
|
name: data |
||||
|
spec: |
||||
|
accessModes: [ "ReadWriteOnce" ] |
||||
|
storageClassName: {{ .Values.volume.data.storageClass }} |
||||
|
resources: |
||||
|
requests: |
||||
|
storage: {{ .Values.volume.data.size }} |
||||
|
{{- end }} |
||||
|
{{- if and (eq .Values.volume.idx.type "persistentVolumeClaim") .Values.volume.dir_idx }} |
||||
|
- metadata: |
||||
|
name: idx |
||||
|
spec: |
||||
|
accessModes: [ "ReadWriteOnce" ] |
||||
|
storageClassName: {{ .Values.volume.idx.storageClass }} |
||||
|
resources: |
||||
|
requests: |
||||
|
storage: {{ .Values.volume.idx.size }} |
||||
|
{{- end }} |
||||
|
{{- if eq .Values.volume.logs.type "persistentVolumeClaim" }} |
||||
|
- metadata: |
||||
|
name: logs |
||||
|
spec: |
||||
|
accessModes: [ "ReadWriteOnce" ] |
||||
|
storageClassName: {{ .Values.volume.logs.storageClass }} |
||||
|
resources: |
||||
|
requests: |
||||
|
storage: {{ .Values.volume.logs.size }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
||||
|
{{- end }} |
@ -0,0 +1,418 @@ |
|||||
|
# Available parameters and their default values for the SeaweedFS chart. |
||||
|
|
||||
|
global: |
||||
|
registry: "" |
||||
|
repository: "" |
||||
|
imageName: chrislusf/seaweedfs |
||||
|
# imageTag: "2.41" - started using {.Chart.appVersion} |
||||
|
imagePullPolicy: IfNotPresent |
||||
|
imagePullSecrets: imagepullsecret |
||||
|
restartPolicy: Always |
||||
|
loggingLevel: 1 |
||||
|
enableSecurity: false |
||||
|
monitoring: |
||||
|
enabled: false |
||||
|
gatewayHost: null |
||||
|
gatewayPort: null |
||||
|
# if enabled will use global.replicationPlacment and override master & filer defaultReplicaPlacement config |
||||
|
enableReplication: false |
||||
|
# replication type is XYZ: |
||||
|
# X number of replica in other data centers |
||||
|
# Y number of replica in other racks in the same data center |
||||
|
# Z number of replica in other servers in the same rack |
||||
|
replicationPlacment: "001" |
||||
|
extraEnvironmentVars: |
||||
|
WEED_CLUSTER_DEFAULT: "sw" |
||||
|
WEED_CLUSTER_SW_MASTER: "seaweedfs-master:9333" |
||||
|
WEED_CLUSTER_SW_FILER: "seaweedfs-filer-client:8888" |
||||
|
|
||||
|
image: |
||||
|
registry: "" |
||||
|
repository: "" |
||||
|
|
||||
|
master: |
||||
|
enabled: true |
||||
|
repository: null |
||||
|
imageName: null |
||||
|
imageTag: null |
||||
|
imageOverride: null |
||||
|
restartPolicy: null |
||||
|
replicas: 1 |
||||
|
port: 9333 |
||||
|
grpcPort: 19333 |
||||
|
ipBind: "0.0.0.0" |
||||
|
volumePreallocate: false |
||||
|
#Master stops directing writes to oversized volumes |
||||
|
volumeSizeLimitMB: 30000 |
||||
|
loggingOverrideLevel: null |
||||
|
#number of seconds between heartbeats, default 5 |
||||
|
pulseSeconds: null |
||||
|
#threshold to vacuum and reclaim spaces, default 0.3 (30%) |
||||
|
garbageThreshold: null |
||||
|
#Prometheus push interval in seconds, default 15 |
||||
|
metricsIntervalSec: 15 |
||||
|
# replication type is XYZ: |
||||
|
# X number of replica in other data centers |
||||
|
# Y number of replica in other racks in the same data center |
||||
|
# Z number of replica in other servers in the same rack |
||||
|
defaultReplication: "000" |
||||
|
|
||||
|
# Disable http request, only gRpc operations are allowed |
||||
|
disableHttp: false |
||||
|
|
||||
|
extraVolumes: "" |
||||
|
extraVolumeMounts: "" |
||||
|
|
||||
|
# storage and storageClass are the settings for configuring stateful |
||||
|
# storage for the master pods. storage should be set to the disk size of |
||||
|
# the attached volume. storageClass is the class of storage which defaults |
||||
|
# to null (the Kube cluster will pick the default). |
||||
|
storage: 25Gi |
||||
|
storageClass: null |
||||
|
|
||||
|
# Resource requests, limits, etc. for the master cluster placement. This |
||||
|
# should map directly to the value of the resources field for a PodSpec, |
||||
|
# formatted as a multi-line string. By default no direct resource request |
||||
|
# is made. |
||||
|
resources: null |
||||
|
|
||||
|
# updatePartition is used to control a careful rolling update of SeaweedFS |
||||
|
# masters. |
||||
|
updatePartition: 0 |
||||
|
|
||||
|
# Affinity Settings |
||||
|
# Commenting out or setting as empty the affinity variable, will allow |
||||
|
# deployment to single node services such as Minikube |
||||
|
affinity: | |
||||
|
podAntiAffinity: |
||||
|
requiredDuringSchedulingIgnoredDuringExecution: |
||||
|
- labelSelector: |
||||
|
matchLabels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
release: "{{ .Release.Name }}" |
||||
|
component: master |
||||
|
topologyKey: kubernetes.io/hostname |
||||
|
|
||||
|
# Toleration Settings for master pods |
||||
|
# This should be a multi-line string matching the Toleration array |
||||
|
# in a PodSpec. |
||||
|
tolerations: "" |
||||
|
|
||||
|
# nodeSelector labels for master pod assignment, formatted as a muli-line string. |
||||
|
# ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector |
||||
|
# Example: |
||||
|
# nodeSelector: | |
||||
|
# beta.kubernetes.io/arch: amd64 |
||||
|
nodeSelector: | |
||||
|
sw-backend: "true" |
||||
|
|
||||
|
# used to assign priority to master pods |
||||
|
# ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ |
||||
|
priorityClassName: "" |
||||
|
|
||||
|
extraEnvironmentVars: |
||||
|
WEED_MASTER_VOLUME_GROWTH_COPY_1: 7 |
||||
|
WEED_MASTER_VOLUME_GROWTH_COPY_2: 6 |
||||
|
WEED_MASTER_VOLUME_GROWTH_COPY_3: 3 |
||||
|
WEED_MASTER_VOLUME_GROWTH_COPY_OTHER: 1 |
||||
|
|
||||
|
volume: |
||||
|
enabled: true |
||||
|
repository: null |
||||
|
imageName: null |
||||
|
imageTag: null |
||||
|
imageOverride: null |
||||
|
restartPolicy: null |
||||
|
port: 8080 |
||||
|
grpcPort: 18080 |
||||
|
metricsPort: 9327 |
||||
|
ipBind: "0.0.0.0" |
||||
|
replicas: 1 |
||||
|
loggingOverrideLevel: null |
||||
|
# number of seconds between heartbeats, must be smaller than or equal to the master's setting |
||||
|
pulseSeconds: null |
||||
|
# Choose [memory|leveldb|leveldbMedium|leveldbLarge] mode for memory~performance balance., default memory |
||||
|
index: null |
||||
|
# limit file size to avoid out of memory, default 256mb |
||||
|
fileSizeLimitMB: null |
||||
|
# minimum free disk space(in percents). If free disk space lower this value - all volumes marks as ReadOnly |
||||
|
minFreeSpacePercent: 7 |
||||
|
|
||||
|
# can use ANY storage-class , example with local-path-provisner |
||||
|
# data: |
||||
|
# type: "persistentVolumeClaim" |
||||
|
# size: "24Ti" |
||||
|
# storageClass: "local-path-provisioner" |
||||
|
data: |
||||
|
type: "hostPath" |
||||
|
size: "" |
||||
|
storageClass: "" |
||||
|
idx: |
||||
|
type: "hostPath" |
||||
|
size: "" |
||||
|
storageClass: "" |
||||
|
|
||||
|
logs: |
||||
|
type: "hostPath" |
||||
|
size: "" |
||||
|
storageClass: "" |
||||
|
|
||||
|
# limit background compaction or copying speed in mega bytes per second |
||||
|
compactionMBps: "50" |
||||
|
|
||||
|
# Directories to store data files. dir[,dir]... (default "/tmp") |
||||
|
dir: "/data" |
||||
|
# Directories to store index files. dir[,dir]... (default "/tmp") |
||||
|
dir_idx: null |
||||
|
|
||||
|
# Maximum numbers of volumes, count[,count]... |
||||
|
# If set to zero on non-windows OS, the limit will be auto configured. (default "7") |
||||
|
maxVolumes: "0" |
||||
|
|
||||
|
# Volume server's rack name |
||||
|
rack: null |
||||
|
|
||||
|
# Volume server's data center name |
||||
|
dataCenter: null |
||||
|
|
||||
|
# Redirect moved or non-local volumes. (default true) |
||||
|
readRedirect: true |
||||
|
|
||||
|
# Comma separated Ip addresses having write permission. No limit if empty. |
||||
|
whiteList: null |
||||
|
|
||||
|
# Adjust jpg orientation when uploading. |
||||
|
imagesFixOrientation: false |
||||
|
|
||||
|
extraVolumes: "" |
||||
|
extraVolumeMounts: "" |
||||
|
|
||||
|
# Affinity Settings |
||||
|
# Commenting out or setting as empty the affinity variable, will allow |
||||
|
# deployment to single node services such as Minikube |
||||
|
affinity: | |
||||
|
podAntiAffinity: |
||||
|
requiredDuringSchedulingIgnoredDuringExecution: |
||||
|
- labelSelector: |
||||
|
matchLabels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
release: "{{ .Release.Name }}" |
||||
|
component: volume |
||||
|
topologyKey: kubernetes.io/hostname |
||||
|
|
||||
|
# Resource requests, limits, etc. for the server cluster placement. This |
||||
|
# should map directly to the value of the resources field for a PodSpec, |
||||
|
# formatted as a multi-line string. By default no direct resource request |
||||
|
# is made. |
||||
|
resources: null |
||||
|
|
||||
|
# Toleration Settings for server pods |
||||
|
# This should be a multi-line string matching the Toleration array |
||||
|
# in a PodSpec. |
||||
|
tolerations: "" |
||||
|
|
||||
|
# nodeSelector labels for server pod assignment, formatted as a muli-line string. |
||||
|
# ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector |
||||
|
# Example: |
||||
|
# nodeSelector: | |
||||
|
# beta.kubernetes.io/arch: amd64 |
||||
|
nodeSelector: | |
||||
|
sw-volume: "true" |
||||
|
|
||||
|
# used to assign priority to server pods |
||||
|
# ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ |
||||
|
priorityClassName: "" |
||||
|
|
||||
|
|
||||
|
filer: |
||||
|
enabled: true |
||||
|
repository: null |
||||
|
imageName: null |
||||
|
imageTag: null |
||||
|
imageOverride: null |
||||
|
restartPolicy: null |
||||
|
replicas: 1 |
||||
|
port: 8888 |
||||
|
grpcPort: 18888 |
||||
|
metricsPort: 9327 |
||||
|
loggingOverrideLevel: null |
||||
|
# replication type is XYZ: |
||||
|
# X number of replica in other data centers |
||||
|
# Y number of replica in other racks in the same data center |
||||
|
# Z number of replica in other servers in the same rack |
||||
|
defaultReplicaPlacement: "000" |
||||
|
# turn off directory listing |
||||
|
disableDirListing: false |
||||
|
# split files larger than the limit, default 32 |
||||
|
maxMB: null |
||||
|
# encrypt data on volume servers |
||||
|
encryptVolumeData: false |
||||
|
# enable peers sync metadata, for leveldb (localdb for filer but with sync across) |
||||
|
enable_peers: false |
||||
|
|
||||
|
# Whether proxy or redirect to volume server during file GET request |
||||
|
redirectOnRead: false |
||||
|
|
||||
|
# Limit sub dir listing size (default 100000) |
||||
|
dirListLimit: 100000 |
||||
|
|
||||
|
# Turn off directory listing |
||||
|
disableDirListing: false |
||||
|
|
||||
|
# Disable http request, only gRpc operations are allowed |
||||
|
disableHttp: false |
||||
|
|
||||
|
# storage and storageClass are the settings for configuring stateful |
||||
|
# storage for the master pods. storage should be set to the disk size of |
||||
|
# the attached volume. storageClass is the class of storage which defaults |
||||
|
# to null (the Kube cluster will pick the default). |
||||
|
storage: 25Gi |
||||
|
storageClass: null |
||||
|
|
||||
|
extraVolumes: "" |
||||
|
extraVolumeMounts: "" |
||||
|
|
||||
|
# Affinity Settings |
||||
|
# Commenting out or setting as empty the affinity variable, will allow |
||||
|
# deployment to single node services such as Minikube |
||||
|
affinity: | |
||||
|
podAntiAffinity: |
||||
|
requiredDuringSchedulingIgnoredDuringExecution: |
||||
|
- labelSelector: |
||||
|
matchLabels: |
||||
|
app: {{ template "seaweedfs.name" . }} |
||||
|
release: "{{ .Release.Name }}" |
||||
|
component: filer |
||||
|
topologyKey: kubernetes.io/hostname |
||||
|
|
||||
|
# updatePartition is used to control a careful rolling update of SeaweedFS |
||||
|
# masters. |
||||
|
updatePartition: 0 |
||||
|
|
||||
|
# Resource requests, limits, etc. for the server cluster placement. This |
||||
|
# should map directly to the value of the resources field for a PodSpec, |
||||
|
# formatted as a multi-line string. By default no direct resource request |
||||
|
# is made. |
||||
|
resources: null |
||||
|
|
||||
|
# Toleration Settings for server pods |
||||
|
# This should be a multi-line string matching the Toleration array |
||||
|
# in a PodSpec. |
||||
|
tolerations: "" |
||||
|
|
||||
|
# nodeSelector labels for server pod assignment, formatted as a muli-line string. |
||||
|
# ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector |
||||
|
# Example: |
||||
|
# nodeSelector: | |
||||
|
# beta.kubernetes.io/arch: amd64 |
||||
|
nodeSelector: | |
||||
|
sw-backend: "true" |
||||
|
|
||||
|
# used to assign priority to server pods |
||||
|
# ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ |
||||
|
priorityClassName: "" |
||||
|
|
||||
|
# extraEnvVars is a list of extra enviroment variables to set with the stateful set. |
||||
|
extraEnvironmentVars: |
||||
|
WEED_MYSQL_ENABLED: "true" |
||||
|
WEED_MYSQL_HOSTNAME: "mysql-db-host" |
||||
|
WEED_MYSQL_PORT: "3306" |
||||
|
WEED_MYSQL_DATABASE: "sw_database" |
||||
|
WEED_MYSQL_CONNECTION_MAX_IDLE: "5" |
||||
|
WEED_MYSQL_CONNECTION_MAX_OPEN: "75" |
||||
|
# "refresh" connection every 10 minutes, eliminating mysql closing "old" connections |
||||
|
WEED_MYSQL_CONNECTION_MAX_LIFETIME_SECONDS: "600" |
||||
|
# enable usage of memsql as filer backend |
||||
|
WEED_MYSQL_INTERPOLATEPARAMS: "true" |
||||
|
WEED_LEVELDB2_ENABLED: "false" |
||||
|
# with http DELETE, by default the filer would check whether a folder is empty. |
||||
|
# recursive_delete will delete all sub folders and files, similar to "rm -Rf" |
||||
|
WEED_FILER_OPTIONS_RECURSIVE_DELETE: "false" |
||||
|
# directories under this folder will be automatically creating a separate bucket |
||||
|
WEED_FILER_BUCKETS_FOLDER: "/buckets" |
||||
|
|
||||
|
s3: |
||||
|
enabled: true |
||||
|
port: 8333 |
||||
|
#allow empty folders |
||||
|
allowEmptyFolder: false |
||||
|
# Suffix of the host name, {bucket}.{domainName} |
||||
|
domainName: "" |
||||
|
# enable user & permission to s3 (need to inject to all services) |
||||
|
enableAuth: false |
||||
|
skipAuthSecretCreation: false |
||||
|
|
||||
|
s3: |
||||
|
enabled: false |
||||
|
repository: null |
||||
|
imageName: null |
||||
|
imageTag: null |
||||
|
restartPolicy: null |
||||
|
replicas: 1 |
||||
|
port: 8333 |
||||
|
metricsPort: 9327 |
||||
|
loggingOverrideLevel: null |
||||
|
#allow empty folders |
||||
|
allowEmptyFolder: true |
||||
|
# enable user & permission to s3 (need to inject to all services) |
||||
|
enableAuth: false |
||||
|
skipAuthSecretCreation: false |
||||
|
|
||||
|
# Suffix of the host name, {bucket}.{domainName} |
||||
|
domainName: "" |
||||
|
|
||||
|
extraVolumes: "" |
||||
|
extraVolumeMounts: "" |
||||
|
|
||||
|
# Resource requests, limits, etc. for the server cluster placement. This |
||||
|
# should map directly to the value of the resources field for a PodSpec, |
||||
|
# formatted as a multi-line string. By default no direct resource request |
||||
|
# is made. |
||||
|
resources: null |
||||
|
|
||||
|
# Toleration Settings for server pods |
||||
|
# This should be a multi-line string matching the Toleration array |
||||
|
# in a PodSpec. |
||||
|
tolerations: "" |
||||
|
|
||||
|
# nodeSelector labels for server pod assignment, formatted as a muli-line string. |
||||
|
# ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector |
||||
|
# Example: |
||||
|
# nodeSelector: | |
||||
|
# beta.kubernetes.io/arch: amd64 |
||||
|
nodeSelector: | |
||||
|
sw-backend: "true" |
||||
|
|
||||
|
# used to assign priority to server pods |
||||
|
# ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ |
||||
|
priorityClassName: "" |
||||
|
|
||||
|
logs: |
||||
|
type: "hostPath" |
||||
|
size: "" |
||||
|
storageClass: "" |
||||
|
|
||||
|
cronjob: |
||||
|
enabled: true |
||||
|
master: "seaweedfs-master:9333" |
||||
|
filer: "seaweedfs-filer-client:8888" |
||||
|
tolerations: "" |
||||
|
nodeSelector: | |
||||
|
sw-backend: "true" |
||||
|
replication: |
||||
|
enable: true |
||||
|
collectionPattern: "" |
||||
|
schedule: "*/7 * * * *" |
||||
|
resources: null |
||||
|
# balance all volumes among volume servers |
||||
|
# ALL|EACH_COLLECTION|<collection_name> |
||||
|
collection: "" |
||||
|
|
||||
|
|
||||
|
certificates: |
||||
|
commonName: "SeaweedFS CA" |
||||
|
ipAddresses: [] |
||||
|
keyAlgorithm: rsa |
||||
|
keySize: 2048 |
||||
|
duration: 2160h # 90d |
||||
|
renewBefore: 360h # 15d |
After Width: 1121 | Height: 701 | Size: 90 KiB |
After Width: 1211 | Height: 586 | Size: 86 KiB |
After Width: 1271 | Height: 566 | Size: 62 KiB |
After Width: 200 | Height: 51 | Size: 12 KiB |
@ -0,0 +1,170 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<groupId>com.github.chrislusf</groupId> |
||||
|
<artifactId>seaweedfs-client</artifactId> |
||||
|
<version>1.6.4</version> |
||||
|
|
||||
|
<parent> |
||||
|
<groupId>org.sonatype.oss</groupId> |
||||
|
<artifactId>oss-parent</artifactId> |
||||
|
<version>9</version> |
||||
|
</parent> |
||||
|
|
||||
|
<properties> |
||||
|
<protobuf.version>3.9.1</protobuf.version> |
||||
|
<!-- follow https://github.com/grpc/grpc-java --> |
||||
|
<grpc.version>1.23.0</grpc.version> |
||||
|
<guava.version>28.0-jre</guava.version> |
||||
|
</properties> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.moandjiezana.toml</groupId> |
||||
|
<artifactId>toml4j</artifactId> |
||||
|
<version>0.7.2</version> |
||||
|
</dependency> |
||||
|
<!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java --> |
||||
|
<dependency> |
||||
|
<groupId>com.google.protobuf</groupId> |
||||
|
<artifactId>protobuf-java</artifactId> |
||||
|
<version>${protobuf.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.google.guava</groupId> |
||||
|
<artifactId>guava</artifactId> |
||||
|
<version>${guava.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>io.grpc</groupId> |
||||
|
<artifactId>grpc-netty-shaded</artifactId> |
||||
|
<version>${grpc.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>io.grpc</groupId> |
||||
|
<artifactId>grpc-protobuf</artifactId> |
||||
|
<version>${grpc.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>io.grpc</groupId> |
||||
|
<artifactId>grpc-stub</artifactId> |
||||
|
<version>${grpc.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.slf4j</groupId> |
||||
|
<artifactId>slf4j-api</artifactId> |
||||
|
<version>1.7.25</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.httpcomponents</groupId> |
||||
|
<artifactId>httpmime</artifactId> |
||||
|
<version>4.5.6</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>junit</groupId> |
||||
|
<artifactId>junit</artifactId> |
||||
|
<version>4.12</version> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<distributionManagement> |
||||
|
<snapshotRepository> |
||||
|
<id>ossrh</id> |
||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url> |
||||
|
</snapshotRepository> |
||||
|
</distributionManagement> |
||||
|
<build> |
||||
|
<extensions> |
||||
|
<extension> |
||||
|
<groupId>kr.motd.maven</groupId> |
||||
|
<artifactId>os-maven-plugin</artifactId> |
||||
|
<version>1.6.2</version> |
||||
|
</extension> |
||||
|
</extensions> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-compiler-plugin</artifactId> |
||||
|
<configuration> |
||||
|
<source>8</source> |
||||
|
<target>8</target> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.xolstice.maven.plugins</groupId> |
||||
|
<artifactId>protobuf-maven-plugin</artifactId> |
||||
|
<version>0.6.1</version> |
||||
|
<configuration> |
||||
|
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} |
||||
|
</protocArtifact> |
||||
|
<pluginId>grpc-java</pluginId> |
||||
|
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} |
||||
|
</pluginArtifact> |
||||
|
</configuration> |
||||
|
<executions> |
||||
|
<execution> |
||||
|
<goals> |
||||
|
<goal>compile</goal> |
||||
|
<goal>compile-custom</goal> |
||||
|
</goals> |
||||
|
</execution> |
||||
|
</executions> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-gpg-plugin</artifactId> |
||||
|
<version>1.5</version> |
||||
|
<executions> |
||||
|
<execution> |
||||
|
<id>sign-artifacts</id> |
||||
|
<phase>verify</phase> |
||||
|
<goals> |
||||
|
<goal>sign</goal> |
||||
|
</goals> |
||||
|
</execution> |
||||
|
</executions> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.sonatype.plugins</groupId> |
||||
|
<artifactId>nexus-staging-maven-plugin</artifactId> |
||||
|
<version>1.6.7</version> |
||||
|
<extensions>true</extensions> |
||||
|
<configuration> |
||||
|
<serverId>ossrh</serverId> |
||||
|
<nexusUrl>https://oss.sonatype.org/</nexusUrl> |
||||
|
<autoReleaseAfterClose>true</autoReleaseAfterClose> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-source-plugin</artifactId> |
||||
|
<version>2.2.1</version> |
||||
|
<executions> |
||||
|
<execution> |
||||
|
<id>attach-sources</id> |
||||
|
<goals> |
||||
|
<goal>jar-no-fork</goal> |
||||
|
</goals> |
||||
|
</execution> |
||||
|
</executions> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-javadoc-plugin</artifactId> |
||||
|
<version>2.9.1</version> |
||||
|
<executions> |
||||
|
<execution> |
||||
|
<id>attach-javadocs</id> |
||||
|
<goals> |
||||
|
<goal>jar</goal> |
||||
|
</goals> |
||||
|
</execution> |
||||
|
</executions> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</build> |
||||
|
|
||||
|
</project> |
@ -0,0 +1,144 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<groupId>com.github.chrislusf</groupId> |
||||
|
<artifactId>seaweedfs-client</artifactId> |
||||
|
<version>1.6.4</version> |
||||
|
|
||||
|
<parent> |
||||
|
<groupId>org.sonatype.oss</groupId> |
||||
|
<artifactId>oss-parent</artifactId> |
||||
|
<version>9</version> |
||||
|
</parent> |
||||
|
|
||||
|
<properties> |
||||
|
<protobuf.version>3.9.1</protobuf.version> |
||||
|
<!-- follow https://github.com/grpc/grpc-java --> |
||||
|
<grpc.version>1.23.0</grpc.version> |
||||
|
<guava.version>28.0-jre</guava.version> |
||||
|
</properties> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.moandjiezana.toml</groupId> |
||||
|
<artifactId>toml4j</artifactId> |
||||
|
<version>0.7.2</version> |
||||
|
</dependency> |
||||
|
<!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java --> |
||||
|
<dependency> |
||||
|
<groupId>com.google.protobuf</groupId> |
||||
|
<artifactId>protobuf-java</artifactId> |
||||
|
<version>${protobuf.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.google.guava</groupId> |
||||
|
<artifactId>guava</artifactId> |
||||
|
<version>${guava.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>io.grpc</groupId> |
||||
|
<artifactId>grpc-netty-shaded</artifactId> |
||||
|
<version>${grpc.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>io.grpc</groupId> |
||||
|
<artifactId>grpc-protobuf</artifactId> |
||||
|
<version>${grpc.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>io.grpc</groupId> |
||||
|
<artifactId>grpc-stub</artifactId> |
||||
|
<version>${grpc.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.slf4j</groupId> |
||||
|
<artifactId>slf4j-api</artifactId> |
||||
|
<version>1.7.25</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.httpcomponents</groupId> |
||||
|
<artifactId>httpmime</artifactId> |
||||
|
<version>4.5.6</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>junit</groupId> |
||||
|
<artifactId>junit</artifactId> |
||||
|
<version>4.13.1</version> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>javax.annotation</groupId> |
||||
|
<artifactId>javax.annotation-api</artifactId> |
||||
|
<version>1.3.2</version> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<extensions> |
||||
|
<extension> |
||||
|
<groupId>kr.motd.maven</groupId> |
||||
|
<artifactId>os-maven-plugin</artifactId> |
||||
|
<version>1.6.2</version> |
||||
|
</extension> |
||||
|
</extensions> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-compiler-plugin</artifactId> |
||||
|
<configuration> |
||||
|
<source>8</source> |
||||
|
<target>8</target> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.xolstice.maven.plugins</groupId> |
||||
|
<artifactId>protobuf-maven-plugin</artifactId> |
||||
|
<version>0.6.1</version> |
||||
|
<configuration> |
||||
|
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} |
||||
|
</protocArtifact> |
||||
|
<pluginId>grpc-java</pluginId> |
||||
|
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} |
||||
|
</pluginArtifact> |
||||
|
</configuration> |
||||
|
<executions> |
||||
|
<execution> |
||||
|
<goals> |
||||
|
<goal>compile</goal> |
||||
|
<goal>compile-custom</goal> |
||||
|
</goals> |
||||
|
</execution> |
||||
|
</executions> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-source-plugin</artifactId> |
||||
|
<version>2.2.1</version> |
||||
|
<executions> |
||||
|
<execution> |
||||
|
<id>attach-sources</id> |
||||
|
<goals> |
||||
|
<goal>jar-no-fork</goal> |
||||
|
</goals> |
||||
|
</execution> |
||||
|
</executions> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-javadoc-plugin</artifactId> |
||||
|
<version>2.9.1</version> |
||||
|
<executions> |
||||
|
<execution> |
||||
|
<id>attach-javadocs</id> |
||||
|
<goals> |
||||
|
<goal>jar</goal> |
||||
|
</goals> |
||||
|
</execution> |
||||
|
</executions> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</build> |
||||
|
|
||||
|
</project> |
@ -0,0 +1,42 @@ |
|||||
|
package seaweedfs.client; |
||||
|
|
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.nio.Buffer; |
||||
|
import java.nio.ByteBuffer; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public class ByteBufferPool { |
||||
|
|
||||
|
private static final int MIN_BUFFER_SIZE = 8 * 1024 * 1024; |
||||
|
private static final Logger LOG = LoggerFactory.getLogger(ByteBufferPool.class); |
||||
|
|
||||
|
private static final List<ByteBuffer> bufferList = new ArrayList<>(); |
||||
|
|
||||
|
public static synchronized ByteBuffer request(int bufferSize) { |
||||
|
if (bufferSize < MIN_BUFFER_SIZE) { |
||||
|
bufferSize = MIN_BUFFER_SIZE; |
||||
|
} |
||||
|
LOG.debug("requested new buffer {}", bufferSize); |
||||
|
if (bufferList.isEmpty()) { |
||||
|
return ByteBuffer.allocate(bufferSize); |
||||
|
} |
||||
|
ByteBuffer buffer = bufferList.remove(bufferList.size() - 1); |
||||
|
if (buffer.capacity() >= bufferSize) { |
||||
|
return buffer; |
||||
|
} |
||||
|
|
||||
|
LOG.info("add new buffer from {} to {}", buffer.capacity(), bufferSize); |
||||
|
bufferList.add(0, buffer); |
||||
|
return ByteBuffer.allocate(bufferSize); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static synchronized void release(ByteBuffer obj) { |
||||
|
((Buffer)obj).clear(); |
||||
|
bufferList.add(0, obj); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package seaweedfs.client; |
||||
|
|
||||
|
import com.google.common.cache.Cache; |
||||
|
import com.google.common.cache.CacheBuilder; |
||||
|
|
||||
|
import java.util.concurrent.TimeUnit; |
||||
|
|
||||
|
public class ChunkCache { |
||||
|
|
||||
|
private Cache<String, byte[]> cache = null; |
||||
|
|
||||
|
public ChunkCache(int maxEntries) { |
||||
|
if (maxEntries == 0) { |
||||
|
return; |
||||
|
} |
||||
|
this.cache = CacheBuilder.newBuilder() |
||||
|
.maximumSize(maxEntries) |
||||
|
.expireAfterAccess(1, TimeUnit.HOURS) |
||||
|
.build(); |
||||
|
} |
||||
|
|
||||
|
public byte[] getChunk(String fileId) { |
||||
|
if (this.cache == null) { |
||||
|
return null; |
||||
|
} |
||||
|
return this.cache.getIfPresent(fileId); |
||||
|
} |
||||
|
|
||||
|
public void setChunk(String fileId, byte[] data) { |
||||
|
if (this.cache == null) { |
||||
|
return; |
||||
|
} |
||||
|
this.cache.put(fileId, data); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,140 @@ |
|||||
|
package seaweedfs.client; |
||||
|
|
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public class FileChunkManifest { |
||||
|
|
||||
|
private static final Logger LOG = LoggerFactory.getLogger(FileChunkManifest.class); |
||||
|
|
||||
|
private static final int mergeFactor = 1000; |
||||
|
|
||||
|
public static boolean hasChunkManifest(List<FilerProto.FileChunk> chunks) { |
||||
|
for (FilerProto.FileChunk chunk : chunks) { |
||||
|
if (chunk.getIsChunkManifest()) { |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
public static List<FilerProto.FileChunk> resolveChunkManifest( |
||||
|
final FilerClient filerClient, List<FilerProto.FileChunk> chunks) throws IOException { |
||||
|
|
||||
|
List<FilerProto.FileChunk> dataChunks = new ArrayList<>(); |
||||
|
|
||||
|
for (FilerProto.FileChunk chunk : chunks) { |
||||
|
if (!chunk.getIsChunkManifest()) { |
||||
|
dataChunks.add(chunk); |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
// IsChunkManifest |
||||
|
LOG.debug("fetching chunk manifest:{}", chunk); |
||||
|
byte[] data = fetchChunk(filerClient, chunk); |
||||
|
FilerProto.FileChunkManifest m = FilerProto.FileChunkManifest.newBuilder().mergeFrom(data).build(); |
||||
|
List<FilerProto.FileChunk> resolvedChunks = new ArrayList<>(); |
||||
|
for (FilerProto.FileChunk t : m.getChunksList()) { |
||||
|
// avoid deprecated chunk.getFileId() |
||||
|
resolvedChunks.add(t.toBuilder().setFileId(FilerClient.toFileId(t.getFid())).build()); |
||||
|
} |
||||
|
dataChunks.addAll(resolveChunkManifest(filerClient, resolvedChunks)); |
||||
|
} |
||||
|
|
||||
|
return dataChunks; |
||||
|
} |
||||
|
|
||||
|
private static byte[] fetchChunk(final FilerClient filerClient, FilerProto.FileChunk chunk) throws IOException { |
||||
|
|
||||
|
String vid = "" + chunk.getFid().getVolumeId(); |
||||
|
FilerProto.Locations locations = filerClient.vidLocations.get(vid); |
||||
|
if (locations == null) { |
||||
|
FilerProto.LookupVolumeRequest.Builder lookupRequest = FilerProto.LookupVolumeRequest.newBuilder(); |
||||
|
lookupRequest.addVolumeIds(vid); |
||||
|
FilerProto.LookupVolumeResponse lookupResponse = filerClient |
||||
|
.getBlockingStub().lookupVolume(lookupRequest.build()); |
||||
|
locations = lookupResponse.getLocationsMapMap().get(vid); |
||||
|
filerClient.vidLocations.put(vid, locations); |
||||
|
LOG.debug("fetchChunk vid:{} locations:{}", vid, locations); |
||||
|
} |
||||
|
|
||||
|
SeaweedRead.ChunkView chunkView = new SeaweedRead.ChunkView( |
||||
|
FilerClient.toFileId(chunk.getFid()), // avoid deprecated chunk.getFileId() |
||||
|
0, |
||||
|
-1, |
||||
|
0, |
||||
|
true, |
||||
|
chunk.getCipherKey().toByteArray(), |
||||
|
chunk.getIsCompressed()); |
||||
|
|
||||
|
byte[] chunkData = SeaweedRead.chunkCache.getChunk(chunkView.fileId); |
||||
|
if (chunkData == null) { |
||||
|
LOG.debug("doFetchFullChunkData:{}", chunkView); |
||||
|
chunkData = SeaweedRead.doFetchFullChunkData(filerClient, chunkView, locations); |
||||
|
} |
||||
|
if (chunk.getIsChunkManifest()){ |
||||
|
LOG.debug("chunk {} size {}", chunkView.fileId, chunkData.length); |
||||
|
SeaweedRead.chunkCache.setChunk(chunkView.fileId, chunkData); |
||||
|
} |
||||
|
|
||||
|
return chunkData; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static List<FilerProto.FileChunk> maybeManifestize( |
||||
|
final FilerClient filerClient, List<FilerProto.FileChunk> inputChunks, String parentDirectory) throws IOException { |
||||
|
// the return variable |
||||
|
List<FilerProto.FileChunk> chunks = new ArrayList<>(); |
||||
|
|
||||
|
List<FilerProto.FileChunk> dataChunks = new ArrayList<>(); |
||||
|
for (FilerProto.FileChunk chunk : inputChunks) { |
||||
|
if (!chunk.getIsChunkManifest()) { |
||||
|
dataChunks.add(chunk); |
||||
|
} else { |
||||
|
chunks.add(chunk); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
int remaining = dataChunks.size(); |
||||
|
for (int i = 0; i + mergeFactor < dataChunks.size(); i += mergeFactor) { |
||||
|
FilerProto.FileChunk chunk = mergeIntoManifest(filerClient, dataChunks.subList(i, i + mergeFactor), parentDirectory); |
||||
|
chunks.add(chunk); |
||||
|
remaining -= mergeFactor; |
||||
|
} |
||||
|
|
||||
|
// remaining |
||||
|
for (int i = dataChunks.size() - remaining; i < dataChunks.size(); i++) { |
||||
|
chunks.add(dataChunks.get(i)); |
||||
|
} |
||||
|
return chunks; |
||||
|
} |
||||
|
|
||||
|
private static FilerProto.FileChunk mergeIntoManifest(final FilerClient filerClient, List<FilerProto.FileChunk> dataChunks, String parentDirectory) throws IOException { |
||||
|
// create and serialize the manifest |
||||
|
dataChunks = FilerClient.beforeEntrySerialization(dataChunks); |
||||
|
FilerProto.FileChunkManifest.Builder m = FilerProto.FileChunkManifest.newBuilder().addAllChunks(dataChunks); |
||||
|
byte[] data = m.build().toByteArray(); |
||||
|
|
||||
|
long minOffset = Long.MAX_VALUE; |
||||
|
long maxOffset = -1; |
||||
|
for (FilerProto.FileChunk chunk : dataChunks) { |
||||
|
minOffset = Math.min(minOffset, chunk.getOffset()); |
||||
|
maxOffset = Math.max(maxOffset, chunk.getSize() + chunk.getOffset()); |
||||
|
} |
||||
|
|
||||
|
FilerProto.FileChunk.Builder manifestChunk = SeaweedWrite.writeChunk( |
||||
|
filerClient.getReplication(), |
||||
|
filerClient, |
||||
|
minOffset, |
||||
|
data, 0, data.length, parentDirectory); |
||||
|
manifestChunk.setIsChunkManifest(true); |
||||
|
manifestChunk.setSize(maxOffset - minOffset); |
||||
|
return manifestChunk.build(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
package seaweedfs.client; |
||||
|
|
||||
|
import java.io.ByteArrayInputStream; |
||||
|
import java.io.ByteArrayOutputStream; |
||||
|
import java.io.IOException; |
||||
|
import java.io.InputStream; |
||||
|
import java.util.zip.GZIPInputStream; |
||||
|
import java.util.zip.GZIPOutputStream; |
||||
|
|
||||
|
public class Gzip { |
||||
|
public static byte[] compress(byte[] data) throws IOException { |
||||
|
ByteArrayOutputStream bos = new ByteArrayOutputStream(data.length); |
||||
|
GZIPOutputStream gzip = new GZIPOutputStream(bos); |
||||
|
gzip.write(data); |
||||
|
gzip.close(); |
||||
|
byte[] compressed = bos.toByteArray(); |
||||
|
bos.close(); |
||||
|
return compressed; |
||||
|
} |
||||
|
|
||||
|
public static byte[] decompress(byte[] compressed) { |
||||
|
try { |
||||
|
ByteArrayInputStream bis = new ByteArrayInputStream(compressed); |
||||
|
GZIPInputStream gis = new GZIPInputStream(bis); |
||||
|
return readAll(gis); |
||||
|
} catch (Exception e) { |
||||
|
return compressed; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private static byte[] readAll(InputStream input) throws IOException { |
||||
|
try (ByteArrayOutputStream output = new ByteArrayOutputStream()) { |
||||
|
byte[] buffer = new byte[4096]; |
||||
|
int n; |
||||
|
while (-1 != (n = input.read(buffer))) { |
||||
|
output.write(buffer, 0, n); |
||||
|
} |
||||
|
return output.toByteArray(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
package seaweedfs.client; |
||||
|
|
||||
|
import javax.crypto.Cipher; |
||||
|
import javax.crypto.spec.GCMParameterSpec; |
||||
|
import javax.crypto.spec.SecretKeySpec; |
||||
|
import java.security.SecureRandom; |
||||
|
|
||||
|
public class SeaweedCipher { |
||||
|
// AES-GCM parameters |
||||
|
public static final int AES_KEY_SIZE = 256; // in bits |
||||
|
public static final int GCM_NONCE_LENGTH = 12; // in bytes |
||||
|
public static final int GCM_TAG_LENGTH = 16; // in bytes |
||||
|
|
||||
|
private static SecureRandom random = new SecureRandom(); |
||||
|
|
||||
|
public static byte[] genCipherKey() throws Exception { |
||||
|
byte[] key = new byte[AES_KEY_SIZE / 8]; |
||||
|
random.nextBytes(key); |
||||
|
return key; |
||||
|
} |
||||
|
|
||||
|
public static byte[] encrypt(byte[] clearTextbytes, byte[] cipherKey) throws Exception { |
||||
|
return encrypt(clearTextbytes, 0, clearTextbytes.length, cipherKey); |
||||
|
} |
||||
|
|
||||
|
public static byte[] encrypt(byte[] clearTextbytes, int offset, int length, byte[] cipherKey) throws Exception { |
||||
|
|
||||
|
final byte[] nonce = new byte[GCM_NONCE_LENGTH]; |
||||
|
random.nextBytes(nonce); |
||||
|
GCMParameterSpec spec = new GCMParameterSpec(GCM_TAG_LENGTH * 8, nonce); |
||||
|
SecretKeySpec keySpec = new SecretKeySpec(cipherKey, "AES"); |
||||
|
|
||||
|
Cipher AES_cipherInstance = Cipher.getInstance("AES/GCM/NoPadding"); |
||||
|
AES_cipherInstance.init(Cipher.ENCRYPT_MODE, keySpec, spec); |
||||
|
|
||||
|
byte[] encryptedText = AES_cipherInstance.doFinal(clearTextbytes, offset, length); |
||||
|
|
||||
|
byte[] iv = AES_cipherInstance.getIV(); |
||||
|
byte[] message = new byte[GCM_NONCE_LENGTH + clearTextbytes.length + GCM_TAG_LENGTH]; |
||||
|
System.arraycopy(iv, 0, message, 0, GCM_NONCE_LENGTH); |
||||
|
System.arraycopy(encryptedText, 0, message, GCM_NONCE_LENGTH, encryptedText.length); |
||||
|
|
||||
|
return message; |
||||
|
} |
||||
|
|
||||
|
public static byte[] decrypt(byte[] encryptedText, byte[] cipherKey) throws Exception { |
||||
|
final Cipher AES_cipherInstance = Cipher.getInstance("AES/GCM/NoPadding"); |
||||
|
GCMParameterSpec params = new GCMParameterSpec(GCM_TAG_LENGTH * 8, encryptedText, 0, GCM_NONCE_LENGTH); |
||||
|
SecretKeySpec keySpec = new SecretKeySpec(cipherKey, "AES"); |
||||
|
AES_cipherInstance.init(Cipher.DECRYPT_MODE, keySpec, params); |
||||
|
byte[] decryptedText = AES_cipherInstance.doFinal(encryptedText, GCM_NONCE_LENGTH, encryptedText.length - GCM_NONCE_LENGTH); |
||||
|
return decryptedText; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,208 @@ |
|||||
|
package seaweedfs.client; |
||||
|
|
||||
|
// based on org.apache.hadoop.fs.azurebfs.services.AbfsInputStream |
||||
|
|
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.io.EOFException; |
||||
|
import java.io.IOException; |
||||
|
import java.io.InputStream; |
||||
|
import java.nio.ByteBuffer; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public class SeaweedInputStream extends InputStream { |
||||
|
|
||||
|
private static final Logger LOG = LoggerFactory.getLogger(SeaweedInputStream.class); |
||||
|
private static final IOException EXCEPTION_STREAM_IS_CLOSED = new IOException("Stream is closed!"); |
||||
|
|
||||
|
private final FilerClient filerClient; |
||||
|
private final String path; |
||||
|
private final FilerProto.Entry entry; |
||||
|
private final List<SeaweedRead.VisibleInterval> visibleIntervalList; |
||||
|
private final long contentLength; |
||||
|
|
||||
|
private long position = 0; // cursor of the file |
||||
|
|
||||
|
private boolean closed = false; |
||||
|
|
||||
|
public SeaweedInputStream( |
||||
|
final FilerClient filerClient, |
||||
|
final String fullpath) throws IOException { |
||||
|
this.path = fullpath; |
||||
|
this.filerClient = filerClient; |
||||
|
this.entry = filerClient.lookupEntry( |
||||
|
SeaweedOutputStream.getParentDirectory(fullpath), |
||||
|
SeaweedOutputStream.getFileName(fullpath)); |
||||
|
this.contentLength = SeaweedRead.fileSize(entry); |
||||
|
|
||||
|
this.visibleIntervalList = SeaweedRead.nonOverlappingVisibleIntervals(filerClient, entry.getChunksList()); |
||||
|
|
||||
|
LOG.debug("new path:{} entry:{} visibleIntervalList:{}", path, entry, visibleIntervalList); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public SeaweedInputStream( |
||||
|
final FilerClient filerClient, |
||||
|
final String path, |
||||
|
final FilerProto.Entry entry) throws IOException { |
||||
|
this.filerClient = filerClient; |
||||
|
this.path = path; |
||||
|
this.entry = entry; |
||||
|
this.contentLength = SeaweedRead.fileSize(entry); |
||||
|
|
||||
|
this.visibleIntervalList = SeaweedRead.nonOverlappingVisibleIntervals(filerClient, entry.getChunksList()); |
||||
|
|
||||
|
LOG.debug("new path:{} entry:{} visibleIntervalList:{}", path, entry, visibleIntervalList); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String getPath() { |
||||
|
return path; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int read() throws IOException { |
||||
|
byte[] b = new byte[1]; |
||||
|
int numberOfBytesRead = read(b, 0, 1); |
||||
|
if (numberOfBytesRead < 0) { |
||||
|
return -1; |
||||
|
} else { |
||||
|
return (b[0] & 0xFF); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int read(final byte[] b, final int off, final int len) throws IOException { |
||||
|
|
||||
|
if (b == null) { |
||||
|
throw new IllegalArgumentException("null byte array passed in to read() method"); |
||||
|
} |
||||
|
if (off >= b.length) { |
||||
|
throw new IllegalArgumentException("offset greater than length of array"); |
||||
|
} |
||||
|
if (len < 0) { |
||||
|
throw new IllegalArgumentException("requested read length is less than zero"); |
||||
|
} |
||||
|
if (len > (b.length - off)) { |
||||
|
throw new IllegalArgumentException("requested read length is more than will fit after requested offset in buffer"); |
||||
|
} |
||||
|
|
||||
|
ByteBuffer buf = ByteBuffer.wrap(b, off, len); |
||||
|
return read(buf); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
// implement ByteBufferReadable |
||||
|
public synchronized int read(ByteBuffer buf) throws IOException { |
||||
|
|
||||
|
if (position < 0) { |
||||
|
throw new IllegalArgumentException("attempting to read from negative offset"); |
||||
|
} |
||||
|
if (position >= contentLength) { |
||||
|
return -1; // Hadoop prefers -1 to EOFException |
||||
|
} |
||||
|
|
||||
|
long bytesRead = 0; |
||||
|
int len = buf.remaining(); |
||||
|
int start = (int) this.position; |
||||
|
if (start+len <= entry.getContent().size()) { |
||||
|
entry.getContent().substring(start, start+len).copyTo(buf); |
||||
|
} else { |
||||
|
bytesRead = SeaweedRead.read(this.filerClient, this.visibleIntervalList, this.position, buf, SeaweedRead.fileSize(entry)); |
||||
|
} |
||||
|
|
||||
|
if (bytesRead > Integer.MAX_VALUE) { |
||||
|
throw new IOException("Unexpected Content-Length"); |
||||
|
} |
||||
|
|
||||
|
if (bytesRead > 0) { |
||||
|
this.position += bytesRead; |
||||
|
} |
||||
|
|
||||
|
return (int) bytesRead; |
||||
|
} |
||||
|
|
||||
|
public synchronized void seek(long n) throws IOException { |
||||
|
if (closed) { |
||||
|
throw EXCEPTION_STREAM_IS_CLOSED; |
||||
|
} |
||||
|
if (n < 0) { |
||||
|
throw new EOFException("Cannot seek to a negative offset"); |
||||
|
} |
||||
|
if (n > contentLength) { |
||||
|
throw new EOFException("Attempted to seek or read past the end of the file"); |
||||
|
} |
||||
|
this.position = n; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public synchronized long skip(long n) throws IOException { |
||||
|
if (closed) { |
||||
|
throw EXCEPTION_STREAM_IS_CLOSED; |
||||
|
} |
||||
|
if (this.position == contentLength) { |
||||
|
if (n > 0) { |
||||
|
throw new EOFException("Attempted to seek or read past the end of the file"); |
||||
|
} |
||||
|
} |
||||
|
long newPos = this.position + n; |
||||
|
if (newPos < 0) { |
||||
|
newPos = 0; |
||||
|
n = newPos - this.position; |
||||
|
} |
||||
|
if (newPos > contentLength) { |
||||
|
newPos = contentLength; |
||||
|
n = newPos - this.position; |
||||
|
} |
||||
|
seek(newPos); |
||||
|
return n; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Return the size of the remaining available bytes |
||||
|
* if the size is less than or equal to {@link Integer#MAX_VALUE}, |
||||
|
* otherwise, return {@link Integer#MAX_VALUE}. |
||||
|
* <p> |
||||
|
* This is to match the behavior of DFSInputStream.available(), |
||||
|
* which some clients may rely on (HBase write-ahead log reading in |
||||
|
* particular). |
||||
|
*/ |
||||
|
@Override |
||||
|
public synchronized int available() throws IOException { |
||||
|
if (closed) { |
||||
|
throw EXCEPTION_STREAM_IS_CLOSED; |
||||
|
} |
||||
|
final long remaining = this.contentLength - this.position; |
||||
|
return remaining <= Integer.MAX_VALUE |
||||
|
? (int) remaining : Integer.MAX_VALUE; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the length of the file that this stream refers to. Note that the length returned is the length |
||||
|
* as of the time the Stream was opened. Specifically, if there have been subsequent appends to the file, |
||||
|
* they wont be reflected in the returned length. |
||||
|
* |
||||
|
* @return length of the file. |
||||
|
* @throws IOException if the stream is closed |
||||
|
*/ |
||||
|
public long length() throws IOException { |
||||
|
if (closed) { |
||||
|
throw EXCEPTION_STREAM_IS_CLOSED; |
||||
|
} |
||||
|
return contentLength; |
||||
|
} |
||||
|
|
||||
|
public synchronized long getPos() throws IOException { |
||||
|
if (closed) { |
||||
|
throw EXCEPTION_STREAM_IS_CLOSED; |
||||
|
} |
||||
|
return position; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public synchronized void close() throws IOException { |
||||
|
closed = true; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package seaweedfs.client; |
||||
|
|
||||
|
import org.apache.http.impl.DefaultConnectionReuseStrategy; |
||||
|
import org.apache.http.impl.client.CloseableHttpClient; |
||||
|
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy; |
||||
|
import org.apache.http.impl.client.HttpClientBuilder; |
||||
|
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
||||
|
|
||||
|
public class SeaweedUtil { |
||||
|
|
||||
|
static PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); |
||||
|
static CloseableHttpClient httpClient; |
||||
|
|
||||
|
static { |
||||
|
// Increase max total connection to 200 |
||||
|
cm.setMaxTotal(200); |
||||
|
// Increase default max connection per route to 20 |
||||
|
cm.setDefaultMaxPerRoute(20); |
||||
|
|
||||
|
httpClient = HttpClientBuilder.create() |
||||
|
.setConnectionManager(cm) |
||||
|
.setConnectionReuseStrategy(DefaultConnectionReuseStrategy.INSTANCE) |
||||
|
.setKeepAliveStrategy(DefaultConnectionKeepAliveStrategy.INSTANCE) |
||||
|
.build(); |
||||
|
} |
||||
|
|
||||
|
public static CloseableHttpClient getClosableHttpClient() { |
||||
|
return httpClient; |
||||
|
} |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package seaweedfs.client; |
||||
|
|
||||
|
import com.google.common.cache.Cache; |
||||
|
import com.google.common.cache.CacheBuilder; |
||||
|
|
||||
|
import java.util.concurrent.TimeUnit; |
||||
|
|
||||
|
public class VolumeIdCache { |
||||
|
|
||||
|
private Cache<String, FilerProto.Locations> cache = null; |
||||
|
|
||||
|
public VolumeIdCache(int maxEntries) { |
||||
|
if (maxEntries == 0) { |
||||
|
return; |
||||
|
} |
||||
|
this.cache = CacheBuilder.newBuilder() |
||||
|
.maximumSize(maxEntries) |
||||
|
.expireAfterAccess(5, TimeUnit.MINUTES) |
||||
|
.build(); |
||||
|
} |
||||
|
|
||||
|
public FilerProto.Locations getLocations(String volumeId) { |
||||
|
if (this.cache == null) { |
||||
|
return null; |
||||
|
} |
||||
|
return this.cache.getIfPresent(volumeId); |
||||
|
} |
||||
|
|
||||
|
public void setLocations(String volumeId, FilerProto.Locations locations) { |
||||
|
if (this.cache == null) { |
||||
|
return; |
||||
|
} |
||||
|
this.cache.put(volumeId, locations); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package seaweedfs.client; |
||||
|
|
||||
|
import org.junit.Test; |
||||
|
|
||||
|
import java.util.Base64; |
||||
|
|
||||
|
import static seaweedfs.client.SeaweedCipher.decrypt; |
||||
|
import static seaweedfs.client.SeaweedCipher.encrypt; |
||||
|
|
||||
|
public class SeaweedCipherTest { |
||||
|
|
||||
|
@Test |
||||
|
public void testSameAsGoImplemnetation() throws Exception { |
||||
|
byte[] secretKey = "256-bit key for AES 256 GCM encr".getBytes(); |
||||
|
|
||||
|
String plainText = "Now we need to generate a 256-bit key for AES 256 GCM"; |
||||
|
|
||||
|
System.out.println("Original Text : " + plainText); |
||||
|
|
||||
|
byte[] cipherText = encrypt(plainText.getBytes(), secretKey); |
||||
|
System.out.println("Encrypted Text : " + Base64.getEncoder().encodeToString(cipherText)); |
||||
|
|
||||
|
byte[] decryptedText = decrypt(cipherText, secretKey); |
||||
|
System.out.println("DeCrypted Text : " + new String(decryptedText)); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
public void testEncryptDecrypt() throws Exception { |
||||
|
byte[] secretKey = SeaweedCipher.genCipherKey(); |
||||
|
|
||||
|
String plainText = "Now we need to generate a 256-bit key for AES 256 GCM"; |
||||
|
|
||||
|
System.out.println("Original Text : " + plainText); |
||||
|
|
||||
|
byte[] cipherText = encrypt(plainText.getBytes(), secretKey); |
||||
|
System.out.println("Encrypted Text : " + Base64.getEncoder().encodeToString(cipherText)); |
||||
|
|
||||
|
byte[] decryptedText = decrypt(cipherText, secretKey); |
||||
|
System.out.println("DeCrypted Text : " + new String(decryptedText)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<groupId>org.example</groupId> |
||||
|
<artifactId>unzip</artifactId> |
||||
|
<version>1.0-SNAPSHOT</version> |
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.github.chrislusf</groupId> |
||||
|
<artifactId>seaweedfs-client</artifactId> |
||||
|
<version>1.6.4</version> |
||||
|
<scope>compile</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.github.chrislusf</groupId> |
||||
|
<artifactId>seaweedfs-hadoop2-client</artifactId> |
||||
|
<version>1.6.4</version> |
||||
|
<scope>compile</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.hadoop</groupId> |
||||
|
<artifactId>hadoop-common</artifactId> |
||||
|
<version>2.9.2</version> |
||||
|
<scope>compile</scope> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
|
||||
|
</project> |
@ -0,0 +1,48 @@ |
|||||
|
package com.seaweedfs.examples; |
||||
|
|
||||
|
import seaweedfs.client.FilerClient; |
||||
|
import seaweedfs.client.SeaweedInputStream; |
||||
|
|
||||
|
import java.io.FileInputStream; |
||||
|
import java.io.IOException; |
||||
|
import java.io.InputStream; |
||||
|
import java.util.zip.ZipEntry; |
||||
|
import java.util.zip.ZipInputStream; |
||||
|
|
||||
|
public class ExampleReadFile { |
||||
|
|
||||
|
public static void main(String[] args) throws IOException { |
||||
|
|
||||
|
FilerClient filerClient = new FilerClient("localhost", 18888); |
||||
|
|
||||
|
long startTime = System.currentTimeMillis(); |
||||
|
parseZip("/Users/chris/tmp/test.zip"); |
||||
|
|
||||
|
long startTime2 = System.currentTimeMillis(); |
||||
|
|
||||
|
long localProcessTime = startTime2 - startTime; |
||||
|
|
||||
|
SeaweedInputStream seaweedInputStream = new SeaweedInputStream( |
||||
|
filerClient, "/test.zip"); |
||||
|
parseZip(seaweedInputStream); |
||||
|
|
||||
|
long swProcessTime = System.currentTimeMillis() - startTime2; |
||||
|
|
||||
|
System.out.println("Local time: " + localProcessTime); |
||||
|
System.out.println("SeaweedFS time: " + swProcessTime); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static void parseZip(String filename) throws IOException { |
||||
|
FileInputStream fileInputStream = new FileInputStream(filename); |
||||
|
parseZip(fileInputStream); |
||||
|
} |
||||
|
|
||||
|
public static void parseZip(InputStream is) throws IOException { |
||||
|
ZipInputStream zin = new ZipInputStream(is); |
||||
|
ZipEntry ze; |
||||
|
while ((ze = zin.getNextEntry()) != null) { |
||||
|
System.out.println(ze.getName()); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package com.seaweedfs.examples; |
||||
|
|
||||
|
import seaweedfs.client.FilerClient; |
||||
|
import seaweedfs.client.FilerProto; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
import java.util.Date; |
||||
|
import java.util.Iterator; |
||||
|
|
||||
|
public class ExampleWatchFileChanges { |
||||
|
|
||||
|
public static void main(String[] args) throws IOException { |
||||
|
|
||||
|
FilerClient filerClient = new FilerClient("localhost", 18888); |
||||
|
|
||||
|
long sinceNs = (System.currentTimeMillis() - 3600 * 1000) * 1000000L; |
||||
|
|
||||
|
Iterator<FilerProto.SubscribeMetadataResponse> watch = filerClient.watch( |
||||
|
"/buckets", |
||||
|
"exampleClientName", |
||||
|
sinceNs |
||||
|
); |
||||
|
|
||||
|
System.out.println("Connected to filer, subscribing from " + new Date()); |
||||
|
|
||||
|
while (watch.hasNext()) { |
||||
|
FilerProto.SubscribeMetadataResponse event = watch.next(); |
||||
|
FilerProto.EventNotification notification = event.getEventNotification(); |
||||
|
if (!event.getDirectory().equals(notification.getNewParentPath())) { |
||||
|
// move an entry to a new directory, possibly with a new name |
||||
|
if (notification.hasOldEntry() && notification.hasNewEntry()) { |
||||
|
System.out.println("moved " + event.getDirectory() + "/" + notification.getOldEntry().getName() + " to " + notification.getNewParentPath() + "/" + notification.getNewEntry().getName()); |
||||
|
} else { |
||||
|
System.out.println("this should not happen."); |
||||
|
} |
||||
|
} else if (notification.hasNewEntry() && !notification.hasOldEntry()) { |
||||
|
System.out.println("created entry " + event.getDirectory() + "/" + notification.getNewEntry().getName()); |
||||
|
} else if (!notification.hasNewEntry() && notification.hasOldEntry()) { |
||||
|
System.out.println("deleted entry " + event.getDirectory() + "/" + notification.getOldEntry().getName()); |
||||
|
} else if (notification.hasNewEntry() && notification.hasOldEntry()) { |
||||
|
System.out.println("updated entry " + event.getDirectory() + "/" + notification.getNewEntry().getName()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.seaweedfs.examples; |
||||
|
|
||||
|
import seaweedfs.client.FilerClient; |
||||
|
import seaweedfs.client.SeaweedInputStream; |
||||
|
import seaweedfs.client.SeaweedOutputStream; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
import java.io.InputStream; |
||||
|
import java.util.zip.ZipEntry; |
||||
|
import java.util.zip.ZipInputStream; |
||||
|
|
||||
|
public class ExampleWriteFile { |
||||
|
|
||||
|
public static void main(String[] args) throws IOException { |
||||
|
|
||||
|
FilerClient filerClient = new FilerClient("localhost", 18888); |
||||
|
|
||||
|
SeaweedInputStream seaweedInputStream = new SeaweedInputStream(filerClient, "/test.zip"); |
||||
|
unZipFiles(filerClient, seaweedInputStream); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static void unZipFiles(FilerClient filerClient, InputStream is) throws IOException { |
||||
|
ZipInputStream zin = new ZipInputStream(is); |
||||
|
ZipEntry ze; |
||||
|
while ((ze = zin.getNextEntry()) != null) { |
||||
|
|
||||
|
String filename = ze.getName(); |
||||
|
if (filename.indexOf("/") >= 0) { |
||||
|
filename = filename.substring(filename.lastIndexOf("/") + 1); |
||||
|
} |
||||
|
if (filename.length()==0) { |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
SeaweedOutputStream seaweedOutputStream = new SeaweedOutputStream(filerClient, "/test/"+filename); |
||||
|
byte[] bytesIn = new byte[16 * 1024]; |
||||
|
int read = 0; |
||||
|
while ((read = zin.read(bytesIn))!=-1) { |
||||
|
seaweedOutputStream.write(bytesIn,0,read); |
||||
|
} |
||||
|
seaweedOutputStream.close(); |
||||
|
|
||||
|
System.out.println(ze.getName()); |
||||
|
} |
||||
|
} |
||||
|
} |
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue