From 0535c0d4f101a4c147a710c5fff74e81368dc7e3 Mon Sep 17 00:00:00 2001 From: Aaron Crickenberger Date: Wed, 16 Jan 2019 10:47:35 -0800 Subject: [PATCH 01/18] Initial commit from kubernetes-template-project --- CONTRIBUTING.md | 31 +++++++ LICENSE | 201 +++++++++++++++++++++++++++++++++++++++++++++ OWNERS | 6 ++ OWNERS_ALIASES | 20 +++++ README.md | 29 +++++++ RELEASE.md | 9 ++ SECURITY_CONTACTS | 14 ++++ code-of-conduct.md | 3 + 8 files changed, 313 insertions(+) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 OWNERS create mode 100644 OWNERS_ALIASES create mode 100644 README.md create mode 100644 RELEASE.md create mode 100644 SECURITY_CONTACTS create mode 100644 code-of-conduct.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..de4711513 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# Contributing Guidelines + +Welcome to Kubernetes. We are excited about the prospect of you joining our [community](https://github.com/kubernetes/community)! The Kubernetes community abides by the CNCF [code of conduct](code-of-conduct.md). Here is an excerpt: + +_As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities._ + +## Getting Started + +We have full documentation on how to get started contributing here: + + + +- [Contributor License Agreement](https://git.k8s.io/community/CLA.md) Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests +- [Kubernetes Contributor Guide](http://git.k8s.io/community/contributors/guide) - Main contributor documentation, or you can just jump directly to the [contributing section](http://git.k8s.io/community/contributors/guide#contributing) +- [Contributor Cheat Sheet](https://git.k8s.io/community/contributors/guide/contributor-cheatsheet.md) - Common resources for existing developers + +## Mentorship + +- [Mentoring Initiatives](https://git.k8s.io/community/mentoring) - We have a diverse set of mentorship programs available that are always looking for volunteers! + + diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..8dada3eda --- /dev/null +++ b/LICENSE @@ -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. diff --git a/OWNERS b/OWNERS new file mode 100644 index 000000000..e4c79b9d2 --- /dev/null +++ b/OWNERS @@ -0,0 +1,6 @@ +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + +approvers: + # TODO: in your repo created from this template, you should replace the + # steering-committee with a list of project owners, see the doc linked above. + - steering-committee diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES new file mode 100644 index 000000000..8bcd3a605 --- /dev/null +++ b/OWNERS_ALIASES @@ -0,0 +1,20 @@ +# See the OWNERS_ALIASES docs: https://git.k8s.io/community/contributors/guide/owners.md#owners_aliases + +aliases: + # TODO: remove this alias, it will go stale in your repo, and in your repo + # you should have your own set of approvers (see OWNERS) + # in the original template repo, we must maintain this list to approve changes + # to the template itself + steering-committee: + - bgrant0607 + - brendandburns + - derekwaynecarr + - dims + - jbeda + - michelleN + - philips + - pwittrock + - sarahnovotny + - smarterclayton + - spiffxp + - timothysc diff --git a/README.md b/README.md new file mode 100644 index 000000000..9431b7bb3 --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# Kubernetes Template Project + +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: + +- a `README.md` outlining the project goals, sponsoring sig, and community contact information +- an `OWNERS` with the project leads listed as approvers ([docs on `OWNERS` files][owners]) +- a `CONTRIBUTING.md` outlining how to contribute to the project +- an unmodified copy of `code-of-conduct.md` from this repo, which outlines community behavior and the consequences of breaking the code +- a `LICENSE` which must be Apache 2.0 for code projects, or [Creative Commons 4.0] for documentation repositories, without any custom content +- a `SECURITY_CONTACTS` with the contact points for the Product Security Team + to reach out to for triaging and handling of incoming issues. They must agree to abide by the + [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy) + and will be removed and replaced if they violate that agreement. + +## Community, discussion, contribution, and support + +Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/). + +You can reach the maintainers of this project at: + +- [Slack](http://slack.k8s.io/) +- [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-dev) + +### Code of conduct + +Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md). + +[owners]: https://git.k8s.io/community/contributors/guide/owners.md +[Creative Commons 4.0]: https://git.k8s.io/website/LICENSE diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 000000000..7274b344e --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,9 @@ +# Release Process + +The Kubernetes Template Project is released on an as-needed basis. The process is as follows: + +1. An issue is proposing a new release with a changelog since the last release +1. All [OWNERS](OWNERS) must LGTM this release +1. An OWNER runs `git tag -s $VERSION` and inserts the changelog and pushes the tag with `git push $VERSION` +1. The release issue is closed +1. An announcement email is sent to `kubernetes-dev@googlegroups.com` with the subject `[ANNOUNCE] kubernetes-template-project $VERSION is released` diff --git a/SECURITY_CONTACTS b/SECURITY_CONTACTS new file mode 100644 index 000000000..39689175d --- /dev/null +++ b/SECURITY_CONTACTS @@ -0,0 +1,14 @@ +# Defined below are the security contacts for this repo. +# +# They are the contact point for the Product Security Team to reach out +# to for triaging and handling of incoming issues. +# +# The below names agree to abide by the +# [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy) +# and will be removed and replaced if they violate that agreement. +# +# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE +# INSTRUCTIONS AT https://kubernetes.io/security/ + +bob +alice diff --git a/code-of-conduct.md b/code-of-conduct.md new file mode 100644 index 000000000..0d15c00cf --- /dev/null +++ b/code-of-conduct.md @@ -0,0 +1,3 @@ +# Kubernetes Community Code of Conduct + +Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md) From b41cac350d9dd1b9c478b16c398745aeb95390a6 Mon Sep 17 00:00:00 2001 From: Aaron Crickenberger Date: Wed, 16 Jan 2019 10:51:52 -0800 Subject: [PATCH 02/18] Add files from github.com/pohly/csi-build-rules --- README.md | 79 ++-- build.make | 1211 ++++++++++++++++++++++++++++++++++++++++++++++++++++ travis.yml | 14 + 3 files changed, 1275 insertions(+), 29 deletions(-) create mode 100644 build.make create mode 100644 travis.yml diff --git a/README.md b/README.md index 9431b7bb3..c67e9308a 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,50 @@ -# Kubernetes Template Project - -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: - -- a `README.md` outlining the project goals, sponsoring sig, and community contact information -- an `OWNERS` with the project leads listed as approvers ([docs on `OWNERS` files][owners]) -- a `CONTRIBUTING.md` outlining how to contribute to the project -- an unmodified copy of `code-of-conduct.md` from this repo, which outlines community behavior and the consequences of breaking the code -- a `LICENSE` which must be Apache 2.0 for code projects, or [Creative Commons 4.0] for documentation repositories, without any custom content -- a `SECURITY_CONTACTS` with the contact points for the Product Security Team - to reach out to for triaging and handling of incoming issues. They must agree to abide by the - [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy) - and will be removed and replaced if they violate that agreement. - -## Community, discussion, contribution, and support - -Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/). - -You can reach the maintainers of this project at: - -- [Slack](http://slack.k8s.io/) -- [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-dev) - -### Code of conduct - -Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md). - -[owners]: https://git.k8s.io/community/contributors/guide/owners.md -[Creative Commons 4.0]: https://git.k8s.io/website/LICENSE +# [csi-build-rules](https://github.com/kubernetes-csi/csi-build-rules) + +These build and test rules can be shared between different Go projects +without modifications. Customization for the different projects happen +in the top-level Makefile. + +The rules include support for building and pushing Docker images, with +the following features: + - one or more command and image per project + - push canary and/or tagged release images + - automatically derive the image tag(s) from repo tags + - the source code revision is stored in a "revision" image label + - never overwrites an existing release image + +Usage +----- + +The expected repository layout is: + - `cmd/*/*.go` - source code for each command + - `cmd/*/Dockerfile` - docker file for each command or + Dockerfile in the root when only building a single command + - `Makefile` - includes `build-rules/build.make` and sets + configuration variables + - `.travis.yml` - a symlink to `build-rules/.travis.yml` + +To create a release, tag a certain revision with a name that +starts with `v`, for example `v1.0.0`, then `make push` +while that commit is checked out. + +It does not matter on which branch that revision exists, i.e. it is +possible to create releases directly from master. A release branch can +still be created for maintenance releases later if needed. + +Release branches are expected to be named `release-x.y` for releases +`x.y.z`. Building from such a branch creates `x.y-canary` +images. Building from master creates the main `canary` image. + +Sharing and updating +-------------------- + +[`git subtree`](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt) +is the recommended way of maintaining a copy of the rules inside the +`build-rules` directory of a project. This way, it is possible to make +changes also locally, test them and then push them back to the shared +repository at a later time. + +Cheat sheet: + +- `git subtree pull --prefix=build-rules https://github.com/kubernetes-csi/csi-build-rules.git master` - update local copy to latest upstream +- edit, `git commit`, `git subtree push --prefix=build-rules git@github.com:/csi-build-rules.git ` - push to a new branch before submitting a PR diff --git a/build.make b/build.make new file mode 100644 index 000000000..460ee71cd --- /dev/null +++ b/build.make @@ -0,0 +1,1211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + csi-build-rules/build.make at master · pohly/csi-build-rules · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + + +
+ +
+ +
+ +
+ + + +
+
+
+ + + + + + + + + + + +
+
+ + + + + + + + Permalink + + + + + + +
+ +
+ + +
+
+
+
+ +
+
+
+
+ +
+ + Find file + + + Copy path + +
+ +
+ + + +
+ + + c03f108 + + Jan 9, 2019 + + + +
+ +
+ + + 1 contributor + + +
+ +

Users who have contributed to this file

