kubernetes-csi / csi-driver-iscsi Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
https://github.com/kubernetes-csi/csi-driver-iscsi/runs/4329568959?check_suite_focus=true
run golangci-lint
Running [/home/runner/golangci-lint-1.29.0-linux-amd64/golangci-lint run --out-format=github-actions -E=gofmt,golint,misspell --timeout=30m0s] in [] ...
Error: Error return value of `iscsiLib.Disconnect` is not checked (errcheck)
Error: Error return value of `server.Serve` is not checked (errcheck)
Error: Error return value of `flag.Set` is not checked (errcheck)
Error: Error return value of `flag.CommandLine.Parse` is not checked (errcheck)
Error: Error return value of `cmd.MarkPersistentFlagRequired` is not checked (errcheck)
Error: Error return value of `cmd.MarkPersistentFlagRequired` is not checked (errcheck)
Error: exported func NewDriver returns unexported type *github.com/kubernetes-csi/csi-driver-iscsi/pkg/iscsi.driver, which can be annoying to use (golint)
Error: exported func NewNodeServer returns unexported type *github.com/kubernetes-csi/csi-driver-iscsi/pkg/iscsi.nodeServer, which can be annoying to use (golint)
Error: type name will be used as iscsi.ISCSIUtil by other packages, and that stutters; consider calling this Util (golint)
Error: `ns` is unused (structcheck)
Error: S1023: redundant `return` statement (gosimple)
Error: S1023: redundant `return` statement (gosimple)
Error: issues found
Ran golangci-lint in 109779ms
Issue
There seems to be bug that lun value provided by PV will be ignored.
Problem seems to be in function buildISCSIConnector (pkg/iscsi/iscsi.go) as it will not give lun value for connector.
The in pkg/iscsi/iscsi_util.go AttachDisk is called with that connector and it will fail if lun is something else than 0. Zero comes form golang default value for int.
Solution
Issue might got resolved if buildISCSIConnector would give the lun value for connector struct. However I am not sure if there is also something else missing as connector has many parameters but only few of those are populated.
/bug
For example:
If we use iscsi device for a pod, when the host rebooting with pod, Won't it get hangs?
Hi ,
I need some support . I used example scripts to attach one pod with volumes using csi-driver-iscsi. But I am seeing the following error:
Normal Scheduled 9m4s default-scheduler Successfully assigned default/nginx to worker3
Warning FailedMount 7m1s kubelet Unable to attach or mount volumes: unmounted volumes=[iscsi-volume], unattached volumes=[default-token-lpfwk iscsi-volume]: timed out waiting for the condition
Warning FailedMount 49s (x12 over 9m4s) kubelet MountVolume.SetUp failed for volume "iscsiplugin-pv" : rpc error: code = Internal desc = format of disk "/dev/sdb" failed: type:("ext4") target:("/var/lib/kubelet/pods/3c4c4497-2867-42bc-917a-1041fa5dfc09/volumes/kubernetes.io~csi/iscsiplugin-pv/mount") options:("rw,defaults") errcode:(executable file not found in $PATH) output:()
Warning FailedMount 10s (x3 over 4m44s) kubelet Unable to attach or mount volumes: unmounted volumes=[iscsi-volume], unattached volumes=[iscsi-volume default-token-lpfwk]: timed out waiting for the condition
Can anyone point out what executable is required?
Wajih
What happened:
node pod logs error desc = chroot: failed to run command 'iscsiadm': No such file or directory
What you expected to happen:
How to reproduce it:
Anything else we need to know?:
[root@cp-dev-2 ~]# kubectl -n kube-system logs -f csi-iscsi-node-6pgt9 iscsi
I0330 17:56:50.193869 1 driver.go:43] driver: iscsi.csi.k8s.io version: 0.2.0 nodeID: 192.168.39.211 endpoint: unix:///csi/csi.sock
I0330 17:56:50.193962 1 driver.go:84] enabling volume access mode: SINGLE_NODE_WRITER
I0330 17:56:50.193987 1 driver.go:95] enabling controller service capability: UNKNOWN
I0330 17:56:50.234056 1 server.go:103] listening for connections on address: &net.UnixAddr{Name:"//csi/csi.sock", Net:"unix"}
I0330 17:56:50.511513 1 utils.go:63] GRPC call: /csi.v1.Identity/GetPluginInfo
I0330 17:56:50.511542 1 utils.go:64] GRPC request: {}
I0330 17:56:50.516116 1 identityserver.go:32] using default GetPluginInfo
I0330 17:56:50.516133 1 utils.go:69] GRPC response: {"name":"iscsi.csi.k8s.io","vendor_version":"0.2.0"}
I0330 17:56:50.746464 1 utils.go:63] GRPC call: /csi.v1.Identity/GetPluginInfo
I0330 17:56:50.746487 1 utils.go:64] GRPC request: {}
I0330 17:56:50.746541 1 identityserver.go:32] using default GetPluginInfo
I0330 17:56:50.746547 1 utils.go:69] GRPC response: {"name":"iscsi.csi.k8s.io","vendor_version":"0.2.0"}
I0330 17:56:51.205393 1 utils.go:63] GRPC call: /csi.v1.Node/NodeGetInfo
I0330 17:56:51.205425 1 utils.go:64] GRPC request: {}
I0330 17:56:51.205509 1 utils.go:69] GRPC response: {"node_id":"192.168.39.211"}
I0330 17:56:57.451445 1 utils.go:63] GRPC call: /csi.v1.Node/NodeGetCapabilities
I0330 17:56:57.451466 1 utils.go:64] GRPC request: {}
I0330 17:56:57.451513 1 utils.go:69] GRPC response: {"capabilities":[{"Type":{"Rpc":{}}}]}
I0330 17:56:57.452618 1 utils.go:63] GRPC call: /csi.v1.Node/NodePublishVolume
I0330 17:56:57.452630 1 utils.go:64] GRPC request: {"target_path":"/var/lib/kubelet/pods/c51982c1-03af-4362-ab59-bf7c943c1594/volumes/kubernetes.io~csi/iscsiplugin-pv/mount","volume_capability":{"AccessType":{"Mount":{}},"access_mode":{"mode":1}},"volume_context":{"discoveryCHAPAuth":"false","iqn":"iqn.2022-03.local.alauda.server:disk1","iscsiInterface":"default","lun":"0","portals":"[]","sessionCHAPAuth":"false","targetPortal":"192.168.39.212:3260"},"volume_id":"iscsi-data-id"}
I0330 17:56:57.453002 1 mount_linux.go:163] Detected OS without systemd
E0330 17:56:57.454656 1 utils.go:67] GRPC error: rpc error: code = Internal desc = chroot: failed to run command 'iscsiadm': No such file or directory
Environment:
kubectl version
):uname -a
):Can this be configured to dynamically prepare Storageclass?
Is your feature request related to a problem?/Why is this needed
At this moment, according to examples, targetd parameters can be only placed in PV, to reduce burden we'd like to have it in one place
Describe the solution you'd like in detail
Ability to have iscsi connection details in one place, ie. StorageClass in similar way like old targetd iscsi-provisioner had:
parameters:
chapAuthDiscovery: 'false'
chapAuthSession: 'false'
fsType: ext4
initiators: >-
iqn.x.y.z:node1,iqn.x.y.z:node2,iqn.x.y.z:node3,iqn.x.y.z:node4
iqn: iqn.x.y.z:targetd
targetPortal: 192.x.y.z:3260
volumeGroup: lvm-iscsi
Describe alternatives you've considered
Old targetd iscsi-provisioner
Additional context
@j-griffith can the iscsi lib be used for this driver?
Add the follow information:
release-0.1
branch for kubernetes-csi/csi-driver-iscsiWhat happened:
In kubernetes/k8s.io#3345 (comment) we found out that the v0.1.0 image was overwritten, once an image is released it should be considered immutable and we shouldn't overwrite the tag, if there are critical bug fixes I think we should bump the image.
I'm not sure about the fix, we could:
/cc @msau42
What happened: I ran curl -skSL https://raw.githubusercontent.com/kubernetes-csi/csi-driver-iscsi/master/deploy/install-driver.sh | bash -s master --
on a Pi cluster
The pods liveness-probe
and node-driver-registrar
started correctly, but "iscsi" goes into CrashLoopBackOff state and logs return an exec /iscsiplugin: exec format error
message
(note that the image loaded is iscsiplugin:arm64-linux-canary
because I set it manually ; canary
is the one that's running by default, and I've also tried arm-linux-canary
)
What you expected to happen: pod iscsi should start
How to reproduce it: simply install using the command above on a Raspberry Pi cluster
Anything else we need to know?: it works correctly on x86_64 nodes
Environment:
kubectl version
): v1.27.4+k3s1uname -a
): 5.15.32-v8++ go build -a -ldflags ' -X main.version=991e8fb04982913f68afdaaf5af265fefc715e1b -extldflags "-static"' -o ./bin/iscsiplugin ./cmd/iscsiplugin
# github.com/kubernetes-csi/csi-driver-iscsi/pkg/iscsi
pkg/iscsi/driver.go:76:22: cannot use NewControllerServer(d) (type *ControllerServer) as type csi.ControllerServer in argument to s.Start:
*ControllerServer does not implement csi.ControllerServer (missing ControllerGetVolume method)
note: module requires Go 1.16
Building iscsiplugin for GOOS= GOARCH= failed, see error(s) above.
make: *** [release-tools/build.make:81: build-iscsiplugin] Error 1
Hello,
I'm trying to install this plugin on one of my k8s development cluster. But I'm facing several issues :
iscsiplugin:latest
doesn't exists, so I have to build and push it before updating .yaml
files in accordance.MountVolume.SetUp failed for volume "lib-modules" : hostPath type check failed: /lib/modules is not a directory
while describing one of the pods, even if the folder /lib/modules
exists on the host. Removing type: Directory
in the volume definition fixes the issue.iscsid: Can not bind IPC socket
from iscsid -f
command. I tried to add hostIPC: true
to the daemonset's pods spec but it doesn't seems to fix anything. (EDIT: uninstalling open-iscsi package on the host fixed it, which is actually the expected behavior).I'm not sure if those issues are real issues or if they are coming from me not using the plugin in the proper way. Anyway, I think this repository is missing some installation instructions and that the installation experience could be improved (for exemple by using a helm chart, or having the image publicly available on docker hub).
[root@hchiramm csi-driver-iscsi]# kubectl logs csi-iscsi-node-drtws -c iscsi
Error: invalid argument "5 --nodeid=127.0.0.1 --endpoint=unix:///csi/csi.sock" for "-v, --v" flag: strconv.ParseInt: parsing "5 --nodeid=127.0.0.1 --endpoint=unix:///csi/csi.sock": invalid syntax
Usage:
iscsi.csi.k8s.io [flags]
Flags:
--add_dir_header If true, adds the file directory to the header of the log messages
--alsologtostderr log to standard error as well as files
--endpoint string CSI endpoint
-h, --help help for iscsi.csi.k8s.io
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log_dir string If non-empty, write log files in this directory
--log_file string If non-empty, use this log file
--log_file_max_size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
--logtostderr log to standard error instead of files (default true)
--nodeid string node id
--one_output If true, only write logs to their native severity level (vs also writing to each lower severity level)
--skip_headers If true, avoid header prefixes in the log messages
--skip_log_headers If true, avoid headers when opening log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level number for the log level verbosity
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
invalid argument "5 --nodeid=127.0.0.1 --endpoint=unix:///csi/csi.sock" for "-v, --v" flag: strconv.ParseInt: parsing "5 --nodeid=127.0.0.1 --endpoint=unix:///csi/csi.sock": invalid syntax[root@hchiramm csi-driver-iscsi]#
Image:
[root@hchiramm csi-driver-iscsi]# kubectl describe pod csi-iscsi-node-drtws |grep -i image
Image: k8s.gcr.io/sig-storage/livenessprobe:v2.1.0
Image ID: docker-pullable://k8s.gcr.io/sig-storage/livenessprobe@sha256:b0a9eb3e489150d79bff1c97681f34c579e6fcb1a4ed0289c19180eb83ebc83d
Image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.1.0
Image ID: docker-pullable://k8s.gcr.io/sig-storage/csi-node-driver-registrar@sha256:a61d309da54641db41fb8f35718f744e9f730d4d0384f8c4b186ddc9f06cbd5f
Image: gcr.io/k8s-staging-sig-storage/iscsiplugin:canary
Image ID: docker-pullable://gcr.io/k8s-staging-sig-storage/iscsiplugin@sha256:127d8f5422b291d54eb9119eb9c1350e288325b942fb52c3b80e1750f4b2de9d
Normal Pulled 3m15s kubelet Container image "k8s.gcr.io/sig-storage/livenessprobe:v2.1.0" already present on machine
Normal Pulled 3m15s kubelet Container image "k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.1.0" already present on machine
Normal Pulled 2m33s (x4 over 3m14s) kubelet Container image "gcr.io/k8s-staging-sig-storage/iscsiplugin:canary" already present on machine
[root@hchiramm csi-driver-iscsi]#
This tracks the requirement of E2E/CI for the iscsi CSI driver. It is required before we have a GA release here to make sure the driver is stable and production ready!
Currently we don't have a containerized e2e test solution for this iscsi CSI driver.
At present, csi-driver-iscsi does not support or lack windows version support. Considering csi-proxy does have named pipe mounts which support ISCSI operations, its good to have windows version of this driver .
csi-proxy: https://github.com/kubernetes-csi/csi-proxy/blob/master/README.md
- name: csi-proxy-iscsi-pipe
hostPath:
path: \\.\pipe\csi-proxy-iscsi-v1beta1
type: ""
csi-proxy expose APIs for windows mounter like below:
rpc AddTargetPortal(AddTargetPortalRequest)
returns (AddTargetPortalResponse) {}
// DiscoverTargetPortal initiates discovery on an iSCSI target network address
// and returns discovered IQNs.
rpc DiscoverTargetPortal(DiscoverTargetPortalRequest)
returns (DiscoverTargetPortalResponse) {}
...
// ConnectTarget connects to an iSCSI Target
rpc ConnectTarget(ConnectTargetRequest) returns (ConnectTargetResponse) {}
// DisconnectTarget disconnects from an iSCSI Target
rpc DisconnectTarget(DisconnectTargetRequest)
returns (DisconnectTargetResponse) {}
The ISCSI CSI driver test reflect the steps with passing NODE PUBLISH operation to CSI driver via CSC as seen below:
$ csc node publish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/iscsi --attrib targetPortal=$ISCSI_TARGET --attrib iqn=$IQN --attrib lun=<lun-id> iscsitestvol
But the attrib
flag does not work anymore. Any replacement for the same ?
csi-driver-iscsi/pkg/iscsi/iscsi_util.go
Line 83 in 12d5f01
If there is only one worker node, when the pod rebuilding, the NodePublishVolume will be called first, and then the NodeUnpublishVolume will be called after the NodePublishVolume. Because of every times the pod rebuilding the targetPath is different, We cant't judge whether the volume is used, when the NodeUnpublishVolume is called, the cnt is always 1, it will logout, the connection between volume and pod will lost.
I tried to test driver using instructions in README but it fails. Please scroll to the end to see Error message on the driver side. How to I get more details about the error?
test@dsib1093:~/go/bin$ csc node publish -e tcp://127.0.0.1:10000 -l debug --attrib targetPortal=$ISCSI_TARGET,iqn=$IQN,lun=$LUN iscsitestvol
DEBU[0000] assigned the root context
DEBU[0000] mounting volume request="{iscsitestvol map[] false map[] map[iqn:iqn.1994-05.com.Max:CLFN3:0359-1F24 lun:0 targetPortal:192.168.208.159] {} [] 0}"
DEBU[0000] parsed endpoint info addr="127.0.0.1:10000" proto=tcp timeout=1m0s
unexpected end of JSON input
Driver side:
I0322 09:23:13.424043 320504 utils.go:97] GRPC call: /csi.v1.Node/NodePublishVolume
I0322 09:23:13.424062 320504 utils.go:98] GRPC request: {"volume_context":{"iqn":"iqn.1994-05.com.Max:CLFN3:0359-1F24","lun":"1","targetPortal":"192.168.208.159"},"volume_id":"iscsitestvol"}
E0322 09:23:13.424527 320504 utils.go:101] GRPC error: rpc error: code = Internal desc = unexpected end of JSON input
update of csi-lib-iscsi fails to compile:
[hchiramm@localhost csi-driver-iscsi]$ grep -iR "github.com/kubernetes-csi/csi-lib-iscsi" * --color
go.mod: github.com/kubernetes-csi/csi-lib-iscsi v0.0.0-20200629134124-4eea777a2dc3
go.sum:github.com/kubernetes-csi/csi-lib-iscsi v0.0.0-20200629134124-4eea777a2dc3 h1:wXFH8cdGsfC7gibAZfolMASqCLsuqt3cbiy44hWkcLU=
go.sum:github.com/kubernetes-csi/csi-lib-iscsi v0.0.0-20200629134124-4eea777a2dc3/go.mod h1:4lv40oTBE8S2UI8H/w0/9GYPPv96vXIwVd/AhU0+ta0=
+ go build -a -ldflags ' -X main.version=991e8fb04982913f68afdaaf5af265fefc715e1b -extldflags "-static"' -o ./bin/iscsiplugin ./cmd/iscsiplugin
# github.com/kubernetes-csi/csi-lib-iscsi/iscsi
vendor/github.com/kubernetes-csi/csi-lib-iscsi/iscsi/iscsi.go:379:7: no new variables on left side of :=
Building iscsiplugin for GOOS= GOARCH= failed, see error(s) above.
make: *** [release-tools/build.make:81: build-iscsiplugin] Error 1
Reference to gocsi should be removed from README as gocsi is no longer maintained:
https://github.com/kubernetes-csi/csi-driver-iscsi#test-using-csc
I tried to test your csi-driver-iscsi, unfortunately, the csc tool always reports
unknown flag: --attrib
after running the below command.
csc node publish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/iscsi --attrib targetPortal=$ISCSI_TARGET,iqn=$IQN,lun=1 iscsitestvol
Can you please update the documentation because it seems that the option attrib is not used anymore by csc tool
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.