Skip to content

Commit 6bfaeda

Browse files
Merge branch 'add-iscsi-driver' into iscsi-driver
2 parents 8ff8f8f + e03e9ce commit 6bfaeda

File tree

2,284 files changed

+973956
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,284 files changed

+973956
-16
lines changed

Gopkg.lock

Lines changed: 813 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
2+
# Gopkg.toml example
3+
#
4+
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
5+
# for detailed Gopkg.toml documentation.
6+
#
7+
# required = ["github.com/user/thing/cmd/thing"]
8+
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
9+
#
10+
# [[constraint]]
11+
# name = "github.com/user/project"
12+
# version = "1.0.0"
13+
#
14+
# [[constraint]]
15+
# name = "github.com/user/project2"
16+
# branch = "dev"
17+
# source = "github.com/myfork/project2"
18+
#
19+
# [[override]]
20+
# name = "github.com/x/y"
21+
# version = "2.4.0"
22+
23+
[prune]
24+
go-tests = true
25+
unused-packages = true
26+
27+
[[constraint]]
28+
name = "github.com/container-storage-interface/spec"
29+
version = "1.0.0"
30+
31+
[[constraint]]
32+
branch = "master"
33+
name = "github.com/golang/glog"
34+
35+
[[override]]
36+
revision = "5db89f0ca68677abc5eefce8f2a0a772c98ba52d"
37+
name = "github.com/docker/distribution"
38+
39+
[[constraint]]
40+
name = "github.com/pborman/uuid"
41+
version = "1.1.0"
42+
43+
[[constraint]]
44+
name = "github.com/spf13/cobra"
45+
version = "0.0.1"
46+
47+
[[constraint]]
48+
name = "github.com/stretchr/testify"
49+
version = "1.2.1"
50+
51+
[[constraint]]
52+
branch = "master"
53+
name = "golang.org/x/net"
54+
55+
[[constraint]]
56+
name = "google.golang.org/grpc"
57+
version = "1.10.0"
58+
59+
[[constraint]]
60+
name = "k8s.io/kubernetes"
61+
version = "v1.12.0"
62+
63+
[[override]]
64+
version = "kubernetes-1.12.0"
65+
name = "k8s.io/api"
66+
67+
[[override]]
68+
version = "kubernetes-1.12.0"
69+
name = "k8s.io/apiserver"
70+
71+
[[override]]
72+
name = "github.com/golang/protobuf"
73+
version = "v1.1.0"
74+
75+
[[override]]
76+
name = "github.com/json-iterator/go"
77+
version = "1.1.4"
78+
79+
[[override]]
80+
name = "gopkg.in/square/go-jose.v2"
81+
version = "2.1.7"
82+
83+
[[constraint]]
84+
name = "github.com/kubernetes-csi/csi-lib-utils"
85+
version = "0.2.0"

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright 2017 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
REGISTRY_NAME=quay.io/k8scsi
16+
IMAGE_NAME=iscsiplugin
17+
IMAGE_VERSION=canary
18+
IMAGE_TAG=$(REGISTRY_NAME)/$(IMAGE_NAME):$(IMAGE_VERSION)
19+
REV=$(shell git describe --long --tags --dirty)
20+
21+
.PHONY: all iscsi clean iscsi-container
22+
23+
all: iscsi
24+
25+
test:
26+
go test github.com/kubernetes-csi/drivers/pkg/... -cover
27+
go vet github.com/kubernetes-csi/drivers/pkg/...
28+
29+
iscsi:
30+
if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi
31+
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o _output/iscsiplugin ./app/
32+
33+
iscsi-container: iscsi
34+
docker build -t $(IMAGE_TAG) -f ./app/iscsiplugin/Dockerfile .
35+
36+
push: iscsi-container
37+
docker push $(IMAGE_TAG)
38+
39+
clean:
40+
go clean -r -x
41+
-rm -rf _output

