Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Driver refactoring and cleanup, part 2 #132

Merged
merged 11 commits into from
Aug 7, 2023
10 changes: 9 additions & 1 deletion cmd/seaweedfs-csi-driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import (
)

var (
runNode = flag.Bool("node", false, "run node server")
runController = flag.Bool("controller", false, "run controller server")
enableAttacher = flag.Bool("attacher", false, "enable attacher")

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")
Expand Down Expand Up @@ -53,7 +57,11 @@ func main() {

glog.Infof("connect to filer %s", *filer)

drv := driver.NewSeaweedFsDriver(*filer, *nodeID, *endpoint)
drv := driver.NewSeaweedFsDriver(*filer, *nodeID, *endpoint, *enableAttacher)

drv.RunNode = *runNode
drv.RunController = *runController

drv.ConcurrentWriters = *concurrentWriters
drv.CacheCapacityMB = *cacheCapacityMB
drv.CacheDir = *cacheDir
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/seaweedfs-csi-driver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: seaweedfs-csi-driver
description: A Helm chart for Kubernetes CSI backed by a SeaweedFS cluster
type: application
version: 0.1.3
version: 0.2.0
appVersion: latest
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ kind: CSIDriver
metadata:
name: {{ .Values.driverName }}
spec:
attachRequired: true
attachRequired: {{ .Values.csiAttacher.enabled }}
podInfoOnMount: true
Original file line number Diff line number Diff line change
Expand Up @@ -31,43 +31,21 @@ spec:
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
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: {{ .Values.node.volumes.plugins_dir }}/{{ .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/
# SeaweedFs Plugin (node)
- name: csi-seaweedfs-plugin
securityContext:
{{ toYaml .Values.seaweedfsCsiPlugin.securityContext | nindent 12 }}
securityContext: {{ toYaml .Values.seaweedfsCsiPlugin.securityContext | nindent 12 }}
image: {{.Values.seaweedfsCsiPlugin.image }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
args:
- "--endpoint=$(CSI_ENDPOINT)"
- "--filer=$(SEAWEEDFS_FILER)"
- "--nodeid=$(NODE_ID)"
- "--cacheDir=/var/cache/seaweedfs"
- "--dataLocality={{ .Values.dataLocality }}"
- --endpoint=$(CSI_ENDPOINT)
- --filer=$(SEAWEEDFS_FILER)
- --nodeid=$(NODE_ID)
- --cacheDir=/var/cache/seaweedfs
- --dataLocality={{ .Values.dataLocality }}
{{- if .Values.node.injectTopologyInfoFromNodeLabel.enabled }}
- "--dataCenter=$(DATACENTER)"
- --dataCenter=$(DATACENTER)
{{- end }}
- --node
env:
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
Expand All @@ -92,12 +70,32 @@ spec:
- name: WEED_GRPC_CA
value: /var/run/secrets/app/tls/ca.crt
{{- end }}
{{- if .Values.logVerbosity }}
{{- with .Values.logVerbosity }}
- name: WEED_V
value: {{ .Values.logVerbosity | quote }}
value: {{ . | quote }}
{{- end }}
ports:
- containerPort: 9808
name: healthz
protocol: TCP
{{- with .Values.node.livenessProbe }}
livenessProbe:
httpGet:
path: /healthz
port: healthz
{{- with .failureThreshold }}
failureThreshold: {{ . }}
{{- end }}
{{- with .initialDelaySeconds }}
initialDelaySeconds: {{ . }}
{{- end }}
{{- with .timeoutSeconds }}
timeoutSeconds: {{ . }}
{{- end }}
resources:
{{ toYaml .Values.seaweedfsCsiPlugin.resources | nindent 12 }}
{{- with .periodSeconds }}
periodSeconds: {{ . }}
{{- end }}
{{- end }}
volumeMounts:
- name: plugin-dir
mountPath: /csi
Expand All @@ -115,6 +113,74 @@ spec:
{{- end }}
- name: cache
mountPath: /var/cache/seaweedfs
resources: {{ toYaml .Values.node.resources | nindent 12 }}

# driver registrar
- name: driver-registrar
image: {{ .Values.csiNodeDriverRegistrar.image }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
args:
- --csi-address=$(ADDRESS)
- --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)
- --http-endpoint=:9809
#- --v=5
env:
- name: ADDRESS
value: /csi/csi.sock
- name: DRIVER_REG_SOCK_PATH
value: {{ .Values.node.volumes.plugins_dir }}/{{ .Values.driverName }}/csi.sock
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{- with .Values.csiNodeDriverRegistrar.livenessProbe }}
ports:
- containerPort: 9809
name: healthz
livenessProbe:
httpGet:
path: /healthz
port: healthz
{{- with .failureThreshold }}
failureThreshold: {{ . }}
{{- end }}
{{- with .initialDelaySeconds }}
initialDelaySeconds: {{ . }}
{{- end }}
{{- with .timeoutSeconds }}
timeoutSeconds: {{ . }}
{{- end }}
{{- with .periodSeconds }}
periodSeconds: {{ . }}
{{- end }}
{{- end }}
volumeMounts:
- name: plugin-dir
mountPath: /csi/
- name: registration-dir
mountPath: /registration/
resources: {{ toYaml .Values.csiNodeDriverRegistrar.resources | nindent 12 }}

# liveness probe
{{- if .Values.node.livenessProbe }}
- name: csi-liveness-probe
image: {{ .Values.csiLivenessProbe.image }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
args:
- --csi-address=$(ADDRESS)
- --http-endpoint=:9808
env:
- name: ADDRESS
value: /csi/csi.sock
ports:
- containerPort: 9808
name: livenessprobe
volumeMounts:
- name: plugin-dir
mountPath: /csi
resources: {{ toYaml .Values.csiLivenessProbe.resources | nindent 12 }}
{{- end }}

volumes:
- name: registration-dir
hostPath:
Expand Down
Loading
Loading