+
+ + + +
+
+ +
+
+ + + + +
+ +
+ +
+ + +
+ Raw + Blame + History +
+ + + + +
+ +
+ 100 lines (83 sloc) + + 3.78 KB +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
# Copyright 2017 The Kubernetes Authors.
#
# 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.
+
.PHONY: build-% build container-% container push-% push clean test
+
# A space-separated list of all commands in the repository, must be
# set in main Makefile of a repository.
# CMDS=
+
# This is the default. It can be overridden in the main Makefile after
# including build.make.
REGISTRY_NAME=quay.io/k8scsi
+
# Revision that gets built into each binary via the main.version
# string. Uses the `git describe` output based on the most recent
# version tag with a short revision suffix or, if nothing has been
# tagged yet, just the revision.
#
# Beware that tags may also be missing in shallow clones as done by
# some CI systems (like TravisCI, which pulls only 50 commits).
REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
+
# A space-separated list of image tags under which the current build is to be pushed.
# Determined dynamically.
IMAGE_TAGS=
+
# A "canary" image gets built if the current commit is the head of the remote "master" branch.
# That branch does not exist when building some other branch in TravisCI.
IMAGE_TAGS+=$(shell if [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 origin/master 2>/dev/null)" ]; then echo "canary"; fi)
+
# A "X.Y.Z-canary" image gets built if the current commit is the head of a "origin/release-X.Y.Z" branch.
# The actual suffix does not matter, only the "release-" prefix is checked.
IMAGE_TAGS+=$(shell git branch -r --points-at=HEAD | grep 'origin/release-' | grep -v -e ' -> ' | sed -e 's;.*/release-\(.*\);\1-canary;')
+
# A release image "vX.Y.Z" gets built if there is a tag of that format for the current commit.
# --abbrev=0 suppresses long format, only showing the closest tag.
IMAGE_TAGS+=$(shell tagged="$$(git describe --tags --match='v*' --abbrev=0)"; if [ "$$tagged" ] && [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 $$tagged)" ]; then echo $$tagged; fi)
+
# Images are named after the command contained in them.
IMAGE_NAME=$(REGISTRY_NAME)/$*
+
ifdef V
TESTARGS = -v -args -alsologtostderr -v 5
else
TESTARGS =
endif
+
build-%:
mkdir -p bin
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$*
+
container-%: build-%
docker build -t $*:latest -f $(shell if [ -e ./cmd/$*/Dockerfile ]; then echo ./cmd/$*/Dockerfile; else echo Dockerfile; fi) --label revision=$(REV) .
+
push-%: container-%
set -ex; \
push_image () { \
docker tag $*:latest $(IMAGE_NAME):$$tag; \
docker push $(IMAGE_NAME):$$tag; \
}; \
for tag in $(IMAGE_TAGS); do \
if echo $$tag | grep -q -e '-canary$$'; then \
: "creating or overwriting canary image"; \
push_image; \
elif docker pull $(IMAGE_NAME):$$tag 2>&1 | tee /dev/stderr | grep -q "manifest for $(IMAGE_NAME):$$tag not found"; then \
: "creating release image"; \
push_image; \
else \
: "release image $(IMAGE_NAME):$$tag already exists, skipping push"; \
fi; \
done
+
build: $(CMDS:%=build-%)
container: $(CMDS:%=container-%)
push: $(CMDS:%=push-%)
+
clean:
-rm -rf bin
+
test:
go test `go list ./... | grep -v 'vendor'` $(TESTARGS)
go vet `go list ./... | grep -v vendor`
files=$$(find . -name '*.go' | grep -v './vendor'); \
if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \
echo "formatting errors:"; \
gofmt -d $$files; \
false; \
fi
+ + + +
+ +
+ + + +
+ + +
+ + +
+
+ + + +
+ +
+ +
+
+ +
+ + + + + + +
+ + + You can’t perform that action at this time. +
+ + + + + + + + + +
+ + You signed in with another tab or window. Reload to refresh your session. + You signed out in another tab or window. Reload to refresh your session. +
+ + + + + + +
+ Press h to open a hovercard with more details. +
+ +
+ + + + diff --git a/travis.yml b/travis.yml new file mode 100644 index 000000000..a44b00175 --- /dev/null +++ b/travis.yml @@ -0,0 +1,14 @@ +language: go +sudo: required +services: + - docker +matrix: + include: + - go: 1.11.1 +script: +- make all test +after_success: + - if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then + docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" quay.io; + make push; + fi From d23a16cb744734b468ac4e226c98ca8aaaea9125 Mon Sep 17 00:00:00 2001 From: Aaron Crickenberger Date: Wed, 16 Jan 2019 11:19:16 -0800 Subject: [PATCH 03/18] Port over information from kubernetes/org --- OWNERS | 11 ++++++++--- OWNERS_ALIASES | 20 -------------------- RELEASE.md | 8 +------- SECURITY_CONTACTS | 4 ++-- 4 files changed, 11 insertions(+), 32 deletions(-) delete mode 100644 OWNERS_ALIASES diff --git a/OWNERS b/OWNERS index e4c79b9d2..6d2f474e1 100644 --- a/OWNERS +++ b/OWNERS @@ -1,6 +1,11 @@ # See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md approvers: - # TODO: in your repo created from this template, you should replace the - # steering-committee with a list of project owners, see the doc linked above. - - steering-committee +- saad-ali +- msau42 +- pohly + +reviewers: +- saad-ali +- msau42 +- pohly diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES deleted file mode 100644 index 8bcd3a605..000000000 --- a/OWNERS_ALIASES +++ /dev/null @@ -1,20 +0,0 @@ -# See the OWNERS_ALIASES docs: https://git.k8s.io/community/contributors/guide/owners.md#owners_aliases - -aliases: - # TODO: remove this alias, it will go stale in your repo, and in your repo - # you should have your own set of approvers (see OWNERS) - # in the original template repo, we must maintain this list to approve changes - # to the template itself - steering-committee: - - bgrant0607 - - brendandburns - - derekwaynecarr - - dims - - jbeda - - michelleN - - philips - - pwittrock - - sarahnovotny - - smarterclayton - - spiffxp - - timothysc diff --git a/RELEASE.md b/RELEASE.md index 7274b344e..491044d22 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,9 +1,3 @@ # Release Process -The Kubernetes Template Project is released on an as-needed basis. The process is as follows: - -1. An issue is proposing a new release with a changelog since the last release -1. All [OWNERS](OWNERS) must LGTM this release -1. An OWNER runs `git tag -s $VERSION` and inserts the changelog and pushes the tag with `git push $VERSION` -1. The release issue is closed -1. An announcement email is sent to `kubernetes-dev@googlegroups.com` with the subject `[ANNOUNCE] kubernetes-template-project $VERSION is released` +TODO: describe the release process for this project diff --git a/SECURITY_CONTACTS b/SECURITY_CONTACTS index 39689175d..2af1414e0 100644 --- a/SECURITY_CONTACTS +++ b/SECURITY_CONTACTS @@ -10,5 +10,5 @@ # DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE # INSTRUCTIONS AT https://kubernetes.io/security/ -bob -alice +saad-ali +msau42 From a1136470c29f970e0af87d352a1b3cb1520d09dc Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 21 Jan 2019 10:08:51 +0100 Subject: [PATCH 04/18] build.make: initial content The repo was created with an HTML version of the build.make file from https://github.com/pohly/csi-build-rules/. Here's the raw file. --- build.make | 1310 ++++------------------------------------------------ 1 file changed, 99 insertions(+), 1211 deletions(-) diff --git a/build.make b/build.make index 460ee71cd..42146483c 100644 --- a/build.make +++ b/build.make @@ -1,1211 +1,99 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - csi-build-rules/build.make at master · pohly/csi-build-rules · GitHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Skip to content -
- - - - - - - - - -
- -
- -
- -
- - - -
-
-
- - - - - - - - - - - -
-
- - - - - - - - Permalink - - - - - - -
- -
- - -
-
-
-
- -
-
-
-
- -
- - Find file - - - Copy path - -
- -
- - - -
- - - c03f108 - - Jan 9, 2019 - - - -
- -
- - - 1 contributor - - -
- -

Users who have contributed to this file

-
- - - -
-
- -
-
- - - - -
- -
- -
- - -
- Raw - Blame - History -
- - - - -
- -
- 100 lines (83 sloc) - - 3.78 KB -
-
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Copyright 2017 The Kubernetes Authors.
#
# 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.
-
.PHONY: build-% build container-% container push-% push clean test
-
# A space-separated list of all commands in the repository, must be
# set in main Makefile of a repository.
# CMDS=
-
# This is the default. It can be overridden in the main Makefile after
# including build.make.
REGISTRY_NAME=quay.io/k8scsi
-
# Revision that gets built into each binary via the main.version
# string. Uses the `git describe` output based on the most recent
# version tag with a short revision suffix or, if nothing has been
# tagged yet, just the revision.
#
# Beware that tags may also be missing in shallow clones as done by
# some CI systems (like TravisCI, which pulls only 50 commits).
REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
-
# A space-separated list of image tags under which the current build is to be pushed.
# Determined dynamically.
IMAGE_TAGS=
-
# A "canary" image gets built if the current commit is the head of the remote "master" branch.
# That branch does not exist when building some other branch in TravisCI.
IMAGE_TAGS+=$(shell if [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 origin/master 2>/dev/null)" ]; then echo "canary"; fi)
-
# A "X.Y.Z-canary" image gets built if the current commit is the head of a "origin/release-X.Y.Z" branch.
# The actual suffix does not matter, only the "release-" prefix is checked.
IMAGE_TAGS+=$(shell git branch -r --points-at=HEAD | grep 'origin/release-' | grep -v -e ' -> ' | sed -e 's;.*/release-\(.*\);\1-canary;')
-
# A release image "vX.Y.Z" gets built if there is a tag of that format for the current commit.
# --abbrev=0 suppresses long format, only showing the closest tag.
IMAGE_TAGS+=$(shell tagged="$$(git describe --tags --match='v*' --abbrev=0)"; if [ "$$tagged" ] && [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 $$tagged)" ]; then echo $$tagged; fi)
-
# Images are named after the command contained in them.
IMAGE_NAME=$(REGISTRY_NAME)/$*
-
ifdef V
TESTARGS = -v -args -alsologtostderr -v 5
else
TESTARGS =
endif
-
build-%:
mkdir -p bin
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$*
-
container-%: build-%
docker build -t $*:latest -f $(shell if [ -e ./cmd/$*/Dockerfile ]; then echo ./cmd/$*/Dockerfile; else echo Dockerfile; fi) --label revision=$(REV) .
-
push-%: container-%
set -ex; \
push_image () { \
docker tag $*:latest $(IMAGE_NAME):$$tag; \
docker push $(IMAGE_NAME):$$tag; \
}; \
for tag in $(IMAGE_TAGS); do \
if echo $$tag | grep -q -e '-canary$$'; then \
: "creating or overwriting canary image"; \
push_image; \
elif docker pull $(IMAGE_NAME):$$tag 2>&1 | tee /dev/stderr | grep -q "manifest for $(IMAGE_NAME):$$tag not found"; then \
: "creating release image"; \
push_image; \
else \
: "release image $(IMAGE_NAME):$$tag already exists, skipping push"; \
fi; \
done
-
build: $(CMDS:%=build-%)
container: $(CMDS:%=container-%)
push: $(CMDS:%=push-%)
-
clean:
-rm -rf bin
-
test:
go test `go list ./... | grep -v 'vendor'` $(TESTARGS)
go vet `go list ./... | grep -v vendor`
files=$$(find . -name '*.go' | grep -v './vendor'); \
if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \
echo "formatting errors:"; \
gofmt -d $$files; \
false; \
fi
- - - -
- -
- - - -
- - -
- - -
-
- - - -
- -
- -
-
- -
- - - - - - -
- - - You can’t perform that action at this time. -
- - - - - - - - - -
- - You signed in with another tab or window. Reload to refresh your session. - You signed out in another tab or window. Reload to refresh your session. -
- - - - - - -
- Press h to open a hovercard with more details. -
- -
- - - - +# Copyright 2019 The Kubernetes Authors. +# +# 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. + +.PHONY: build-% build container-% container push-% push clean test + +# A space-separated list of all commands in the repository, must be +# set in main Makefile of a repository. +# CMDS= + +# This is the default. It can be overridden in the main Makefile after +# including build.make. +REGISTRY_NAME=quay.io/k8scsi + +# Revision that gets built into each binary via the main.version +# string. Uses the `git describe` output based on the most recent +# version tag with a short revision suffix or, if nothing has been +# tagged yet, just the revision. +# +# Beware that tags may also be missing in shallow clones as done by +# some CI systems (like TravisCI, which pulls only 50 commits). +REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD) + +# A space-separated list of image tags under which the current build is to be pushed. +# Determined dynamically. +IMAGE_TAGS= + +# A "canary" image gets built if the current commit is the head of the remote "master" branch. +# That branch does not exist when building some other branch in TravisCI. +IMAGE_TAGS+=$(shell if [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 origin/master 2>/dev/null)" ]; then echo "canary"; fi) + +# A "X.Y.Z-canary" image gets built if the current commit is the head of a "origin/release-X.Y.Z" branch. +# The actual suffix does not matter, only the "release-" prefix is checked. +IMAGE_TAGS+=$(shell git branch -r --points-at=HEAD | grep 'origin/release-' | grep -v -e ' -> ' | sed -e 's;.*/release-\(.*\);\1-canary;') + +# A release image "vX.Y.Z" gets built if there is a tag of that format for the current commit. +# --abbrev=0 suppresses long format, only showing the closest tag. +IMAGE_TAGS+=$(shell tagged="$$(git describe --tags --match='v*' --abbrev=0)"; if [ "$$tagged" ] && [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 $$tagged)" ]; then echo $$tagged; fi) + +# Images are named after the command contained in them. +IMAGE_NAME=$(REGISTRY_NAME)/$* + +ifdef V +TESTARGS = -v -args -alsologtostderr -v 5 +else +TESTARGS = +endif + +build-%: + mkdir -p bin + CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$* + +container-%: build-% + docker build -t $*:latest -f $(shell if [ -e ./cmd/$*/Dockerfile ]; then echo ./cmd/$*/Dockerfile; else echo Dockerfile; fi) --label revision=$(REV) . + +push-%: container-% + set -ex; \ + push_image () { \ + docker tag $*:latest $(IMAGE_NAME):$$tag; \ + docker push $(IMAGE_NAME):$$tag; \ + }; \ + for tag in $(IMAGE_TAGS); do \ + if echo $$tag | grep -q -e '-canary$$'; then \ + : "creating or overwriting canary image"; \ + push_image; \ + elif docker pull $(IMAGE_NAME):$$tag 2>&1 | tee /dev/stderr | grep -q "manifest for $(IMAGE_NAME):$$tag not found"; then \ + : "creating release image"; \ + push_image; \ + else \ + : "release image $(IMAGE_NAME):$$tag already exists, skipping push"; \ + fi; \ + done + +build: $(CMDS:%=build-%) +container: $(CMDS:%=container-%) +push: $(CMDS:%=push-%) + +clean: + -rm -rf bin + +test: + go test `go list ./... | grep -v 'vendor'` $(TESTARGS) + go vet `go list ./... | grep -v vendor` + files=$$(find . -name '*.go' | grep -v './vendor'); \ + if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \ + echo "formatting errors:"; \ + gofmt -d $$files; \ + false; \ + fi From 51e16be615359fa450d223f3a7381a85dacc62fb Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 21 Jan 2019 10:18:56 +0100 Subject: [PATCH 05/18] RELEASE.md: clarify release process It's worth calling out explicitly that only the master branch is maintained. --- RELEASE.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RELEASE.md b/RELEASE.md index 491044d22..a0fd815b0 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,5 @@ # Release Process -TODO: describe the release process for this project +No tagged releases are planned at this point. The intention is to keep +the master branch in a state such that it can be used for all +supported branches in downstream repos which use these files. From c876547b7f4b22447c963a68cc81529e181105ba Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 21 Jan 2019 10:26:11 +0100 Subject: [PATCH 06/18] README.md: update repo name, add initial setup step The actual repository was not named like the prototype repo. --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c67e9308a..286be88d6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [csi-build-rules](https://github.com/kubernetes-csi/csi-build-rules) +# [csi-release-tools](https://github.com/kubernetes-csi/csi-release-tools) These build and test rules can be shared between different Go projects without modifications. Customization for the different projects happen @@ -19,9 +19,9 @@ The expected repository layout is: - `cmd/*/*.go` - source code for each command - `cmd/*/Dockerfile` - docker file for each command or Dockerfile in the root when only building a single command - - `Makefile` - includes `build-rules/build.make` and sets + - `Makefile` - includes `release-tools/build.make` and sets configuration variables - - `.travis.yml` - a symlink to `build-rules/.travis.yml` + - `.travis.yml` - a symlink to `release-tools/.travis.yml` To create a release, tag a certain revision with a name that starts with `v`, for example `v1.0.0`, then `make push` @@ -40,11 +40,12 @@ Sharing and updating [`git subtree`](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt) is the recommended way of maintaining a copy of the rules inside the -`build-rules` directory of a project. This way, it is possible to make +`release-tools` directory of a project. This way, it is possible to make changes also locally, test them and then push them back to the shared repository at a later time. Cheat sheet: -- `git subtree pull --prefix=build-rules https://github.com/kubernetes-csi/csi-build-rules.git master` - update local copy to latest upstream -- edit, `git commit`, `git subtree push --prefix=build-rules git@github.com:/csi-build-rules.git ` - push to a new branch before submitting a PR +- `git subtree add --prefix=release-tools https://github.com/pohly/csi-release-tools.git master` - add release tools to a repo which does not have them yet (only once) +- `git subtree pull --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master` - update local copy to latest upstream (whenever upstream changes) +- edit, `git commit`, `git subtree push --prefix=release-tools git@github.com:/csi-release-tools.git ` - push to a new branch before submitting a PR From fb9dcc29e2946f70da7dd80f3fef768e7f3f8cc1 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 22 Jan 2019 10:28:11 +0100 Subject: [PATCH 07/18] README.md: fix repo URL for initial setup Copy-and-paste error from the time when the kubernetes-csi/csi-release-tools repo didn't have the code... --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 286be88d6..56d2248c0 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,6 @@ repository at a later time. Cheat sheet: -- `git subtree add --prefix=release-tools https://github.com/pohly/csi-release-tools.git master` - add release tools to a repo which does not have them yet (only once) +- `git subtree add --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master` - add release tools to a repo which does not have them yet (only once) - `git subtree pull --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master` - update local copy to latest upstream (whenever upstream changes) - edit, `git commit`, `git subtree push --prefix=release-tools git@github.com:/csi-release-tools.git ` - push to a new branch before submitting a PR From 86b7449f031dc57b6dc306a6f4b879c05098e480 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 23 Jan 2019 14:41:26 +0100 Subject: [PATCH 08/18] verify-subtree.sh: ensure that there are no local commits The goal is to enforce that changes get merged upstream first and only get into the local repo via a normal "git subtree merge". --- verify-subtree.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 verify-subtree.sh diff --git a/verify-subtree.sh b/verify-subtree.sh new file mode 100755 index 000000000..ce8375fc9 --- /dev/null +++ b/verify-subtree.sh @@ -0,0 +1,41 @@ +#! /bin/sh -e +# +# Copyright 2019 The Kubernetes Authors. +# +# 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. + +# This script verifies that the content of a directory managed +# by "git subtree" has not been modified locally. It does that +# by looking for commits that modify the files with the +# subtree prefix (aka directory) while ignoring merge +# commits. Merge commits are where "git subtree" pulls the +# upstream files into the directory. +# +# Theoretically a developer can subvert this check by modifying files +# in a merge commit, but in practice that shouldn't happen. + +DIR="$1" +if [ ! "$DIR" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +REV=$(git log -n1 --format=format:%H --no-merges -- "$DIR") +if [ "$REV" ]; then + echo "Directory '$DIR' contains non-upstream changes:" + echo + git log --no-merges -- "$DIR" + exit 1 +else + echo "$DIR is a clean copy of upstream." +fi From 27121c22b405de6cbf5d230bd33b521e23bcf39d Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 23 Jan 2019 14:49:07 +0100 Subject: [PATCH 09/18] test: split up into individual targets, run all "make test" used to abort after the first test failure. That was partly intentional: if the simple tests already fail (for example, because of a syntax error), then there is no point in continuing to test. However, it also makes it harder to find all errors in a CI system when the errors are unrelated (first error shows up, gets fixed, next error shows up, etc.). Now "make test" still aborts early, but "make -k test" is used in the CI and will run all individual tests because they are split up into different targets. --- build.make | 15 +++++++++++++++ travis.yml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/build.make b/build.make index 42146483c..4818b5122 100644 --- a/build.make +++ b/build.make @@ -89,8 +89,23 @@ clean: -rm -rf bin test: + +.PHONY: test-go +test: test-go +test-go: + @ echo; echo $@ go test `go list ./... | grep -v 'vendor'` $(TESTARGS) + +.PHONY: test-vet +test: test-vet +test-vet: + @ echo; echo $@ go vet `go list ./... | grep -v vendor` + +.PHONY: test-fmt +test: test-fmt +test-fmt: + @ echo; echo $@ files=$$(find . -name '*.go' | grep -v './vendor'); \ if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \ echo "formatting errors:"; \ diff --git a/travis.yml b/travis.yml index a44b00175..b5a360af8 100644 --- a/travis.yml +++ b/travis.yml @@ -6,7 +6,7 @@ matrix: include: - go: 1.11.1 script: -- make all test +- make -k all test after_success: - if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" quay.io; From 46220b147166bac95760abeb343593e2a59188d9 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 23 Jan 2019 14:52:09 +0100 Subject: [PATCH 10/18] test: verify that 'release-tools' subtree is clean We don't want to allow local modifications in the subtree. Everything should go to the csi-release-tools repo first. --- build.make | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.make b/build.make index 4818b5122..f07f25e84 100644 --- a/build.make +++ b/build.make @@ -112,3 +112,9 @@ test-fmt: gofmt -d $$files; \ false; \ fi + +.PHONY: test-subtree +test: test-subtree +test-subtree: + @ echo; echo $@ + ./release-tools/verify-subtree.sh release-tools From 861f4166fe72c7b70f81fde1836bcd7c50c0a170 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 24 Jan 2019 16:42:23 +0100 Subject: [PATCH 11/18] build.make: clarify usage of "make V=1" This may or may not work, depending on which packages have tests and whether they contain glog. --- build.make | 1 + 1 file changed, 1 insertion(+) diff --git a/build.make b/build.make index f07f25e84..010dcb946 100644 --- a/build.make +++ b/build.make @@ -51,6 +51,7 @@ IMAGE_TAGS+=$(shell tagged="$$(git describe --tags --match='v*' --abbrev=0)"; if IMAGE_NAME=$(REGISTRY_NAME)/$* ifdef V +# Adding "-alsologtostderr" assumes that all test binaries contain glog. This is not guaranteed. TESTARGS = -v -args -alsologtostderr -v 5 else TESTARGS = From ea55a0a5a21b8bc8c266f6de8ec39ce7f2e7ec8d Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 24 Jan 2019 16:43:24 +0100 Subject: [PATCH 12/18] build.make: support suppressing checks Individual repos may have to filter out certain packages from testing. For example, in csi-test the cmd/csi-sanity directory contains a special test that depends on additional parameters that set the CSI driver to test against. --- build.make | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build.make b/build.make index 010dcb946..dfc405e06 100644 --- a/build.make +++ b/build.make @@ -57,6 +57,9 @@ else TESTARGS = endif +# Specific packages can be excluded from each of the tests below by setting the *_FILTER_CMD variables +# to something like "| grep -v 'github.com/kubernetes-csi/project/pkg/foobar'". See usage below. + build-%: mkdir -p bin CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$* @@ -95,19 +98,19 @@ test: test: test-go test-go: @ echo; echo $@ - go test `go list ./... | grep -v 'vendor'` $(TESTARGS) + go test `go list ./... | grep -v 'vendor' $(TEST_GO_FILTER_CMD)` $(TESTARGS) .PHONY: test-vet test: test-vet test-vet: @ echo; echo $@ - go vet `go list ./... | grep -v vendor` + go vet `go list ./... | grep -v vendor $(TEST_VET_FILTER_CMD)` .PHONY: test-fmt test: test-fmt test-fmt: @ echo; echo $@ - files=$$(find . -name '*.go' | grep -v './vendor'); \ + files=$$(find . -name '*.go' | grep -v './vendor' $(TEST_FMT_FILTER_CMD)); \ if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \ echo "formatting errors:"; \ gofmt -d $$files; \ From 60c0fa21d8dd989c6eb09901762977329dc53607 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 25 Jan 2019 11:48:59 +0100 Subject: [PATCH 13/18] build.make: fix pushing of "canary" image from master branch After merging into external-attacher, the next Travis CI run did not push the "canary" image because the check for "canary" only covered the case where "-canary" is used as suffix (https://travis-ci.org/kubernetes-csi/external-attacher/builds/484095261). --- build.make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.make b/build.make index f07f25e84..a6a8916ea 100644 --- a/build.make +++ b/build.make @@ -70,7 +70,7 @@ push-%: container-% docker push $(IMAGE_NAME):$$tag; \ }; \ for tag in $(IMAGE_TAGS); do \ - if echo $$tag | grep -q -e '-canary$$'; then \ + if [ "$$tag" = "canary" ] || echo "$$tag" | grep -q -e '-canary$$'; then \ : "creating or overwriting canary image"; \ push_image; \ elif docker pull $(IMAGE_NAME):$$tag 2>&1 | tee /dev/stderr | grep -q "manifest for $(IMAGE_NAME):$$tag not found"; then \ From 57794e23ea7570391fd2a2b4f9d25cbc429f57ce Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 25 Jan 2019 11:53:36 +0100 Subject: [PATCH 14/18] build.make: more readable "make test" output The introduction for each individual test looked like an actual command: test-subtree ./release-tools/verify-subtree.sh release-tools Directory 'release-tools' contains non-upstream changes: ... It's better to make it look like a shell comment and increase its visibility with a longer prefix: ### test-subtree: ./release-tools/verify-subtree.sh release-tools ... --- build.make | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.make b/build.make index dfc405e06..4296ff47a 100644 --- a/build.make +++ b/build.make @@ -97,19 +97,19 @@ test: .PHONY: test-go test: test-go test-go: - @ echo; echo $@ + @ echo; echo "### $@:" go test `go list ./... | grep -v 'vendor' $(TEST_GO_FILTER_CMD)` $(TESTARGS) .PHONY: test-vet test: test-vet test-vet: - @ echo; echo $@ + @ echo; echo "### $@:" go vet `go list ./... | grep -v vendor $(TEST_VET_FILTER_CMD)` .PHONY: test-fmt test: test-fmt test-fmt: - @ echo; echo $@ + @ echo; echo "### $@:" files=$$(find . -name '*.go' | grep -v './vendor' $(TEST_FMT_FILTER_CMD)); \ if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \ echo "formatting errors:"; \ @@ -120,5 +120,5 @@ test-fmt: .PHONY: test-subtree test: test-subtree test-subtree: - @ echo; echo $@ + @ echo; echo "### $@:" ./release-tools/verify-subtree.sh release-tools From bbfe68479aaa292a9f7a9bf0f9e91d35134ff6aa Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Wed, 27 Feb 2019 18:05:46 -0500 Subject: [PATCH 15/18] update csi-lib-utils to v0.4.0-rc1 --- Gopkg.lock | 20 +- Gopkg.toml | 6 +- .../spec/lib/go/csi/csi.pb.go | 154 ++++----- .../csi-lib-utils/connection/connection.go | 310 ++++++++++++++++++ .../csi-lib-utils/release-tools/LICENSE | 201 ++++++++++++ .../csi-lib-utils/rpc/common.go | 160 +++++++++ 6 files changed, 763 insertions(+), 88 deletions(-) create mode 100644 vendor/github.com/kubernetes-csi/csi-lib-utils/connection/connection.go create mode 100644 vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/LICENSE create mode 100644 vendor/github.com/kubernetes-csi/csi-lib-utils/rpc/common.go diff --git a/Gopkg.lock b/Gopkg.lock index 6650b24b4..1e1510a9d 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -3,11 +3,11 @@ [[projects]] branch = "master" - digest = "1:f1976930cb2f6da9d51858bc9eb3620b2f9e75f1f22c878a50eadf236400265e" + digest = "1:ff934b391013dfaef6ebed90128b18fafd8a7780a21be5e7a1a9ffcd15433c9c" name = "github.com/container-storage-interface/spec" packages = ["lib/go/csi"] pruneopts = "NUT" - revision = "37e74064635d27c8e33537c863b37ccb1182d4f8" + revision = "915ae314723e53f501b9ce4d01dc3c023f869ea0" [[projects]] digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec" @@ -120,12 +120,16 @@ version = "v1.1.5" [[projects]] - digest = "1:2b060bb1a39127e592baf9ab62ec1e94100dc22107f915183f3cd1f6d1cd579a" + digest = "1:a0892607b4f5385bb9fb12759facc8fad4e61b8b557384e4a078150c6ba43623" name = "github.com/kubernetes-csi/csi-lib-utils" - packages = ["protosanitizer"] + packages = [ + "connection", + "protosanitizer", + "rpc", + ] pruneopts = "NUT" - revision = "5853414e1d4771302e0df10d1870c444c2135799" - version = "v0.2.0" + revision = "8053f37bf1d11d769c20f9514538c4b3b906e1f7" + version = "v0.4.0-rc1" [[projects]] digest = "1:2f42fa12d6911c7b7659738758631bec870b7e9b4c6be5444f963cdcfccc191f" @@ -596,9 +600,9 @@ analyzer-version = 1 input-imports = [ "github.com/container-storage-interface/spec/lib/go/csi", - "github.com/kubernetes-csi/csi-lib-utils/protosanitizer", + "github.com/kubernetes-csi/csi-lib-utils/connection", + "github.com/kubernetes-csi/csi-lib-utils/rpc", "google.golang.org/grpc", - "google.golang.org/grpc/connectivity", "k8s.io/api/core/v1", "k8s.io/apimachinery/pkg/api/errors", "k8s.io/apimachinery/pkg/api/resource", diff --git a/Gopkg.toml b/Gopkg.toml index 600da2dd7..8a96f7704 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -40,13 +40,13 @@ name = "k8s.io/klog" version = "0.1.0" -[[constraint]] - branch = "master" +[[override]] name = "github.com/container-storage-interface/spec" + branch = "master" [[constraint]] name = "github.com/kubernetes-csi/csi-lib-utils" - version = "0.2.0" + version = ">=0.4.0-rc1" [prune] non-go = true diff --git a/vendor/github.com/container-storage-interface/spec/lib/go/csi/csi.pb.go b/vendor/github.com/container-storage-interface/spec/lib/go/csi/csi.pb.go index eb2e62035..2bfd13b03 100644 --- a/vendor/github.com/container-storage-interface/spec/lib/go/csi/csi.pb.go +++ b/vendor/github.com/container-storage-interface/spec/lib/go/csi/csi.pb.go @@ -63,7 +63,7 @@ func (x PluginCapability_Service_Type) String() string { return proto.EnumName(PluginCapability_Service_Type_name, int32(x)) } func (PluginCapability_Service_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{4, 0, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{4, 0, 0} } type PluginCapability_VolumeExpansion_Type int32 @@ -124,7 +124,7 @@ func (x PluginCapability_VolumeExpansion_Type) String() string { return proto.EnumName(PluginCapability_VolumeExpansion_Type_name, int32(x)) } func (PluginCapability_VolumeExpansion_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{4, 1, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{4, 1, 0} } type VolumeCapability_AccessMode_Mode int32 @@ -168,7 +168,7 @@ func (x VolumeCapability_AccessMode_Mode) String() string { return proto.EnumName(VolumeCapability_AccessMode_Mode_name, int32(x)) } func (VolumeCapability_AccessMode_Mode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{10, 2, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{10, 2, 0} } type ControllerServiceCapability_RPC_Type int32 @@ -226,7 +226,7 @@ func (x ControllerServiceCapability_RPC_Type) String() string { return proto.EnumName(ControllerServiceCapability_RPC_Type_name, int32(x)) } func (ControllerServiceCapability_RPC_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{29, 0, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{29, 0, 0} } type VolumeUsage_Unit int32 @@ -252,7 +252,7 @@ func (x VolumeUsage_Unit) String() string { return proto.EnumName(VolumeUsage_Unit_name, int32(x)) } func (VolumeUsage_Unit) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{49, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{49, 0} } type NodeServiceCapability_RPC_Type int32 @@ -285,7 +285,7 @@ func (x NodeServiceCapability_RPC_Type) String() string { return proto.EnumName(NodeServiceCapability_RPC_Type_name, int32(x)) } func (NodeServiceCapability_RPC_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{52, 0, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{52, 0, 0} } type GetPluginInfoRequest struct { @@ -298,7 +298,7 @@ func (m *GetPluginInfoRequest) Reset() { *m = GetPluginInfoRequest{} } func (m *GetPluginInfoRequest) String() string { return proto.CompactTextString(m) } func (*GetPluginInfoRequest) ProtoMessage() {} func (*GetPluginInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{0} } func (m *GetPluginInfoRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPluginInfoRequest.Unmarshal(m, b) @@ -340,7 +340,7 @@ func (m *GetPluginInfoResponse) Reset() { *m = GetPluginInfoResponse{} } func (m *GetPluginInfoResponse) String() string { return proto.CompactTextString(m) } func (*GetPluginInfoResponse) ProtoMessage() {} func (*GetPluginInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{1} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{1} } func (m *GetPluginInfoResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPluginInfoResponse.Unmarshal(m, b) @@ -391,7 +391,7 @@ func (m *GetPluginCapabilitiesRequest) Reset() { *m = GetPluginCapabilit func (m *GetPluginCapabilitiesRequest) String() string { return proto.CompactTextString(m) } func (*GetPluginCapabilitiesRequest) ProtoMessage() {} func (*GetPluginCapabilitiesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{2} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{2} } func (m *GetPluginCapabilitiesRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPluginCapabilitiesRequest.Unmarshal(m, b) @@ -424,7 +424,7 @@ func (m *GetPluginCapabilitiesResponse) Reset() { *m = GetPluginCapabili func (m *GetPluginCapabilitiesResponse) String() string { return proto.CompactTextString(m) } func (*GetPluginCapabilitiesResponse) ProtoMessage() {} func (*GetPluginCapabilitiesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{3} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{3} } func (m *GetPluginCapabilitiesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPluginCapabilitiesResponse.Unmarshal(m, b) @@ -466,7 +466,7 @@ func (m *PluginCapability) Reset() { *m = PluginCapability{} } func (m *PluginCapability) String() string { return proto.CompactTextString(m) } func (*PluginCapability) ProtoMessage() {} func (*PluginCapability) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{4} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{4} } func (m *PluginCapability) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PluginCapability.Unmarshal(m, b) @@ -608,7 +608,7 @@ func (m *PluginCapability_Service) Reset() { *m = PluginCapability_Servi func (m *PluginCapability_Service) String() string { return proto.CompactTextString(m) } func (*PluginCapability_Service) ProtoMessage() {} func (*PluginCapability_Service) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{4, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{4, 0} } func (m *PluginCapability_Service) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PluginCapability_Service.Unmarshal(m, b) @@ -645,7 +645,7 @@ func (m *PluginCapability_VolumeExpansion) Reset() { *m = PluginCapabili func (m *PluginCapability_VolumeExpansion) String() string { return proto.CompactTextString(m) } func (*PluginCapability_VolumeExpansion) ProtoMessage() {} func (*PluginCapability_VolumeExpansion) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{4, 1} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{4, 1} } func (m *PluginCapability_VolumeExpansion) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PluginCapability_VolumeExpansion.Unmarshal(m, b) @@ -675,7 +675,7 @@ func (m *ProbeRequest) Reset() { *m = ProbeRequest{} } func (m *ProbeRequest) String() string { return proto.CompactTextString(m) } func (*ProbeRequest) ProtoMessage() {} func (*ProbeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{5} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{5} } func (m *ProbeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ProbeRequest.Unmarshal(m, b) @@ -726,7 +726,7 @@ func (m *ProbeResponse) Reset() { *m = ProbeResponse{} } func (m *ProbeResponse) String() string { return proto.CompactTextString(m) } func (*ProbeResponse) ProtoMessage() {} func (*ProbeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{6} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{6} } func (m *ProbeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ProbeResponse.Unmarshal(m, b) @@ -835,7 +835,7 @@ func (m *CreateVolumeRequest) Reset() { *m = CreateVolumeRequest{} } func (m *CreateVolumeRequest) String() string { return proto.CompactTextString(m) } func (*CreateVolumeRequest) ProtoMessage() {} func (*CreateVolumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{7} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{7} } func (m *CreateVolumeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateVolumeRequest.Unmarshal(m, b) @@ -920,7 +920,7 @@ func (m *VolumeContentSource) Reset() { *m = VolumeContentSource{} } func (m *VolumeContentSource) String() string { return proto.CompactTextString(m) } func (*VolumeContentSource) ProtoMessage() {} func (*VolumeContentSource) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{8} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{8} } func (m *VolumeContentSource) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_VolumeContentSource.Unmarshal(m, b) @@ -1066,7 +1066,7 @@ func (m *VolumeContentSource_SnapshotSource) Reset() { *m = VolumeConten func (m *VolumeContentSource_SnapshotSource) String() string { return proto.CompactTextString(m) } func (*VolumeContentSource_SnapshotSource) ProtoMessage() {} func (*VolumeContentSource_SnapshotSource) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{8, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{8, 0} } func (m *VolumeContentSource_SnapshotSource) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_VolumeContentSource_SnapshotSource.Unmarshal(m, b) @@ -1107,7 +1107,7 @@ func (m *VolumeContentSource_VolumeSource) Reset() { *m = VolumeContentS func (m *VolumeContentSource_VolumeSource) String() string { return proto.CompactTextString(m) } func (*VolumeContentSource_VolumeSource) ProtoMessage() {} func (*VolumeContentSource_VolumeSource) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{8, 1} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{8, 1} } func (m *VolumeContentSource_VolumeSource) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_VolumeContentSource_VolumeSource.Unmarshal(m, b) @@ -1148,7 +1148,7 @@ func (m *CreateVolumeResponse) Reset() { *m = CreateVolumeResponse{} } func (m *CreateVolumeResponse) String() string { return proto.CompactTextString(m) } func (*CreateVolumeResponse) ProtoMessage() {} func (*CreateVolumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{9} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{9} } func (m *CreateVolumeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateVolumeResponse.Unmarshal(m, b) @@ -1195,7 +1195,7 @@ func (m *VolumeCapability) Reset() { *m = VolumeCapability{} } func (m *VolumeCapability) String() string { return proto.CompactTextString(m) } func (*VolumeCapability) ProtoMessage() {} func (*VolumeCapability) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{10} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{10} } func (m *VolumeCapability) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_VolumeCapability.Unmarshal(m, b) @@ -1344,7 +1344,7 @@ func (m *VolumeCapability_BlockVolume) Reset() { *m = VolumeCapability_B func (m *VolumeCapability_BlockVolume) String() string { return proto.CompactTextString(m) } func (*VolumeCapability_BlockVolume) ProtoMessage() {} func (*VolumeCapability_BlockVolume) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{10, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{10, 0} } func (m *VolumeCapability_BlockVolume) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_VolumeCapability_BlockVolume.Unmarshal(m, b) @@ -1384,7 +1384,7 @@ func (m *VolumeCapability_MountVolume) Reset() { *m = VolumeCapability_M func (m *VolumeCapability_MountVolume) String() string { return proto.CompactTextString(m) } func (*VolumeCapability_MountVolume) ProtoMessage() {} func (*VolumeCapability_MountVolume) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{10, 1} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{10, 1} } func (m *VolumeCapability_MountVolume) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_VolumeCapability_MountVolume.Unmarshal(m, b) @@ -1431,7 +1431,7 @@ func (m *VolumeCapability_AccessMode) Reset() { *m = VolumeCapability_Ac func (m *VolumeCapability_AccessMode) String() string { return proto.CompactTextString(m) } func (*VolumeCapability_AccessMode) ProtoMessage() {} func (*VolumeCapability_AccessMode) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{10, 2} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{10, 2} } func (m *VolumeCapability_AccessMode) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_VolumeCapability_AccessMode.Unmarshal(m, b) @@ -1479,7 +1479,7 @@ func (m *CapacityRange) Reset() { *m = CapacityRange{} } func (m *CapacityRange) String() string { return proto.CompactTextString(m) } func (*CapacityRange) ProtoMessage() {} func (*CapacityRange) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{11} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{11} } func (m *CapacityRange) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CapacityRange.Unmarshal(m, b) @@ -1584,7 +1584,7 @@ func (m *Volume) Reset() { *m = Volume{} } func (m *Volume) String() string { return proto.CompactTextString(m) } func (*Volume) ProtoMessage() {} func (*Volume) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{12} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{12} } func (m *Volume) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Volume.Unmarshal(m, b) @@ -1776,7 +1776,7 @@ func (m *TopologyRequirement) Reset() { *m = TopologyRequirement{} } func (m *TopologyRequirement) String() string { return proto.CompactTextString(m) } func (*TopologyRequirement) ProtoMessage() {} func (*TopologyRequirement) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{13} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{13} } func (m *TopologyRequirement) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TopologyRequirement.Unmarshal(m, b) @@ -1850,7 +1850,7 @@ func (m *Topology) Reset() { *m = Topology{} } func (m *Topology) String() string { return proto.CompactTextString(m) } func (*Topology) ProtoMessage() {} func (*Topology) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{14} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{14} } func (m *Topology) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Topology.Unmarshal(m, b) @@ -1894,7 +1894,7 @@ func (m *DeleteVolumeRequest) Reset() { *m = DeleteVolumeRequest{} } func (m *DeleteVolumeRequest) String() string { return proto.CompactTextString(m) } func (*DeleteVolumeRequest) ProtoMessage() {} func (*DeleteVolumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{15} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{15} } func (m *DeleteVolumeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteVolumeRequest.Unmarshal(m, b) @@ -1938,7 +1938,7 @@ func (m *DeleteVolumeResponse) Reset() { *m = DeleteVolumeResponse{} } func (m *DeleteVolumeResponse) String() string { return proto.CompactTextString(m) } func (*DeleteVolumeResponse) ProtoMessage() {} func (*DeleteVolumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{16} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{16} } func (m *DeleteVolumeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteVolumeResponse.Unmarshal(m, b) @@ -1992,7 +1992,7 @@ func (m *ControllerPublishVolumeRequest) Reset() { *m = ControllerPublis func (m *ControllerPublishVolumeRequest) String() string { return proto.CompactTextString(m) } func (*ControllerPublishVolumeRequest) ProtoMessage() {} func (*ControllerPublishVolumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{17} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{17} } func (m *ControllerPublishVolumeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ControllerPublishVolumeRequest.Unmarshal(m, b) @@ -2078,7 +2078,7 @@ func (m *ControllerPublishVolumeResponse) Reset() { *m = ControllerPubli func (m *ControllerPublishVolumeResponse) String() string { return proto.CompactTextString(m) } func (*ControllerPublishVolumeResponse) ProtoMessage() {} func (*ControllerPublishVolumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{18} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{18} } func (m *ControllerPublishVolumeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ControllerPublishVolumeResponse.Unmarshal(m, b) @@ -2129,7 +2129,7 @@ func (m *ControllerUnpublishVolumeRequest) Reset() { *m = ControllerUnpu func (m *ControllerUnpublishVolumeRequest) String() string { return proto.CompactTextString(m) } func (*ControllerUnpublishVolumeRequest) ProtoMessage() {} func (*ControllerUnpublishVolumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{19} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{19} } func (m *ControllerUnpublishVolumeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ControllerUnpublishVolumeRequest.Unmarshal(m, b) @@ -2180,7 +2180,7 @@ func (m *ControllerUnpublishVolumeResponse) Reset() { *m = ControllerUnp func (m *ControllerUnpublishVolumeResponse) String() string { return proto.CompactTextString(m) } func (*ControllerUnpublishVolumeResponse) ProtoMessage() {} func (*ControllerUnpublishVolumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{20} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{20} } func (m *ControllerUnpublishVolumeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ControllerUnpublishVolumeResponse.Unmarshal(m, b) @@ -2227,7 +2227,7 @@ func (m *ValidateVolumeCapabilitiesRequest) Reset() { *m = ValidateVolum func (m *ValidateVolumeCapabilitiesRequest) String() string { return proto.CompactTextString(m) } func (*ValidateVolumeCapabilitiesRequest) ProtoMessage() {} func (*ValidateVolumeCapabilitiesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{21} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{21} } func (m *ValidateVolumeCapabilitiesRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ValidateVolumeCapabilitiesRequest.Unmarshal(m, b) @@ -2305,7 +2305,7 @@ func (m *ValidateVolumeCapabilitiesResponse) Reset() { *m = ValidateVolu func (m *ValidateVolumeCapabilitiesResponse) String() string { return proto.CompactTextString(m) } func (*ValidateVolumeCapabilitiesResponse) ProtoMessage() {} func (*ValidateVolumeCapabilitiesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{22} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{22} } func (m *ValidateVolumeCapabilitiesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ValidateVolumeCapabilitiesResponse.Unmarshal(m, b) @@ -2362,7 +2362,7 @@ func (m *ValidateVolumeCapabilitiesResponse_Confirmed) String() string { } func (*ValidateVolumeCapabilitiesResponse_Confirmed) ProtoMessage() {} func (*ValidateVolumeCapabilitiesResponse_Confirmed) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{22, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{22, 0} } func (m *ValidateVolumeCapabilitiesResponse_Confirmed) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ValidateVolumeCapabilitiesResponse_Confirmed.Unmarshal(m, b) @@ -2427,7 +2427,7 @@ func (m *ListVolumesRequest) Reset() { *m = ListVolumesRequest{} } func (m *ListVolumesRequest) String() string { return proto.CompactTextString(m) } func (*ListVolumesRequest) ProtoMessage() {} func (*ListVolumesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{23} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{23} } func (m *ListVolumesRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListVolumesRequest.Unmarshal(m, b) @@ -2479,7 +2479,7 @@ func (m *ListVolumesResponse) Reset() { *m = ListVolumesResponse{} } func (m *ListVolumesResponse) String() string { return proto.CompactTextString(m) } func (*ListVolumesResponse) ProtoMessage() {} func (*ListVolumesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{24} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{24} } func (m *ListVolumesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListVolumesResponse.Unmarshal(m, b) @@ -2524,7 +2524,7 @@ func (m *ListVolumesResponse_Entry) Reset() { *m = ListVolumesResponse_E func (m *ListVolumesResponse_Entry) String() string { return proto.CompactTextString(m) } func (*ListVolumesResponse_Entry) ProtoMessage() {} func (*ListVolumesResponse_Entry) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{24, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{24, 0} } func (m *ListVolumesResponse_Entry) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListVolumesResponse_Entry.Unmarshal(m, b) @@ -2579,7 +2579,7 @@ func (m *GetCapacityRequest) Reset() { *m = GetCapacityRequest{} } func (m *GetCapacityRequest) String() string { return proto.CompactTextString(m) } func (*GetCapacityRequest) ProtoMessage() {} func (*GetCapacityRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{25} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{25} } func (m *GetCapacityRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCapacityRequest.Unmarshal(m, b) @@ -2637,7 +2637,7 @@ func (m *GetCapacityResponse) Reset() { *m = GetCapacityResponse{} } func (m *GetCapacityResponse) String() string { return proto.CompactTextString(m) } func (*GetCapacityResponse) ProtoMessage() {} func (*GetCapacityResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{26} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{26} } func (m *GetCapacityResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetCapacityResponse.Unmarshal(m, b) @@ -2674,7 +2674,7 @@ func (m *ControllerGetCapabilitiesRequest) Reset() { *m = ControllerGetC func (m *ControllerGetCapabilitiesRequest) String() string { return proto.CompactTextString(m) } func (*ControllerGetCapabilitiesRequest) ProtoMessage() {} func (*ControllerGetCapabilitiesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{27} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{27} } func (m *ControllerGetCapabilitiesRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ControllerGetCapabilitiesRequest.Unmarshal(m, b) @@ -2707,7 +2707,7 @@ func (m *ControllerGetCapabilitiesResponse) Reset() { *m = ControllerGet func (m *ControllerGetCapabilitiesResponse) String() string { return proto.CompactTextString(m) } func (*ControllerGetCapabilitiesResponse) ProtoMessage() {} func (*ControllerGetCapabilitiesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{28} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{28} } func (m *ControllerGetCapabilitiesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ControllerGetCapabilitiesResponse.Unmarshal(m, b) @@ -2748,7 +2748,7 @@ func (m *ControllerServiceCapability) Reset() { *m = ControllerServiceCa func (m *ControllerServiceCapability) String() string { return proto.CompactTextString(m) } func (*ControllerServiceCapability) ProtoMessage() {} func (*ControllerServiceCapability) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{29} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{29} } func (m *ControllerServiceCapability) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ControllerServiceCapability.Unmarshal(m, b) @@ -2858,7 +2858,7 @@ func (m *ControllerServiceCapability_RPC) Reset() { *m = ControllerServi func (m *ControllerServiceCapability_RPC) String() string { return proto.CompactTextString(m) } func (*ControllerServiceCapability_RPC) ProtoMessage() {} func (*ControllerServiceCapability_RPC) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{29, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{29, 0} } func (m *ControllerServiceCapability_RPC) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ControllerServiceCapability_RPC.Unmarshal(m, b) @@ -2920,7 +2920,7 @@ func (m *CreateSnapshotRequest) Reset() { *m = CreateSnapshotRequest{} } func (m *CreateSnapshotRequest) String() string { return proto.CompactTextString(m) } func (*CreateSnapshotRequest) ProtoMessage() {} func (*CreateSnapshotRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{30} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{30} } func (m *CreateSnapshotRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateSnapshotRequest.Unmarshal(m, b) @@ -2982,7 +2982,7 @@ func (m *CreateSnapshotResponse) Reset() { *m = CreateSnapshotResponse{} func (m *CreateSnapshotResponse) String() string { return proto.CompactTextString(m) } func (*CreateSnapshotResponse) ProtoMessage() {} func (*CreateSnapshotResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{31} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{31} } func (m *CreateSnapshotResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateSnapshotResponse.Unmarshal(m, b) @@ -3049,7 +3049,7 @@ func (m *Snapshot) Reset() { *m = Snapshot{} } func (m *Snapshot) String() string { return proto.CompactTextString(m) } func (*Snapshot) ProtoMessage() {} func (*Snapshot) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{32} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{32} } func (m *Snapshot) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Snapshot.Unmarshal(m, b) @@ -3121,7 +3121,7 @@ func (m *DeleteSnapshotRequest) Reset() { *m = DeleteSnapshotRequest{} } func (m *DeleteSnapshotRequest) String() string { return proto.CompactTextString(m) } func (*DeleteSnapshotRequest) ProtoMessage() {} func (*DeleteSnapshotRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{33} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{33} } func (m *DeleteSnapshotRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteSnapshotRequest.Unmarshal(m, b) @@ -3165,7 +3165,7 @@ func (m *DeleteSnapshotResponse) Reset() { *m = DeleteSnapshotResponse{} func (m *DeleteSnapshotResponse) String() string { return proto.CompactTextString(m) } func (*DeleteSnapshotResponse) ProtoMessage() {} func (*DeleteSnapshotResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{34} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{34} } func (m *DeleteSnapshotResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteSnapshotResponse.Unmarshal(m, b) @@ -3220,7 +3220,7 @@ func (m *ListSnapshotsRequest) Reset() { *m = ListSnapshotsRequest{} } func (m *ListSnapshotsRequest) String() string { return proto.CompactTextString(m) } func (*ListSnapshotsRequest) ProtoMessage() {} func (*ListSnapshotsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{35} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{35} } func (m *ListSnapshotsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListSnapshotsRequest.Unmarshal(m, b) @@ -3286,7 +3286,7 @@ func (m *ListSnapshotsResponse) Reset() { *m = ListSnapshotsResponse{} } func (m *ListSnapshotsResponse) String() string { return proto.CompactTextString(m) } func (*ListSnapshotsResponse) ProtoMessage() {} func (*ListSnapshotsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{36} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{36} } func (m *ListSnapshotsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListSnapshotsResponse.Unmarshal(m, b) @@ -3331,7 +3331,7 @@ func (m *ListSnapshotsResponse_Entry) Reset() { *m = ListSnapshotsRespon func (m *ListSnapshotsResponse_Entry) String() string { return proto.CompactTextString(m) } func (*ListSnapshotsResponse_Entry) ProtoMessage() {} func (*ListSnapshotsResponse_Entry) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{36, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{36, 0} } func (m *ListSnapshotsResponse_Entry) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListSnapshotsResponse_Entry.Unmarshal(m, b) @@ -3376,7 +3376,7 @@ func (m *ControllerExpandVolumeRequest) Reset() { *m = ControllerExpandV func (m *ControllerExpandVolumeRequest) String() string { return proto.CompactTextString(m) } func (*ControllerExpandVolumeRequest) ProtoMessage() {} func (*ControllerExpandVolumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{37} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{37} } func (m *ControllerExpandVolumeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ControllerExpandVolumeRequest.Unmarshal(m, b) @@ -3433,7 +3433,7 @@ func (m *ControllerExpandVolumeResponse) Reset() { *m = ControllerExpand func (m *ControllerExpandVolumeResponse) String() string { return proto.CompactTextString(m) } func (*ControllerExpandVolumeResponse) ProtoMessage() {} func (*ControllerExpandVolumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{38} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{38} } func (m *ControllerExpandVolumeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ControllerExpandVolumeResponse.Unmarshal(m, b) @@ -3508,7 +3508,7 @@ func (m *NodeStageVolumeRequest) Reset() { *m = NodeStageVolumeRequest{} func (m *NodeStageVolumeRequest) String() string { return proto.CompactTextString(m) } func (*NodeStageVolumeRequest) ProtoMessage() {} func (*NodeStageVolumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{39} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{39} } func (m *NodeStageVolumeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeStageVolumeRequest.Unmarshal(m, b) @@ -3580,7 +3580,7 @@ func (m *NodeStageVolumeResponse) Reset() { *m = NodeStageVolumeResponse func (m *NodeStageVolumeResponse) String() string { return proto.CompactTextString(m) } func (*NodeStageVolumeResponse) ProtoMessage() {} func (*NodeStageVolumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{40} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{40} } func (m *NodeStageVolumeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeStageVolumeResponse.Unmarshal(m, b) @@ -3616,7 +3616,7 @@ func (m *NodeUnstageVolumeRequest) Reset() { *m = NodeUnstageVolumeReque func (m *NodeUnstageVolumeRequest) String() string { return proto.CompactTextString(m) } func (*NodeUnstageVolumeRequest) ProtoMessage() {} func (*NodeUnstageVolumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{41} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{41} } func (m *NodeUnstageVolumeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeUnstageVolumeRequest.Unmarshal(m, b) @@ -3660,7 +3660,7 @@ func (m *NodeUnstageVolumeResponse) Reset() { *m = NodeUnstageVolumeResp func (m *NodeUnstageVolumeResponse) String() string { return proto.CompactTextString(m) } func (*NodeUnstageVolumeResponse) ProtoMessage() {} func (*NodeUnstageVolumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{42} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{42} } func (m *NodeUnstageVolumeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeUnstageVolumeResponse.Unmarshal(m, b) @@ -3734,7 +3734,7 @@ func (m *NodePublishVolumeRequest) Reset() { *m = NodePublishVolumeReque func (m *NodePublishVolumeRequest) String() string { return proto.CompactTextString(m) } func (*NodePublishVolumeRequest) ProtoMessage() {} func (*NodePublishVolumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{43} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{43} } func (m *NodePublishVolumeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodePublishVolumeRequest.Unmarshal(m, b) @@ -3820,7 +3820,7 @@ func (m *NodePublishVolumeResponse) Reset() { *m = NodePublishVolumeResp func (m *NodePublishVolumeResponse) String() string { return proto.CompactTextString(m) } func (*NodePublishVolumeResponse) ProtoMessage() {} func (*NodePublishVolumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{44} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{44} } func (m *NodePublishVolumeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodePublishVolumeResponse.Unmarshal(m, b) @@ -3857,7 +3857,7 @@ func (m *NodeUnpublishVolumeRequest) Reset() { *m = NodeUnpublishVolumeR func (m *NodeUnpublishVolumeRequest) String() string { return proto.CompactTextString(m) } func (*NodeUnpublishVolumeRequest) ProtoMessage() {} func (*NodeUnpublishVolumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{45} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{45} } func (m *NodeUnpublishVolumeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeUnpublishVolumeRequest.Unmarshal(m, b) @@ -3901,7 +3901,7 @@ func (m *NodeUnpublishVolumeResponse) Reset() { *m = NodeUnpublishVolume func (m *NodeUnpublishVolumeResponse) String() string { return proto.CompactTextString(m) } func (*NodeUnpublishVolumeResponse) ProtoMessage() {} func (*NodeUnpublishVolumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{46} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{46} } func (m *NodeUnpublishVolumeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeUnpublishVolumeResponse.Unmarshal(m, b) @@ -3939,7 +3939,7 @@ func (m *NodeGetVolumeStatsRequest) Reset() { *m = NodeGetVolumeStatsReq func (m *NodeGetVolumeStatsRequest) String() string { return proto.CompactTextString(m) } func (*NodeGetVolumeStatsRequest) ProtoMessage() {} func (*NodeGetVolumeStatsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{47} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{47} } func (m *NodeGetVolumeStatsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeGetVolumeStatsRequest.Unmarshal(m, b) @@ -3985,7 +3985,7 @@ func (m *NodeGetVolumeStatsResponse) Reset() { *m = NodeGetVolumeStatsRe func (m *NodeGetVolumeStatsResponse) String() string { return proto.CompactTextString(m) } func (*NodeGetVolumeStatsResponse) ProtoMessage() {} func (*NodeGetVolumeStatsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{48} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{48} } func (m *NodeGetVolumeStatsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeGetVolumeStatsResponse.Unmarshal(m, b) @@ -4033,7 +4033,7 @@ func (m *VolumeUsage) Reset() { *m = VolumeUsage{} } func (m *VolumeUsage) String() string { return proto.CompactTextString(m) } func (*VolumeUsage) ProtoMessage() {} func (*VolumeUsage) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{49} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{49} } func (m *VolumeUsage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_VolumeUsage.Unmarshal(m, b) @@ -4091,7 +4091,7 @@ func (m *NodeGetCapabilitiesRequest) Reset() { *m = NodeGetCapabilitiesR func (m *NodeGetCapabilitiesRequest) String() string { return proto.CompactTextString(m) } func (*NodeGetCapabilitiesRequest) ProtoMessage() {} func (*NodeGetCapabilitiesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{50} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{50} } func (m *NodeGetCapabilitiesRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeGetCapabilitiesRequest.Unmarshal(m, b) @@ -4124,7 +4124,7 @@ func (m *NodeGetCapabilitiesResponse) Reset() { *m = NodeGetCapabilities func (m *NodeGetCapabilitiesResponse) String() string { return proto.CompactTextString(m) } func (*NodeGetCapabilitiesResponse) ProtoMessage() {} func (*NodeGetCapabilitiesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{51} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{51} } func (m *NodeGetCapabilitiesResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeGetCapabilitiesResponse.Unmarshal(m, b) @@ -4165,7 +4165,7 @@ func (m *NodeServiceCapability) Reset() { *m = NodeServiceCapability{} } func (m *NodeServiceCapability) String() string { return proto.CompactTextString(m) } func (*NodeServiceCapability) ProtoMessage() {} func (*NodeServiceCapability) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{52} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{52} } func (m *NodeServiceCapability) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeServiceCapability.Unmarshal(m, b) @@ -4275,7 +4275,7 @@ func (m *NodeServiceCapability_RPC) Reset() { *m = NodeServiceCapability func (m *NodeServiceCapability_RPC) String() string { return proto.CompactTextString(m) } func (*NodeServiceCapability_RPC) ProtoMessage() {} func (*NodeServiceCapability_RPC) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{52, 0} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{52, 0} } func (m *NodeServiceCapability_RPC) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeServiceCapability_RPC.Unmarshal(m, b) @@ -4312,7 +4312,7 @@ func (m *NodeGetInfoRequest) Reset() { *m = NodeGetInfoRequest{} } func (m *NodeGetInfoRequest) String() string { return proto.CompactTextString(m) } func (*NodeGetInfoRequest) ProtoMessage() {} func (*NodeGetInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{53} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{53} } func (m *NodeGetInfoRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeGetInfoRequest.Unmarshal(m, b) @@ -4375,7 +4375,7 @@ func (m *NodeGetInfoResponse) Reset() { *m = NodeGetInfoResponse{} } func (m *NodeGetInfoResponse) String() string { return proto.CompactTextString(m) } func (*NodeGetInfoResponse) ProtoMessage() {} func (*NodeGetInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{54} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{54} } func (m *NodeGetInfoResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeGetInfoResponse.Unmarshal(m, b) @@ -4437,7 +4437,7 @@ func (m *NodeExpandVolumeRequest) Reset() { *m = NodeExpandVolumeRequest func (m *NodeExpandVolumeRequest) String() string { return proto.CompactTextString(m) } func (*NodeExpandVolumeRequest) ProtoMessage() {} func (*NodeExpandVolumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{55} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{55} } func (m *NodeExpandVolumeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeExpandVolumeRequest.Unmarshal(m, b) @@ -4490,7 +4490,7 @@ func (m *NodeExpandVolumeResponse) Reset() { *m = NodeExpandVolumeRespon func (m *NodeExpandVolumeResponse) String() string { return proto.CompactTextString(m) } func (*NodeExpandVolumeResponse) ProtoMessage() {} func (*NodeExpandVolumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_csi_0bd9c8bbafae69e2, []int{56} + return fileDescriptor_csi_6e4ee596c38f0b8b, []int{56} } func (m *NodeExpandVolumeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NodeExpandVolumeResponse.Unmarshal(m, b) @@ -5492,10 +5492,10 @@ var _Node_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("github.com/container-storage-interface/spec/csi.proto", fileDescriptor_csi_0bd9c8bbafae69e2) + proto.RegisterFile("github.com/container-storage-interface/spec/csi.proto", fileDescriptor_csi_6e4ee596c38f0b8b) } -var fileDescriptor_csi_0bd9c8bbafae69e2 = []byte{ +var fileDescriptor_csi_6e4ee596c38f0b8b = []byte{ // 3266 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5a, 0xcd, 0x73, 0xdb, 0xc6, 0x15, 0x27, 0xf8, 0x21, 0x51, 0x4f, 0x1f, 0xa6, 0x57, 0x1f, 0xa6, 0x21, 0xc9, 0x96, 0xe1, 0xd8, diff --git a/vendor/github.com/kubernetes-csi/csi-lib-utils/connection/connection.go b/vendor/github.com/kubernetes-csi/csi-lib-utils/connection/connection.go new file mode 100644 index 000000000..588826ee3 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-lib-utils/connection/connection.go @@ -0,0 +1,310 @@ +/* +Copyright 2019 The Kubernetes Authors. + +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. +*/ + +package connection + +import ( + "context" + "errors" + "fmt" + "io/ioutil" + "net" + "strings" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/container-storage-interface/spec/lib/go/csi" + "github.com/kubernetes-csi/csi-lib-utils/protosanitizer" + "google.golang.org/grpc" + "k8s.io/klog" +) + +const ( + // Interval of logging connection errors + connectionLoggingInterval = 10 * time.Second + + // Interval of trying to call Probe() until it succeeds + probeInterval = 1 * time.Second +) + +const terminationLogPath = "/dev/termination-log" + +// Connect opens insecure gRPC connection to a CSI driver. Address must be either absolute path to UNIX domain socket +// file or have format '://', following gRPC name resolution mechanism at +// https://github.com/grpc/grpc/blob/master/doc/naming.md. +// +// The function tries to connect indefinitely every second until it connects. The function automatically disables TLS +// and adds interceptor for logging of all gRPC messages at level 5. +// +// For a connection to a Unix Domain socket, the behavior after +// loosing the connection is configurable. The default is to +// log the connection loss and reestablish a connection. Applications +// which need to know about a connection loss can be notified by +// passing a callback with OnConnectionLoss and in that callback +// can decide what to do: +// - exit the application with os.Exit +// - invalidate cached information +// - disable the reconnect, which will cause all gRPC method calls to fail with status.Unavailable +// +// For other connections, the default behavior from gRPC is used and +// loss of connection is not detected reliably. +func Connect(address string, options ...Option) (*grpc.ClientConn, error) { + return connect(address, []grpc.DialOption{}, options) +} + +// Option is the type of all optional parameters for Connect. +type Option func(o *options) + +// OnConnectionLoss registers a callback that will be invoked when the +// connection got lost. If that callback returns true, the connection +// is reestablished. Otherwise the connection is left as it is and +// all future gRPC calls using it will fail with status.Unavailable. +func OnConnectionLoss(reconnect func() bool) Option { + return func(o *options) { + o.reconnect = reconnect + } +} + +// ExitOnConnectionLoss returns callback for OnConnectionLoss() that writes +// an error to /dev/termination-log and exits. +func ExitOnConnectionLoss() func() bool { + return func() bool { + terminationMsg := "Lost connection to CSI driver, exiting" + if err := ioutil.WriteFile(terminationLogPath, []byte(terminationMsg), 0644); err != nil { + klog.Errorf("%s: %s", terminationLogPath, err) + } + klog.Fatalf(terminationMsg) + return false + } +} + +type options struct { + reconnect func() bool +} + +// connect is the internal implementation of Connect. It has more options to enable testing. +func connect(address string, dialOptions []grpc.DialOption, connectOptions []Option) (*grpc.ClientConn, error) { + var o options + for _, option := range connectOptions { + option(&o) + } + + dialOptions = append(dialOptions, + grpc.WithInsecure(), // Don't use TLS, it's usually local Unix domain socket in a container. + grpc.WithBackoffMaxDelay(time.Second), // Retry every second after failure. + grpc.WithBlock(), // Block until connection succeeds. + grpc.WithUnaryInterceptor(LogGRPC), // Log all messages. + ) + unixPrefix := "unix://" + if strings.HasPrefix(address, "/") { + // It looks like filesystem path. + address = unixPrefix + address + } + + if strings.HasPrefix(address, unixPrefix) { + // state variables for the custom dialer + haveConnected := false + lostConnection := false + reconnect := true + + dialOptions = append(dialOptions, grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) { + if haveConnected && !lostConnection { + // We have detected a loss of connection for the first time. Decide what to do... + // Record this once. TODO (?): log at regular time intervals. + klog.Errorf("Lost connection to %s.", address) + // Inform caller and let it decide? Default is to reconnect. + if o.reconnect != nil { + reconnect = o.reconnect() + } + lostConnection = true + } + if !reconnect { + return nil, errors.New("connection lost, reconnecting disabled") + } + conn, err := net.DialTimeout("unix", address[len(unixPrefix):], timeout) + if err == nil { + // Connection restablished. + haveConnected = true + lostConnection = false + } + return conn, err + })) + } else if o.reconnect != nil { + return nil, errors.New("OnConnectionLoss callback only supported for unix:// addresses") + } + + klog.Infof("Connecting to %s", address) + + // Connect in background. + var conn *grpc.ClientConn + var err error + ready := make(chan bool) + go func() { + conn, err = grpc.Dial(address, dialOptions...) + close(ready) + }() + + // Log error every connectionLoggingInterval + ticker := time.NewTicker(connectionLoggingInterval) + defer ticker.Stop() + + // Wait until Dial() succeeds. + for { + select { + case <-ticker.C: + klog.Warningf("Still connecting to %s", address) + + case <-ready: + return conn, err + } + } +} + +// LogGRPC is gPRC unary interceptor for logging of CSI messages at level 5. It removes any secrets from the message. +func LogGRPC(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + klog.V(5).Infof("GRPC call: %s", method) + klog.V(5).Infof("GRPC request: %s", protosanitizer.StripSecrets(req)) + err := invoker(ctx, method, req, reply, cc, opts...) + klog.V(5).Infof("GRPC response: %s", protosanitizer.StripSecrets(reply)) + klog.V(5).Infof("GRPC error: %v", err) + return err +} + +// GetDriverName returns name of CSI driver. +func GetDriverName(ctx context.Context, conn *grpc.ClientConn) (string, error) { + client := csi.NewIdentityClient(conn) + + req := csi.GetPluginInfoRequest{} + rsp, err := client.GetPluginInfo(ctx, &req) + if err != nil { + return "", err + } + name := rsp.GetName() + if name == "" { + return "", fmt.Errorf("driver name is empty") + } + return name, nil +} + +// PluginCapabilitySet is set of CSI plugin capabilities. Only supported capabilities are in the map. +type PluginCapabilitySet map[csi.PluginCapability_Service_Type]bool + +// GetPluginCapabilities returns set of supported capabilities of CSI driver. +func GetPluginCapabilities(ctx context.Context, conn *grpc.ClientConn) (PluginCapabilitySet, error) { + client := csi.NewIdentityClient(conn) + req := csi.GetPluginCapabilitiesRequest{} + rsp, err := client.GetPluginCapabilities(ctx, &req) + if err != nil { + return nil, err + } + caps := PluginCapabilitySet{} + for _, cap := range rsp.GetCapabilities() { + if cap == nil { + continue + } + srv := cap.GetService() + if srv == nil { + continue + } + t := srv.GetType() + caps[t] = true + } + return caps, nil +} + +// ControllerCapabilitySet is set of CSI controller capabilities. Only supported capabilities are in the map. +type ControllerCapabilitySet map[csi.ControllerServiceCapability_RPC_Type]bool + +// GetControllerCapabilities returns set of supported controller capabilities of CSI driver. +func GetControllerCapabilities(ctx context.Context, conn *grpc.ClientConn) (ControllerCapabilitySet, error) { + client := csi.NewControllerClient(conn) + req := csi.ControllerGetCapabilitiesRequest{} + rsp, err := client.ControllerGetCapabilities(ctx, &req) + if err != nil { + return nil, err + } + + caps := ControllerCapabilitySet{} + for _, cap := range rsp.GetCapabilities() { + if cap == nil { + continue + } + rpc := cap.GetRpc() + if rpc == nil { + continue + } + t := rpc.GetType() + caps[t] = true + } + return caps, nil +} + +// ProbeForever calls Probe() of a CSI driver and waits until the driver becomes ready. +// Any error other than timeout is returned. +func ProbeForever(conn *grpc.ClientConn, singleProbeTimeout time.Duration) error { + for { + klog.Info("Probing CSI driver for readiness") + ready, err := probeOnce(conn, singleProbeTimeout) + if err != nil { + st, ok := status.FromError(err) + if !ok { + // This is not gRPC error. The probe must have failed before gRPC + // method was called, otherwise we would get gRPC error. + return fmt.Errorf("CSI driver probe failed: %s", err) + } + if st.Code() != codes.DeadlineExceeded { + return fmt.Errorf("CSI driver probe failed: %s", err) + } + // Timeout -> driver is not ready. Fall through to sleep() below. + klog.Warning("CSI driver probe timed out") + } else { + if ready { + return nil + } + klog.Warning("CSI driver is not ready") + } + // Timeout was returned or driver is not ready. + time.Sleep(probeInterval) + } +} + +// probeOnce is a helper to simplify defer cancel() +func probeOnce(conn *grpc.ClientConn, timeout time.Duration) (bool, error) { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + return Probe(ctx, conn) +} + +// Probe calls driver Probe() just once and returns its result without any processing. +func Probe(ctx context.Context, conn *grpc.ClientConn) (ready bool, err error) { + client := csi.NewIdentityClient(conn) + + req := csi.ProbeRequest{} + rsp, err := client.Probe(ctx, &req) + + if err != nil { + return false, err + } + + r := rsp.GetReady() + if r == nil { + // "If not present, the caller SHALL assume that the plugin is in a ready state" + return true, nil + } + return r.GetValue(), nil +} diff --git a/vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/LICENSE b/vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/LICENSE new file mode 100644 index 000000000..8dada3eda --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/LICENSE @@ -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. diff --git a/vendor/github.com/kubernetes-csi/csi-lib-utils/rpc/common.go b/vendor/github.com/kubernetes-csi/csi-lib-utils/rpc/common.go new file mode 100644 index 000000000..bb4a5c448 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-lib-utils/rpc/common.go @@ -0,0 +1,160 @@ +/* +Copyright 2019 The Kubernetes Authors. + +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. +*/ + +package rpc + +import ( + "context" + "fmt" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/container-storage-interface/spec/lib/go/csi" + + "k8s.io/klog" +) + +const ( + // Interval of trying to call Probe() until it succeeds + probeInterval = 1 * time.Second +) + +// GetDriverName returns name of CSI driver. +func GetDriverName(ctx context.Context, conn *grpc.ClientConn) (string, error) { + client := csi.NewIdentityClient(conn) + + req := csi.GetPluginInfoRequest{} + rsp, err := client.GetPluginInfo(ctx, &req) + if err != nil { + return "", err + } + name := rsp.GetName() + if name == "" { + return "", fmt.Errorf("driver name is empty") + } + return name, nil +} + +// PluginCapabilitySet is set of CSI plugin capabilities. Only supported capabilities are in the map. +type PluginCapabilitySet map[csi.PluginCapability_Service_Type]bool + +// GetPluginCapabilities returns set of supported capabilities of CSI driver. +func GetPluginCapabilities(ctx context.Context, conn *grpc.ClientConn) (PluginCapabilitySet, error) { + client := csi.NewIdentityClient(conn) + req := csi.GetPluginCapabilitiesRequest{} + rsp, err := client.GetPluginCapabilities(ctx, &req) + if err != nil { + return nil, err + } + caps := PluginCapabilitySet{} + for _, cap := range rsp.GetCapabilities() { + if cap == nil { + continue + } + srv := cap.GetService() + if srv == nil { + continue + } + t := srv.GetType() + caps[t] = true + } + return caps, nil +} + +// ControllerCapabilitySet is set of CSI controller capabilities. Only supported capabilities are in the map. +type ControllerCapabilitySet map[csi.ControllerServiceCapability_RPC_Type]bool + +// GetControllerCapabilities returns set of supported controller capabilities of CSI driver. +func GetControllerCapabilities(ctx context.Context, conn *grpc.ClientConn) (ControllerCapabilitySet, error) { + client := csi.NewControllerClient(conn) + req := csi.ControllerGetCapabilitiesRequest{} + rsp, err := client.ControllerGetCapabilities(ctx, &req) + if err != nil { + return nil, err + } + + caps := ControllerCapabilitySet{} + for _, cap := range rsp.GetCapabilities() { + if cap == nil { + continue + } + rpc := cap.GetRpc() + if rpc == nil { + continue + } + t := rpc.GetType() + caps[t] = true + } + return caps, nil +} + +// ProbeForever calls Probe() of a CSI driver and waits until the driver becomes ready. +// Any error other than timeout is returned. +func ProbeForever(conn *grpc.ClientConn, singleProbeTimeout time.Duration) error { + for { + klog.Info("Probing CSI driver for readiness") + ready, err := probeOnce(conn, singleProbeTimeout) + if err != nil { + st, ok := status.FromError(err) + if !ok { + // This is not gRPC error. The probe must have failed before gRPC + // method was called, otherwise we would get gRPC error. + return fmt.Errorf("CSI driver probe failed: %s", err) + } + if st.Code() != codes.DeadlineExceeded { + return fmt.Errorf("CSI driver probe failed: %s", err) + } + // Timeout -> driver is not ready. Fall through to sleep() below. + klog.Warning("CSI driver probe timed out") + } else { + if ready { + return nil + } + klog.Warning("CSI driver is not ready") + } + // Timeout was returned or driver is not ready. + time.Sleep(probeInterval) + } +} + +// probeOnce is a helper to simplify defer cancel() +func probeOnce(conn *grpc.ClientConn, timeout time.Duration) (bool, error) { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + return Probe(ctx, conn) +} + +// Probe calls driver Probe() just once and returns its result without any processing. +func Probe(ctx context.Context, conn *grpc.ClientConn) (ready bool, err error) { + client := csi.NewIdentityClient(conn) + + req := csi.ProbeRequest{} + rsp, err := client.Probe(ctx, &req) + + if err != nil { + return false, err + } + + r := rsp.GetReady() + if r == nil { + // "If not present, the caller SHALL assume that the plugin is in a ready state" + return true, nil + } + return r.GetValue(), nil +} From d5ebbb8586525e89b4c3f8e578ee53a218c02ee0 Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Wed, 27 Feb 2019 18:06:30 -0500 Subject: [PATCH 16/18] refactor external-resizer to use csi-lib-utils/rpc --- pkg/client/client.go | 59 +++++++++++ pkg/csi/client.go | 198 ------------------------------------- pkg/resizer/csi_resizer.go | 90 ++++++++--------- 3 files changed, 98 insertions(+), 249 deletions(-) create mode 100644 pkg/client/client.go delete mode 100644 pkg/csi/client.go diff --git a/pkg/client/client.go b/pkg/client/client.go new file mode 100644 index 000000000..c3c1d6166 --- /dev/null +++ b/pkg/client/client.go @@ -0,0 +1,59 @@ +/* +Copyright 2019 The Kubernetes Authors. + +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. +*/ + +package client + +import ( + "context" + + "github.com/container-storage-interface/spec/lib/go/csi" + "google.golang.org/grpc" +) + +// Client is a gRPC client connect to remote CSI driver and abstracts all CSI calls. +type Client interface { + // Expand expands the volume to a new size at least as big as requestBytes. + // It returns the new size and whether the volume need expand operation on the node. + Expand(ctx context.Context, volumeID string, requestBytes int64, secrets map[string]string) (int64, bool, error) +} + +// New creates a new CSI client. +func New(conn *grpc.ClientConn) Client { + return &client{ + ctrlClient: csi.NewControllerClient(conn), + } +} + +type client struct { + ctrlClient csi.ControllerClient +} + +func (c *client) Expand( + ctx context.Context, + volumeID string, + requestBytes int64, + secrets map[string]string) (int64, bool, error) { + req := &csi.ControllerExpandVolumeRequest{ + Secrets: secrets, + VolumeId: volumeID, + CapacityRange: &csi.CapacityRange{RequiredBytes: requestBytes}, + } + resp, err := c.ctrlClient.ControllerExpandVolume(ctx, req) + if err != nil { + return 0, false, err + } + return resp.CapacityBytes, resp.NodeExpansionRequired, nil +} diff --git a/pkg/csi/client.go b/pkg/csi/client.go deleted file mode 100644 index f7313fe0d..000000000 --- a/pkg/csi/client.go +++ /dev/null @@ -1,198 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -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. -*/ - -package csi - -import ( - "context" - "errors" - "fmt" - "net" - "strings" - "time" - - "github.com/container-storage-interface/spec/lib/go/csi" - "github.com/kubernetes-csi/csi-lib-utils/protosanitizer" - "google.golang.org/grpc" - "google.golang.org/grpc/connectivity" - "k8s.io/klog" -) - -// Client is a gRPC client connect to remote CSI driver and abstracts all CSI calls. -type Client interface { - // GetDriverName returns driver name as discovered by GetPluginInfo() - // gRPC call. - GetDriverName(ctx context.Context) (string, error) - - // SupportsPluginControllerService return true if the CSI driver reports - // CONTROLLER_SERVICE in GetPluginCapabilities() gRPC call. - SupportsPluginControllerService(ctx context.Context) (bool, error) - - // SupportsControllerResize returns whether the CSI driver reports EXPAND_VOLUME - // in ControllerGetCapabilities() gRPC call. - SupportsControllerResize(ctx context.Context) (bool, error) - - // Expand expands the volume to a new size at least as big as requestBytes. - // It returns the new size and whether the volume need expand operation on the node. - Expand(ctx context.Context, volumeID string, requestBytes int64, secrets map[string]string) (int64, bool, error) - - // Probe checks that the CSI driver is ready to process requests - Probe(ctx context.Context) error -} - -// New creates a new CSI client. -func New(address string, timeout time.Duration) (Client, error) { - conn, err := newGRPCConnection(address, timeout) - if err != nil { - return nil, err - } - return &client{ - idClient: csi.NewIdentityClient(conn), - ctrlClient: csi.NewControllerClient(conn), - }, nil -} - -type client struct { - idClient csi.IdentityClient - ctrlClient csi.ControllerClient -} - -func (c *client) GetDriverName(ctx context.Context) (string, error) { - req := csi.GetPluginInfoRequest{} - - resp, err := c.idClient.GetPluginInfo(ctx, &req) - if err != nil { - return "", err - } - - name := resp.GetName() - if name == "" { - return "", errors.New("driver name is empty") - } - - return name, nil -} - -func (c *client) SupportsPluginControllerService(ctx context.Context) (bool, error) { - rsp, err := c.idClient.GetPluginCapabilities(ctx, &csi.GetPluginCapabilitiesRequest{}) - if err != nil { - return false, err - } - caps := rsp.GetCapabilities() - for _, capability := range caps { - if capability == nil { - continue - } - service := capability.GetService() - if service == nil { - continue - } - if service.GetType() == csi.PluginCapability_Service_CONTROLLER_SERVICE { - return true, nil - } - } - return false, nil -} - -func (c *client) SupportsControllerResize(ctx context.Context) (bool, error) { - rsp, err := c.ctrlClient.ControllerGetCapabilities(ctx, &csi.ControllerGetCapabilitiesRequest{}) - if err != nil { - return false, err - } - caps := rsp.GetCapabilities() - for _, capability := range caps { - if capability == nil { - continue - } - rpc := capability.GetRpc() - if rpc == nil { - continue - } - if rpc.GetType() == csi.ControllerServiceCapability_RPC_EXPAND_VOLUME { - return true, nil - } - } - return false, nil -} - -func (c *client) Expand( - ctx context.Context, - volumeID string, - requestBytes int64, - secrets map[string]string) (int64, bool, error) { - req := &csi.ControllerExpandVolumeRequest{ - Secrets: secrets, - VolumeId: volumeID, - CapacityRange: &csi.CapacityRange{RequiredBytes: requestBytes}, - } - resp, err := c.ctrlClient.ControllerExpandVolume(ctx, req) - if err != nil { - return 0, false, err - } - return resp.CapacityBytes, resp.NodeExpansionRequired, nil -} - -func (c *client) Probe(ctx context.Context) error { - resp, err := c.idClient.Probe(ctx, &csi.ProbeRequest{}) - if err != nil { - return err - } - if resp.Ready == nil || !resp.Ready.Value { - return errors.New("driver is still initializing") - } - return nil -} - -func newGRPCConnection(address string, timeout time.Duration) (*grpc.ClientConn, error) { - klog.V(2).Infof("Connecting to %s", address) - dialOptions := []grpc.DialOption{ - grpc.WithInsecure(), - grpc.WithBackoffMaxDelay(time.Second), - grpc.WithUnaryInterceptor(logGRPC), - } - if strings.HasPrefix(address, "/") { - dialOptions = append(dialOptions, grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) { - return net.DialTimeout("unix", addr, timeout) - })) - } - conn, err := grpc.Dial(address, dialOptions...) - - if err != nil { - return nil, err - } - ctx, cancel := context.WithTimeout(context.Background(), timeout) - defer cancel() - for { - if !conn.WaitForStateChange(ctx, conn.GetState()) { - klog.V(4).Infof("Connection timed out") - return conn, fmt.Errorf("Connection timed out") - } - if conn.GetState() == connectivity.Ready { - klog.V(3).Infof("Connected") - return conn, nil - } - klog.V(4).Infof("Still trying, connection is %s", conn.GetState()) - } -} - -func logGRPC(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { - klog.V(5).Infof("GRPC call: %s", method) - klog.V(5).Infof("GRPC request: %s", protosanitizer.StripSecrets(req)) - err := invoker(ctx, method, req, reply, cc, opts...) - klog.V(5).Infof("GRPC response: %s", protosanitizer.StripSecrets(reply)) - klog.V(5).Infof("GRPC error: %v", err) - return err -} diff --git a/pkg/resizer/csi_resizer.go b/pkg/resizer/csi_resizer.go index b17914e36..da3daacc8 100644 --- a/pkg/resizer/csi_resizer.go +++ b/pkg/resizer/csi_resizer.go @@ -23,14 +23,18 @@ import ( "os" "time" - "github.com/kubernetes-csi/external-resizer/pkg/csi" + "github.com/container-storage-interface/spec/lib/go/csi" + "github.com/kubernetes-csi/csi-lib-utils/connection" + csirpc "github.com/kubernetes-csi/csi-lib-utils/rpc" + "github.com/kubernetes-csi/external-resizer/pkg/client" + + "google.golang.org/grpc" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/validation" - "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" storagev1listers "k8s.io/client-go/listers/storage/v1" @@ -47,31 +51,42 @@ func NewCSIResizer( address string, timeout time.Duration, k8sClient kubernetes.Interface, informerFactory informers.SharedInformerFactory) (Resizer, error) { - client, err := csi.New(address, timeout) + conn, err := connection.Connect(address) if err != nil { - return nil, fmt.Errorf("connect to CSI driver failed: %v", err) + return nil, fmt.Errorf("failed to connect to CSI driver: %v", err) } - if err := waitDriverReady(client, timeout); err != nil { - return nil, err + err = csirpc.ProbeForever(conn, timeout) + if err != nil { + return nil, fmt.Errorf("failed probing CSI driver: %v", err) } - name, err := getDriverName(client, timeout) + name, err := csirpc.GetDriverName(context.Background(), conn) if err != nil { return nil, fmt.Errorf("get driver name failed: %v", err) } - if err := supportsPluginControllerService(client, timeout); err != nil { - return nil, err + supports, err := supportsPluginControllerService(conn, timeout) + if err != nil { + return nil, fmt.Errorf("failed to check if plugin supports controller service: %v", err) + } + + if !supports { + return nil, errors.New("CSI driver does not support controller service") + } + + supports, err = supportsControllerResize(conn, timeout) + if err != nil { + return nil, fmt.Errorf("failed to check if plugin supports controller resize: %v", err) } - if err := supportsControllerResize(client, timeout); err != nil { - return nil, err + if !supports { + return nil, fmt.Errorf("CSI driver does not support controller resize") } return &csiResizer{ name: name, - client: client, + client: client.New(conn), timeout: timeout, k8sClient: k8sClient, @@ -81,7 +96,7 @@ func NewCSIResizer( type csiResizer struct { name string - client csi.Client + client client.Client timeout time.Duration k8sClient kubernetes.Interface @@ -144,55 +159,28 @@ func (r *csiResizer) Resize(pv *v1.PersistentVolume, requestSize resource.Quanti return *resource.NewQuantity(newSizeBytes, resource.BinarySI), nodeResizeRequired, err } -func waitDriverReady(client csi.Client, timeout time.Duration) error { - err := wait.PollImmediate(time.Second, timeout, func() (bool, error) { - ctx, cancel := timeoutCtx(timeout) - defer cancel() - if err := client.Probe(ctx); err != nil { - klog.V(4).Infof("Driver not ready: %v", err) - return false, nil - } - return true, nil - }) - if err != nil { - if err == wait.ErrWaitTimeout { - return errors.New("waiting for driver ready timeout") - } - return err - } - return nil -} - -func getDriverName(client csi.Client, timeout time.Duration) (string, error) { +func supportsPluginControllerService(conn *grpc.ClientConn, timeout time.Duration) (bool, error) { ctx, cancel := timeoutCtx(timeout) defer cancel() - return client.GetDriverName(ctx) -} -func supportsPluginControllerService(client csi.Client, timeout time.Duration) error { - ctx, cancel := timeoutCtx(timeout) - defer cancel() - support, err := client.SupportsPluginControllerService(ctx) + caps, err := csirpc.GetPluginCapabilities(ctx, conn) if err != nil { - return fmt.Errorf("check driver's controller service capacity failed: %v", err) + return false, fmt.Errorf("error getting controller capabilities: %v", err) } - if !support { - return errors.New("driver not support controller service") - } - return nil + + return caps[csi.PluginCapability_Service_CONTROLLER_SERVICE], nil } -func supportsControllerResize(client csi.Client, timeout time.Duration) error { +func supportsControllerResize(conn *grpc.ClientConn, timeout time.Duration) (bool, error) { ctx, cancel := timeoutCtx(timeout) defer cancel() - support, err := client.SupportsControllerResize(ctx) + + caps, err := csirpc.GetControllerCapabilities(ctx, conn) if err != nil { - return fmt.Errorf("check driver's controller resize capacity failed: %v", err) + return false, fmt.Errorf("error getting controller capabilities: %v", err) } - if !support { - return errors.New("driver not support controller resize") - } - return nil + + return caps[csi.ControllerServiceCapability_RPC_EXPAND_VOLUME], nil } func timeoutCtx(timeout time.Duration) (context.Context, context.CancelFunc) { From e0bff2ee64e9e732fe0acca1580550419bf596e8 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Sun, 3 Mar 2019 16:00:10 -0500 Subject: [PATCH 17/18] Add Dockerfile and add release-tools --- Dockerfile | 6 ++++++ Makefile | 24 +++--------------------- 2 files changed, 9 insertions(+), 21 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..56618c530 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM alpine +LABEL maintainers="Kubernetes Authors" +LABEL description="CSI External Resizer" + +COPY ./bin/csi-resizer csi-resizer +ENTRYPOINT ["/csi-resizer"] diff --git a/Makefile b/Makefile index acdbffa70..8fa9d2c4f 100644 --- a/Makefile +++ b/Makefile @@ -12,26 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -.PHONY: all csi-resizer clean test -all: csi-resizer - -csi-resizer: - mkdir -p bin - go build -o bin/csi-resizer ./cmd/csi-resizer - -clean: - -rm -rf bin/ - -test: - go test `go list ./... | grep -v 'vendor'` - -fmt: - find . -not \( \( -wholename '*/vendor/*' \) -prune \) -name '*.go' | xargs gofmt -s -w - -vet: - go vet `go list ./... | grep -v vendor` - -lint: - find . -not \( \( -wholename '*/vendor/*' \) -prune \) -name '*.go' | xargs -L1 golint +CMDS=csi-resizer +all: build +include release-tools/build.make From c74fc9b5c8e275beb56d02c80940b133d24be616 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 4 Mar 2019 13:16:39 +0100 Subject: [PATCH 18/18] fix release-tools integration `make test` failed because the directory wasn't named as expected. The top-level .travis.yml is needed for Travis CI.