README.md

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,49 @@
1-
# Kubernetes Template Project
2-
3-
The Kubernetes Template Project is a template for starting new projects in the GitHub organizations owned by Kubernetes. All Kubernetes projects, at minimum, must have the following files:
4-
5-
- a `README.md` outlining the project goals, sponsoring sig, and community contact information
6-
- an `OWNERS` with the project leads listed as approvers ([docs on `OWNERS` files][owners])
7-
- a `CONTRIBUTING.md` outlining how to contribute to the project
8-
- an unmodified copy of `code-of-conduct.md` from this repo, which outlines community behavior and the consequences of breaking the code
9-
- a `LICENSE` which must be Apache 2.0 for code projects, or [Creative Commons 4.0] for documentation repositories, without any custom content
10-
- a `SECURITY_CONTACTS` with the contact points for the Product Security Team
11-
to reach out to for triaging and handling of incoming issues. They must agree to abide by the
12-
[Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy)
13-
and will be removed and replaced if they violate that agreement.
1+
# CSI ISCSI driver
2+
3+
## Usage:
4+
5+
### Start ISCSI driver
6+
```
7+
$ sudo ./_output/iscsidriver --endpoint tcp://127.0.0.1:10000 --nodeid CSINode
8+
```
9+
10+
### Test using csc
11+
Get ```csc``` tool from https://github.com/rexray/gocsi/tree/master/csc
12+
13+
#### Get plugin info
14+
```
15+
$ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
16+
"ISCSI" "0.1.0"
17+
```
18+
19+
#### NodePublish a volume
20+
```
21+
$ export ISCSI_TARGET="iSCSI Target Server IP (Ex: 10.10.10.10)"
22+
$ export IQN="Target IQN"
23+
$ 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
24+
iscsitestvol
25+
```
26+
27+
#### NodeUnpublish a volume
28+
```
29+
$ csc node unpublish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/iscsi iscsitestvol
30+
iscsitestvol
31+
```
32+
33+
#### Get NodeID
34+
```
35+
$ csc node get-id --endpoint tcp://127.0.0.1:10000
36+
CSINode
37+
```
1438

1539
## Community, discussion, contribution, and support
1640

1741
Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/).
1842

1943
You can reach the maintainers of this project at:
2044

21-
- [Slack](http://slack.k8s.io/)
22-
- [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-dev)
45+
- [Slack channel](https://kubernetes.slack.com/messages/sig-storage)
46+
- [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-storage)
2347

2448
### Code of conduct
2549

app/main.go

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
Copyright 2017 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package main
18+
19+
import (
20+
"flag"
21+
"fmt"
22+
"os"
23+
24+
"github.com/spf13/cobra"
25+
26+
"github.com/kubernetes-csi/csi-driver-iscsi/pkg/iscsi"
27+
)
28+
29+
var (
30+
endpoint string
31+
nodeID string
32+
)
33+
34+
func init() {
35+
flag.Set("logtostderr", "true")
36+
}
37+
38+
func main() {
39+
40+
flag.CommandLine.Parse([]string{})
41+
42+
cmd := &cobra.Command{
43+
Use: "ISCSI",
44+
Short: "CSI based ISCSI driver",
45+
Run: func(cmd *cobra.Command, args []string) {
46+
handle()
47+
},
48+
}
49+
50+
cmd.Flags().AddGoFlagSet(flag.CommandLine)
51+
52+
cmd.PersistentFlags().StringVar(&nodeID, "nodeid", "", "node id")
53+
cmd.MarkPersistentFlagRequired("nodeid")
54+
55+
cmd.PersistentFlags().StringVar(&endpoint, "endpoint", "", "CSI endpoint")
56+
cmd.MarkPersistentFlagRequired("endpoint")
57+
58+
if err := cmd.Execute(); err != nil {
59+
fmt.Fprintf(os.Stderr, "%s", err.Error())
60+
os.Exit(1)
61+
}
62+
63+
os.Exit(0)
64+
}
65+
66+
func handle() {
67+
d := iscsi.NewDriver(nodeID, endpoint)
68+
d.Run()
69+
}

pkg/iscsi/driver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/container-storage-interface/spec/lib/go/csi"
2121
"github.com/golang/glog"
2222

23-
"github.com/kubernetes-csi/drivers/pkg/csi-common"
23+
csicommon "github.com/kubernetes-csi/drivers/pkg/csi-common"
2424
)
2525

2626
type driver struct {

vendor/github.com/beorn7/perks/LICENSE

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)