Skip to content

Commit

Permalink
Helm chart refactoring
Browse files Browse the repository at this point in the history
* Separate NodeServer and ControllerServer
* Allow leader election for sidecars and replica count fot controller component
* Liveness probes
* Allow disabling attacher, cause this functionality is not used in reality
  • Loading branch information
kvaster authored and chrislusf committed Aug 7, 2023
1 parent 70bb14d commit f294627
Show file tree
Hide file tree
Showing 7 changed files with 640 additions and 250 deletions.
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
2 changes: 1 addition & 1 deletion deploy/helm/seaweedfs-csi-driver/templates/csidriver.yaml
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
139 changes: 101 additions & 38 deletions deploy/helm/seaweedfs-csi-driver/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,46 +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 }}"
- "--node"
- "--controller"
- "--attacher"
- --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 @@ -95,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 @@ -118,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

0 comments on commit f294627

Please sign in to comment.