init csi-driver-nvmf

Signed-off-by: zhouenhua <zhouenhua@bytedance.com>
This commit is contained in:
zhouenhua
2021-09-10 11:50:07 +08:00
commit 6a6ac61e01
31 changed files with 2544 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: csi-nvmf-node
labels:
app: csi-nvmf
role: node
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-nvmf-node
labels:
app: csi-nvmf
role: node
rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-nvmf-node
labels:
app: csi-nvmf
role: node
subjects:
- kind: ServiceAccount
name: csi-nvmf-node
namespace: default
roleRef:
kind: ClusterRole
name: csi-nvmf-node
apiGroup: rbac.authorization.k8s.io

View File

@@ -0,0 +1,7 @@
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi.nvmf.com
spec:
attachRequired: true
podInfoOnMount: true

View File

@@ -0,0 +1,107 @@
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: csi-nvmf-node
spec:
selector:
matchLabels:
app: csi-nvmf
role: node
template:
metadata:
labels:
app: csi-nvmf
role: node
spec:
serviceAccount: csi-nvmf-node
hostNetwork: true
containers:
- name: node-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.1.0
lifecycle:
preStop:
exec:
command: ["bin/sh", "-c", "rm -rf /registration/csi.nvmf.com \
/registration/csi.nvmf.com-reg.sock"]
env:
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
args:
- "--v=5"
- "--csi-address=/csi/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/csi.nvmf.com/csi.sock"
volumeMounts:
- name: registration-dir
mountPath: /registration
- name: socket-dir
mountPath: /csi
- name: csi-nvmf-plugin
securityContext:
privileged: true
capabilities:
add: ["SYS_ADMIN"]
allowPrivilegeEscalation: true
image: nvmfplugin:latest
imagePullPolicy: "IfNotPresent"
args:
- "--endpoint=$(CSI_ENDPOINT)"
- "--nodeid=$(NODE_ID)"
env:
- name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi.nvmf.com/csi.sock
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi.nvmf.com
- name: pods-mount-dir
mountPath: /var/lib/kubelet/pods
mountPropagation: "Bidirectional"
- name: plugin-mount-dir
mountPath: /plugin
mountPropagation: "Bidirectional"
- name: host-dev
mountPath: /dev
mountPropagation: "HostToContainer"
- name: host-sys
mountPath: /sys
- name: nvmf-tcp
mountPath: /usr/sbin/nvmf
subPath: nvmf
- name: lib-modules
mountPath: /lib/modules
readOnly: true
volumes:
- name: socket-dir
hostPath:
path: /var/lib/kubelet/plugins/csi.nvmf.com
type: DirectoryOrCreate
- name: plugin-mount-dir
hostPath:
path: /var/lib/kubelet/plugins/csi-nvmfplugin
type: DirectoryOrCreate
- name: registration-dir
hostPath:
path: /var/lib/kubelet/plugins_registry
type: DirectoryOrCreate
- name: pods-mount-dir
hostPath:
path: /var/lib/kubelet/pods
type: Directory
- name: host-dev
hostPath:
path: /dev
- name: nvmf-tcp
hostPath:
path: /usr/sbin
- name: host-sys
hostPath:
path: /sys
- name: lib-modules
hostPath:
path: /lib/modules