Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eff14d6532 |
105
.github/workflows/release.yaml
vendored
105
.github/workflows/release.yaml
vendored
@ -1,105 +0,0 @@
|
|||||||
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,8 +13,6 @@ container: build
|
|||||||
docker build -t $(IMAGE_TAG) -f cmd/seaweedfs-csi-driver/Dockerfile.dev .
|
docker build -t $(IMAGE_TAG) -f cmd/seaweedfs-csi-driver/Dockerfile.dev .
|
||||||
push: container
|
push: container
|
||||||
docker push $(IMAGE_TAG)
|
docker push $(IMAGE_TAG)
|
||||||
release: container
|
|
||||||
VERSION=latest docker push $(IMAGE_TAG)
|
|
||||||
clean:
|
clean:
|
||||||
go clean -r -x
|
go clean -r -x
|
||||||
-rm -rf _output
|
-rm -rf _output
|
||||||
|
|||||||
32
README.md
32
README.md
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[](https://hub.docker.com/r/chrislusf/seaweedfs-csi-driver/)
|
[](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 enables 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 will enable 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!
|
[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 Kubernetes cluster (includes `kubectl`)
|
||||||
* Already have a working SeaweedFS cluster
|
* Already have a working SeaweedFS cluster
|
||||||
|
|
||||||
## Utilize existing SeaweedFS storage for your Kubernetes cluster (bare metal)
|
## Utilize exiting 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)
|
1. Git clone this repository and add your SeaweedFS master IP to `deploy/kubernetes/seaweedfs-csi.yaml` (2 places)
|
||||||
|
|
||||||
@ -46,34 +46,6 @@ $ kubectl delete -f deploy/kubernetes/sample-seaweedfs-pvc.yaml
|
|||||||
$ kubectl delete -f deploy/kubernetes/seaweedfs-csi.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
|
# License
|
||||||
[Apache v2 license](https://www.apache.org/licenses/LICENSE-2.0)
|
[Apache v2 license](https://www.apache.org/licenses/LICENSE-2.0)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@ -1,21 +1,18 @@
|
|||||||
FROM amd64/golang:1.16-alpine as builder
|
FROM frolvlad/alpine-glibc as builder
|
||||||
|
RUN apk add git go g++
|
||||||
|
|
||||||
RUN apk add git go g++ curl jq
|
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
|
||||||
|
|
||||||
WORKDIR /
|
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 curl -sL \
|
RUN cd /go/src/github.com/seaweedfs/seaweedfs-csi-driver && go build -o /seaweedfs-csi-driver ./cmd/seaweedfs-csi-driver/main.go
|
||||||
$(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
|
FROM alpine AS final
|
||||||
RUN apk add fuse
|
RUN apk add fuse
|
||||||
LABEL author="Chris Lu"
|
LABEL author="Chris Lu"
|
||||||
COPY --from=builder /weed /usr/bin/
|
COPY --from=builder /root/go/bin/weed /usr/bin/
|
||||||
COPY --from=builder /seaweedfs-csi-driver /
|
COPY --from=builder /seaweedfs-csi-driver /
|
||||||
|
|
||||||
RUN chmod +x /seaweedfs-csi-driver
|
RUN chmod +x /seaweedfs-csi-driver
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
FROM amd64/golang:1.16-alpine as builder
|
FROM golang:buster as builder
|
||||||
RUN apk add git go g++
|
|
||||||
|
|
||||||
RUN mkdir -p /go/src/github.com/chrislusf/
|
RUN mkdir -p /go/src/github.com/chrislusf/
|
||||||
RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs
|
RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs
|
||||||
|
|||||||
@ -6,18 +6,14 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
|
||||||
"github.com/seaweedfs/seaweedfs-csi-driver/pkg/driver"
|
"github.com/seaweedfs/seaweedfs-csi-driver/pkg/driver"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
filer = flag.String("filer", "localhost:8888", "filer server")
|
filer = flag.String("filer", "localhost:8888", "filer server")
|
||||||
endpoint = flag.String("endpoint", "unix://tmp/seaweedfs-csi.sock", "CSI endpoint to accept gRPC calls")
|
endpoint = flag.String("endpoint", "unix://tmp/seaweedfs-csi.sock", "CSI endpoint to accept gRPC calls")
|
||||||
nodeID = flag.String("nodeid", "", "node id")
|
nodeID = flag.String("nodeid", "", "node id")
|
||||||
version = flag.Bool("version", false, "Print the version and exit.")
|
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() {
|
func main() {
|
||||||
@ -33,11 +29,6 @@ func main() {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("connect to filer %s", *filer)
|
|
||||||
|
|
||||||
drv := driver.NewSeaweedFsDriver(*filer, *nodeID, *endpoint)
|
drv := driver.NewSeaweedFsDriver(*filer, *nodeID, *endpoint)
|
||||||
drv.ConcurrentWriters = *concurrentWriters
|
|
||||||
drv.CacheSizeMB = *cacheSizeMB
|
|
||||||
drv.CacheDir = *cacheDir
|
|
||||||
drv.Run()
|
drv.Run()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
# 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
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
apiVersion: v2
|
|
||||||
name: seaweedfs-csi-driver
|
|
||||||
description: A Helm chart for Kubernetes
|
|
||||||
type: application
|
|
||||||
version: 0.1.1
|
|
||||||
appVersion: latest
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{{- define "seaweedfs-csi-driver.name" -}}
|
|
||||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
|
||||||
{{- end -}}
|
|
||||||
@ -1,61 +0,0 @@
|
|||||||
{{- 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 }}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
apiVersion: storage.k8s.io/v1
|
|
||||||
kind: CSIDriver
|
|
||||||
metadata:
|
|
||||||
name: {{ .Values.driverName }}
|
|
||||||
spec:
|
|
||||||
attachRequired: true
|
|
||||||
podInfoOnMount: true
|
|
||||||
@ -1,110 +0,0 @@
|
|||||||
{{- 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 }}
|
|
||||||
@ -1,172 +0,0 @@
|
|||||||
---
|
|
||||||
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
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
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
|
|
||||||
@ -1,91 +0,0 @@
|
|||||||
---
|
|
||||||
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 }}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
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 }}
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
|
|
||||||
# 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
|
namespace: kube-system
|
||||||
annotations:
|
annotations:
|
||||||
storageclass.kubernetes.io/is-default-class: "true"
|
storageclass.kubernetes.io/is-default-class: "true"
|
||||||
provisioner: seaweedfs-csi-driver
|
provisioner: com.seaweedfs.csi
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ServiceAccount
|
kind: ServiceAccount
|
||||||
@ -106,19 +106,16 @@ metadata:
|
|||||||
rules:
|
rules:
|
||||||
- apiGroups: [""]
|
- apiGroups: [""]
|
||||||
resources: ["persistentvolumes"]
|
resources: ["persistentvolumes"]
|
||||||
verbs: ["get", "list", "watch", "update", "patch"]
|
verbs: ["get", "list", "watch", "update"]
|
||||||
- apiGroups: [""]
|
- apiGroups: [""]
|
||||||
resources: ["nodes"]
|
resources: ["nodes"]
|
||||||
verbs: ["get", "list", "watch", "update", "patch"]
|
verbs: ["get", "list", "watch"]
|
||||||
- apiGroups: ["storage.k8s.io"]
|
- apiGroups: ["csi.storage.k8s.io"]
|
||||||
resources: ["csinodes"]
|
resources: ["csinodeinfos"]
|
||||||
verbs: ["get", "list", "watch", "update", "patch"]
|
verbs: ["get", "list", "watch"]
|
||||||
- apiGroups: ["storage.k8s.io"]
|
- apiGroups: ["storage.k8s.io"]
|
||||||
resources: ["volumeattachments"]
|
resources: ["volumeattachments"]
|
||||||
verbs: ["get", "list", "watch", "update", "patch"]
|
verbs: ["get", "list", "watch", "update"]
|
||||||
- apiGroups: ["storage.k8s.io"]
|
|
||||||
resources: ["volumeattachments/status"]
|
|
||||||
verbs: ["patch"]
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: ClusterRoleBinding
|
kind: ClusterRoleBinding
|
||||||
@ -252,8 +249,9 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
# provisioner
|
# provisioner
|
||||||
- name: csi-provisioner
|
- name: csi-provisioner
|
||||||
image: k8s.gcr.io/sig-storage/csi-provisioner:v2.0.4
|
image: quay.io/k8scsi/csi-provisioner:v1.0.1
|
||||||
args:
|
args:
|
||||||
|
- "--provisioner=com.seaweedfs.csi"
|
||||||
- "--csi-address=$(ADDRESS)"
|
- "--csi-address=$(ADDRESS)"
|
||||||
- "--v=5"
|
- "--v=5"
|
||||||
env:
|
env:
|
||||||
@ -265,7 +263,7 @@ spec:
|
|||||||
mountPath: /var/lib/csi/sockets/pluginproxy/
|
mountPath: /var/lib/csi/sockets/pluginproxy/
|
||||||
# attacher
|
# attacher
|
||||||
- name: csi-attacher
|
- name: csi-attacher
|
||||||
image: k8s.gcr.io/sig-storage/csi-attacher:v3.0.2
|
image: quay.io/k8scsi/csi-attacher:v1.0.1
|
||||||
args:
|
args:
|
||||||
- "--v=5"
|
- "--v=5"
|
||||||
- "--csi-address=$(ADDRESS)"
|
- "--csi-address=$(ADDRESS)"
|
||||||
@ -297,8 +295,6 @@ spec:
|
|||||||
- "--endpoint=$(CSI_ENDPOINT)"
|
- "--endpoint=$(CSI_ENDPOINT)"
|
||||||
- "--filer=$(SEAWEEDFS_FILER)"
|
- "--filer=$(SEAWEEDFS_FILER)"
|
||||||
- "--nodeid=$(NODE_ID)"
|
- "--nodeid=$(NODE_ID)"
|
||||||
- "--cacheCapacityMB=$(SEAWEEDFS_CACHE_CAPACITY_MB)"
|
|
||||||
- "--cacheDir=$(SEAWEEDFS_CACHE_DIR)"
|
|
||||||
env:
|
env:
|
||||||
- name: CSI_ENDPOINT
|
- name: CSI_ENDPOINT
|
||||||
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
|
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
|
||||||
@ -308,10 +304,6 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: spec.nodeName
|
fieldPath: spec.nodeName
|
||||||
- name: SEAWEEDFS_CACHE_CAPACITY_MB
|
|
||||||
value: "1000"
|
|
||||||
- name: SEAWEEDFS_CACHE_DIR
|
|
||||||
value: /tmp
|
|
||||||
imagePullPolicy: "Always"
|
imagePullPolicy: "Always"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: socket-dir
|
- name: socket-dir
|
||||||
@ -341,7 +333,7 @@ spec:
|
|||||||
dnsPolicy: ClusterFirstWithHostNet
|
dnsPolicy: ClusterFirstWithHostNet
|
||||||
containers:
|
containers:
|
||||||
- name: driver-registrar
|
- name: driver-registrar
|
||||||
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.0.1
|
image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.1
|
||||||
args:
|
args:
|
||||||
- "--v=5"
|
- "--v=5"
|
||||||
- "--csi-address=$(ADDRESS)"
|
- "--csi-address=$(ADDRESS)"
|
||||||
@ -350,7 +342,7 @@ spec:
|
|||||||
- name: ADDRESS
|
- name: ADDRESS
|
||||||
value: /csi/csi.sock
|
value: /csi/csi.sock
|
||||||
- name: DRIVER_REG_SOCK_PATH
|
- name: DRIVER_REG_SOCK_PATH
|
||||||
value: /var/lib/kubelet/plugins/seaweedfs-csi-driver/csi.sock
|
value: /var/lib/kubelet/plugins/com.seaweedfs.csi/csi.sock
|
||||||
- name: KUBE_NODE_NAME
|
- name: KUBE_NODE_NAME
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
@ -371,8 +363,6 @@ spec:
|
|||||||
- "--endpoint=$(CSI_ENDPOINT)"
|
- "--endpoint=$(CSI_ENDPOINT)"
|
||||||
- "--filer=$(SEAWEEDFS_FILER)"
|
- "--filer=$(SEAWEEDFS_FILER)"
|
||||||
- "--nodeid=$(NODE_ID)"
|
- "--nodeid=$(NODE_ID)"
|
||||||
- "--cacheCapacityMB=$(SEAWEEDFS_CACHE_CAPACITY_MB)"
|
|
||||||
- "--cacheDir=$(SEAWEEDFS_CACHE_DIR)"
|
|
||||||
env:
|
env:
|
||||||
- name: CSI_ENDPOINT
|
- name: CSI_ENDPOINT
|
||||||
value: unix:///csi/csi.sock
|
value: unix:///csi/csi.sock
|
||||||
@ -382,10 +372,6 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: spec.nodeName
|
fieldPath: spec.nodeName
|
||||||
- name: SEAWEEDFS_CACHE_CAPACITY_MB
|
|
||||||
value: "1000"
|
|
||||||
- name: SEAWEEDFS_CACHE_DIR
|
|
||||||
value: /tmp
|
|
||||||
imagePullPolicy: "IfNotPresent"
|
imagePullPolicy: "IfNotPresent"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: plugin-dir
|
- name: plugin-dir
|
||||||
@ -402,7 +388,7 @@ spec:
|
|||||||
type: DirectoryOrCreate
|
type: DirectoryOrCreate
|
||||||
- name: plugin-dir
|
- name: plugin-dir
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /var/lib/kubelet/plugins/seaweedfs-csi-driver
|
path: /var/lib/kubelet/plugins/com.seaweedfs.csi
|
||||||
type: DirectoryOrCreate
|
type: DirectoryOrCreate
|
||||||
- name: pods-mount-dir
|
- name: pods-mount-dir
|
||||||
hostPath:
|
hostPath:
|
||||||
|
|||||||
69
go.mod
69
go.mod
@ -3,75 +3,68 @@ module github.com/seaweedfs/seaweedfs-csi-driver
|
|||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
cloud.google.com/go v0.68.0 // indirect
|
||||||
cloud.google.com/go/pubsub v1.8.1 // indirect
|
cloud.google.com/go/pubsub v1.8.1 // indirect
|
||||||
cloud.google.com/go/storage v1.12.0 // 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-pipeline-go v0.2.3 // indirect
|
||||||
github.com/Azure/azure-storage-blob-go v0.10.0 // indirect
|
github.com/Azure/azure-storage-blob-go v0.10.0 // indirect
|
||||||
github.com/DataDog/zstd v1.4.5 // indirect
|
github.com/DataDog/zstd v1.4.5 // indirect
|
||||||
github.com/Shopify/sarama v1.27.1 // indirect
|
github.com/Shopify/sarama v1.27.1 // indirect
|
||||||
github.com/andybalholm/brotli v1.0.3 // indirect
|
github.com/aws/aws-sdk-go v1.35.7 // indirect
|
||||||
github.com/aws/aws-sdk-go v1.38.69 // indirect
|
github.com/chrislusf/seaweedfs v0.0.0-20201012192625-f022aff289d5
|
||||||
github.com/chrislusf/seaweedfs v0.0.0-20210723063554-bdb632fa62bf
|
github.com/container-storage-interface/spec v1.2.0
|
||||||
github.com/container-storage-interface/spec v1.5.0
|
|
||||||
github.com/coreos/bbolt v1.3.3 // indirect
|
github.com/coreos/bbolt v1.3.3 // indirect
|
||||||
github.com/coreos/etcd v3.3.15+incompatible // 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 v0.0.0-20190719114852-fd7a80b32e1f // indirect
|
||||||
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 // indirect
|
github.com/coreos/go-systemd/v22 v22.1.0 // indirect
|
||||||
github.com/fsnotify/fsnotify v1.4.9 // 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/go-redis/redis v6.15.9+incompatible // indirect
|
||||||
github.com/gocql/gocql v0.0.0-20200926162733-393f0c961220 // indirect
|
github.com/gocql/gocql v0.0.0-20200926162733-393f0c961220 // indirect
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
|
||||||
github.com/google/go-cmp v0.5.6 // indirect
|
github.com/golang/snappy v0.0.2 // 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/gorilla/mux v1.8.0 // indirect
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
|
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4 // indirect
|
||||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||||
github.com/karlseguin/ccache v2.0.3+incompatible // indirect
|
github.com/klauspost/compress v1.11.1 // indirect
|
||||||
github.com/klauspost/compress v1.13.1 // indirect
|
|
||||||
github.com/klauspost/cpuid v1.3.1 // indirect
|
github.com/klauspost/cpuid v1.3.1 // indirect
|
||||||
github.com/klauspost/reedsolomon v1.9.9 // indirect
|
github.com/klauspost/reedsolomon v1.9.9 // indirect
|
||||||
github.com/lunixbochs/vtclean v1.0.0 // indirect
|
github.com/lib/pq v1.8.0 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.2 // indirect
|
github.com/magiconair/properties v1.8.4 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||||
github.com/mitchellh/go-ps v1.0.0
|
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/mmcloughlin/avo v0.0.0-20200803215136-443f81d77104 // indirect
|
||||||
github.com/olivere/elastic/v7 v7.0.20 // 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/peterh/liner v1.2.0 // indirect
|
||||||
github.com/prometheus/common v0.29.0 // indirect
|
github.com/prometheus/common v0.14.0 // indirect
|
||||||
github.com/rakyll/statik v0.1.7 // indirect
|
github.com/prometheus/procfs v0.2.0 // indirect
|
||||||
|
github.com/spf13/afero v1.4.1 // indirect
|
||||||
github.com/spf13/cast v1.3.1 // indirect
|
github.com/spf13/cast v1.3.1 // indirect
|
||||||
github.com/spf13/viper v1.8.1 // indirect
|
github.com/spf13/viper v1.7.1 // indirect
|
||||||
github.com/streadway/amqp v1.0.0 // indirect
|
github.com/streadway/amqp v1.0.0 // indirect
|
||||||
github.com/valyala/fasthttp v1.27.0 // indirect
|
github.com/tidwall/gjson v1.6.1 // indirect
|
||||||
github.com/viant/toolbox v0.34.4 // indirect
|
|
||||||
github.com/willf/bitset v1.1.11 // indirect
|
github.com/willf/bitset v1.1.11 // indirect
|
||||||
go.etcd.io/etcd v3.3.25+incompatible // 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/multierr v1.6.0 // indirect
|
||||||
|
go.uber.org/zap v1.16.0 // indirect
|
||||||
gocloud.dev/pubsub/natspubsub v0.20.0 // indirect
|
gocloud.dev/pubsub/natspubsub v0.20.0 // indirect
|
||||||
gocloud.dev/pubsub/rabbitpubsub v0.20.0 // indirect
|
gocloud.dev/pubsub/rabbitpubsub v0.20.0 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
|
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee // indirect
|
||||||
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect
|
golang.org/x/image v0.0.0-20200927104501-e162460cd6b5 // indirect
|
||||||
golang.org/x/net v0.0.0-20210614182718-04defd469f4e
|
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb
|
||||||
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 // indirect
|
golang.org/x/sync v0.0.0-20201008141435-b3e1573b7520 // indirect
|
||||||
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
|
golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634 // indirect
|
||||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
|
golang.org/x/tools v0.0.0-20201012192620-5bd05386311b // indirect
|
||||||
golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 // indirect
|
google.golang.org/genproto v0.0.0-20201012135029-0c95dc0d88e8 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 // indirect
|
google.golang.org/grpc v1.33.0
|
||||||
google.golang.org/grpc v1.38.0
|
|
||||||
google.golang.org/protobuf v1.27.1 // indirect
|
|
||||||
gopkg.in/ini.v1 v1.62.0 // indirect
|
gopkg.in/ini.v1 v1.62.0 // indirect
|
||||||
gopkg.in/karlseguin/expect.v1 v1.0.1 // indirect
|
k8s.io/apimachinery v0.18.2 // indirect
|
||||||
k8s.io/client-go v0.21.2
|
k8s.io/client-go v0.17.0
|
||||||
k8s.io/klog v1.0.0
|
k8s.io/klog v1.0.0
|
||||||
k8s.io/klog/v2 v2.9.0 // indirect
|
k8s.io/utils v0.0.0-20200318093247-d1ab8797c558
|
||||||
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
|
replace go.etcd.io/etcd => go.etcd.io/etcd v0.5.0-alpha.5.0.20200425165423-262c93980547
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/util/log"
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
@ -26,7 +26,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
|||||||
volumeId := sanitizeVolumeId(req.GetName())
|
volumeId := sanitizeVolumeId(req.GetName())
|
||||||
|
|
||||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
||||||
glog.V(3).Infof("invalid create volume req: %v", req)
|
log.Tracef("invalid create volume req: %v", req)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
|||||||
}
|
}
|
||||||
|
|
||||||
params := req.GetParameters()
|
params := req.GetParameters()
|
||||||
glog.V(4).Info("params:%v", params)
|
log.Trace("params:%v", params)
|
||||||
capacity := req.GetCapacityRange().GetRequiredBytes()
|
capacity := req.GetCapacityRange().GetRequiredBytes()
|
||||||
capacityGB := capacity >> 30
|
capacityGB := capacity >> 30
|
||||||
if capacityGB == 0 {
|
if capacityGB == 0 {
|
||||||
@ -54,7 +54,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
|||||||
return nil, fmt.Errorf("Error setting bucket metadata: %v", err)
|
return nil, fmt.Errorf("Error setting bucket metadata: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(4).Infof("create volume %s", volumeId)
|
log.Tracef("create volume %s", volumeId)
|
||||||
|
|
||||||
return &csi.CreateVolumeResponse{
|
return &csi.CreateVolumeResponse{
|
||||||
Volume: &csi.Volume{
|
Volume: &csi.Volume{
|
||||||
@ -75,10 +75,10 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
||||||
glog.V(3).Infof("Invalid delete volume req: %v", req)
|
log.Tracef("Invalid delete volume req: %v", req)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("Deleting volume %s", volumeId)
|
log.Tracef("Deleting volume %s", volumeId)
|
||||||
|
|
||||||
if err := filer_pb.Remove(cs.Driver, "/buckets", volumeId, true, true, true, false, nil); err != nil {
|
if err := filer_pb.Remove(cs.Driver, "/buckets", volumeId, true, true, true, false, nil); err != nil {
|
||||||
return nil, fmt.Errorf("Error setting bucket metadata: %v", err)
|
return nil, fmt.Errorf("Error setting bucket metadata: %v", err)
|
||||||
@ -151,7 +151,7 @@ func (cs *ControllerServer) GetCapacity(ctx context.Context, req *csi.GetCapacit
|
|||||||
// ControllerGetCapabilities implements the default GRPC callout.
|
// ControllerGetCapabilities implements the default GRPC callout.
|
||||||
// Default supports all capabilities
|
// Default supports all capabilities
|
||||||
func (cs *ControllerServer) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
|
func (cs *ControllerServer) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
|
||||||
glog.V(3).Infof("Using default ControllerGetCapabilities")
|
log.Tracef("Using default ControllerGetCapabilities")
|
||||||
|
|
||||||
return &csi.ControllerGetCapabilitiesResponse{
|
return &csi.ControllerGetCapabilitiesResponse{
|
||||||
Capabilities: cs.Driver.cscap,
|
Capabilities: cs.Driver.cscap,
|
||||||
@ -174,10 +174,6 @@ func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi
|
|||||||
return nil, status.Error(codes.Unimplemented, "")
|
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 {
|
func sanitizeVolumeId(volumeId string) string {
|
||||||
volumeId = strings.ToLower(volumeId)
|
volumeId = strings.ToLower(volumeId)
|
||||||
if len(volumeId) > 63 {
|
if len(volumeId) > 63 {
|
||||||
|
|||||||
@ -4,12 +4,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb"
|
"github.com/chrislusf/seaweedfs/weed/pb"
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||||
"github.com/chrislusf/seaweedfs/weed/security"
|
"github.com/chrislusf/seaweedfs/weed/security"
|
||||||
"github.com/chrislusf/seaweedfs/weed/util"
|
"github.com/chrislusf/seaweedfs/weed/util"
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
|
"github.com/chrislusf/seaweedfs/weed/util/log"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -35,18 +35,13 @@ type SeaweedFsDriver struct {
|
|||||||
vcap []*csi.VolumeCapability_AccessMode
|
vcap []*csi.VolumeCapability_AccessMode
|
||||||
cscap []*csi.ControllerServiceCapability
|
cscap []*csi.ControllerServiceCapability
|
||||||
|
|
||||||
filer string
|
filer string
|
||||||
grpcDialOption grpc.DialOption
|
grpcDialOption grpc.DialOption
|
||||||
ConcurrentWriters int
|
|
||||||
CacheSizeMB int64
|
|
||||||
CacheDir string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSeaweedFsDriver(filer, nodeID, endpoint string) *SeaweedFsDriver {
|
func NewSeaweedFsDriver(filer, nodeID, endpoint string) *SeaweedFsDriver {
|
||||||
|
|
||||||
glog.Infof("Driver: %v version: %v", driverName, version)
|
log.Infof("Driver: %v version: %v", driverName, version)
|
||||||
|
|
||||||
util.LoadConfiguration("security", false)
|
|
||||||
|
|
||||||
n := &SeaweedFsDriver{
|
n := &SeaweedFsDriver{
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
@ -92,7 +87,7 @@ func (n *SeaweedFsDriver) Run() {
|
|||||||
func (n *SeaweedFsDriver) AddVolumeCapabilityAccessModes(vc []csi.VolumeCapability_AccessMode_Mode) []*csi.VolumeCapability_AccessMode {
|
func (n *SeaweedFsDriver) AddVolumeCapabilityAccessModes(vc []csi.VolumeCapability_AccessMode_Mode) []*csi.VolumeCapability_AccessMode {
|
||||||
var vca []*csi.VolumeCapability_AccessMode
|
var vca []*csi.VolumeCapability_AccessMode
|
||||||
for _, c := range vc {
|
for _, c := range vc {
|
||||||
glog.Infof("Enabling volume access mode: %v", c.String())
|
log.Infof("Enabling volume access mode: %v", c.String())
|
||||||
vca = append(vca, &csi.VolumeCapability_AccessMode{Mode: c})
|
vca = append(vca, &csi.VolumeCapability_AccessMode{Mode: c})
|
||||||
}
|
}
|
||||||
n.vcap = vca
|
n.vcap = vca
|
||||||
@ -103,7 +98,7 @@ func (n *SeaweedFsDriver) AddControllerServiceCapabilities(cl []csi.ControllerSe
|
|||||||
var csc []*csi.ControllerServiceCapability
|
var csc []*csi.ControllerServiceCapability
|
||||||
|
|
||||||
for _, c := range cl {
|
for _, c := range cl {
|
||||||
glog.Infof("Enabling controller service capability: %v", c.String())
|
log.Infof("Enabling controller service capability: %v", c.String())
|
||||||
csc = append(csc, NewControllerServiceCapability(c))
|
csc = append(csc, NewControllerServiceCapability(c))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package driver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/util/log"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ func (ids *IdentityServer) Probe(ctx context.Context, req *csi.ProbeRequest) (*c
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ids *IdentityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
|
func (ids *IdentityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
|
||||||
glog.V(4).Infof("Using default capabilities")
|
log.Tracef("Using default capabilities")
|
||||||
return &csi.GetPluginCapabilitiesResponse{
|
return &csi.GetPluginCapabilitiesResponse{
|
||||||
Capabilities: []*csi.PluginCapability{
|
Capabilities: []*csi.PluginCapability{
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mitchellh/go-ps"
|
"github.com/mitchellh/go-ps"
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/util/log"
|
||||||
"k8s.io/utils/mount"
|
"k8s.io/utils/mount"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ func waitForProcess(p *os.Process, backoff int) error {
|
|||||||
}
|
}
|
||||||
cmdLine, err := getCmdLine(p.Pid)
|
cmdLine, err := getCmdLine(p.Pid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("Error checking cmdline of PID %v, assuming it is dead: %s", p.Pid, err)
|
log.Warnf("Error checking cmdline of PID %v, assuming it is dead: %s", p.Pid, err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if cmdLine == "" {
|
if cmdLine == "" {
|
||||||
@ -31,10 +31,10 @@ func waitForProcess(p *os.Process, backoff int) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err := p.Signal(syscall.Signal(0)); err != nil {
|
if err := p.Signal(syscall.Signal(0)); err != nil {
|
||||||
glog.Warningf("Fuse process does not seem active or we are unprivileged: %s", err)
|
log.Warnf("Fuse process does not seem active or we are unprivileged: %s", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
glog.Infof("Fuse process with PID %v still active, waiting...", p.Pid)
|
log.Infof("Fuse process with PID %v still active, waiting...", p.Pid)
|
||||||
time.Sleep(time.Duration(backoff*100) * time.Millisecond)
|
time.Sleep(time.Duration(backoff*100) * time.Millisecond)
|
||||||
return waitForProcess(p, backoff+1)
|
return waitForProcess(p, backoff+1)
|
||||||
}
|
}
|
||||||
@ -66,11 +66,11 @@ func findFuseMountProcess(path string) (*os.Process, error) {
|
|||||||
for _, p := range processes {
|
for _, p := range processes {
|
||||||
cmdLine, err := getCmdLine(p.Pid())
|
cmdLine, err := getCmdLine(p.Pid())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Unable to get cmdline of PID %v: %s", p.Pid(), err)
|
log.Errorf("Unable to get cmdline of PID %v: %s", p.Pid(), err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if strings.Contains(cmdLine, path) {
|
if strings.Contains(cmdLine, path) {
|
||||||
glog.Infof("Found matching pid %v on path %s", p.Pid(), path)
|
log.Infof("Found matching pid %v on path %s", p.Pid(), path)
|
||||||
return os.FindProcess(p.Pid())
|
return os.FindProcess(p.Pid())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,9 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/chrislusf/seaweedfs/weed/util/log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
|
||||||
"k8s.io/utils/mount"
|
"k8s.io/utils/mount"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,17 +19,17 @@ type Mounter interface {
|
|||||||
Mount(target string) error
|
Mount(target string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMounter(bucketName string, driver *SeaweedFsDriver, volContext map[string]string) (Mounter, error) {
|
func newMounter(bucketName string, filer string) (Mounter, error) {
|
||||||
return newSeaweedFsMounter(bucketName, driver, volContext)
|
return newSeaweedFsMounter(bucketName, filer)
|
||||||
}
|
}
|
||||||
|
|
||||||
func fuseMount(path string, command string, args []string) error {
|
func fuseMount(path string, command string, args []string) error {
|
||||||
cmd := exec.Command(command, args...)
|
cmd := exec.Command(command, args...)
|
||||||
glog.V(0).Infof("Mounting fuse with command: %s and args: %s", command, args)
|
log.Infof("Mounting fuse with command: %s and args: %s", command, args)
|
||||||
|
|
||||||
err := cmd.Start()
|
err := cmd.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("running weed mount: %v", err)
|
log.Errorf("running weed mount: %v", err)
|
||||||
return fmt.Errorf("Error fuseMount command: %s\nargs: %s\nerror: %v", command, args, err)
|
return fmt.Errorf("Error fuseMount command: %s\nargs: %s\nerror: %v", command, args, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,14 +43,14 @@ func fuseUnmount(path string) error {
|
|||||||
// as fuse quits immediately, we will try to wait until the process is done
|
// as fuse quits immediately, we will try to wait until the process is done
|
||||||
process, err := findFuseMountProcess(path)
|
process, err := findFuseMountProcess(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Error getting PID of fuse mount: %s", err)
|
log.Errorf("Error getting PID of fuse mount: %s", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if process == nil {
|
if process == nil {
|
||||||
glog.Warningf("Unable to find PID of fuse mount %s, it must have finished already", path)
|
log.Warnf("Unable to find PID of fuse mount %s, it must have finished already", path)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
glog.Infof("Found fuse pid %v of mount %s, checking if it still runs", process.Pid, path)
|
log.Infof("Found fuse pid %v of mount %s, checking if it still runs", process.Pid, path)
|
||||||
return waitForProcess(process, 1)
|
return waitForProcess(process, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,30 +3,28 @@ package driver
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/util/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Implements Mounter
|
// Implements Mounter
|
||||||
type seaweedFsMounter struct {
|
type seaweedFsMounter struct {
|
||||||
bucketName string
|
bucketName string
|
||||||
driver *SeaweedFsDriver
|
filerUrl string
|
||||||
volContext map[string]string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
seaweedFsCmd = "weed"
|
seaweedFsCmd = "weed"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newSeaweedFsMounter(bucketName string, driver *SeaweedFsDriver, volContext map[string]string) (Mounter, error) {
|
func newSeaweedFsMounter(bucketName string, filer string) (Mounter, error) {
|
||||||
return &seaweedFsMounter{
|
return &seaweedFsMounter{
|
||||||
bucketName: bucketName,
|
bucketName: bucketName,
|
||||||
driver: driver,
|
filerUrl: filer,
|
||||||
volContext: volContext,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (seaweedFs *seaweedFsMounter) Mount(target string) error {
|
func (seaweedFs *seaweedFsMounter) Mount(target string) error {
|
||||||
glog.V(0).Infof("mounting %s %s to %s", seaweedFs.driver.filer, seaweedFs.bucketName, target)
|
log.Infof("mounting %s%s to %s", seaweedFs.filerUrl, seaweedFs.bucketName, target)
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
"mount",
|
"mount",
|
||||||
@ -34,29 +32,12 @@ func (seaweedFs *seaweedFsMounter) Mount(target string) error {
|
|||||||
"-umask=000",
|
"-umask=000",
|
||||||
fmt.Sprintf("-dir=%s", target),
|
fmt.Sprintf("-dir=%s", target),
|
||||||
fmt.Sprintf("-collection=%s", seaweedFs.bucketName),
|
fmt.Sprintf("-collection=%s", seaweedFs.bucketName),
|
||||||
fmt.Sprintf("-filer=%s", seaweedFs.driver.filer),
|
fmt.Sprintf("-filer=%s", seaweedFs.filerUrl),
|
||||||
fmt.Sprintf("-filer.path=/buckets/%s", seaweedFs.bucketName),
|
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)
|
err := fuseMount(target, seaweedFsCmd, args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("mount %s %s to %s: %s", seaweedFs.driver.filer, seaweedFs.bucketName, target, err)
|
log.Errorf("mount %s%s to %s: %s", seaweedFs.filerUrl, seaweedFs.bucketName, target, err)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/util/log"
|
||||||
|
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
@ -25,7 +25,7 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
|||||||
// mount the fs here
|
// mount the fs here
|
||||||
targetPath := req.GetTargetPath()
|
targetPath := req.GetTargetPath()
|
||||||
|
|
||||||
glog.V(0).Infof("NodePublishVolume volume %s to %s", volumeID, targetPath)
|
log.Infof("NodePublishVolume volume %s to %s", volumeID, targetPath)
|
||||||
|
|
||||||
// Check arguments
|
// Check arguments
|
||||||
if req.GetVolumeCapability() == nil {
|
if req.GetVolumeCapability() == nil {
|
||||||
@ -55,9 +55,7 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
|||||||
mo = append(mo, "ro")
|
mo = append(mo, "ro")
|
||||||
}
|
}
|
||||||
|
|
||||||
volContext := req.GetVolumeContext()
|
mounter, err := newMounter(volumeID, ns.Driver.filer)
|
||||||
|
|
||||||
mounter, err := newMounter(volumeID, ns.Driver, volContext)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -71,7 +69,7 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
|||||||
return nil, status.Error(codes.Internal, err.Error())
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(0).Infof("volume %s successfully mounted to %s", volumeID, targetPath)
|
log.Infof("volume %s successfully mounted to %s", volumeID, targetPath)
|
||||||
|
|
||||||
return &csi.NodePublishVolumeResponse{}, nil
|
return &csi.NodePublishVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
@ -97,7 +95,7 @@ func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ns *NodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
|
func (ns *NodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
|
||||||
glog.V(3).Infof("Using default NodeGetInfo: nodeID %s", ns.Driver.nodeID)
|
log.Tracef("Using default NodeGetInfo: nodeID %s", ns.Driver.nodeID)
|
||||||
|
|
||||||
return &csi.NodeGetInfoResponse{
|
return &csi.NodeGetInfoResponse{
|
||||||
NodeId: ns.Driver.nodeID,
|
NodeId: ns.Driver.nodeID,
|
||||||
@ -105,7 +103,7 @@ func (ns *NodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoReque
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ns *NodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
|
func (ns *NodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
|
||||||
glog.V(3).Infof("Using default NodeGetCapabilities")
|
log.Tracef("Using default NodeGetCapabilities")
|
||||||
|
|
||||||
return &csi.NodeGetCapabilitiesResponse{
|
return &csi.NodeGetCapabilitiesResponse{
|
||||||
Capabilities: []*csi.NodeServiceCapability{
|
Capabilities: []*csi.NodeServiceCapability{
|
||||||
@ -165,4 +163,4 @@ func checkMount(targetPath string) (bool, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return notMnt, nil
|
return notMnt, nil
|
||||||
}
|
}
|
||||||
@ -5,7 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/util/log"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
@ -58,19 +58,19 @@ func (s *nonBlockingGRPCServer) serve(endpoint string, ids csi.IdentityServer, c
|
|||||||
|
|
||||||
proto, addr, err := ParseEndpoint(endpoint)
|
proto, addr, err := ParseEndpoint(endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatal(err.Error())
|
log.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if proto == "unix" {
|
if proto == "unix" {
|
||||||
addr = "/" + addr
|
addr = "/" + addr
|
||||||
if err := os.Remove(addr); err != nil && !os.IsNotExist(err) {
|
if err := os.Remove(addr); err != nil && !os.IsNotExist(err) {
|
||||||
glog.Fatalf("Failed to remove %s, error: %s", addr, err.Error())
|
log.Fatalf("Failed to remove %s, error: %s", addr, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
listener, err := net.Listen(proto, addr)
|
listener, err := net.Listen(proto, addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Failed to listen: %v", err)
|
log.Fatalf("Failed to listen: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := []grpc.ServerOption{
|
opts := []grpc.ServerOption{
|
||||||
@ -89,7 +89,7 @@ func (s *nonBlockingGRPCServer) serve(endpoint string, ids csi.IdentityServer, c
|
|||||||
csi.RegisterNodeServer(server, ns)
|
csi.RegisterNodeServer(server, ns)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("Listening for connections on address: %#v", listener.Addr())
|
log.Infof("Listening for connections on address: %#v", listener.Addr())
|
||||||
|
|
||||||
server.Serve(listener)
|
server.Serve(listener)
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/util/log"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
@ -50,11 +50,11 @@ func ParseEndpoint(ep string) (string, string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
||||||
glog.V(3).Infof("GRPC %s request %+v", info.FullMethod, req)
|
log.Tracef("GRPC %s request %+v", info.FullMethod, req)
|
||||||
resp, err := handler(ctx, req)
|
resp, err := handler(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("GRPC error: %v", err)
|
log.Errorf("GRPC error: %v", err)
|
||||||
}
|
}
|
||||||
glog.V(3).Infof("GRPC %s response %+v", info.FullMethod, resp)
|
log.Tracef("GRPC %s response %+v", info.FullMethod, resp)
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user