Use helm for install

dev
Ruakij 4 months ago
parent a3414c37dd
commit 629fbef620

@ -4,6 +4,12 @@
This is a repository for webdav csi driver, csi plugin name: `webdav.csi.io`. This driver supports dynamic provisioning of Persistent Volumes via Persistent Volume Claims by creating a new sub directory under webdav server. This is a repository for webdav csi driver, csi plugin name: `webdav.csi.io`. This driver supports dynamic provisioning of Persistent Volumes via Persistent Volume Claims by creating a new sub directory under webdav server.
### Deploy CSI
#### With Helm
```bash
helm install -n webdav-csi-driver webdav-csi-driver helm/
```
### Quick start with kind ### Quick start with kind
#### Build plugin image #### Build plugin image
@ -24,10 +30,7 @@ kind load docker-image registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.
kind load docker-image localhost:5000/webdavplugin:v0.0.1 kind load docker-image localhost:5000/webdavplugin:v0.0.1
``` ```
### Deploy CSI
```bash
kubectl apply -f deploy/
```
### Tests ### Tests
```bash ```bash

@ -0,0 +1,4 @@
apiVersion: v2
name: webdav-csi-driver
description: A Helm chart for deploying CSI WebDAV Storage Driver
version: 0.0.1

@ -1,24 +1,23 @@
---
kind: Deployment
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment
metadata: metadata:
name: csi-webdav-controller name: webdav-csi-controller
namespace: kube-system namespace: {{ .Release.Namespace }}
spec: spec:
replicas: 1 replicas: {{ .Values.controller.replicas }}
selector: selector:
matchLabels: matchLabels:
app: csi-webdav-controller app: webdav-csi-controller
template: template:
metadata: metadata:
labels: labels:
app: csi-webdav-controller app: webdav-csi-controller
spec: spec:
hostNetwork: true # controller also needs to mount webdav to create dir hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet # available values: Default, ClusterFirstWithHostNet, ClusterFirst dnsPolicy: ClusterFirstWithHostNet
serviceAccountName: webdav-csi-sa serviceAccountName: webdav-csi-sa
nodeSelector: nodeSelector:
kubernetes.io/os: linux # add "kubernetes.io/role: master" to run controller on master node kubernetes.io/os: linux
priorityClassName: system-cluster-critical priorityClassName: system-cluster-critical
securityContext: securityContext:
seccompProfile: seccompProfile:
@ -35,8 +34,8 @@ spec:
effect: "NoSchedule" effect: "NoSchedule"
containers: containers:
- name: csi-provisioner - name: csi-provisioner
image: registry.k8s.io/sig-storage/csi-provisioner:v3.6.2 image: {{ .Values.csiProvisioner.image.name }}:{{ .Values.csiProvisioner.image.tag }}
imagePullPolicy: IfNotPresent imagePullPolicy: {{ .Values.csiProvisioner.image.pullPolicy }}
args: args:
- "-v=2" - "-v=2"
- "--csi-address=$(ADDRESS)" - "--csi-address=$(ADDRESS)"
@ -52,13 +51,13 @@ spec:
name: socket-dir name: socket-dir
resources: resources:
limits: limits:
memory: 400Mi memory: {{ .Values.controller.resources.limits.memory }}
requests: requests:
cpu: 10m cpu: {{ .Values.controller.resources.requests.cpu }}
memory: 20Mi memory: {{ .Values.controller.resources.requests.memory }}
- name: liveness-probe - name: liveness-probe
image: registry.k8s.io/sig-storage/livenessprobe:v2.11.0 image: {{ .Values.livenessProbe.image.name }}:{{ .Values.livenessProbe.image.tag }}
imagePullPolicy: IfNotPresent imagePullPolicy: {{ .Values.livenessProbe.image.pullPolicy }}
args: args:
- --csi-address=/csi/csi.sock - --csi-address=/csi/csi.sock
- --probe-timeout=3s - --probe-timeout=3s
@ -74,8 +73,8 @@ spec:
cpu: 10m cpu: 10m
memory: 20Mi memory: 20Mi
- name: webdav - name: webdav
image: localhost:5000/webdavplugin:v0.0.1 image: {{ .Values.controller.image.name }}:{{ .Values.controller.image.tag }}
imagePullPolicy: IfNotPresent imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
securityContext: securityContext:
privileged: true privileged: true
capabilities: capabilities:
@ -112,10 +111,10 @@ spec:
name: socket-dir name: socket-dir
resources: resources:
limits: limits:
memory: 200Mi memory: {{ .Values.controller.resources.limits.memory }}
requests: requests:
cpu: 10m cpu: {{ .Values.controller.resources.requests.cpu }}
memory: 20Mi memory: {{ .Values.controller.resources.requests.memory }}
volumes: volumes:
- name: pods-mount-dir - name: pods-mount-dir
hostPath: hostPath:

@ -0,0 +1,13 @@
{{- if .Values.defaultStorageClass }}
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ .Values.defaultStorageClass.name }}
provisioner: webdav.csi.io
parameters:
{{- toYaml .Values.defaultStorageClass.parameters | nindent 2 }}
reclaimPolicy: {{ .Values.defaultStorageClass.reclaimPolicy }}
volumeBindingMode: {{ .Values.defaultStorageClass.volumeBindingMode }}
mountOptions:
{{- toYaml .Values.defaultStorageClass.mountOptions | nindent 2 }}
{{- end }}

@ -1,4 +1,3 @@
---
apiVersion: storage.k8s.io/v1 apiVersion: storage.k8s.io/v1
kind: CSIDriver kind: CSIDriver
metadata: metadata:

