mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 10:53:34 +00:00
vendor update for CSI 0.3.0
This commit is contained in:
11
vendor/github.com/kubernetes-csi/drivers/.travis.yml
generated
vendored
11
vendor/github.com/kubernetes-csi/drivers/.travis.yml
generated
vendored
@ -1,8 +1,9 @@
|
||||
language: go
|
||||
|
||||
services:
|
||||
- docker
|
||||
# Needed for e2e tests
|
||||
sudo: true
|
||||
go: 1.9.x
|
||||
go: 1.10.3
|
||||
go_import_path: github.com/kubernetes-csi/drivers
|
||||
install:
|
||||
- go get -u github.com/golang/dep/cmd/dep
|
||||
@ -13,3 +14,9 @@ script:
|
||||
- go vet $(go list ./... | grep -v vendor)
|
||||
- go test $(go list ./... | grep -v vendor)
|
||||
- ./hack/e2e-hostpath.sh
|
||||
after_success:
|
||||
- if [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
|
||||
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" quay.io;
|
||||
make hostpath-container;
|
||||
docker push quay.io/k8scsi/hostpathplugin:canary;
|
||||
fi
|
||||
|
13
vendor/github.com/kubernetes-csi/drivers/Gopkg.lock
generated
vendored
13
vendor/github.com/kubernetes-csi/drivers/Gopkg.lock
generated
vendored
@ -10,8 +10,8 @@
|
||||
[[projects]]
|
||||
name = "github.com/container-storage-interface/spec"
|
||||
packages = ["lib/go/csi/v0"]
|
||||
revision = "35d9f9d77954980e449e52c3f3e43c21bd8171f5"
|
||||
version = "v0.2.0-rc1"
|
||||
revision = "2178fdeea87f1150a17a63252eee28d4d8141f72"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/davecgh/go-spew"
|
||||
@ -61,10 +61,11 @@
|
||||
"ptypes",
|
||||
"ptypes/any",
|
||||
"ptypes/duration",
|
||||
"ptypes/timestamp"
|
||||
"ptypes/timestamp",
|
||||
"ptypes/wrappers"
|
||||
]
|
||||
revision = "925541529c1fa6821df4e44ce2723319eb2be768"
|
||||
version = "v1.0.0"
|
||||
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@ -658,6 +659,6 @@
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "52850d29ee1bd54bcd87d2d39fec1bfd9ee33d5d3611184f8442ce71687e1d1c"
|
||||
inputs-digest = "8b43ab8306203b049af581d7567bd62d58b438ad31ada07c05ab0398c721a0fd"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
6
vendor/github.com/kubernetes-csi/drivers/Gopkg.toml
generated
vendored
6
vendor/github.com/kubernetes-csi/drivers/Gopkg.toml
generated
vendored
@ -23,7 +23,7 @@
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/container-storage-interface/spec"
|
||||
version = "~0.2.0"
|
||||
version = "~0.3.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
@ -72,3 +72,7 @@
|
||||
[[override]]
|
||||
version = "kubernetes-1.10.0-beta.1"
|
||||
name = "k8s.io/api"
|
||||
|
||||
[[override]]
|
||||
name = "github.com/golang/protobuf"
|
||||
version = "v1.1.0"
|
||||
|
201
vendor/github.com/kubernetes-csi/drivers/LICENSE
generated
vendored
Normal file
201
vendor/github.com/kubernetes-csi/drivers/LICENSE
generated
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
27
vendor/github.com/kubernetes-csi/drivers/Makefile
generated
vendored
27
vendor/github.com/kubernetes-csi/drivers/Makefile
generated
vendored
@ -12,38 +12,37 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
REGISTRY_NAME = quay.io/k8scsi
|
||||
IMAGE_VERSION = v0.2.0
|
||||
REGISTRY_NAME=quay.io/k8scsi
|
||||
IMAGE_NAME=hostpathplugin
|
||||
IMAGE_VERSION=canary
|
||||
IMAGE_TAG=$(REGISTRY_NAME)/$(IMAGE_NAME):$(IMAGE_VERSION)
|
||||
|
||||
.PHONY: all flexadapter nfs hostpath iscsi cinder clean
|
||||
.PHONY: all flexadapter nfs hostpath iscsi cinder clean hostpath-container
|
||||
|
||||
all: flexadapter nfs hostpath iscsi cinder
|
||||
|
||||
test:
|
||||
go test github.com/kubernetes-csi/drivers/pkg/... -cover
|
||||
go vet github.com/kubernetes-csi/drivers/pkg/...
|
||||
|
||||
flexadapter:
|
||||
if [ ! -d ./vendor ]; then dep ensure; fi
|
||||
if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o _output/flexadapter ./app/flexadapter
|
||||
nfs:
|
||||
if [ ! -d ./vendor ]; then dep ensure; fi
|
||||
if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o _output/nfsplugin ./app/nfsplugin
|
||||
hostpath:
|
||||
if [ ! -d ./vendor ]; then dep ensure; fi
|
||||
if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o _output/hostpathplugin ./app/hostpathplugin
|
||||
|
||||
hostpath-container: hostpath
|
||||
cp _output/hostpathplugin pkg/hostpath/extras/docker
|
||||
docker build -t $(REGISTRY_NAME)/hostpathplugin:$(IMAGE_VERSION) ./pkg/hostpath/extras/docker
|
||||
|
||||
docker build -t $(IMAGE_TAG) -f ./app/hostpathplugin/Dockerfile .
|
||||
push: hostpath-container
|
||||
docker push $(IMAGE_TAG)
|
||||
iscsi:
|
||||
if [ ! -d ./vendor ]; then dep ensure; fi
|
||||
if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o _output/iscsiplugin ./app/iscsiplugin
|
||||
cinder:
|
||||
if [ ! -d ./vendor ]; then dep ensure; fi
|
||||
if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o _output/cinderplugin ./app/cinderplugin
|
||||
|
||||
clean:
|
||||
go clean -r -x
|
||||
-rm -rf _output
|
||||
|
1
vendor/github.com/kubernetes-csi/drivers/README.md
generated
vendored
1
vendor/github.com/kubernetes-csi/drivers/README.md
generated
vendored
@ -1,3 +1,4 @@
|
||||
[](https://travis-ci.org/kubernetes-csi/drivers)
|
||||
# CSI Drivers
|
||||
|
||||
These drivers are provided purely for illustrative purposes, and should not be used for production workloads.
|
||||
|
@ -1,6 +1,6 @@
|
||||
FROM alpine
|
||||
LABEL maintainers="Kubernetes Authors"
|
||||
LABEL description="HostPath CSI Plugin"
|
||||
LABEL description="HostPath Driver"
|
||||
|
||||
COPY hostpathplugin /hostpathplugin
|
||||
COPY ./_output/hostpathplugin /hostpathplugin
|
||||
ENTRYPOINT ["/hostpathplugin"]
|
21
vendor/github.com/kubernetes-csi/drivers/hack/e2e-hostpath.sh
generated
vendored
21
vendor/github.com/kubernetes-csi/drivers/hack/e2e-hostpath.sh
generated
vendored
@ -13,35 +13,34 @@ CSI_MOUNTPOINT="/mnt"
|
||||
APP=hostpathplugin
|
||||
|
||||
SKIP="WithCapacity"
|
||||
SKIP=""
|
||||
if [ x${TRAVIS} = x"true" ] ; then
|
||||
SKIP="WithCapacity|NodeUnpublishVolume|NodePublishVolume"
|
||||
fi
|
||||
|
||||
# Get csi-sanity
|
||||
git clone https://github.com/kubernetes-csi/csi-test $GOPATH/src/github.com/kubernetes-csi/csi-test
|
||||
pushd $GOPATH/src/github.com/kubernetes-csi/csi-test/cmd/csi-sanity
|
||||
make all
|
||||
make install
|
||||
popd
|
||||
if [ ! -x $GOPATH/bin/csi-sanity ] ; then
|
||||
go get -u github.com/kubernetes-csi/csi-test
|
||||
pushd $GOPATH/src/github.com/kubernetes-csi/csi-test/cmd/csi-sanity
|
||||
make all
|
||||
make install
|
||||
popd
|
||||
#./hack/get-sanity.sh
|
||||
fi
|
||||
|
||||
# Build
|
||||
cd app/hostpathplugin
|
||||
go install || exit 1
|
||||
cd ../..
|
||||
make hostpath
|
||||
|
||||
# Cleanup
|
||||
rm -f $UDS
|
||||
|
||||
# Start the application in the background
|
||||
sudo $GOPATH/bin/$APP --endpoint=$CSI_ENDPOINT --nodeid=1 &
|
||||
sudo _output/$APP --endpoint=$CSI_ENDPOINT --nodeid=1 &
|
||||
pid=$!
|
||||
|
||||
# Need to skip Capacity testing since hostpath does not support it
|
||||
sudo $GOPATH/bin/csi-sanity $@ \
|
||||
--ginkgo.skip=${SKIP} \
|
||||
--csi.mountpoint=$CSI_MOUNTPOINT \
|
||||
--csi.mountdir=$CSI_MOUNTPOINT \
|
||||
--csi.endpoint=$CSI_ENDPOINT ; ret=$?
|
||||
sudo kill -9 $pid
|
||||
sudo rm -f $UDS
|
||||
|
8
vendor/github.com/kubernetes-csi/drivers/pkg/cinder/README.md
generated
vendored
8
vendor/github.com/kubernetes-csi/drivers/pkg/cinder/README.md
generated
vendored
@ -40,7 +40,7 @@ $ sudo ./_output/cinderplugin --endpoint tcp://127.0.0.1:10000 --cloud-config /e
|
||||
```
|
||||
|
||||
### Test using csc
|
||||
Get ```csc``` tool from https://github.com/thecodeteam/gocsi/tree/master/csc
|
||||
Get ```csc``` tool from https://github.com/rexray/gocsi/tree/master/csc
|
||||
|
||||
#### Get plugin info
|
||||
```
|
||||
@ -48,12 +48,6 @@ $ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
|
||||
"csi-cinderplugin" "0.1.0"
|
||||
```
|
||||
|
||||
#### Get supported versions
|
||||
```
|
||||
$ csc identity supported-versions --endpoint tcp://127.0.0.1:10000
|
||||
0.1.0
|
||||
```
|
||||
|
||||
#### Create a volume
|
||||
```
|
||||
$ csc controller new --endpoint tcp://127.0.0.1:10000 CSIVolumeName
|
||||
|
@ -30,7 +30,7 @@ spec:
|
||||
serviceAccount: csi-attacher
|
||||
containers:
|
||||
- name: csi-attacher
|
||||
image: docker.io/k8scsi/csi-attacher
|
||||
image: quay.io/k8scsi/csi-attacher:v0.3.0
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
@ -42,7 +42,7 @@ spec:
|
||||
- name: socket-dir
|
||||
mountPath: /var/lib/csi/sockets/pluginproxy/
|
||||
- name: cinder
|
||||
image: docker.io/k8scsi/cinderplugin
|
||||
image: quay.io/k8scsi/cinderplugin
|
||||
args :
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
@ -53,13 +53,13 @@ spec:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix://plugin/csi.sock
|
||||
value: unix://csi/csi.sock
|
||||
- name: CLOUD_CONFIG
|
||||
value: /etc/config/cloud.conf
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /plugin
|
||||
mountPath: /csi
|
||||
- name: secret-cinderplugin
|
||||
mountPath: /etc/config
|
||||
readOnly: true
|
||||
|
@ -18,27 +18,27 @@ spec:
|
||||
hostNetwork: true
|
||||
containers:
|
||||
- name: driver-registrar
|
||||
image: docker.io/k8scsi/driver-registrar
|
||||
image: quay.io/k8scsi/driver-registrar:v0.3.0
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /plugin/csi.sock
|
||||
value: /csi/csi.sock
|
||||
- name: KUBE_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
volumeMounts:
|
||||
- name: plugin-dir
|
||||
mountPath: /plugin
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
- name: cinder
|
||||
securityContext:
|
||||
privileged: true
|
||||
capabilities:
|
||||
add: ["SYS_ADMIN"]
|
||||
allowPrivilegeEscalation: true
|
||||
image: docker.io/k8scsi/cinderplugin
|
||||
image: quay.io/k8scsi/cinderplugin
|
||||
args :
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
@ -49,13 +49,13 @@ spec:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix://plugin/csi.sock
|
||||
value: unix://csi/csi.sock
|
||||
- name: CLOUD_CONFIG
|
||||
value: /etc/config/cloud.conf
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: plugin-dir
|
||||
mountPath: /plugin
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
- name: pods-mount-dir
|
||||
mountPath: /var/lib/kubelet/pods
|
||||
mountPropagation: "Bidirectional"
|
||||
@ -69,7 +69,7 @@ spec:
|
||||
mountPath: /etc/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: plugin-dir
|
||||
- name: socket-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/csi-cinderplugin
|
||||
type: DirectoryOrCreate
|
||||
|
@ -30,7 +30,7 @@ spec:
|
||||
serviceAccount: csi-provisioner
|
||||
containers:
|
||||
- name: csi-provisioner
|
||||
image: docker.io/k8scsi/csi-provisioner
|
||||
image: quay.io/k8scsi/csi-provisioner:v0.3.0
|
||||
args:
|
||||
- "--provisioner=csi-cinderplugin"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
@ -42,7 +42,7 @@ spec:
|
||||
- name: socket-dir
|
||||
mountPath: /var/lib/csi/sockets/pluginproxy/
|
||||
- name: cinder
|
||||
image: docker.io/k8scsi/cinderplugin
|
||||
image: quay.io/k8scsi/cinderplugin
|
||||
args :
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
@ -53,13 +53,13 @@ spec:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix://plugin/csi.sock
|
||||
value: unix://csi/csi.sock
|
||||
- name: CLOUD_CONFIG
|
||||
value: /etc/config/cloud.conf
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /plugin
|
||||
mountPath: /csi
|
||||
- name: secret-cinderplugin
|
||||
mountPath: /etc/config
|
||||
readOnly: true
|
||||
|
2
vendor/github.com/kubernetes-csi/drivers/pkg/cinder/driver.go
generated
vendored
2
vendor/github.com/kubernetes-csi/drivers/pkg/cinder/driver.go
generated
vendored
@ -42,7 +42,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
)
|
||||
|
||||
func NewDriver(nodeID, endpoint string, cloudconfig string) *driver {
|
||||
|
45
vendor/github.com/kubernetes-csi/drivers/pkg/cinder/nodeserver.go
generated
vendored
45
vendor/github.com/kubernetes-csi/drivers/pkg/cinder/nodeserver.go
generated
vendored
@ -33,16 +33,8 @@ type nodeServer struct {
|
||||
|
||||
func (ns *nodeServer) NodeGetId(ctx context.Context, req *csi.NodeGetIdRequest) (*csi.NodeGetIdResponse, error) {
|
||||
|
||||
// Get Mount Provider
|
||||
m, err := mount.GetMountProvider()
|
||||
nodeID, err := getNodeID()
|
||||
if err != nil {
|
||||
glog.V(3).Infof("Failed to GetMountProvider: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
nodeID, err := m.GetInstanceID()
|
||||
if err != nil {
|
||||
glog.V(3).Infof("Failed to GetInstanceID: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -56,6 +48,41 @@ func (ns *nodeServer) NodeGetId(ctx context.Context, req *csi.NodeGetIdRequest)
|
||||
return ns.DefaultNodeServer.NodeGetId(ctx, req)
|
||||
}
|
||||
|
||||
func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
|
||||
|
||||
nodeID, err := getNodeID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(nodeID) > 0 {
|
||||
return &csi.NodeGetInfoResponse{
|
||||
NodeId: nodeID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Using default function
|
||||
return ns.DefaultNodeServer.NodeGetInfo(ctx, req)
|
||||
}
|
||||
|
||||
func getNodeID() (string, error) {
|
||||
|
||||
// Get Mount Provider
|
||||
m, err := mount.GetMountProvider()
|
||||
if err != nil {
|
||||
glog.V(3).Infof("Failed to GetMountProvider: %v", err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
nodeID, err := m.GetInstanceID()
|
||||
if err != nil {
|
||||
glog.V(3).Infof("Failed to GetInstanceID: %v", err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
return nodeID, nil
|
||||
}
|
||||
|
||||
func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
|
||||
|
||||
targetPath := req.GetTargetPath()
|
||||
|
30
vendor/github.com/kubernetes-csi/drivers/pkg/cinder/nodeserver_test.go
generated
vendored
30
vendor/github.com/kubernetes-csi/drivers/pkg/cinder/nodeserver_test.go
generated
vendored
@ -65,6 +65,36 @@ func TestNodeGetId(t *testing.T) {
|
||||
assert.Equal(expectedRes, actualRes)
|
||||
}
|
||||
|
||||
// Test NodeGetInfo
|
||||
func TestNodeGetInfo(t *testing.T) {
|
||||
|
||||
// mock MountMock
|
||||
mmock := new(mount.MountMock)
|
||||
// GetInstanceID() (string, error)
|
||||
mmock.On("GetInstanceID").Return(fakeNodeID, nil)
|
||||
mount.MInstance = mmock
|
||||
|
||||
// Init assert
|
||||
assert := assert.New(t)
|
||||
|
||||
// Expected Result
|
||||
expectedRes := &csi.NodeGetInfoResponse{
|
||||
NodeId: fakeNodeID,
|
||||
}
|
||||
|
||||
// Fake request
|
||||
fakeReq := &csi.NodeGetInfoRequest{}
|
||||
|
||||
// Invoke NodeGetId
|
||||
actualRes, err := fakeNs.NodeGetInfo(fakeCtx, fakeReq)
|
||||
if err != nil {
|
||||
t.Errorf("failed to NodeGetInfo: %v", err)
|
||||
}
|
||||
|
||||
// Assert
|
||||
assert.Equal(expectedRes, actualRes)
|
||||
}
|
||||
|
||||
// Test NodePublishVolume
|
||||
func TestNodePublishVolume(t *testing.T) {
|
||||
|
||||
|
12
vendor/github.com/kubernetes-csi/drivers/pkg/csi-common/controllerserver-default.go
generated
vendored
12
vendor/github.com/kubernetes-csi/drivers/pkg/csi-common/controllerserver-default.go
generated
vendored
@ -85,3 +85,15 @@ func (cs *DefaultControllerServer) ControllerGetCapabilities(ctx context.Context
|
||||
Capabilities: cs.Driver.cap,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (cs *DefaultControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
func (cs *DefaultControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
func (cs *DefaultControllerServer) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
2
vendor/github.com/kubernetes-csi/drivers/pkg/csi-common/driver_test.go
generated
vendored
2
vendor/github.com/kubernetes-csi/drivers/pkg/csi-common/driver_test.go
generated
vendored
@ -31,7 +31,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
vendorVersion = "0.2.0"
|
||||
vendorVersion = "0.3.0"
|
||||
)
|
||||
|
||||
func NewFakeDriver() *CSIDriver {
|
||||
|
4
vendor/github.com/kubernetes-csi/drivers/pkg/csi-common/identityserver-default.go
generated
vendored
4
vendor/github.com/kubernetes-csi/drivers/pkg/csi-common/identityserver-default.go
generated
vendored
@ -29,7 +29,7 @@ type DefaultIdentityServer struct {
|
||||
}
|
||||
|
||||
func (ids *DefaultIdentityServer) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
|
||||
glog.V(5).Infof("Using default GetPluginInnfo")
|
||||
glog.V(5).Infof("Using default GetPluginInfo")
|
||||
|
||||
if ids.Driver.name == "" {
|
||||
return nil, status.Error(codes.Unavailable, "Driver name not configured")
|
||||
@ -56,7 +56,7 @@ func (ids *DefaultIdentityServer) GetPluginCapabilities(ctx context.Context, req
|
||||
{
|
||||
Type: &csi.PluginCapability_Service_{
|
||||
Service: &csi.PluginCapability_Service{
|
||||
Type: csi.PluginCapability_Service_UNKNOWN,
|
||||
Type: csi.PluginCapability_Service_CONTROLLER_SERVICE,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
8
vendor/github.com/kubernetes-csi/drivers/pkg/csi-common/nodeserver-default.go
generated
vendored
8
vendor/github.com/kubernetes-csi/drivers/pkg/csi-common/nodeserver-default.go
generated
vendored
@ -44,6 +44,14 @@ func (ns *DefaultNodeServer) NodeGetId(ctx context.Context, req *csi.NodeGetIdRe
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (ns *DefaultNodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
|
||||
glog.V(5).Infof("Using default NodeGetInfo")
|
||||
|
||||
return &csi.NodeGetInfoResponse{
|
||||
NodeId: ns.Driver.nodeID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (ns *DefaultNodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
|
||||
glog.V(5).Infof("Using default NodeGetCapabilities")
|
||||
|
||||
|
12
vendor/github.com/kubernetes-csi/drivers/pkg/csi-common/nodeserver-default_test.go
generated
vendored
12
vendor/github.com/kubernetes-csi/drivers/pkg/csi-common/nodeserver-default_test.go
generated
vendored
@ -38,6 +38,18 @@ func TestNodeGetId(t *testing.T) {
|
||||
assert.Equal(t, resp.GetNodeId(), fakeNodeID)
|
||||
}
|
||||
|
||||
func TestNodeGetInfo(t *testing.T) {
|
||||
d := NewFakeDriver()
|
||||
|
||||
ns := NewDefaultNodeServer(d)
|
||||
|
||||
// Test valid request
|
||||
req := csi.NodeGetInfoRequest{}
|
||||
resp, err := ns.NodeGetInfo(context.Background(), &req)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, resp.GetNodeId(), fakeNodeID)
|
||||
}
|
||||
|
||||
func TestNodeGetCapabilities(t *testing.T) {
|
||||
d := NewFakeDriver()
|
||||
|
||||
|
8
vendor/github.com/kubernetes-csi/drivers/pkg/flexadapter/README.md
generated
vendored
8
vendor/github.com/kubernetes-csi/drivers/pkg/flexadapter/README.md
generated
vendored
@ -8,7 +8,7 @@ $ sudo ./_output/flexadapter --endpoint tcp://127.0.0.1:10000 --drivername simpl
|
||||
```
|
||||
|
||||
### Test using csc
|
||||
Get ```csc``` tool from https://github.com/thecodeteam/gocsi/tree/master/csc
|
||||
Get ```csc``` tool from https://github.com/rexray/gocsi/tree/master/csc
|
||||
|
||||
#### Get plugin info
|
||||
```
|
||||
@ -16,12 +16,6 @@ $ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
|
||||
"simplenfs" "0.1.0"
|
||||
```
|
||||
|
||||
### Get supported versions
|
||||
```
|
||||
$ csc identity supported-versions --endpoint tcp://127.0.0.1:10000
|
||||
0.1.0
|
||||
```
|
||||
|
||||
#### NodePublish a volume
|
||||
```
|
||||
$ csc node publish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs --attrib server=a.b.c.d --attrib share=nfs_share nfstestvol
|
||||
|
@ -72,7 +72,7 @@ spec:
|
||||
serviceAccount: csi-attacher
|
||||
containers:
|
||||
- name: csi-attacher
|
||||
image: docker.io/k8scsi/csi-attacher
|
||||
image: quay.io/k8scsi/csi-attacher:v0.3.0
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
|
@ -15,7 +15,7 @@ spec:
|
||||
hostNetwork: true
|
||||
containers:
|
||||
- name: driver-registrar
|
||||
image: docker.io/k8scsi/driver-registrar
|
||||
image: quay.io/k8scsi/driver-registrar:v0.3.0
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
|
2
vendor/github.com/kubernetes-csi/drivers/pkg/flexadapter/flexadapter.go
generated
vendored
2
vendor/github.com/kubernetes-csi/drivers/pkg/flexadapter/flexadapter.go
generated
vendored
@ -38,7 +38,7 @@ type flexAdapter struct {
|
||||
}
|
||||
|
||||
var (
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
)
|
||||
|
||||
func New() *flexAdapter {
|
||||
|
8
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/README.md
generated
vendored
8
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/README.md
generated
vendored
@ -13,7 +13,7 @@ $ sudo ./_output/hostpathplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINod
|
||||
```
|
||||
|
||||
### Test using csc
|
||||
Get ```csc``` tool from https://github.com/thecodeteam/gocsi/tree/master/csc
|
||||
Get ```csc``` tool from https://github.com/rexray/gocsi/tree/master/csc
|
||||
|
||||
#### Get plugin info
|
||||
```
|
||||
@ -21,12 +21,6 @@ $ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
|
||||
"csi-hostpath" "0.1.0"
|
||||
```
|
||||
|
||||
#### Get supported versions
|
||||
```
|
||||
$ csc identity supported-versions --endpoint tcp://127.0.0.1:10000
|
||||
0.1.0
|
||||
```
|
||||
|
||||
#### Create a volume
|
||||
```
|
||||
$ csc controller new --endpoint tcp://127.0.0.1:10000 --cap 1,block CSIVolumeName
|
||||
|
61
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/controllerserver.go
generated
vendored
61
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/controllerserver.go
generated
vendored
@ -17,6 +17,7 @@ limitations under the License.
|
||||
package hostpath
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/golang/glog"
|
||||
@ -30,8 +31,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
deviceID = "deviceID"
|
||||
provisionRoot = "/tmp/"
|
||||
deviceID = "deviceID"
|
||||
provisionRoot = "/tmp/"
|
||||
maxStorageCapacity = tib
|
||||
)
|
||||
|
||||
type controllerServer struct {
|
||||
@ -39,6 +41,10 @@ type controllerServer struct {
|
||||
}
|
||||
|
||||
func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
|
||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
||||
glog.V(3).Infof("invalid create volume req: %v", req)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Check arguments
|
||||
if len(req.GetName()) == 0 {
|
||||
@ -47,23 +53,49 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
if req.GetVolumeCapabilities() == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "Volume Capabilities missing in request")
|
||||
}
|
||||
|
||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
||||
glog.V(3).Infof("invalid create volume req: %v", req)
|
||||
return nil, err
|
||||
// Need to check for already existing volume name, and if found
|
||||
// check for the requested capacity and already allocated capacity
|
||||
if exVol, err := getVolumeByName(req.GetName()); err == nil {
|
||||
// Since err is nil, it means the volume with the same name already exists
|
||||
// need to check if the size of exisiting volume is the same as in new
|
||||
// request
|
||||
if exVol.VolSize >= int64(req.GetCapacityRange().GetRequiredBytes()) {
|
||||
// exisiting volume is compatible with new request and should be reused.
|
||||
// TODO (sbezverk) Do I need to make sure that RBD volume still exists?
|
||||
return &csi.CreateVolumeResponse{
|
||||
Volume: &csi.Volume{
|
||||
Id: exVol.VolID,
|
||||
CapacityBytes: int64(exVol.VolSize),
|
||||
Attributes: req.GetParameters(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
return nil, status.Error(codes.AlreadyExists, fmt.Sprintf("Volume with the same name: %s but with different size already exist", req.GetName()))
|
||||
}
|
||||
volumeId := uuid.NewUUID().String()
|
||||
path := provisionRoot + volumeId
|
||||
// Check for maximum available capacity
|
||||
capacity := int64(req.GetCapacityRange().GetRequiredBytes())
|
||||
if capacity >= maxStorageCapacity {
|
||||
return nil, status.Errorf(codes.OutOfRange, "Requested capacity %d exceeds maximum allowed %d", capacity, maxStorageCapacity)
|
||||
}
|
||||
volumeID := uuid.NewUUID().String()
|
||||
path := provisionRoot + volumeID
|
||||
err := os.MkdirAll(path, 0777)
|
||||
if err != nil {
|
||||
glog.V(3).Infof("failed to create volume: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
glog.V(4).Infof("create volume %s", path)
|
||||
hostPathVol := hostPathVolume{}
|
||||
hostPathVol.VolName = req.GetName()
|
||||
hostPathVol.VolID = volumeID
|
||||
hostPathVol.VolSize = capacity
|
||||
hostPathVol.VolPath = path
|
||||
hostPathVolumes[volumeID] = hostPathVol
|
||||
return &csi.CreateVolumeResponse{
|
||||
Volume: &csi.Volume{
|
||||
Id: volumeId,
|
||||
Id: volumeID,
|
||||
CapacityBytes: req.GetCapacityRange().GetRequiredBytes(),
|
||||
Attributes: req.GetParameters(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@ -79,11 +111,11 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
|
||||
glog.V(3).Infof("invalid delete volume req: %v", req)
|
||||
return nil, err
|
||||
}
|
||||
volumeId := req.VolumeId
|
||||
glog.V(4).Infof("deleting volume %s", volumeId)
|
||||
path := provisionRoot + volumeId
|
||||
volumeID := req.VolumeId
|
||||
glog.V(4).Infof("deleting volume %s", volumeID)
|
||||
path := provisionRoot + volumeID
|
||||
os.RemoveAll(path)
|
||||
|
||||
delete(hostPathVolumes, volumeID)
|
||||
return &csi.DeleteVolumeResponse{}, nil
|
||||
}
|
||||
|
||||
@ -96,6 +128,9 @@ func (cs *controllerServer) ValidateVolumeCapabilities(ctx context.Context, req
|
||||
if req.GetVolumeCapabilities() == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "Volume capabilities missing in request")
|
||||
}
|
||||
if _, ok := hostPathVolumes[req.GetVolumeId()]; !ok {
|
||||
return nil, status.Error(codes.NotFound, "Volume does not exist")
|
||||
}
|
||||
|
||||
for _, cap := range req.VolumeCapabilities {
|
||||
if cap.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER {
|
||||
|
13
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/extras/docker/Dockerfile.builder
generated
vendored
13
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/extras/docker/Dockerfile.builder
generated
vendored
@ -1,13 +0,0 @@
|
||||
FROM golang:alpine
|
||||
LABEL maintainers="Kubernetes Authors"
|
||||
LABEL description="HostPath CSI Plugin"
|
||||
|
||||
RUN apk add --no-cache git make wget
|
||||
RUN wget https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64 && \
|
||||
chmod +x dep-linux-amd64 && \
|
||||
mv dep-linux-amd64 /usr/bin/dep
|
||||
RUN go get -d github.com/kubernetes-csi/drivers/app/hostpathplugin
|
||||
RUN cd /go/src/github.com/kubernetes-csi/drivers && \
|
||||
dep ensure && \
|
||||
make hostpath && \
|
||||
cp _output/hostpathplugin /hostpathplugin
|
10
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/extras/docker/make.sh
generated
vendored
10
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/extras/docker/make.sh
generated
vendored
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
PROG=hostpathplugin
|
||||
|
||||
docker build --rm -f Dockerfile.builder -t ${PROG}:builder .
|
||||
docker run --rm --privileged -v $PWD:/host ${PROG}:builder cp /${PROG} /host/${PROG}
|
||||
sudo chown $USER ${PROG}
|
||||
docker build --rm -t docker.io/k8scsi/${PROG} .
|
||||
docker rmi ${PROG}:builder
|
||||
rm -f ${PROG}
|
42
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/hostpath.go
generated
vendored
42
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/hostpath.go
generated
vendored
@ -17,12 +17,23 @@ limitations under the License.
|
||||
package hostpath
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/golang/glog"
|
||||
|
||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||
)
|
||||
|
||||
const (
|
||||
kib int64 = 1024
|
||||
mib int64 = kib * 1024
|
||||
gib int64 = mib * 1024
|
||||
gib100 int64 = gib * 100
|
||||
tib int64 = gib * 1024
|
||||
tib100 int64 = tib * 100
|
||||
)
|
||||
|
||||
type hostPath struct {
|
||||
driver *csicommon.CSIDriver
|
||||
|
||||
@ -34,11 +45,24 @@ type hostPath struct {
|
||||
cscap []*csi.ControllerServiceCapability
|
||||
}
|
||||
|
||||
type hostPathVolume struct {
|
||||
VolName string `json:"volName"`
|
||||
VolID string `json:"volID"`
|
||||
VolSize int64 `json:"volSize"`
|
||||
VolPath string `json:"volPath"`
|
||||
}
|
||||
|
||||
var hostPathVolumes map[string]hostPathVolume
|
||||
|
||||
var (
|
||||
hostPathDriver *hostPath
|
||||
vendorVersion = "0.2.0"
|
||||
vendorVersion = "0.3.0"
|
||||
)
|
||||
|
||||
func init() {
|
||||
hostPathVolumes = map[string]hostPathVolume{}
|
||||
}
|
||||
|
||||
func GetHostPathDriver() *hostPath {
|
||||
return &hostPath{}
|
||||
}
|
||||
@ -81,3 +105,19 @@ func (hp *hostPath) Run(driverName, nodeID, endpoint string) {
|
||||
s.Start(endpoint, hp.ids, hp.cs, hp.ns)
|
||||
s.Wait()
|
||||
}
|
||||
|
||||
func getVolumeByID(volumeID string) (hostPathVolume, error) {
|
||||
if hostPathVol, ok := hostPathVolumes[volumeID]; ok {
|
||||
return hostPathVol, nil
|
||||
}
|
||||
return hostPathVolume{}, fmt.Errorf("volume id %s does not exit in the volumes list", volumeID)
|
||||
}
|
||||
|
||||
func getVolumeByName(volName string) (hostPathVolume, error) {
|
||||
for _, hostPathVol := range hostPathVolumes {
|
||||
if hostPathVol.VolName == volName {
|
||||
return hostPathVol, nil
|
||||
}
|
||||
}
|
||||
return hostPathVolume{}, fmt.Errorf("volume name %s does not exit in the volumes list", volName)
|
||||
}
|
||||
|
2
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/nodeserver.go
generated
vendored
2
vendor/github.com/kubernetes-csi/drivers/pkg/hostpath/nodeserver.go
generated
vendored
@ -76,7 +76,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
||||
attrib := req.GetVolumeAttributes()
|
||||
mountFlags := req.GetVolumeCapability().GetMount().GetMountFlags()
|
||||
|
||||
glog.V(4).Infof("target %v\nfstype %v\ndevice %v\nreadonly %v\nattributes %v\n mountflags %v\n",
|
||||
glog.V(4).Infof("target %v\nfstype %v\ndevice %v\nreadonly %v\nvolumeId %v\nattributes %v\nmountflags %v\n",
|
||||
targetPath, fsType, deviceId, readOnly, volumeId, attrib, mountFlags)
|
||||
|
||||
options := []string{"bind"}
|
||||
|
8
vendor/github.com/kubernetes-csi/drivers/pkg/iscsi/README.md
generated
vendored
8
vendor/github.com/kubernetes-csi/drivers/pkg/iscsi/README.md
generated
vendored
@ -8,7 +8,7 @@ $ sudo ./_output/iscsidriver --endpoint tcp://127.0.0.1:10000 --nodeid CSINode
|
||||
```
|
||||
|
||||
### Test using csc
|
||||
Get ```csc``` tool from https://github.com/thecodeteam/gocsi/tree/master/csc
|
||||
Get ```csc``` tool from https://github.com/rexray/gocsi/tree/master/csc
|
||||
|
||||
#### Get plugin info
|
||||
```
|
||||
@ -16,12 +16,6 @@ $ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
|
||||
"ISCSI" "0.1.0"
|
||||
```
|
||||
|
||||
### Get supported versions
|
||||
```
|
||||
$ csc identity supported-versions --endpoint tcp://127.0.0.1:10000
|
||||
0.1.0
|
||||
```
|
||||
|
||||
#### NodePublish a volume
|
||||
```
|
||||
$ export ISCSI_TARGET="iSCSI Target Server IP (Ex: 10.10.10.10)"
|
||||
|
2
vendor/github.com/kubernetes-csi/drivers/pkg/iscsi/driver.go
generated
vendored
2
vendor/github.com/kubernetes-csi/drivers/pkg/iscsi/driver.go
generated
vendored
@ -39,7 +39,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
)
|
||||
|
||||
func NewDriver(nodeID, endpoint string) *driver {
|
||||
|
15
vendor/github.com/kubernetes-csi/drivers/pkg/iscsi/iscsi_util.go
generated
vendored
15
vendor/github.com/kubernetes-csi/drivers/pkg/iscsi/iscsi_util.go
generated
vendored
@ -268,7 +268,7 @@ func (util *ISCSIUtil) AttachDisk(b iscsiDiskMounter) (string, error) {
|
||||
devicePath = devicePaths[0]
|
||||
|
||||
// Mount device
|
||||
mntPath := path.Join(b.targetPath, b.VolName)
|
||||
mntPath := b.targetPath
|
||||
notMnt, err := b.mounter.IsLikelyNotMountPoint(mntPath)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return "", fmt.Errorf("Heuristic determination of mount point failed:%v", err)
|
||||
@ -320,21 +320,20 @@ func (util *ISCSIUtil) AttachDisk(b iscsiDiskMounter) (string, error) {
|
||||
}
|
||||
|
||||
func (util *ISCSIUtil) DetachDisk(c iscsiDiskUnmounter, targetPath string) error {
|
||||
mntPath := path.Join(targetPath, c.VolName)
|
||||
_, cnt, err := mount.GetDeviceNameFromMount(c.mounter, mntPath)
|
||||
_, cnt, err := mount.GetDeviceNameFromMount(c.mounter, targetPath)
|
||||
if err != nil {
|
||||
glog.Errorf("iscsi detach disk: failed to get device from mnt: %s\nError: %v", mntPath, err)
|
||||
glog.Errorf("iscsi detach disk: failed to get device from mnt: %s\nError: %v", targetPath, err)
|
||||
return err
|
||||
}
|
||||
|
||||
if pathExists, pathErr := volumeutil.PathExists(mntPath); pathErr != nil {
|
||||
if pathExists, pathErr := volumeutil.PathExists(targetPath); pathErr != nil {
|
||||
return fmt.Errorf("Error checking if path exists: %v", pathErr)
|
||||
} else if !pathExists {
|
||||
glog.Warningf("Warning: Unmount skipped because path does not exist: %v", mntPath)
|
||||
glog.Warningf("Warning: Unmount skipped because path does not exist: %v", targetPath)
|
||||
return nil
|
||||
}
|
||||
if err = c.mounter.Unmount(mntPath); err != nil {
|
||||
glog.Errorf("iscsi detach disk: failed to unmount: %s\nError: %v", mntPath, err)
|
||||
if err = c.mounter.Unmount(targetPath); err != nil {
|
||||
glog.Errorf("iscsi detach disk: failed to unmount: %s\nError: %v", targetPath, err)
|
||||
return err
|
||||
}
|
||||
cnt--
|
||||
|
8
vendor/github.com/kubernetes-csi/drivers/pkg/nfs/README.md
generated
vendored
8
vendor/github.com/kubernetes-csi/drivers/pkg/nfs/README.md
generated
vendored
@ -39,7 +39,7 @@ $ sudo ./_output/nfsplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINode -v=
|
||||
```
|
||||
|
||||
## Test
|
||||
Get ```csc``` tool from https://github.com/thecodeteam/gocsi/tree/master/csc
|
||||
Get ```csc``` tool from https://github.com/rexray/gocsi/tree/master/csc
|
||||
|
||||
#### Get plugin info
|
||||
```
|
||||
@ -47,12 +47,6 @@ $ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
|
||||
"NFS" "0.1.0"
|
||||
```
|
||||
|
||||
### Get supported versions
|
||||
```
|
||||
$ csc identity supported-versions --endpoint tcp://127.0.0.1:10000
|
||||
0.1.0
|
||||
```
|
||||
|
||||
#### NodePublish a volume
|
||||
```
|
||||
$ export NFS_SERVER="Your Server IP (Ex: 10.10.10.10)"
|
||||
|
@ -30,7 +30,7 @@ spec:
|
||||
serviceAccount: csi-attacher
|
||||
containers:
|
||||
- name: csi-attacher
|
||||
image: docker.io/k8scsi/csi-attacher
|
||||
image: quay.io/k8scsi/csi-attacher:v0.3.0
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
@ -43,7 +43,7 @@ spec:
|
||||
mountPath: /var/lib/csi/sockets/pluginproxy/
|
||||
|
||||
- name: nfs
|
||||
image: docker.io/k8scsi/nfsplugin:v0.1
|
||||
image: quay.io/k8scsi/nfsplugin:v0.3.0
|
||||
args :
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
|
@ -17,7 +17,7 @@ spec:
|
||||
hostNetwork: true
|
||||
containers:
|
||||
- name: driver-registrar
|
||||
image: docker.io/k8scsi/driver-registrar
|
||||
image: quay.io/k8scsi/driver-registrar:v0.3.0
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
@ -37,7 +37,7 @@ spec:
|
||||
capabilities:
|
||||
add: ["SYS_ADMIN"]
|
||||
allowPrivilegeEscalation: true
|
||||
image: docker.io/k8scsi/nfsplugin:v0.1
|
||||
image: quay.io/k8scsi/nfsplugin:v0.3.0
|
||||
args :
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
|
9
vendor/github.com/kubernetes-csi/drivers/pkg/nfs/driver.go
generated
vendored
9
vendor/github.com/kubernetes-csi/drivers/pkg/nfs/driver.go
generated
vendored
@ -39,7 +39,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
)
|
||||
|
||||
func NewDriver(nodeID, endpoint string) *driver {
|
||||
@ -51,6 +51,10 @@ func NewDriver(nodeID, endpoint string) *driver {
|
||||
|
||||
csiDriver := csicommon.NewCSIDriver(driverName, version, nodeID)
|
||||
csiDriver.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER})
|
||||
// NFS plugin does not support ControllerServiceCapability now.
|
||||
// If support is added, it should set to appropriate
|
||||
// ControllerServiceCapability RPC types.
|
||||
csiDriver.AddControllerServiceCapabilities([]csi.ControllerServiceCapability_RPC_Type{csi.ControllerServiceCapability_RPC_UNKNOWN})
|
||||
|
||||
d.csiDriver = csiDriver
|
||||
|
||||
@ -67,7 +71,8 @@ func (d *driver) Run() {
|
||||
s := csicommon.NewNonBlockingGRPCServer()
|
||||
s.Start(d.endpoint,
|
||||
csicommon.NewDefaultIdentityServer(d.csiDriver),
|
||||
csicommon.NewDefaultControllerServer(d.csiDriver),
|
||||
// NFS plugin has not implemented ControllerServer.
|
||||
nil,
|
||||
NewNodeServer(d))
|
||||
s.Wait()
|
||||
}
|
||||
|
9
vendor/github.com/kubernetes-csi/drivers/pkg/nfs/examples/kubernetes/nginx.yaml
generated
vendored
9
vendor/github.com/kubernetes-csi/drivers/pkg/nfs/examples/kubernetes/nginx.yaml
generated
vendored
@ -4,16 +4,17 @@ metadata:
|
||||
name: data-nfsplugin
|
||||
labels:
|
||||
name: data-nfsplugin
|
||||
annotations:
|
||||
csi.volume.kubernetes.io/volume-attributes: '{"server": "10.10.10.10", "share": "share"}'
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
- ReadWriteMany
|
||||
capacity:
|
||||
storage: 100Gi
|
||||
csi:
|
||||
driver: csi-nfsplugin
|
||||
volumeHandle: data-id
|
||||
volumeAttributes:
|
||||
server: 127.0.0.1
|
||||
share: /export
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
@ -21,7 +22,7 @@ metadata:
|
||||
name: data-nfsplugin
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Gi
|
||||
|
Reference in New Issue
Block a user