fix: make example available

1. fix path error in pkg/nvmf/fabrics.go
2. add nvmf kernel target setup guide
3. update example and deploy yaml

Signed-off-by: Meinhard Zhou <zhouenhua@bytedance.com>
This commit is contained in:
Meinhard Zhou
2022-08-19 18:04:40 +08:00
parent 430f2e209b
commit 411117889a
15 changed files with 288 additions and 103 deletions

View File

@@ -1,36 +0,0 @@
---
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,69 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: csi-nvmf-controller
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
app: csi-nvmf-controller
template:
metadata:
labels:
app: csi-nvmf-controller
spec:
serviceAccount: csi-nvmf-controller-sa
containers:
- name: csi-provisioner
image: quay.io/k8scsi/csi-provisioner:v1.3.0
imagePullPolicy: "IfNotPresent"
args:
- "--csi-address=$(ADDRESS)"
- "--v=2"
env:
- name: ADDRESS
value: /csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: csi-attacher
image: quay.io/k8scsi/csi-attacher:v1.2.0
imagePullPolicy: "IfNotPresent"
args:
- "--v=2"
- "--csi-address=$(ADDRESS)"
- "--leader-election=false"
env:
- name: ADDRESS
value: /csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: csi-nvmf-plugin
image: nvmfplugin:latest
imagePullPolicy: "IfNotPresent"
args:
- "--endpoint=$(CSI_ENDPOINT)"
- "--IsControllerServer=true"
env:
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: volume-map
mountPath: /var/lib/kubelet/plugins/csi.nvmf.com/volumes
mountPropagation: "HostToContainer"
volumes:
- name: socket-dir
emptyDir: {}
- name: volume-map
hostPath:
path: /var/lib/kubelet/plugins/csi.nvmf.com/volumes
type: DirectoryOrCreate

View File

@@ -2,19 +2,19 @@ kind: DaemonSet
apiVersion: apps/v1
metadata:
name: csi-nvmf-node
namespace: kube-system
spec:
selector:
matchLabels:
app: csi-nvmf
role: node
app: csi-nvmf-node
template:
metadata:
labels:
app: csi-nvmf
role: node
app: csi-nvmf-node
spec:
serviceAccount: csi-nvmf-node
serviceAccount: csi-nvmf-node-sa
hostNetwork: true
dnsPolicy: Default
containers:
- name: node-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.1.0
@@ -29,7 +29,7 @@ spec:
fieldRef:
fieldPath: spec.nodeName
args:
- "--v=5"
- "--v=2"
- "--csi-address=/csi/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/csi.nvmf.com/csi.sock"
volumeMounts:
@@ -51,7 +51,7 @@ spec:
- "--nodeid=$(NODE_ID)"
env:
- name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi.nvmf.com/csi.sock
value: unix:///var/lib/kubelet/plugins/csi.nvmf.com/csi.sock
- name: NODE_ID
valueFrom:
fieldRef:
@@ -62,17 +62,11 @@ spec:
- 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
@@ -81,10 +75,6 @@ spec:
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
@@ -96,9 +86,6 @@ spec:
- name: host-dev
hostPath:
path: /dev
- name: nvmf-tcp
hostPath:
path: /usr/sbin
- name: host-sys
hostPath:
path: /sys

View File

@@ -0,0 +1,86 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: csi-nvmf-controller-sa
namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: csi-nvmf-node-sa
namespace: kube-system
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nvmf-external-provisioner-role
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- 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: ["storage.k8s.io"]
resources: ["csinodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nvmf-external-provisioner-role
subjects:
- kind: ServiceAccount
name: csi-nvmf-controller-sa
namespace: kube-system
roleRef:
kind: ClusterRole
name: nvmf-external-provisioner-role
apiGroup: rbac.authorization.k8s.io
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nvmf-external-attacher-role
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: ["storage.k8s.io"]
resources: ["csinodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
verbs: ["get", "list", "watch", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-nvmf-attacher-binding
subjects:
- kind: ServiceAccount
name: csi-nvmf-controller-sa
namespace: kube-system
roleRef:
kind: ClusterRole
name: nvmf-external-attacher-role
apiGroup: rbac.authorization.k8s.io