@ -1,9 +1,8 @@
---
kind: DaemonSet
apiVersion: apps/v1 apiVersion: apps/v1
kind: DaemonSet
metadata: metadata:
name: csi-webdav-node name: webdav-csi-node
namespace: kube-system namespace: {{ .Release.Namespace }}
spec: spec:
updateStrategy: updateStrategy:
rollingUpdate: rollingUpdate:
@ -11,14 +10,14 @@ spec:
type: RollingUpdate type: RollingUpdate
selector: selector:
matchLabels: matchLabels:
app: csi-webdav-node app: webdav-csi-node
template: template:
metadata: metadata:
labels: labels:
app: csi-webdav-node app: webdav-csi-node
spec: spec:
hostNetwork: true # original webdav connection would be broken without hostNetwork setting hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet # available values: Default, ClusterFirstWithHostNet, ClusterFirst dnsPolicy: ClusterFirstWithHostNet
serviceAccountName: webdav-csi-sa serviceAccountName: webdav-csi-sa
priorityClassName: system-node-critical priorityClassName: system-node-critical
securityContext: securityContext:
@ -30,8 +29,8 @@ spec:
- operator: "Exists" - operator: "Exists"
containers: containers:
- name: liveness-probe - name: liveness-probe
image: registry.k8s.io/sig-storage/livenessprobe:v2.11.0 image: {{ .Values.livenessProbe.image.name }}:{{ .Values.livenessProbe.image.tag }}
imagePullPolicy: IfNotPresent imagePullPolicy: {{ .Values.livenessProbe.image.pullPolicy }}
args: args:
- --csi-address=/csi/csi.sock - --csi-address=/csi/csi.sock
- --probe-timeout=3s - --probe-timeout=3s
@ -63,7 +62,7 @@ spec:
timeoutSeconds: 15 timeoutSeconds: 15
env: env:
- name: DRIVER_REG_SOCK_PATH - name: DRIVER_REG_SOCK_PATH
value: /var/lib/kubelet/plugins/csi-webdavplugin/csi.sock value: /var/lib/kubelet/plugins/webdav-csiplugin/csi.sock
- name: KUBE_NODE_NAME - name: KUBE_NODE_NAME
valueFrom: valueFrom:
fieldRef: fieldRef:
@ -85,8 +84,8 @@ spec:
capabilities: capabilities:
add: ["SYS_ADMIN"] add: ["SYS_ADMIN"]
allowPrivilegeEscalation: true allowPrivilegeEscalation: true
image: localhost:5000/webdavplugin:v0.0.1 image: {{ .Values.node.image.name }}:{{ .Values.node.image.tag }}
imagePullPolicy: IfNotPresent imagePullPolicy: {{ .Values.node.image.pullPolicy }}
args: args:
- "-v=5" - "-v=5"
- "--nodeid=$(NODE_ID)" - "--nodeid=$(NODE_ID)"
@ -110,7 +109,6 @@ spec:
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 10 timeoutSeconds: 10
periodSeconds: 30 periodSeconds: 30
imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /csi mountPath: /csi
@ -119,14 +117,14 @@ spec:
mountPropagation: "Bidirectional" mountPropagation: "Bidirectional"
resources: resources:
limits: limits:
memory: 300Mi memory: {{ .Values.node.resources.limits.memory }}
requests: requests:
cpu: 10m cpu: {{ .Values.node.resources.requests.cpu }}
memory: 20Mi memory: {{ .Values.node.resources.requests.memory }}
volumes: volumes:
- name: socket-dir - name: socket-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/csi-webdavplugin path: /var/lib/kubelet/plugins/webdav-csiplugin
type: DirectoryOrCreate type: DirectoryOrCreate
- name: pods-mount-dir - name: pods-mount-dir
hostPath: hostPath:

@ -1,9 +1,8 @@
---
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: webdav-csi-sa name: webdav-csi-sa
namespace: kube-system namespace: {{ .Release.Namespace }}
--- ---
kind: ClusterRole kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -42,7 +41,7 @@ metadata:
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: webdav-csi-sa name: webdav-csi-sa
namespace: kube-system namespace: {{ .Release.Namespace }}
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: webdav-csi-cr name: webdav-csi-cr

@ -0,0 +1,50 @@
controller:
replicas: 1
image:
name: ghcr.io/ruakij/webdav-csi-driver
tag: dev
pullPolicy: Always
resources:
limits:
memory: 200Mi
requests:
cpu: 10m
memory: 20Mi
node:
image:
name: ghcr.io/ruakij/webdav-csi-driver
tag: dev
pullPolicy: Always
resources:
limits:
memory: 300Mi
requests:
cpu: 10m
memory: 20Mi
livenessProbe:
image:
name: registry.k8s.io/sig-storage/livenessprobe
tag: v2.11.0
pullPolicy: IfNotPresent
csiProvisioner:
image:
name: registry.k8s.io/sig-storage/csi-provisioner
tag: v3.6.2
pullPolicy: IfNotPresent
# Configuration for the default storage class
defaultStorageClass: {}
# name: "webdav"
# parameters:
# # alist folder webdav address
# share: http://ip:port/dav/media
# csi.storage.k8s.io/provisioner-secret-name: "webdav-secrect"
# csi.storage.k8s.io/provisioner-secret-namespace: "default"
# csi.storage.k8s.io/node-publish-secret-name: "webdav-secrect"
# csi.storage.k8s.io/node-publish-secret-namespace: "default"
# reclaimPolicy: "Delete"
# volumeBindingMode: Immediate
# mountOptions: {}
Loading…
Cancel
Save