Compare commits
62 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09385434ef | ||
|
|
714bdba2b4 | ||
|
|
e31e483037 | ||
|
|
8a82e63fe1 | ||
|
|
48f7ae5ac2 | ||
|
|
cfe0766a42 | ||
|
|
fa1045c861 | ||
|
|
a17a59426e | ||
|
|
6fefb28e98 | ||
|
|
cecbc77245 | ||
|
|
9c8c528b76 | ||
|
|
33dd6ea35e | ||
|
|
5a6563d9fd | ||
|
|
0b0414ebab | ||
|
|
54dd42dd19 | ||
|
|
48af8034f8 | ||
|
|
bb90a8bb79 | ||
|
|
5ac713b8b0 | ||
|
|
81f8d6313e | ||
|
|
55d2359797 | ||
|
|
a270522d25 | ||
|
|
45ba112fa1 | ||
|
|
40fa2802eb | ||
|
|
177fdf0ea0 | ||
|
|
6e072681f4 | ||
|
|
23abb01600 | ||
|
|
b0ec35d426 | ||
|
|
0466f0e51e | ||
|
|
b46b6c4c3f | ||
|
|
92f880882c | ||
|
|
b4eb1f3b52 | ||
|
|
f45aaa39dd | ||
|
|
d6cf7499e3 | ||
|
|
ba19317751 | ||
|
|
1e8ca97f81 | ||
|
|
767e95d2b6 | ||
|
|
641cce456f | ||
|
|
bf92f0a086 | ||
|
|
56d1995f29 | ||
|
|
cb9fd37baf | ||
|
|
bbd2e539cb | ||
|
|
171f304191 | ||
|
|
50f31fe33c | ||
|
|
ba2214b7f8 | ||
|
|
b4390ffd5b | ||
|
|
e5bc351871 | ||
|
|
7fa73a5d2c | ||
|
|
30cd8c4168 | ||
|
|
ca767fdce1 | ||
|
|
89d2b22e4f | ||
|
|
7844509790 | ||
|
|
d0d7f1ee3d | ||
|
|
9e3c2ce6e2 | ||
|
|
4274180f3d | ||
|
|
5c89ac3f88 | ||
|
|
e4cb2a5c42 | ||
|
|
1496166194 | ||
|
|
e45e75e102 | ||
|
|
fcc0835e93 | ||
|
|
0ddc866b7f | ||
|
|
7523736239 | ||
|
|
73d4234f5c |
105
.github/workflows/release.yaml
vendored
Normal file
105
.github/workflows/release.yaml
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
name: Build & release Docker images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
tags:
|
||||
- 'v*'
|
||||
paths:
|
||||
- 'cmd/seaweedfs-csi-driver/Dockerfile'
|
||||
- 'cmd/seaweedfs-csi-driver/*.go'
|
||||
- 'pkg/driver/**'
|
||||
- 'go.*'
|
||||
- '.github/**'
|
||||
|
||||
# Build on PR
|
||||
pull_request:
|
||||
|
||||
# Allow trigger for external PRs
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Fetch history
|
||||
run: git fetch --prune --unshallow
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
|
||||
- name: Get the current tag name
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" | sed 's/\//_/g' >> $GITHUB_ENV
|
||||
|
||||
- name: Setup QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Annotate Docker images
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
id: docker_meta
|
||||
uses: crazy-max/ghaction-docker-meta@v1
|
||||
with:
|
||||
images: ${{ github.repository }}
|
||||
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./cmd/seaweedfs-csi-driver/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: false
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
tags: ${{ github.repository }}:${{ env.RELEASE_VERSION }}
|
||||
|
||||
- name: Publish Docker image to DockerHub & GitHub Container Registry
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./cmd/seaweedfs-csi-driver/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
tags: |
|
||||
${{ github.repository }}:${{ env.RELEASE_VERSION }}
|
||||
ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}
|
||||
|
||||
- name: Update DockerHub repo description
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: peter-evans/dockerhub-description@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
repository: ${{ github.repository }}
|
||||
|
||||
- name: Create Release
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ env.RELEASE_VERSION }}
|
||||
2
Makefile
2
Makefile
@ -13,6 +13,8 @@ container: build
|
||||
docker build -t $(IMAGE_TAG) -f cmd/seaweedfs-csi-driver/Dockerfile.dev .
|
||||
push: container
|
||||
docker push $(IMAGE_TAG)
|
||||
release: container
|
||||
VERSION=latest docker push $(IMAGE_TAG)
|
||||
clean:
|
||||
go clean -r -x
|
||||
-rm -rf _output
|
||||
|
||||
32
README.md
32
README.md
@ -2,7 +2,7 @@
|
||||
|
||||
[](https://hub.docker.com/r/chrislusf/seaweedfs-csi-driver/)
|
||||
|
||||
[Container storage interface](https://kubernetes-csi.github.io/docs/) is an [industry standard](https://github.com/container-storage-interface/spec/blob/master/spec.md) that will enable storage vendors to develop a plugin once and have it work across a number of container orchestration systems.
|
||||
[Container storage interface](https://kubernetes-csi.github.io/docs/) is an [industry standard](https://github.com/container-storage-interface/spec/blob/master/spec.md) that enables storage vendors to develop a plugin once and have it work across a number of container orchestration systems.
|
||||
|
||||
[SeaweedFS](https://github.com/chrislusf/seaweedfs) is a simple and highly scalable distributed file system, to store and serve billions of files fast!
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
* Already have a working Kubernetes cluster (includes `kubectl`)
|
||||
* Already have a working SeaweedFS cluster
|
||||
|
||||
## Utilize exiting SeaweedFS storage for your Kubernetes cluster (bare metal)
|
||||
## Utilize existing SeaweedFS storage for your Kubernetes cluster (bare metal)
|
||||
|
||||
1. Git clone this repository and add your SeaweedFS master IP to `deploy/kubernetes/seaweedfs-csi.yaml` (2 places)
|
||||
|
||||
@ -46,6 +46,34 @@ $ kubectl delete -f deploy/kubernetes/sample-seaweedfs-pvc.yaml
|
||||
$ kubectl delete -f deploy/kubernetes/seaweedfs-csi.yaml
|
||||
```
|
||||
|
||||
# Deployment by helm chart
|
||||
|
||||
1. Clone project
|
||||
```bash
|
||||
git clone https://github.com/seaweedfs/seaweedfs-csi-driver.git
|
||||
```
|
||||
2. Install
|
||||
```bash
|
||||
helm install --set seaweedfsFiler=<filerHost:port> seaweedfs-csi-driver ./seaweedfs-csi-driver/deploy/helm/seaweedfs-csi-driver
|
||||
```
|
||||
|
||||
3. Clean up
|
||||
```bash
|
||||
helm uninstall seaweedfs-csi-driver
|
||||
```
|
||||
|
||||
# Safe rollout update
|
||||
When update DaemonSet ( DS ) break processes who implements fuse mount.
|
||||
And now new pod not remount net device
|
||||
|
||||
For better safe update use ``node.updateStrategy.type: OnDelete`` in this need manual update. Steps:
|
||||
- delete DS pods on node where no exists seaweefs PV
|
||||
- cordon or taint node
|
||||
- evict or delete pods with seaweedfs PV
|
||||
- delete DS pod on node
|
||||
- uncordon or remove taint on node
|
||||
- repeat all steps on all nodes
|
||||
|
||||
# License
|
||||
[Apache v2 license](https://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
|
||||
BIN
_output/seaweedfs-csi-driver
Executable file
BIN
_output/seaweedfs-csi-driver
Executable file
Binary file not shown.
@ -1,18 +1,21 @@
|
||||
FROM frolvlad/alpine-glibc as builder
|
||||
RUN apk add git go g++
|
||||
FROM amd64/golang:1.16-alpine as builder
|
||||
|
||||
RUN mkdir -p /go/src/github.com/chrislusf/
|
||||
RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs
|
||||
RUN cd /go/src/github.com/chrislusf/seaweedfs/weed && go install
|
||||
RUN apk add git go g++ curl jq
|
||||
|
||||
RUN mkdir -p /go/src/github.com/seaweedfs/
|
||||
RUN git clone https://github.com/seaweedfs/seaweedfs-csi-driver /go/src/github.com/seaweedfs/seaweedfs-csi-driver
|
||||
RUN cd /go/src/github.com/seaweedfs/seaweedfs-csi-driver && go build -o /seaweedfs-csi-driver ./cmd/seaweedfs-csi-driver/main.go
|
||||
WORKDIR /
|
||||
|
||||
RUN curl -sL \
|
||||
$(curl -s https://api.github.com/repos/chrislusf/seaweedfs/releases/latest \
|
||||
| jq -r '.assets[]|select(.name=="linux_amd64.tar.gz")|.browser_download_url') \
|
||||
| tar xzvf -
|
||||
|
||||
COPY ../../ /src
|
||||
RUN cd /src && go build -o /seaweedfs-csi-driver ./cmd/seaweedfs-csi-driver/main.go
|
||||
|
||||
FROM alpine AS final
|
||||
RUN apk add fuse
|
||||
LABEL author="Chris Lu"
|
||||
COPY --from=builder /root/go/bin/weed /usr/bin/
|
||||
COPY --from=builder /weed /usr/bin/
|
||||
COPY --from=builder /seaweedfs-csi-driver /
|
||||
|
||||
RUN chmod +x /seaweedfs-csi-driver
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
FROM golang:buster as builder
|
||||
FROM amd64/golang:1.16-alpine as builder
|
||||
RUN apk add git go g++
|
||||
|
||||
RUN mkdir -p /go/src/github.com/chrislusf/
|
||||
RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs
|
||||
|
||||
@ -6,14 +6,18 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/seaweedfs/seaweedfs-csi-driver/pkg/driver"
|
||||
)
|
||||
|
||||
var (
|
||||
filer = flag.String("filer", "localhost:8888", "filer server")
|
||||
endpoint = flag.String("endpoint", "unix://tmp/seaweedfs-csi.sock", "CSI endpoint to accept gRPC calls")
|
||||
nodeID = flag.String("nodeid", "", "node id")
|
||||
version = flag.Bool("version", false, "Print the version and exit.")
|
||||
filer = flag.String("filer", "localhost:8888", "filer server")
|
||||
endpoint = flag.String("endpoint", "unix://tmp/seaweedfs-csi.sock", "CSI endpoint to accept gRPC calls")
|
||||
nodeID = flag.String("nodeid", "", "node id")
|
||||
version = flag.Bool("version", false, "Print the version and exit.")
|
||||
concurrentWriters = flag.Int("concurrentWriters", 32, "limit concurrent goroutine writers if not 0")
|
||||
cacheSizeMB = flag.Int64("cacheCapacityMB", 1000, "local file chunk cache capacity in MB (0 will disable cache)")
|
||||
cacheDir = flag.String("cacheDir", os.TempDir(), "local cache directory for file chunks and meta data")
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -29,6 +33,11 @@ func main() {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
glog.Infof("connect to filer %s", *filer)
|
||||
|
||||
drv := driver.NewSeaweedFsDriver(*filer, *nodeID, *endpoint)
|
||||
drv.ConcurrentWriters = *concurrentWriters
|
||||
drv.CacheSizeMB = *cacheSizeMB
|
||||
drv.CacheDir = *cacheDir
|
||||
drv.Run()
|
||||
}
|
||||
|
||||
24
deploy/helm/seaweedfs-csi-driver/.helmignore
Normal file
24
deploy/helm/seaweedfs-csi-driver/.helmignore
Normal file
@ -0,0 +1,24 @@
|
||||
# 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
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
.tgz
|
||||
6
deploy/helm/seaweedfs-csi-driver/Chart.yaml
Normal file
6
deploy/helm/seaweedfs-csi-driver/Chart.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: seaweedfs-csi-driver
|
||||
description: A Helm chart for Kubernetes
|
||||
type: application
|
||||
version: 0.1.1
|
||||
appVersion: latest
|
||||
3
deploy/helm/seaweedfs-csi-driver/templates/_helpers.tpl
Normal file
3
deploy/helm/seaweedfs-csi-driver/templates/_helpers.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
{{- define "seaweedfs-csi-driver.name" -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
@ -0,0 +1,61 @@
|
||||
{{- if .Values.tlsSecret }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}
|
||||
labels:
|
||||
app: {{ template "seaweedfs-csi-driver.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 = "{{ .Values.jwtSigningKey }}"
|
||||
#expires_after_seconds = 10 # seconds
|
||||
|
||||
#[jwt.signing.read]
|
||||
#key = ""
|
||||
#expires_after_seconds = 10 # seconds
|
||||
# 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.crt"
|
||||
|
||||
[grpc.volume]
|
||||
cert = "/usr/local/share/ca-certificates/tls.crt"
|
||||
key = "/usr/local/share/ca-certificates/tls.key"
|
||||
ca = "/usr/local/share/ca-certificates/ca.crt"
|
||||
|
||||
[grpc.master]
|
||||
cert = "/usr/local/share/ca-certificates/tls.crt"
|
||||
key = "/usr/local/share/ca-certificates/tls.key"
|
||||
ca = "/usr/local/share/ca-certificates/ca.crt"
|
||||
|
||||
[grpc.filer]
|
||||
cert = "/usr/local/share/ca-certificates/tls.crt"
|
||||
key = "/usr/local/share/ca-certificates/tls.key"
|
||||
ca = "/usr/local/share/ca-certificates/ca.crt"
|
||||
|
||||
[grpc.msg_broker]
|
||||
cert = "/usr/local/share/ca-certificates/tls.crt"
|
||||
key = "/usr/local/share/ca-certificates/tls.key"
|
||||
ca = "/usr/local/share/ca-certificates/ca.crt"
|
||||
|
||||
# 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/tls.crt"
|
||||
key = "/usr/local/share/ca-certificates/tls.key"
|
||||
ca = "/usr/local/share/ca-certificates/ca.crt"
|
||||
|
||||
# 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 }}
|
||||
7
deploy/helm/seaweedfs-csi-driver/templates/csidriver.yml
Normal file
7
deploy/helm/seaweedfs-csi-driver/templates/csidriver.yml
Normal file
@ -0,0 +1,7 @@
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: CSIDriver
|
||||
metadata:
|
||||
name: {{ .Values.driverName }}
|
||||
spec:
|
||||
attachRequired: true
|
||||
podInfoOnMount: true
|
||||
110
deploy/helm/seaweedfs-csi-driver/templates/daemonset.yml
Normal file
110
deploy/helm/seaweedfs-csi-driver/templates/daemonset.yml
Normal file
@ -0,0 +1,110 @@
|
||||
{{- if .Values.node.enabled}}
|
||||
---
|
||||
kind: DaemonSet
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-node
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "seaweedfs-csi-driver.name" . }}-node
|
||||
updateStrategy:
|
||||
{{ toYaml .Values.node.updateStrategy | nindent 4 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "seaweedfs-csi-driver.name" . }}-node
|
||||
spec:
|
||||
priorityClassName: system-node-critical
|
||||
serviceAccountName: {{ template "seaweedfs-csi-driver.name" . }}-node-sa
|
||||
#hostNetwork: true
|
||||
#dnsPolicy: ClusterFirstWithHostNet
|
||||
containers:
|
||||
- name: driver-registrar
|
||||
image: {{ .Values.csiNodeDriverRegistrar.image }}
|
||||
imagePullPolicy: {{ .Values.imagePullPolicy }}
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /csi/csi.sock
|
||||
- name: DRIVER_REG_SOCK_PATH
|
||||
value: /var/lib/kubelet/plugins/{{ .Values.driverName }}/csi.sock
|
||||
- name: KUBE_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
resources:
|
||||
{{ toYaml .Values.csiNodeDriverRegistrar.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: plugin-dir
|
||||
mountPath: /csi/
|
||||
- name: registration-dir
|
||||
mountPath: /registration/
|
||||
- name: csi-seaweedfs-plugin
|
||||
securityContext:
|
||||
privileged: true
|
||||
capabilities:
|
||||
add: ["SYS_ADMIN"]
|
||||
allowPrivilegeEscalation: true
|
||||
image: {{.Values.seaweedfsCsiPlugin.image }}
|
||||
imagePullPolicy: {{ .Values.imagePullPolicy }}
|
||||
args :
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
- "--filer=$(SEAWEEDFS_FILER)"
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
env:
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix:///csi/csi.sock
|
||||
- name: SEAWEEDFS_FILER
|
||||
value: {{ .Values.seaweedfsFiler | quote }}
|
||||
- name: NODE_ID
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
{{- if .Values.tlsSecret }}
|
||||
- name: WEED_GRPC_CLIENT_KEY
|
||||
value: /var/run/secrets/app/tls/tls.key
|
||||
- name: WEED_GRPC_CLIENT_CERT
|
||||
value: /var/run/secrets/app/tls/tls.crt
|
||||
- name: WEED_GRPC_CA
|
||||
value: /var/run/secrets/app/tls/ca.crt
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.seaweedfsCsiPlugin.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: plugin-dir
|
||||
mountPath: /csi
|
||||
- name: pods-mount-dir
|
||||
mountPath: /var/lib/kubelet/pods
|
||||
mountPropagation: "Bidirectional"
|
||||
- mountPath: /dev
|
||||
name: device-dir
|
||||
{{- if .Values.tlsSecret }}
|
||||
- name: tls
|
||||
mountPath: /var/run/secrets/app/tls
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: registration-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins_registry/
|
||||
type: DirectoryOrCreate
|
||||
- name: plugin-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/{{ .Values.driverName }}
|
||||
type: DirectoryOrCreate
|
||||
- name: pods-mount-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/pods
|
||||
type: Directory
|
||||
- name: device-dir
|
||||
hostPath:
|
||||
path: /dev
|
||||
{{- if .Values.tlsSecret }}
|
||||
- name: tls
|
||||
secret:
|
||||
secretName: {{ .Values.tlsSecret }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
172
deploy/helm/seaweedfs-csi-driver/templates/rbac.yml
Normal file
172
deploy/helm/seaweedfs-csi-driver/templates/rbac.yml
Normal file
@ -0,0 +1,172 @@
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-provisioner-role
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets"]
|
||||
verbs: ["get", "list"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumes"]
|
||||
verbs: ["get", "list", "watch", "create", "delete"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims"]
|
||||
verbs: ["get", "list", "watch", "update"]
|
||||
- apiGroups: ["storage.k8s.io"]
|
||||
resources: ["storageclasses"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["events"]
|
||||
verbs: ["list", "watch", "create", "update", "patch"]
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshots"]
|
||||
verbs: ["get", "list"]
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshotcontents"]
|
||||
verbs: ["get", "list"]
|
||||
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-provisioner-binding
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-controller-sa
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-provisioner-role
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-attacher-role
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumes"]
|
||||
verbs: ["get", "list", "watch", "update", "patch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["nodes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["csi.storage.k8s.io"]
|
||||
resources: ["csinodeinfos"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["storage.k8s.io"]
|
||||
resources: ["volumeattachments", "volumeattachments/status"]
|
||||
verbs: ["get", "list", "watch", "update", "patch"]
|
||||
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-attacher-binding
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-controller-sa
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-attacher-role
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-snapshotter-role
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["storage.k8s.io"]
|
||||
resources: ["storageclasses"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["events"]
|
||||
verbs: ["list", "watch", "create", "update", "patch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets"]
|
||||
verbs: ["get", "list"]
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshotclasses"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshotcontents"]
|
||||
verbs: ["create", "get", "list", "watch", "update", "delete"]
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshots"]
|
||||
verbs: ["get", "list", "watch", "update"]
|
||||
- apiGroups: ["apiextensions.k8s.io"]
|
||||
resources: ["customresourcedefinitions"]
|
||||
verbs: ["create", "list", "watch", "delete"]
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-snapshotter-binding
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-controller-sa
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-snapshotter-role
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-driver-registrar-controller-role
|
||||
rules:
|
||||
- apiGroups: ["csi.storage.k8s.io"]
|
||||
resources: ["csidrivers"]
|
||||
verbs: ["create", "delete"]
|
||||
- apiGroups: ["storage.k8s.io"]
|
||||
resources: ["csinodes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-driver-registrar-controller-binding
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-controller-sa
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-driver-registrar-controller-role
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-driver-registrar-node-role
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["events"]
|
||||
verbs: ["get", "list", "watch", "create", "update", "patch"]
|
||||
- apiGroups: ["apiextensions.k8s.io"]
|
||||
resources: ["customresourcedefinitions"]
|
||||
verbs: ["create", "list", "watch", "delete"]
|
||||
- apiGroups: [""]
|
||||
resources: ["nodes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-driver-registrar-node-binding
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-node-sa
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-driver-registrar-node-role
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
@ -0,0 +1,10 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-controller-sa
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-node-sa
|
||||
91
deploy/helm/seaweedfs-csi-driver/templates/statefulset.yml
Normal file
91
deploy/helm/seaweedfs-csi-driver/templates/statefulset.yml
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
kind: StatefulSet
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{ template "seaweedfs-csi-driver.name" . }}-controller
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "seaweedfs-csi-driver.name" . }}-controller
|
||||
serviceName: "csi-seaweedfs"
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "seaweedfs-csi-driver.name" . }}-controller
|
||||
spec:
|
||||
priorityClassName: system-cluster-critical
|
||||
serviceAccountName: {{ template "seaweedfs-csi-driver.name" . }}-controller-sa
|
||||
containers:
|
||||
# provisioner
|
||||
- name: csi-provisioner
|
||||
image: {{ .Values.csiProvisioner.image }}
|
||||
args:
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- -v
|
||||
- "9"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
||||
imagePullPolicy: {{ .Values.imagePullPolicy }}
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /var/lib/csi/sockets/pluginproxy/
|
||||
resources:
|
||||
{{ toYaml .Values.csiProvisioner.resources | nindent 12 }}
|
||||
# attacher
|
||||
- name: csi-attacher
|
||||
image: {{ .Values.csiAttacher.image }}
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- "--timeout=120s"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
||||
imagePullPolicy: {{ .Values.imagePullPolicy }}
|
||||
resources:
|
||||
{{ toYaml .Values.csiAttacher.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /var/lib/csi/sockets/pluginproxy/
|
||||
# SeaweedFs Plugin
|
||||
- name: seaweedfs-csi-plugin
|
||||
image: {{.Values.seaweedfsCsiPlugin.image}}
|
||||
imagePullPolicy: {{ .Values.imagePullPolicy }}
|
||||
args :
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
- "--filer=$(SEAWEEDFS_FILER)"
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
env:
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
|
||||
- name: SEAWEEDFS_FILER
|
||||
value: {{ .Values.seaweedfsFiler | quote }}
|
||||
- name: NODE_ID
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
{{- if .Values.tlsSecret }}
|
||||
- name: WEED_GRPC_CLIENT_KEY
|
||||
value: /var/run/secrets/app/tls/tls.key
|
||||
- name: WEED_GRPC_CLIENT_CERT
|
||||
value: /var/run/secrets/app/tls/tls.crt
|
||||
- name: WEED_GRPC_CA
|
||||
value: /var/run/secrets/app/tls/ca.crt
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /var/lib/csi/sockets/pluginproxy/
|
||||
{{- if .Values.tlsSecret }}
|
||||
- name: tls
|
||||
mountPath: /var/run/secrets/app/tls
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: socket-dir
|
||||
emptyDir: {}
|
||||
{{- if .Values.tlsSecret }}
|
||||
- name: tls
|
||||
secret:
|
||||
secretName: {{ .Values.tlsSecret }}
|
||||
{{- end }}
|
||||
10
deploy/helm/seaweedfs-csi-driver/templates/storageclass.yml
Normal file
10
deploy/helm/seaweedfs-csi-driver/templates/storageclass.yml
Normal file
@ -0,0 +1,10 @@
|
||||
kind: StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ .Values.storageClassName }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
{{- if .Values.isDefaultStorageClass }}
|
||||
storageclass.kubernetes.io/is-default-class: "true"
|
||||
{{- end }}
|
||||
provisioner: {{ .Values.driverName }}
|
||||
39
deploy/helm/seaweedfs-csi-driver/values.yaml
Normal file
39
deploy/helm/seaweedfs-csi-driver/values.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
# host and port of your SeaweedFs filer
|
||||
seaweedfsFiler: ""
|
||||
storageClassName: seaweedfs-storage
|
||||
isDefaultStorageClass: false
|
||||
tlsSecret: ""
|
||||
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
|
||||
csiProvisioner:
|
||||
image: quay.io/k8scsi/csi-provisioner:v1.6.1
|
||||
resources: {}
|
||||
|
||||
csiAttacher:
|
||||
image: quay.io/k8scsi/csi-attacher:v1.2.1
|
||||
resources: {}
|
||||
|
||||
csiNodeDriverRegistrar:
|
||||
image: quay.io/k8scsi/csi-node-driver-registrar:v1.2.0
|
||||
resources: {}
|
||||
|
||||
seaweedfsCsiPlugin:
|
||||
image: chrislusf/seaweedfs-csi-driver:latest
|
||||
resources: {}
|
||||
|
||||
# NOT Change, for future releases. Must be equal Name in GetPluginInfoResponse
|
||||
driverName: seaweedfs-csi-driver
|
||||
|
||||
node:
|
||||
# Deploy node daemonset
|
||||
enabled: true
|
||||
# When pod on node be recreated all pod on same node lost PV.
|
||||
# For safe update use updateStrategy.type: OnDelete and manual move pods who use PV and delete damonset pod
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 25%
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ metadata:
|
||||
namespace: kube-system
|
||||
annotations:
|
||||
storageclass.kubernetes.io/is-default-class: "true"
|
||||
provisioner: com.seaweedfs.csi
|
||||
provisioner: seaweedfs-csi-driver
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
@ -106,16 +106,19 @@ metadata:
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumes"]
|
||||
verbs: ["get", "list", "watch", "update"]
|
||||
verbs: ["get", "list", "watch", "update", "patch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["nodes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["csi.storage.k8s.io"]
|
||||
resources: ["csinodeinfos"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
verbs: ["get", "list", "watch", "update", "patch"]
|
||||
- apiGroups: ["storage.k8s.io"]
|
||||
resources: ["csinodes"]
|
||||
verbs: ["get", "list", "watch", "update", "patch"]
|
||||
- apiGroups: ["storage.k8s.io"]
|
||||
resources: ["volumeattachments"]
|
||||
verbs: ["get", "list", "watch", "update"]
|
||||
verbs: ["get", "list", "watch", "update", "patch"]
|
||||
- apiGroups: ["storage.k8s.io"]
|
||||
resources: ["volumeattachments/status"]
|
||||
verbs: ["patch"]
|
||||
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
@ -249,9 +252,8 @@ spec:
|
||||
containers:
|
||||
# provisioner
|
||||
- name: csi-provisioner
|
||||
image: quay.io/k8scsi/csi-provisioner:v1.0.1
|
||||
image: k8s.gcr.io/sig-storage/csi-provisioner:v2.0.4
|
||||
args:
|
||||
- "--provisioner=com.seaweedfs.csi"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- "--v=5"
|
||||
env:
|
||||
@ -263,7 +265,7 @@ spec:
|
||||
mountPath: /var/lib/csi/sockets/pluginproxy/
|
||||
# attacher
|
||||
- name: csi-attacher
|
||||
image: quay.io/k8scsi/csi-attacher:v1.0.1
|
||||
image: k8s.gcr.io/sig-storage/csi-attacher:v3.0.2
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
@ -295,6 +297,8 @@ spec:
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
- "--filer=$(SEAWEEDFS_FILER)"
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--cacheCapacityMB=$(SEAWEEDFS_CACHE_CAPACITY_MB)"
|
||||
- "--cacheDir=$(SEAWEEDFS_CACHE_DIR)"
|
||||
env:
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
|
||||
@ -304,6 +308,10 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: SEAWEEDFS_CACHE_CAPACITY_MB
|
||||
value: "1000"
|
||||
- name: SEAWEEDFS_CACHE_DIR
|
||||
value: /tmp
|
||||
imagePullPolicy: "Always"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
@ -333,7 +341,7 @@ spec:
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
containers:
|
||||
- name: driver-registrar
|
||||
image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.1
|
||||
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.0.1
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
@ -342,7 +350,7 @@ spec:
|
||||
- name: ADDRESS
|
||||
value: /csi/csi.sock
|
||||
- name: DRIVER_REG_SOCK_PATH
|
||||
value: /var/lib/kubelet/plugins/com.seaweedfs.csi/csi.sock
|
||||
value: /var/lib/kubelet/plugins/seaweedfs-csi-driver/csi.sock
|
||||
- name: KUBE_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
@ -363,6 +371,8 @@ spec:
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
- "--filer=$(SEAWEEDFS_FILER)"
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--cacheCapacityMB=$(SEAWEEDFS_CACHE_CAPACITY_MB)"
|
||||
- "--cacheDir=$(SEAWEEDFS_CACHE_DIR)"
|
||||
env:
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix:///csi/csi.sock
|
||||
@ -372,6 +382,10 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: SEAWEEDFS_CACHE_CAPACITY_MB
|
||||
value: "1000"
|
||||
- name: SEAWEEDFS_CACHE_DIR
|
||||
value: /tmp
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: plugin-dir
|
||||
@ -388,7 +402,7 @@ spec:
|
||||
type: DirectoryOrCreate
|
||||
- name: plugin-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/com.seaweedfs.csi
|
||||
path: /var/lib/kubelet/plugins/seaweedfs-csi-driver
|
||||
type: DirectoryOrCreate
|
||||
- name: pods-mount-dir
|
||||
hostPath:
|
||||
|
||||
69
go.mod
69
go.mod
@ -3,68 +3,75 @@ module github.com/seaweedfs/seaweedfs-csi-driver
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.68.0 // indirect
|
||||
cloud.google.com/go/pubsub v1.8.1 // indirect
|
||||
cloud.google.com/go/storage v1.12.0 // indirect
|
||||
github.com/Azure/azure-amqp-common-go/v2 v2.1.0 // indirect
|
||||
github.com/Azure/azure-pipeline-go v0.2.3 // indirect
|
||||
github.com/Azure/azure-storage-blob-go v0.10.0 // indirect
|
||||
github.com/DataDog/zstd v1.4.5 // indirect
|
||||
github.com/Shopify/sarama v1.27.1 // indirect
|
||||
github.com/aws/aws-sdk-go v1.35.7 // indirect
|
||||
github.com/chrislusf/seaweedfs v0.0.0-20201012192625-f022aff289d5
|
||||
github.com/container-storage-interface/spec v1.2.0
|
||||
github.com/andybalholm/brotli v1.0.3 // indirect
|
||||
github.com/aws/aws-sdk-go v1.38.69 // indirect
|
||||
github.com/chrislusf/seaweedfs v0.0.0-20210723063554-bdb632fa62bf
|
||||
github.com/container-storage-interface/spec v1.5.0
|
||||
github.com/coreos/bbolt v1.3.3 // indirect
|
||||
github.com/coreos/etcd v3.3.15+incompatible // indirect
|
||||
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.1.0 // indirect
|
||||
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 // indirect
|
||||
github.com/fsnotify/fsnotify v1.4.9 // indirect
|
||||
github.com/go-errors/errors v1.4.0 // indirect
|
||||
github.com/go-redis/redis v6.15.9+incompatible // indirect
|
||||
github.com/gocql/gocql v0.0.0-20200926162733-393f0c961220 // indirect
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
|
||||
github.com/golang/snappy v0.0.2 // indirect
|
||||
github.com/google/go-cmp v0.5.6 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/uuid v1.2.0 // indirect
|
||||
github.com/gophercloud/gophercloud v0.1.0 // indirect
|
||||
github.com/gorilla/mux v1.8.0 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/klauspost/compress v1.11.1 // indirect
|
||||
github.com/karlseguin/ccache v2.0.3+incompatible // indirect
|
||||
github.com/klauspost/compress v1.13.1 // indirect
|
||||
github.com/klauspost/cpuid v1.3.1 // indirect
|
||||
github.com/klauspost/reedsolomon v1.9.9 // indirect
|
||||
github.com/lib/pq v1.8.0 // indirect
|
||||
github.com/magiconair/properties v1.8.4 // indirect
|
||||
github.com/lunixbochs/vtclean v1.0.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.2 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||
github.com/mitchellh/go-ps v1.0.0
|
||||
github.com/mitchellh/mapstructure v1.3.3 // indirect
|
||||
github.com/mmcloughlin/avo v0.0.0-20200803215136-443f81d77104 // indirect
|
||||
github.com/olivere/elastic/v7 v7.0.20 // indirect
|
||||
github.com/pelletier/go-toml v1.8.1 // indirect
|
||||
github.com/peterh/liner v1.2.0 // indirect
|
||||
github.com/prometheus/common v0.14.0 // indirect
|
||||
github.com/prometheus/procfs v0.2.0 // indirect
|
||||
github.com/spf13/afero v1.4.1 // indirect
|
||||
github.com/prometheus/common v0.29.0 // indirect
|
||||
github.com/rakyll/statik v0.1.7 // indirect
|
||||
github.com/spf13/cast v1.3.1 // indirect
|
||||
github.com/spf13/viper v1.7.1 // indirect
|
||||
github.com/spf13/viper v1.8.1 // indirect
|
||||
github.com/streadway/amqp v1.0.0 // indirect
|
||||
github.com/tidwall/gjson v1.6.1 // indirect
|
||||
github.com/valyala/fasthttp v1.27.0 // indirect
|
||||
github.com/viant/toolbox v0.34.4 // indirect
|
||||
github.com/willf/bitset v1.1.11 // indirect
|
||||
go.etcd.io/etcd v3.3.25+incompatible // indirect
|
||||
go.mongodb.org/mongo-driver v1.4.2 // indirect
|
||||
go.opencensus.io v0.22.5 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
go.uber.org/zap v1.16.0 // indirect
|
||||
gocloud.dev/pubsub/natspubsub v0.20.0 // indirect
|
||||
gocloud.dev/pubsub/rabbitpubsub v0.20.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee // indirect
|
||||
golang.org/x/image v0.0.0-20200927104501-e162460cd6b5 // indirect
|
||||
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb
|
||||
golang.org/x/sync v0.0.0-20201008141435-b3e1573b7520 // indirect
|
||||
golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634 // indirect
|
||||
golang.org/x/tools v0.0.0-20201012192620-5bd05386311b // indirect
|
||||
google.golang.org/genproto v0.0.0-20201012135029-0c95dc0d88e8 // indirect
|
||||
google.golang.org/grpc v1.33.0
|
||||
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
|
||||
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect
|
||||
golang.org/x/net v0.0.0-20210614182718-04defd469f4e
|
||||
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 // indirect
|
||||
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
|
||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
|
||||
golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 // indirect
|
||||
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 // indirect
|
||||
google.golang.org/grpc v1.38.0
|
||||
google.golang.org/protobuf v1.27.1 // indirect
|
||||
gopkg.in/ini.v1 v1.62.0 // indirect
|
||||
k8s.io/apimachinery v0.18.2 // indirect
|
||||
k8s.io/client-go v0.17.0
|
||||
gopkg.in/karlseguin/expect.v1 v1.0.1 // indirect
|
||||
k8s.io/client-go v0.21.2
|
||||
k8s.io/klog v1.0.0
|
||||
k8s.io/utils v0.0.0-20200318093247-d1ab8797c558
|
||||
k8s.io/klog/v2 v2.9.0 // indirect
|
||||
k8s.io/utils v0.0.0-20210629042839-4a2b36d8d73f
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v3 v3.0.1 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.1.1 // indirect
|
||||
)
|
||||
|
||||
replace go.etcd.io/etcd => go.etcd.io/etcd v0.5.0-alpha.5.0.20200425165423-262c93980547
|
||||
|
||||
@ -174,6 +174,10 @@ func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
func (cs *ControllerServer) ControllerGetVolume(ctx context.Context, req *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
func sanitizeVolumeId(volumeId string) string {
|
||||
volumeId = strings.ToLower(volumeId)
|
||||
if len(volumeId) > 63 {
|
||||
|
||||
@ -4,12 +4,12 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/security"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@ -35,14 +35,19 @@ type SeaweedFsDriver struct {
|
||||
vcap []*csi.VolumeCapability_AccessMode
|
||||
cscap []*csi.ControllerServiceCapability
|
||||
|
||||
filer string
|
||||
grpcDialOption grpc.DialOption
|
||||
filer string
|
||||
grpcDialOption grpc.DialOption
|
||||
ConcurrentWriters int
|
||||
CacheSizeMB int64
|
||||
CacheDir string
|
||||
}
|
||||
|
||||
func NewSeaweedFsDriver(filer, nodeID, endpoint string) *SeaweedFsDriver {
|
||||
|
||||
glog.Infof("Driver: %v version: %v", driverName, version)
|
||||
|
||||
util.LoadConfiguration("security", false)
|
||||
|
||||
n := &SeaweedFsDriver{
|
||||
endpoint: endpoint,
|
||||
nodeID: nodeID,
|
||||
|
||||
@ -4,8 +4,9 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"os/exec"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"k8s.io/utils/mount"
|
||||
)
|
||||
|
||||
@ -19,8 +20,8 @@ type Mounter interface {
|
||||
Mount(target string) error
|
||||
}
|
||||
|
||||
func newMounter(bucketName string, filer string) (Mounter, error) {
|
||||
return newSeaweedFsMounter(bucketName, filer)
|
||||
func newMounter(bucketName string, driver *SeaweedFsDriver, volContext map[string]string) (Mounter, error) {
|
||||
return newSeaweedFsMounter(bucketName, driver, volContext)
|
||||
}
|
||||
|
||||
func fuseMount(path string, command string, args []string) error {
|
||||
|
||||
@ -8,23 +8,25 @@ import (
|
||||
|
||||
// Implements Mounter
|
||||
type seaweedFsMounter struct {
|
||||
bucketName string
|
||||
filerUrl string
|
||||
bucketName string
|
||||
driver *SeaweedFsDriver
|
||||
volContext map[string]string
|
||||
}
|
||||
|
||||
const (
|
||||
seaweedFsCmd = "weed"
|
||||
)
|
||||
|
||||
func newSeaweedFsMounter(bucketName string, filer string) (Mounter, error) {
|
||||
func newSeaweedFsMounter(bucketName string, driver *SeaweedFsDriver, volContext map[string]string) (Mounter, error) {
|
||||
return &seaweedFsMounter{
|
||||
bucketName: bucketName,
|
||||
filerUrl: filer,
|
||||
bucketName: bucketName,
|
||||
driver: driver,
|
||||
volContext: volContext,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (seaweedFs *seaweedFsMounter) Mount(target string) error {
|
||||
glog.V(0).Infof("mounting %s%s to %s", seaweedFs.filerUrl, seaweedFs.bucketName, target)
|
||||
glog.V(0).Infof("mounting %s %s to %s", seaweedFs.driver.filer, seaweedFs.bucketName, target)
|
||||
|
||||
args := []string{
|
||||
"mount",
|
||||
@ -32,12 +34,29 @@ func (seaweedFs *seaweedFsMounter) Mount(target string) error {
|
||||
"-umask=000",
|
||||
fmt.Sprintf("-dir=%s", target),
|
||||
fmt.Sprintf("-collection=%s", seaweedFs.bucketName),
|
||||
fmt.Sprintf("-filer=%s", seaweedFs.filerUrl),
|
||||
fmt.Sprintf("-filer=%s", seaweedFs.driver.filer),
|
||||
fmt.Sprintf("-filer.path=/buckets/%s", seaweedFs.bucketName),
|
||||
fmt.Sprintf("-cacheCapacityMB=%d", seaweedFs.driver.CacheSizeMB),
|
||||
}
|
||||
|
||||
for arg, value := range seaweedFs.volContext {
|
||||
switch arg {
|
||||
case "map.uid":
|
||||
args = append(args, fmt.Sprintf("-map.uid=%s", value))
|
||||
case "map.gid":
|
||||
args = append(args, fmt.Sprintf("-map.gid=%s", value))
|
||||
}
|
||||
}
|
||||
|
||||
if seaweedFs.driver.ConcurrentWriters > 0 {
|
||||
args = append(args, fmt.Sprintf("-concurrentWriters=%d", seaweedFs.driver.ConcurrentWriters))
|
||||
}
|
||||
if seaweedFs.driver.CacheDir != "" {
|
||||
args = append(args, fmt.Sprintf("-cacheDir=%s", seaweedFs.driver.CacheDir))
|
||||
}
|
||||
err := fuseMount(target, seaweedFsCmd, args)
|
||||
if err != nil {
|
||||
glog.Errorf("mount %s%s to %s: %s", seaweedFs.filerUrl, seaweedFs.bucketName, target, err)
|
||||
glog.Errorf("mount %s %s to %s: %s", seaweedFs.driver.filer, seaweedFs.bucketName, target, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@ -55,7 +55,9 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
||||
mo = append(mo, "ro")
|
||||
}
|
||||
|
||||
mounter, err := newMounter(volumeID, ns.Driver.filer)
|
||||
volContext := req.GetVolumeContext()
|
||||
|
||||
mounter, err := newMounter(volumeID, ns.Driver, volContext)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -163,4 +165,4 @@ func checkMount(targetPath string) (bool, error) {
|
||||
}
|
||||
}
|
||||
return notMnt, nil
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user