mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
rebase: update kubernetes to v1.20.0
updated kubernetes packages to latest release. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
4abe128bd8
commit
83559144b1
7
vendor/k8s.io/csi-translation-lib/CONTRIBUTING.md
generated
vendored
7
vendor/k8s.io/csi-translation-lib/CONTRIBUTING.md
generated
vendored
@ -1,7 +0,0 @@
|
||||
# Contributing guidelines
|
||||
|
||||
Do not open pull requests directly against this repository, they will be ignored. Instead, please open pull requests against [kubernetes/kubernetes](https://git.k8s.io/kubernetes/). Please follow the same [contributing guide](https://git.k8s.io/kubernetes/CONTRIBUTING.md) you would follow for any other pull request made to kubernetes/kubernetes.
|
||||
|
||||
This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/csi-translation-lib](https://git.k8s.io/kubernetes/staging/src/k8s.io/csi-translation-lib) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot).
|
||||
|
||||
Please see [Staging Directory and Publishing](https://git.k8s.io/community/contributors/devel/sig-architecture/staging.md) for more information.
|
201
vendor/k8s.io/csi-translation-lib/LICENSE
generated
vendored
201
vendor/k8s.io/csi-translation-lib/LICENSE
generated
vendored
@ -1,201 +0,0 @@
|
||||
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.
|
14
vendor/k8s.io/csi-translation-lib/OWNERS
generated
vendored
14
vendor/k8s.io/csi-translation-lib/OWNERS
generated
vendored
@ -1,14 +0,0 @@
|
||||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
|
||||
reviewers:
|
||||
- davidz627
|
||||
- saad-ali
|
||||
- msau42
|
||||
- ddebroy
|
||||
- leakingtapan
|
||||
- andyzhangx
|
||||
|
||||
approvers:
|
||||
- davidz627
|
||||
- saad-ali
|
||||
- msau42
|
29
vendor/k8s.io/csi-translation-lib/README.md
generated
vendored
29
vendor/k8s.io/csi-translation-lib/README.md
generated
vendored
@ -1,29 +0,0 @@
|
||||
## Purpose
|
||||
|
||||
This repository contains functions to be consumed by various Kubernetes and
|
||||
out-of-tree CSI components like external provisioner to facilitate migration of
|
||||
code from Kubernetes In-tree plugin code to CSI plugin repositories.
|
||||
|
||||
Consumers of this repository can make use of functions like `TranslateToCSI` and
|
||||
`TranslateToInTree` functions to translate PV sources.
|
||||
|
||||
## 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 repository at:
|
||||
|
||||
- Slack: #sig-storage (on https://kubernetes.slack.com -- get an
|
||||
invite at slack.kubernetes.io)
|
||||
- Mailing List:
|
||||
https://groups.google.com/forum/#!forum/kubernetes-sig-storage
|
||||
|
||||
### Code of Conduct
|
||||
|
||||
Participation in the Kubernetes community is governed by the [Kubernetes
|
||||
Code of Conduct](code-of-conduct.md).
|
||||
|
||||
### Contibution Guidelines
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
|
18
vendor/k8s.io/csi-translation-lib/SECURITY_CONTACTS
generated
vendored
18
vendor/k8s.io/csi-translation-lib/SECURITY_CONTACTS
generated
vendored
@ -1,18 +0,0 @@
|
||||
# Defined below are the security contacts for this repo.
|
||||
#
|
||||
# They are the contact point for the Product Security Committee to reach out
|
||||
# to for triaging and handling of incoming issues.
|
||||
#
|
||||
# The below names agree to abide by the
|
||||
# [Embargo Policy](https://git.k8s.io/security/private-distributors-list.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/
|
||||
|
||||
saad-ali
|
||||
cjcullen
|
||||
joelsmith
|
||||
liggitt
|
||||
philips
|
||||
tallclair
|
3
vendor/k8s.io/csi-translation-lib/code-of-conduct.md
generated
vendored
3
vendor/k8s.io/csi-translation-lib/code-of-conduct.md
generated
vendored
@ -1,3 +0,0 @@
|
||||
# Kubernetes Community Code of Conduct
|
||||
|
||||
Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md)
|
22
vendor/k8s.io/csi-translation-lib/go.mod
generated
vendored
22
vendor/k8s.io/csi-translation-lib/go.mod
generated
vendored
@ -1,22 +0,0 @@
|
||||
// This is a generated file. Do not edit directly.
|
||||
|
||||
module k8s.io/csi-translation-lib
|
||||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/stretchr/testify v1.4.0
|
||||
k8s.io/api v0.18.6
|
||||
k8s.io/apimachinery v0.18.6
|
||||
k8s.io/cloud-provider v0.18.6
|
||||
k8s.io/klog v1.0.0
|
||||
)
|
||||
|
||||
replace (
|
||||
golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13
|
||||
golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13
|
||||
k8s.io/api => k8s.io/api v0.18.6
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.18.6
|
||||
k8s.io/client-go => k8s.io/client-go v0.18.6
|
||||
k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.6
|
||||
)
|
170
vendor/k8s.io/csi-translation-lib/go.sum
generated
vendored
170
vendor/k8s.io/csi-translation-lib/go.sum
generated
vendored
@ -1,170 +0,0 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
|
||||
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
|
||||
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
|
||||
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
|
||||
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
|
||||
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
|
||||
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
|
||||
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
|
||||
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
|
||||
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
||||
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
|
||||
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
|
||||
github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
|
||||
github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
|
||||
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
|
||||
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
|
||||
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=
|
||||
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
|
||||
github.com/googleapis/gnostic v0.1.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
|
||||
github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok=
|
||||
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
|
||||
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
|
||||
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI=
|
||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
k8s.io/api v0.18.6/go.mod h1:eeyxr+cwCjMdLAmr2W3RyDI0VvTawSg/3RFFBEnmZGI=
|
||||
k8s.io/apimachinery v0.18.6/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
|
||||
k8s.io/client-go v0.18.6/go.mod h1:/fwtGLjYMS1MaM5oi+eXhKwG+1UHidUEXRh6cNsdO0Q=
|
||||
k8s.io/cloud-provider v0.18.6/go.mod h1:QnPLLdFkvtx1dEyVMaPUdzVWB+ECzEf+PA3DXwIr8bo=
|
||||
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
|
||||
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
|
||||
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
|
||||
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
|
||||
sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=
|
||||
sigs.k8s.io/structured-merge-diff/v3 v3.0.0 h1:dOmIZBMfhcHS09XZkMyUgkq5trg3/jRyJYFZUiaOp8E=
|
||||
sigs.k8s.io/structured-merge-diff/v3 v3.0.0/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
255
vendor/k8s.io/csi-translation-lib/plugins/aws_ebs.go
generated
vendored
255
vendor/k8s.io/csi-translation-lib/plugins/aws_ebs.go
generated
vendored
@ -1,255 +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 plugins
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
// AWSEBSDriverName is the name of the CSI driver for EBS
|
||||
AWSEBSDriverName = "ebs.csi.aws.com"
|
||||
// AWSEBSInTreePluginName is the name of the intree plugin for EBS
|
||||
AWSEBSInTreePluginName = "kubernetes.io/aws-ebs"
|
||||
// AWSEBSTopologyKey is the zonal topology key for AWS EBS CSI driver
|
||||
AWSEBSTopologyKey = "topology." + AWSEBSDriverName + "/zone"
|
||||
)
|
||||
|
||||
var _ InTreePlugin = &awsElasticBlockStoreCSITranslator{}
|
||||
|
||||
// awsElasticBlockStoreTranslator handles translation of PV spec from In-tree EBS to CSI EBS and vice versa
|
||||
type awsElasticBlockStoreCSITranslator struct{}
|
||||
|
||||
// NewAWSElasticBlockStoreCSITranslator returns a new instance of awsElasticBlockStoreTranslator
|
||||
func NewAWSElasticBlockStoreCSITranslator() InTreePlugin {
|
||||
return &awsElasticBlockStoreCSITranslator{}
|
||||
}
|
||||
|
||||
// TranslateInTreeStorageClassToCSI translates InTree EBS storage class parameters to CSI storage class
|
||||
func (t *awsElasticBlockStoreCSITranslator) TranslateInTreeStorageClassToCSI(sc *storage.StorageClass) (*storage.StorageClass, error) {
|
||||
var (
|
||||
generatedTopologies []v1.TopologySelectorTerm
|
||||
params = map[string]string{}
|
||||
)
|
||||
for k, v := range sc.Parameters {
|
||||
switch strings.ToLower(k) {
|
||||
case fsTypeKey:
|
||||
params[csiFsTypeKey] = v
|
||||
case zoneKey:
|
||||
generatedTopologies = generateToplogySelectors(AWSEBSTopologyKey, []string{v})
|
||||
case zonesKey:
|
||||
generatedTopologies = generateToplogySelectors(AWSEBSTopologyKey, strings.Split(v, ","))
|
||||
default:
|
||||
params[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
if len(generatedTopologies) > 0 && len(sc.AllowedTopologies) > 0 {
|
||||
return nil, fmt.Errorf("cannot simultaneously set allowed topologies and zone/zones parameters")
|
||||
} else if len(generatedTopologies) > 0 {
|
||||
sc.AllowedTopologies = generatedTopologies
|
||||
} else if len(sc.AllowedTopologies) > 0 {
|
||||
newTopologies, err := translateAllowedTopologies(sc.AllowedTopologies, AWSEBSTopologyKey)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed translating allowed topologies: %v", err)
|
||||
}
|
||||
sc.AllowedTopologies = newTopologies
|
||||
}
|
||||
|
||||
sc.Parameters = params
|
||||
|
||||
return sc, nil
|
||||
}
|
||||
|
||||
// TranslateInTreeInlineVolumeToCSI takes a Volume with AWSElasticBlockStore set from in-tree
|
||||
// and converts the AWSElasticBlockStore source to a CSIPersistentVolumeSource
|
||||
func (t *awsElasticBlockStoreCSITranslator) TranslateInTreeInlineVolumeToCSI(volume *v1.Volume) (*v1.PersistentVolume, error) {
|
||||
if volume == nil || volume.AWSElasticBlockStore == nil {
|
||||
return nil, fmt.Errorf("volume is nil or AWS EBS not defined on volume")
|
||||
}
|
||||
ebsSource := volume.AWSElasticBlockStore
|
||||
volumeHandle, err := KubernetesVolumeIDToEBSVolumeID(ebsSource.VolumeID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to translate Kubernetes ID to EBS Volume ID %v", err)
|
||||
}
|
||||
pv := &v1.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
// Must be unique per disk as it is used as the unique part of the
|
||||
// staging path
|
||||
Name: fmt.Sprintf("%s-%s", AWSEBSDriverName, ebsSource.VolumeID),
|
||||
},
|
||||
Spec: v1.PersistentVolumeSpec{
|
||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||
CSI: &v1.CSIPersistentVolumeSource{
|
||||
Driver: AWSEBSDriverName,
|
||||
VolumeHandle: volumeHandle,
|
||||
ReadOnly: ebsSource.ReadOnly,
|
||||
FSType: ebsSource.FSType,
|
||||
VolumeAttributes: map[string]string{
|
||||
"partition": strconv.FormatInt(int64(ebsSource.Partition), 10),
|
||||
},
|
||||
},
|
||||
},
|
||||
AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce},
|
||||
},
|
||||
}
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// TranslateInTreePVToCSI takes a PV with AWSElasticBlockStore set from in-tree
|
||||
// and converts the AWSElasticBlockStore source to a CSIPersistentVolumeSource
|
||||
func (t *awsElasticBlockStoreCSITranslator) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
if pv == nil || pv.Spec.AWSElasticBlockStore == nil {
|
||||
return nil, fmt.Errorf("pv is nil or AWS EBS not defined on pv")
|
||||
}
|
||||
|
||||
ebsSource := pv.Spec.AWSElasticBlockStore
|
||||
|
||||
volumeHandle, err := KubernetesVolumeIDToEBSVolumeID(ebsSource.VolumeID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to translate Kubernetes ID to EBS Volume ID %v", err)
|
||||
}
|
||||
|
||||
csiSource := &v1.CSIPersistentVolumeSource{
|
||||
Driver: AWSEBSDriverName,
|
||||
VolumeHandle: volumeHandle,
|
||||
ReadOnly: ebsSource.ReadOnly,
|
||||
FSType: ebsSource.FSType,
|
||||
VolumeAttributes: map[string]string{
|
||||
"partition": strconv.FormatInt(int64(ebsSource.Partition), 10),
|
||||
},
|
||||
}
|
||||
|
||||
if err := translateTopology(pv, AWSEBSTopologyKey); err != nil {
|
||||
return nil, fmt.Errorf("failed to translate topology: %v", err)
|
||||
}
|
||||
|
||||
pv.Spec.AWSElasticBlockStore = nil
|
||||
pv.Spec.CSI = csiSource
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// TranslateCSIPVToInTree takes a PV with CSIPersistentVolumeSource set and
|
||||
// translates the EBS CSI source to a AWSElasticBlockStore source.
|
||||
func (t *awsElasticBlockStoreCSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
if pv == nil || pv.Spec.CSI == nil {
|
||||
return nil, fmt.Errorf("pv is nil or CSI source not defined on pv")
|
||||
}
|
||||
|
||||
csiSource := pv.Spec.CSI
|
||||
|
||||
ebsSource := &v1.AWSElasticBlockStoreVolumeSource{
|
||||
VolumeID: csiSource.VolumeHandle,
|
||||
FSType: csiSource.FSType,
|
||||
ReadOnly: csiSource.ReadOnly,
|
||||
}
|
||||
|
||||
if partition, ok := csiSource.VolumeAttributes["partition"]; ok {
|
||||
partValue, err := strconv.Atoi(partition)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to convert partition %v to integer: %v", partition, err)
|
||||
}
|
||||
ebsSource.Partition = int32(partValue)
|
||||
}
|
||||
|
||||
pv.Spec.CSI = nil
|
||||
pv.Spec.AWSElasticBlockStore = ebsSource
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// CanSupport tests whether the plugin supports a given persistent volume
|
||||
// specification from the API. The spec pointer should be considered
|
||||
// const.
|
||||
func (t *awsElasticBlockStoreCSITranslator) CanSupport(pv *v1.PersistentVolume) bool {
|
||||
return pv != nil && pv.Spec.AWSElasticBlockStore != nil
|
||||
}
|
||||
|
||||
// CanSupportInline tests whether the plugin supports a given inline volume
|
||||
// specification from the API. The spec pointer should be considered
|
||||
// const.
|
||||
func (t *awsElasticBlockStoreCSITranslator) CanSupportInline(volume *v1.Volume) bool {
|
||||
return volume != nil && volume.AWSElasticBlockStore != nil
|
||||
}
|
||||
|
||||
// GetInTreePluginName returns the name of the intree plugin driver
|
||||
func (t *awsElasticBlockStoreCSITranslator) GetInTreePluginName() string {
|
||||
return AWSEBSInTreePluginName
|
||||
}
|
||||
|
||||
// GetCSIPluginName returns the name of the CSI plugin
|
||||
func (t *awsElasticBlockStoreCSITranslator) GetCSIPluginName() string {
|
||||
return AWSEBSDriverName
|
||||
}
|
||||
|
||||
func (t *awsElasticBlockStoreCSITranslator) RepairVolumeHandle(volumeHandle, nodeID string) (string, error) {
|
||||
return volumeHandle, nil
|
||||
}
|
||||
|
||||
// awsVolumeRegMatch represents Regex Match for AWS volume.
|
||||
var awsVolumeRegMatch = regexp.MustCompile("^vol-[^/]*$")
|
||||
|
||||
// KubernetesVolumeIDToEBSVolumeID translates Kubernetes volume ID to EBS volume ID
|
||||
// KubernetsVolumeID forms:
|
||||
// * aws://<zone>/<awsVolumeId>
|
||||
// * aws:///<awsVolumeId>
|
||||
// * <awsVolumeId>
|
||||
// EBS Volume ID form:
|
||||
// * vol-<alphanumberic>
|
||||
// This translation shouldn't be needed and should be fixed in long run
|
||||
// See https://github.com/kubernetes/kubernetes/issues/73730
|
||||
func KubernetesVolumeIDToEBSVolumeID(kubernetesID string) (string, error) {
|
||||
// name looks like aws://availability-zone/awsVolumeId
|
||||
|
||||
// The original idea of the URL-style name was to put the AZ into the
|
||||
// host, so we could find the AZ immediately from the name without
|
||||
// querying the API. But it turns out we don't actually need it for
|
||||
// multi-AZ clusters, as we put the AZ into the labels on the PV instead.
|
||||
// However, if in future we want to support multi-AZ cluster
|
||||
// volume-awareness without using PersistentVolumes, we likely will
|
||||
// want the AZ in the host.
|
||||
if !strings.HasPrefix(kubernetesID, "aws://") {
|
||||
// Assume a bare aws volume id (vol-1234...)
|
||||
return kubernetesID, nil
|
||||
}
|
||||
url, err := url.Parse(kubernetesID)
|
||||
if err != nil {
|
||||
// TODO: Maybe we should pass a URL into the Volume functions
|
||||
return "", fmt.Errorf("Invalid disk name (%s): %v", kubernetesID, err)
|
||||
}
|
||||
if url.Scheme != "aws" {
|
||||
return "", fmt.Errorf("Invalid scheme for AWS volume (%s)", kubernetesID)
|
||||
}
|
||||
|
||||
awsID := url.Path
|
||||
awsID = strings.Trim(awsID, "/")
|
||||
|
||||
// We sanity check the resulting volume; the two known formats are
|
||||
// vol-12345678 and vol-12345678abcdef01
|
||||
if !awsVolumeRegMatch.MatchString(awsID) {
|
||||
return "", fmt.Errorf("Invalid format for AWS volume (%s)", kubernetesID)
|
||||
}
|
||||
|
||||
return awsID, nil
|
||||
}
|
239
vendor/k8s.io/csi-translation-lib/plugins/azure_disk.go
generated
vendored
239
vendor/k8s.io/csi-translation-lib/plugins/azure_disk.go
generated
vendored
@ -1,239 +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 plugins
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
// AzureDiskDriverName is the name of the CSI driver for Azure Disk
|
||||
AzureDiskDriverName = "disk.csi.azure.com"
|
||||
// AzureDiskInTreePluginName is the name of the intree plugin for Azure Disk
|
||||
AzureDiskInTreePluginName = "kubernetes.io/azure-disk"
|
||||
|
||||
// Parameter names defined in azure disk CSI driver, refer to
|
||||
// https://github.com/kubernetes-sigs/azuredisk-csi-driver/blob/master/docs/driver-parameters.md
|
||||
azureDiskKind = "kind"
|
||||
azureDiskCachingMode = "cachingMode"
|
||||
azureDiskFSType = "fsType"
|
||||
)
|
||||
|
||||
var (
|
||||
managedDiskPathRE = regexp.MustCompile(`.*/subscriptions/(?:.*)/resourceGroups/(?:.*)/providers/Microsoft.Compute/disks/(.+)`)
|
||||
unmanagedDiskPathRE = regexp.MustCompile(`http(?:.*)://(?:.*)/vhds/(.+)`)
|
||||
)
|
||||
|
||||
var _ InTreePlugin = &azureDiskCSITranslator{}
|
||||
|
||||
// azureDiskCSITranslator handles translation of PV spec from In-tree
|
||||
// Azure Disk to CSI Azure Disk and vice versa
|
||||
type azureDiskCSITranslator struct{}
|
||||
|
||||
// NewAzureDiskCSITranslator returns a new instance of azureDiskTranslator
|
||||
func NewAzureDiskCSITranslator() InTreePlugin {
|
||||
return &azureDiskCSITranslator{}
|
||||
}
|
||||
|
||||
// TranslateInTreeStorageClassParametersToCSI translates InTree Azure Disk storage class parameters to CSI storage class
|
||||
func (t *azureDiskCSITranslator) TranslateInTreeStorageClassToCSI(sc *storage.StorageClass) (*storage.StorageClass, error) {
|
||||
return sc, nil
|
||||
}
|
||||
|
||||
// TranslateInTreeInlineVolumeToCSI takes a Volume with AzureDisk set from in-tree
|
||||
// and converts the AzureDisk source to a CSIPersistentVolumeSource
|
||||
func (t *azureDiskCSITranslator) TranslateInTreeInlineVolumeToCSI(volume *v1.Volume) (*v1.PersistentVolume, error) {
|
||||
if volume == nil || volume.AzureDisk == nil {
|
||||
return nil, fmt.Errorf("volume is nil or Azure Disk not defined on volume")
|
||||
}
|
||||
|
||||
azureSource := volume.AzureDisk
|
||||
pv := &v1.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
// Must be unique per disk as it is used as the unique part of the
|
||||
// staging path
|
||||
Name: fmt.Sprintf("%s-%s", AzureDiskDriverName, azureSource.DiskName),
|
||||
},
|
||||
Spec: v1.PersistentVolumeSpec{
|
||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||
CSI: &v1.CSIPersistentVolumeSource{
|
||||
Driver: AzureDiskDriverName,
|
||||
VolumeHandle: azureSource.DataDiskURI,
|
||||
VolumeAttributes: map[string]string{azureDiskKind: "Managed"},
|
||||
},
|
||||
},
|
||||
AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce},
|
||||
},
|
||||
}
|
||||
if azureSource.ReadOnly != nil {
|
||||
pv.Spec.PersistentVolumeSource.CSI.ReadOnly = *azureSource.ReadOnly
|
||||
}
|
||||
|
||||
if azureSource.CachingMode != nil && *azureSource.CachingMode != "" {
|
||||
pv.Spec.PersistentVolumeSource.CSI.VolumeAttributes[azureDiskCachingMode] = string(*azureSource.CachingMode)
|
||||
}
|
||||
if azureSource.FSType != nil {
|
||||
pv.Spec.PersistentVolumeSource.CSI.FSType = *azureSource.FSType
|
||||
pv.Spec.PersistentVolumeSource.CSI.VolumeAttributes[azureDiskFSType] = *azureSource.FSType
|
||||
}
|
||||
if azureSource.Kind != nil {
|
||||
pv.Spec.PersistentVolumeSource.CSI.VolumeAttributes[azureDiskKind] = string(*azureSource.Kind)
|
||||
}
|
||||
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// TranslateInTreePVToCSI takes a PV with AzureDisk set from in-tree
|
||||
// and converts the AzureDisk source to a CSIPersistentVolumeSource
|
||||
func (t *azureDiskCSITranslator) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
if pv == nil || pv.Spec.AzureDisk == nil {
|
||||
return nil, fmt.Errorf("pv is nil or Azure Disk source not defined on pv")
|
||||
}
|
||||
|
||||
var (
|
||||
azureSource = pv.Spec.PersistentVolumeSource.AzureDisk
|
||||
|
||||
// refer to https://github.com/kubernetes-sigs/azuredisk-csi-driver/blob/master/docs/driver-parameters.md
|
||||
csiSource = &v1.CSIPersistentVolumeSource{
|
||||
Driver: AzureDiskDriverName,
|
||||
VolumeAttributes: map[string]string{azureDiskKind: "Managed"},
|
||||
VolumeHandle: azureSource.DataDiskURI,
|
||||
}
|
||||
)
|
||||
|
||||
if azureSource.CachingMode != nil {
|
||||
csiSource.VolumeAttributes[azureDiskCachingMode] = string(*azureSource.CachingMode)
|
||||
}
|
||||
|
||||
if azureSource.FSType != nil {
|
||||
csiSource.FSType = *azureSource.FSType
|
||||
csiSource.VolumeAttributes[azureDiskFSType] = *azureSource.FSType
|
||||
}
|
||||
|
||||
if azureSource.Kind != nil {
|
||||
csiSource.VolumeAttributes[azureDiskKind] = string(*azureSource.Kind)
|
||||
}
|
||||
|
||||
if azureSource.ReadOnly != nil {
|
||||
csiSource.ReadOnly = *azureSource.ReadOnly
|
||||
}
|
||||
|
||||
pv.Spec.PersistentVolumeSource.AzureDisk = nil
|
||||
pv.Spec.PersistentVolumeSource.CSI = csiSource
|
||||
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// TranslateCSIPVToInTree takes a PV with CSIPersistentVolumeSource set and
|
||||
// translates the Azure Disk CSI source to a AzureDisk source.
|
||||
func (t *azureDiskCSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
if pv == nil || pv.Spec.CSI == nil {
|
||||
return nil, fmt.Errorf("pv is nil or CSI source not defined on pv")
|
||||
}
|
||||
csiSource := pv.Spec.CSI
|
||||
|
||||
diskURI := csiSource.VolumeHandle
|
||||
diskName, err := getDiskName(diskURI)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// refer to https://github.com/kubernetes-sigs/azuredisk-csi-driver/blob/master/docs/driver-parameters.md
|
||||
managed := v1.AzureManagedDisk
|
||||
azureSource := &v1.AzureDiskVolumeSource{
|
||||
DiskName: diskName,
|
||||
DataDiskURI: diskURI,
|
||||
FSType: &csiSource.FSType,
|
||||
ReadOnly: &csiSource.ReadOnly,
|
||||
Kind: &managed,
|
||||
}
|
||||
|
||||
if csiSource.VolumeAttributes != nil {
|
||||
if cachingMode, ok := csiSource.VolumeAttributes[azureDiskCachingMode]; ok {
|
||||
mode := v1.AzureDataDiskCachingMode(cachingMode)
|
||||
azureSource.CachingMode = &mode
|
||||
}
|
||||
|
||||
if fsType, ok := csiSource.VolumeAttributes[azureDiskFSType]; ok && fsType != "" {
|
||||
azureSource.FSType = &fsType
|
||||
}
|
||||
|
||||
if kind, ok := csiSource.VolumeAttributes[azureDiskKind]; ok && kind != "" {
|
||||
diskKind := v1.AzureDataDiskKind(kind)
|
||||
azureSource.Kind = &diskKind
|
||||
}
|
||||
}
|
||||
|
||||
pv.Spec.CSI = nil
|
||||
pv.Spec.AzureDisk = azureSource
|
||||
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// CanSupport tests whether the plugin supports a given volume
|
||||
// specification from the API. The spec pointer should be considered
|
||||
// const.
|
||||
func (t *azureDiskCSITranslator) CanSupport(pv *v1.PersistentVolume) bool {
|
||||
return pv != nil && pv.Spec.AzureDisk != nil
|
||||
}
|
||||
|
||||
// CanSupportInline tests whether the plugin supports a given inline volume
|
||||
// specification from the API. The spec pointer should be considered
|
||||
// const.
|
||||
func (t *azureDiskCSITranslator) CanSupportInline(volume *v1.Volume) bool {
|
||||
return volume != nil && volume.AzureDisk != nil
|
||||
}
|
||||
|
||||
// GetInTreePluginName returns the name of the intree plugin driver
|
||||
func (t *azureDiskCSITranslator) GetInTreePluginName() string {
|
||||
return AzureDiskInTreePluginName
|
||||
}
|
||||
|
||||
// GetCSIPluginName returns the name of the CSI plugin
|
||||
func (t *azureDiskCSITranslator) GetCSIPluginName() string {
|
||||
return AzureDiskDriverName
|
||||
}
|
||||
|
||||
func (t *azureDiskCSITranslator) RepairVolumeHandle(volumeHandle, nodeID string) (string, error) {
|
||||
return volumeHandle, nil
|
||||
}
|
||||
|
||||
func isManagedDisk(diskURI string) bool {
|
||||
if len(diskURI) > 4 && strings.ToLower(diskURI[:4]) == "http" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func getDiskName(diskURI string) (string, error) {
|
||||
diskPathRE := managedDiskPathRE
|
||||
if !isManagedDisk(diskURI) {
|
||||
diskPathRE = unmanagedDiskPathRE
|
||||
}
|
||||
|
||||
matches := diskPathRE.FindStringSubmatch(diskURI)
|
||||
if len(matches) != 2 {
|
||||
return "", fmt.Errorf("could not get disk name from %s, correct format: %s", diskURI, diskPathRE)
|
||||
}
|
||||
return matches[1], nil
|
||||
}
|
231
vendor/k8s.io/csi-translation-lib/plugins/azure_file.go
generated
vendored
231
vendor/k8s.io/csi-translation-lib/plugins/azure_file.go
generated
vendored
@ -1,231 +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 plugins
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
const (
|
||||
// AzureFileDriverName is the name of the CSI driver for Azure File
|
||||
AzureFileDriverName = "file.csi.azure.com"
|
||||
// AzureFileInTreePluginName is the name of the intree plugin for Azure file
|
||||
AzureFileInTreePluginName = "kubernetes.io/azure-file"
|
||||
|
||||
separator = "#"
|
||||
volumeIDTemplate = "%s#%s#%s#%s"
|
||||
// Parameter names defined in azure file CSI driver, refer to
|
||||
// https://github.com/kubernetes-sigs/azurefile-csi-driver/blob/master/docs/driver-parameters.md
|
||||
azureFileShareName = "shareName"
|
||||
|
||||
secretNameTemplate = "azure-storage-account-%s-secret"
|
||||
defaultSecretNamespace = "default"
|
||||
)
|
||||
|
||||
var _ InTreePlugin = &azureFileCSITranslator{}
|
||||
|
||||
var secretNameFormatRE = regexp.MustCompile(`azure-storage-account-(.+)-secret`)
|
||||
|
||||
// azureFileCSITranslator handles translation of PV spec from In-tree
|
||||
// Azure File to CSI Azure File and vice versa
|
||||
type azureFileCSITranslator struct{}
|
||||
|
||||
// NewAzureFileCSITranslator returns a new instance of azureFileTranslator
|
||||
func NewAzureFileCSITranslator() InTreePlugin {
|
||||
return &azureFileCSITranslator{}
|
||||
}
|
||||
|
||||
// TranslateInTreeStorageClassParametersToCSI translates InTree Azure File storage class parameters to CSI storage class
|
||||
func (t *azureFileCSITranslator) TranslateInTreeStorageClassToCSI(sc *storage.StorageClass) (*storage.StorageClass, error) {
|
||||
return sc, nil
|
||||
}
|
||||
|
||||
// TranslateInTreeInlineVolumeToCSI takes a Volume with AzureFile set from in-tree
|
||||
// and converts the AzureFile source to a CSIPersistentVolumeSource
|
||||
func (t *azureFileCSITranslator) TranslateInTreeInlineVolumeToCSI(volume *v1.Volume) (*v1.PersistentVolume, error) {
|
||||
if volume == nil || volume.AzureFile == nil {
|
||||
return nil, fmt.Errorf("volume is nil or Azure File not defined on volume")
|
||||
}
|
||||
|
||||
azureSource := volume.AzureFile
|
||||
accountName, err := getStorageAccountName(azureSource.SecretName)
|
||||
if err != nil {
|
||||
klog.Warningf("getStorageAccountName(%s) returned with error: %v", azureSource.SecretName, err)
|
||||
accountName = azureSource.SecretName
|
||||
}
|
||||
|
||||
var (
|
||||
pv = &v1.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
// Must be unique per disk as it is used as the unique part of the
|
||||
// staging path
|
||||
Name: fmt.Sprintf("%s-%s", AzureFileDriverName, azureSource.ShareName),
|
||||
},
|
||||
Spec: v1.PersistentVolumeSpec{
|
||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||
CSI: &v1.CSIPersistentVolumeSource{
|
||||
Driver: AzureFileDriverName,
|
||||
VolumeHandle: fmt.Sprintf(volumeIDTemplate, "", accountName, azureSource.ShareName, ""),
|
||||
ReadOnly: azureSource.ReadOnly,
|
||||
VolumeAttributes: map[string]string{azureFileShareName: azureSource.ShareName},
|
||||
NodeStageSecretRef: &v1.SecretReference{
|
||||
Name: azureSource.SecretName,
|
||||
Namespace: defaultSecretNamespace,
|
||||
},
|
||||
},
|
||||
},
|
||||
AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteMany},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// TranslateInTreePVToCSI takes a PV with AzureFile set from in-tree
|
||||
// and converts the AzureFile source to a CSIPersistentVolumeSource
|
||||
func (t *azureFileCSITranslator) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
if pv == nil || pv.Spec.AzureFile == nil {
|
||||
return nil, fmt.Errorf("pv is nil or Azure File source not defined on pv")
|
||||
}
|
||||
|
||||
azureSource := pv.Spec.PersistentVolumeSource.AzureFile
|
||||
accountName, err := getStorageAccountName(azureSource.SecretName)
|
||||
if err != nil {
|
||||
klog.Warningf("getStorageAccountName(%s) returned with error: %v", azureSource.SecretName, err)
|
||||
accountName = azureSource.SecretName
|
||||
}
|
||||
volumeID := fmt.Sprintf(volumeIDTemplate, "", accountName, azureSource.ShareName, "")
|
||||
|
||||
var (
|
||||
// refer to https://github.com/kubernetes-sigs/azurefile-csi-driver/blob/master/docs/driver-parameters.md
|
||||
csiSource = &v1.CSIPersistentVolumeSource{
|
||||
Driver: AzureFileDriverName,
|
||||
NodeStageSecretRef: &v1.SecretReference{
|
||||
Name: azureSource.SecretName,
|
||||
Namespace: defaultSecretNamespace,
|
||||
},
|
||||
ReadOnly: azureSource.ReadOnly,
|
||||
VolumeAttributes: map[string]string{azureFileShareName: azureSource.ShareName},
|
||||
VolumeHandle: volumeID,
|
||||
}
|
||||
)
|
||||
|
||||
if azureSource.SecretNamespace != nil {
|
||||
csiSource.NodeStageSecretRef.Namespace = *azureSource.SecretNamespace
|
||||
}
|
||||
|
||||
pv.Spec.PersistentVolumeSource.AzureFile = nil
|
||||
pv.Spec.PersistentVolumeSource.CSI = csiSource
|
||||
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// TranslateCSIPVToInTree takes a PV with CSIPersistentVolumeSource set and
|
||||
// translates the Azure File CSI source to a AzureFile source.
|
||||
func (t *azureFileCSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
if pv == nil || pv.Spec.CSI == nil {
|
||||
return nil, fmt.Errorf("pv is nil or CSI source not defined on pv")
|
||||
}
|
||||
csiSource := pv.Spec.CSI
|
||||
|
||||
// refer to https://github.com/kubernetes-sigs/azurefile-csi-driver/blob/master/docs/driver-parameters.md
|
||||
azureSource := &v1.AzureFilePersistentVolumeSource{
|
||||
ReadOnly: csiSource.ReadOnly,
|
||||
}
|
||||
|
||||
if csiSource.NodeStageSecretRef != nil && csiSource.NodeStageSecretRef.Name != "" {
|
||||
azureSource.SecretName = csiSource.NodeStageSecretRef.Name
|
||||
azureSource.SecretNamespace = &csiSource.NodeStageSecretRef.Namespace
|
||||
if csiSource.VolumeAttributes != nil {
|
||||
if shareName, ok := csiSource.VolumeAttributes[azureFileShareName]; ok {
|
||||
azureSource.ShareName = shareName
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_, storageAccount, fileShareName, _, err := getFileShareInfo(csiSource.VolumeHandle)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
azureSource.ShareName = fileShareName
|
||||
azureSource.SecretName = fmt.Sprintf(secretNameTemplate, storageAccount)
|
||||
}
|
||||
|
||||
pv.Spec.CSI = nil
|
||||
pv.Spec.AzureFile = azureSource
|
||||
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// CanSupport tests whether the plugin supports a given volume
|
||||
// specification from the API. The spec pointer should be considered
|
||||
// const.
|
||||
func (t *azureFileCSITranslator) CanSupport(pv *v1.PersistentVolume) bool {
|
||||
return pv != nil && pv.Spec.AzureFile != nil
|
||||
}
|
||||
|
||||
// CanSupportInline tests whether the plugin supports a given inline volume
|
||||
// specification from the API. The spec pointer should be considered
|
||||
// const.
|
||||
func (t *azureFileCSITranslator) CanSupportInline(volume *v1.Volume) bool {
|
||||
return volume != nil && volume.AzureFile != nil
|
||||
}
|
||||
|
||||
// GetInTreePluginName returns the name of the intree plugin driver
|
||||
func (t *azureFileCSITranslator) GetInTreePluginName() string {
|
||||
return AzureFileInTreePluginName
|
||||
}
|
||||
|
||||
// GetCSIPluginName returns the name of the CSI plugin
|
||||
func (t *azureFileCSITranslator) GetCSIPluginName() string {
|
||||
return AzureFileDriverName
|
||||
}
|
||||
|
||||
func (t *azureFileCSITranslator) RepairVolumeHandle(volumeHandle, nodeID string) (string, error) {
|
||||
return volumeHandle, nil
|
||||
}
|
||||
|
||||
// get file share info according to volume id, e.g.
|
||||
// input: "rg#f5713de20cde511e8ba4900#pvc-file-dynamic-17e43f84-f474-11e8-acd0-000d3a00df41#diskname.vhd"
|
||||
// output: rg, f5713de20cde511e8ba4900, pvc-file-dynamic-17e43f84-f474-11e8-acd0-000d3a00df41, diskname.vhd
|
||||
func getFileShareInfo(id string) (string, string, string, string, error) {
|
||||
segments := strings.Split(id, separator)
|
||||
if len(segments) < 3 {
|
||||
return "", "", "", "", fmt.Errorf("error parsing volume id: %q, should at least contain two #", id)
|
||||
}
|
||||
var diskName string
|
||||
if len(segments) > 3 {
|
||||
diskName = segments[3]
|
||||
}
|
||||
return segments[0], segments[1], segments[2], diskName, nil
|
||||
}
|
||||
|
||||
// get storage account name from secret name
|
||||
func getStorageAccountName(secretName string) (string, error) {
|
||||
matches := secretNameFormatRE.FindStringSubmatch(secretName)
|
||||
if len(matches) != 2 {
|
||||
return "", fmt.Errorf("could not get account name from %s, correct format: %s", secretName, secretNameFormatRE)
|
||||
}
|
||||
return matches[1], nil
|
||||
}
|
392
vendor/k8s.io/csi-translation-lib/plugins/gce_pd.go
generated
vendored
392
vendor/k8s.io/csi-translation-lib/plugins/gce_pd.go
generated
vendored
@ -1,392 +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 plugins
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
cloudvolume "k8s.io/cloud-provider/volume"
|
||||
)
|
||||
|
||||
const (
|
||||
// GCEPDDriverName is the name of the CSI driver for GCE PD
|
||||
GCEPDDriverName = "pd.csi.storage.gke.io"
|
||||
// GCEPDInTreePluginName is the name of the intree plugin for GCE PD
|
||||
GCEPDInTreePluginName = "kubernetes.io/gce-pd"
|
||||
|
||||
// GCEPDTopologyKey is the zonal topology key for GCE PD CSI Driver
|
||||
GCEPDTopologyKey = "topology.gke.io/zone"
|
||||
|
||||
// Volume ID Expected Format
|
||||
// "projects/{projectName}/zones/{zoneName}/disks/{diskName}"
|
||||
volIDZonalFmt = "projects/%s/zones/%s/disks/%s"
|
||||
// "projects/{projectName}/regions/{regionName}/disks/{diskName}"
|
||||
volIDRegionalFmt = "projects/%s/regions/%s/disks/%s"
|
||||
volIDProjectValue = 1
|
||||
volIDRegionalityValue = 2
|
||||
volIDZoneValue = 3
|
||||
volIDDiskNameValue = 5
|
||||
volIDTotalElements = 6
|
||||
|
||||
nodeIDFmt = "projects/%s/zones/%s/instances/%s"
|
||||
|
||||
// UnspecifiedValue is used for an unknown zone string
|
||||
UnspecifiedValue = "UNSPECIFIED"
|
||||
)
|
||||
|
||||
var _ InTreePlugin = &gcePersistentDiskCSITranslator{}
|
||||
|
||||
// gcePersistentDiskCSITranslator handles translation of PV spec from In-tree
|
||||
// GCE PD to CSI GCE PD and vice versa
|
||||
type gcePersistentDiskCSITranslator struct{}
|
||||
|
||||
// NewGCEPersistentDiskCSITranslator returns a new instance of gcePersistentDiskTranslator
|
||||
func NewGCEPersistentDiskCSITranslator() InTreePlugin {
|
||||
return &gcePersistentDiskCSITranslator{}
|
||||
}
|
||||
|
||||
func generateToplogySelectors(key string, values []string) []v1.TopologySelectorTerm {
|
||||
return []v1.TopologySelectorTerm{
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: key,
|
||||
Values: values,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// TranslateInTreeStorageClassParametersToCSI translates InTree GCE storage class parameters to CSI storage class
|
||||
func (g *gcePersistentDiskCSITranslator) TranslateInTreeStorageClassToCSI(sc *storage.StorageClass) (*storage.StorageClass, error) {
|
||||
var generatedTopologies []v1.TopologySelectorTerm
|
||||
|
||||
np := map[string]string{}
|
||||
for k, v := range sc.Parameters {
|
||||
switch strings.ToLower(k) {
|
||||
case fsTypeKey:
|
||||
// prefixed fstype parameter is stripped out by external provisioner
|
||||
np[csiFsTypeKey] = v
|
||||
// Strip out zone and zones parameters and translate them into topologies instead
|
||||
case zoneKey:
|
||||
generatedTopologies = generateToplogySelectors(GCEPDTopologyKey, []string{v})
|
||||
case zonesKey:
|
||||
generatedTopologies = generateToplogySelectors(GCEPDTopologyKey, strings.Split(v, ","))
|
||||
default:
|
||||
np[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
if len(generatedTopologies) > 0 && len(sc.AllowedTopologies) > 0 {
|
||||
return nil, fmt.Errorf("cannot simultaneously set allowed topologies and zone/zones parameters")
|
||||
} else if len(generatedTopologies) > 0 {
|
||||
sc.AllowedTopologies = generatedTopologies
|
||||
} else if len(sc.AllowedTopologies) > 0 {
|
||||
newTopologies, err := translateAllowedTopologies(sc.AllowedTopologies, GCEPDTopologyKey)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed translating allowed topologies: %v", err)
|
||||
}
|
||||
sc.AllowedTopologies = newTopologies
|
||||
}
|
||||
|
||||
sc.Parameters = np
|
||||
|
||||
return sc, nil
|
||||
}
|
||||
|
||||
// backwardCompatibleAccessModes translates all instances of ReadWriteMany
|
||||
// access mode from the in-tree plugin to ReadWriteOnce. This is because in-tree
|
||||
// plugin never supported ReadWriteMany but also did not validate or enforce
|
||||
// this access mode for pre-provisioned volumes. The GCE PD CSI Driver validates
|
||||
// and enforces (fails) ReadWriteMany. Therefore we treat all in-tree
|
||||
// ReadWriteMany as ReadWriteOnce volumes to not break legacy volumes. It also
|
||||
// takes [ReadWriteOnce, ReadOnlyMany] and makes it ReadWriteOnce. This is
|
||||
// because the in-tree plugin does not enforce access modes and just attaches
|
||||
// the disk in ReadWriteOnce mode; however, the CSI external-attacher will fail
|
||||
// this combination because technically [ReadWriteOnce, ReadOnlyMany] is not
|
||||
// supportable on an attached volume
|
||||
// See: https://github.com/kubernetes-csi/external-attacher/issues/153
|
||||
func backwardCompatibleAccessModes(ams []v1.PersistentVolumeAccessMode) []v1.PersistentVolumeAccessMode {
|
||||
if ams == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
s := map[v1.PersistentVolumeAccessMode]bool{}
|
||||
var newAM []v1.PersistentVolumeAccessMode
|
||||
|
||||
for _, am := range ams {
|
||||
if am == v1.ReadWriteMany {
|
||||
// ReadWriteMany is unsupported in CSI, but in-tree did no
|
||||
// validation and treated it as ReadWriteOnce
|
||||
s[v1.ReadWriteOnce] = true
|
||||
} else {
|
||||
s[am] = true
|
||||
}
|
||||
}
|
||||
|
||||
switch {
|
||||
case s[v1.ReadOnlyMany] && s[v1.ReadWriteOnce]:
|
||||
// ROX,RWO is unsupported in CSI, but in-tree did not validation and
|
||||
// treated it as ReadWriteOnce
|
||||
newAM = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}
|
||||
case s[v1.ReadWriteOnce]:
|
||||
newAM = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}
|
||||
case s[v1.ReadOnlyMany]:
|
||||
newAM = []v1.PersistentVolumeAccessMode{v1.ReadOnlyMany}
|
||||
default:
|
||||
newAM = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}
|
||||
}
|
||||
|
||||
return newAM
|
||||
}
|
||||
|
||||
// TranslateInTreeInlineVolumeToCSI takes a Volume with GCEPersistentDisk set from in-tree
|
||||
// and converts the GCEPersistentDisk source to a CSIPersistentVolumeSource
|
||||
func (g *gcePersistentDiskCSITranslator) TranslateInTreeInlineVolumeToCSI(volume *v1.Volume) (*v1.PersistentVolume, error) {
|
||||
if volume == nil || volume.GCEPersistentDisk == nil {
|
||||
return nil, fmt.Errorf("volume is nil or GCE PD not defined on volume")
|
||||
}
|
||||
|
||||
pdSource := volume.GCEPersistentDisk
|
||||
|
||||
partition := ""
|
||||
if pdSource.Partition != 0 {
|
||||
partition = strconv.Itoa(int(pdSource.Partition))
|
||||
}
|
||||
|
||||
var am v1.PersistentVolumeAccessMode
|
||||
if pdSource.ReadOnly {
|
||||
am = v1.ReadOnlyMany
|
||||
} else {
|
||||
am = v1.ReadWriteOnce
|
||||
}
|
||||
|
||||
fsMode := v1.PersistentVolumeFilesystem
|
||||
return &v1.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
// Must be unique per disk as it is used as the unique part of the
|
||||
// staging path
|
||||
Name: fmt.Sprintf("%s-%s", GCEPDDriverName, pdSource.PDName),
|
||||
},
|
||||
Spec: v1.PersistentVolumeSpec{
|
||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||
CSI: &v1.CSIPersistentVolumeSource{
|
||||
Driver: GCEPDDriverName,
|
||||
VolumeHandle: fmt.Sprintf(volIDZonalFmt, UnspecifiedValue, UnspecifiedValue, pdSource.PDName),
|
||||
ReadOnly: pdSource.ReadOnly,
|
||||
FSType: pdSource.FSType,
|
||||
VolumeAttributes: map[string]string{
|
||||
"partition": partition,
|
||||
},
|
||||
},
|
||||
},
|
||||
AccessModes: []v1.PersistentVolumeAccessMode{am},
|
||||
VolumeMode: &fsMode,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// TranslateInTreePVToCSI takes a PV with GCEPersistentDisk set from in-tree
|
||||
// and converts the GCEPersistentDisk source to a CSIPersistentVolumeSource
|
||||
func (g *gcePersistentDiskCSITranslator) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
var volID string
|
||||
|
||||
if pv == nil || pv.Spec.GCEPersistentDisk == nil {
|
||||
return nil, fmt.Errorf("pv is nil or GCE Persistent Disk source not defined on pv")
|
||||
}
|
||||
|
||||
zonesLabel := pv.Labels[v1.LabelZoneFailureDomain]
|
||||
zones := strings.Split(zonesLabel, cloudvolume.LabelMultiZoneDelimiter)
|
||||
if len(zones) == 1 && len(zones[0]) != 0 {
|
||||
// Zonal
|
||||
volID = fmt.Sprintf(volIDZonalFmt, UnspecifiedValue, zones[0], pv.Spec.GCEPersistentDisk.PDName)
|
||||
} else if len(zones) > 1 {
|
||||
// Regional
|
||||
region, err := getRegionFromZones(zones)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get region from zones: %v", err)
|
||||
}
|
||||
volID = fmt.Sprintf(volIDZonalFmt, UnspecifiedValue, region, pv.Spec.GCEPersistentDisk.PDName)
|
||||
} else {
|
||||
// Unspecified
|
||||
volID = fmt.Sprintf(volIDZonalFmt, UnspecifiedValue, UnspecifiedValue, pv.Spec.GCEPersistentDisk.PDName)
|
||||
}
|
||||
|
||||
gceSource := pv.Spec.PersistentVolumeSource.GCEPersistentDisk
|
||||
|
||||
partition := ""
|
||||
if gceSource.Partition != 0 {
|
||||
partition = strconv.Itoa(int(gceSource.Partition))
|
||||
}
|
||||
|
||||
csiSource := &v1.CSIPersistentVolumeSource{
|
||||
Driver: GCEPDDriverName,
|
||||
VolumeHandle: volID,
|
||||
ReadOnly: gceSource.ReadOnly,
|
||||
FSType: gceSource.FSType,
|
||||
VolumeAttributes: map[string]string{
|
||||
"partition": partition,
|
||||
},
|
||||
}
|
||||
|
||||
if err := translateTopology(pv, GCEPDTopologyKey); err != nil {
|
||||
return nil, fmt.Errorf("failed to translate topology: %v", err)
|
||||
}
|
||||
|
||||
pv.Spec.PersistentVolumeSource.GCEPersistentDisk = nil
|
||||
pv.Spec.PersistentVolumeSource.CSI = csiSource
|
||||
pv.Spec.AccessModes = backwardCompatibleAccessModes(pv.Spec.AccessModes)
|
||||
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// TranslateCSIPVToInTree takes a PV with CSIPersistentVolumeSource set and
|
||||
// translates the GCE PD CSI source to a GCEPersistentDisk source.
|
||||
func (g *gcePersistentDiskCSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
if pv == nil || pv.Spec.CSI == nil {
|
||||
return nil, fmt.Errorf("pv is nil or CSI source not defined on pv")
|
||||
}
|
||||
csiSource := pv.Spec.CSI
|
||||
|
||||
pdName, err := pdNameFromVolumeID(csiSource.VolumeHandle)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
gceSource := &v1.GCEPersistentDiskVolumeSource{
|
||||
PDName: pdName,
|
||||
FSType: csiSource.FSType,
|
||||
ReadOnly: csiSource.ReadOnly,
|
||||
}
|
||||
if partition, ok := csiSource.VolumeAttributes["partition"]; ok && partition != "" {
|
||||
partInt, err := strconv.Atoi(partition)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to convert partition %v to integer: %v", partition, err)
|
||||
}
|
||||
gceSource.Partition = int32(partInt)
|
||||
}
|
||||
|
||||
// TODO: Take the zone/regional information and stick it into the label.
|
||||
|
||||
pv.Spec.CSI = nil
|
||||
pv.Spec.GCEPersistentDisk = gceSource
|
||||
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// CanSupport tests whether the plugin supports a given persistent volume
|
||||
// specification from the API. The spec pointer should be considered
|
||||
// const.
|
||||
func (g *gcePersistentDiskCSITranslator) CanSupport(pv *v1.PersistentVolume) bool {
|
||||
return pv != nil && pv.Spec.GCEPersistentDisk != nil
|
||||
}
|
||||
|
||||
// CanSupportInline tests whether the plugin supports a given inline volume
|
||||
// specification from the API. The spec pointer should be considered
|
||||
// const.
|
||||
func (g *gcePersistentDiskCSITranslator) CanSupportInline(volume *v1.Volume) bool {
|
||||
return volume != nil && volume.GCEPersistentDisk != nil
|
||||
}
|
||||
|
||||
// GetInTreePluginName returns the name of the intree plugin driver
|
||||
func (g *gcePersistentDiskCSITranslator) GetInTreePluginName() string {
|
||||
return GCEPDInTreePluginName
|
||||
}
|
||||
|
||||
// GetCSIPluginName returns the name of the CSI plugin
|
||||
func (g *gcePersistentDiskCSITranslator) GetCSIPluginName() string {
|
||||
return GCEPDDriverName
|
||||
}
|
||||
|
||||
// RepairVolumeHandle returns a fully specified volume handle by inferring
|
||||
// project, zone/region from the node ID if the volume handle has UNSPECIFIED
|
||||
// sections
|
||||
func (g *gcePersistentDiskCSITranslator) RepairVolumeHandle(volumeHandle, nodeID string) (string, error) {
|
||||
var err error
|
||||
tok := strings.Split(volumeHandle, "/")
|
||||
if len(tok) < volIDTotalElements {
|
||||
return "", fmt.Errorf("volume handle has wrong number of elements; got %v, wanted %v or more", len(tok), volIDTotalElements)
|
||||
}
|
||||
if tok[volIDProjectValue] != UnspecifiedValue {
|
||||
return volumeHandle, nil
|
||||
}
|
||||
|
||||
nodeTok := strings.Split(nodeID, "/")
|
||||
if len(nodeTok) < volIDTotalElements {
|
||||
return "", fmt.Errorf("node handle has wrong number of elements; got %v, wanted %v or more", len(nodeTok), volIDTotalElements)
|
||||
}
|
||||
|
||||
switch tok[volIDRegionalityValue] {
|
||||
case "zones":
|
||||
zone := ""
|
||||
if tok[volIDZoneValue] == UnspecifiedValue {
|
||||
zone = nodeTok[volIDZoneValue]
|
||||
} else {
|
||||
zone = tok[volIDZoneValue]
|
||||
}
|
||||
return fmt.Sprintf(volIDZonalFmt, nodeTok[volIDProjectValue], zone, tok[volIDDiskNameValue]), nil
|
||||
case "regions":
|
||||
region := ""
|
||||
if tok[volIDZoneValue] == UnspecifiedValue {
|
||||
region, err = getRegionFromZones([]string{nodeTok[volIDZoneValue]})
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to get region from zone %s: %v", nodeTok[volIDZoneValue], err)
|
||||
}
|
||||
} else {
|
||||
region = tok[volIDZoneValue]
|
||||
}
|
||||
return fmt.Sprintf(volIDRegionalFmt, nodeTok[volIDProjectValue], region, tok[volIDDiskNameValue]), nil
|
||||
default:
|
||||
return "", fmt.Errorf("expected volume handle to have zones or regions regionality value, got: %s", tok[volIDRegionalityValue])
|
||||
}
|
||||
}
|
||||
|
||||
func pdNameFromVolumeID(id string) (string, error) {
|
||||
splitID := strings.Split(id, "/")
|
||||
if len(splitID) < volIDTotalElements {
|
||||
return "", fmt.Errorf("failed to get id components.Got: %v, wanted %v components or more. ", len(splitID), volIDTotalElements)
|
||||
}
|
||||
return splitID[volIDDiskNameValue], nil
|
||||
}
|
||||
|
||||
// TODO: Replace this with the imported one from GCE PD CSI Driver when
|
||||
// the driver removes all k8s/k8s dependencies
|
||||
func getRegionFromZones(zones []string) (string, error) {
|
||||
regions := sets.String{}
|
||||
if len(zones) < 1 {
|
||||
return "", fmt.Errorf("no zones specified")
|
||||
}
|
||||
for _, zone := range zones {
|
||||
// Zone expected format {locale}-{region}-{zone}
|
||||
splitZone := strings.Split(zone, "-")
|
||||
if len(splitZone) != 3 {
|
||||
return "", fmt.Errorf("zone in unexpected format, expected: {locale}-{region}-{zone}, got: %v", zone)
|
||||
}
|
||||
regions.Insert(strings.Join(splitZone[0:2], "-"))
|
||||
}
|
||||
if regions.Len() != 1 {
|
||||
return "", fmt.Errorf("multiple or no regions gotten from zones, got: %v", regions)
|
||||
}
|
||||
return regions.UnsortedList()[0], nil
|
||||
}
|
196
vendor/k8s.io/csi-translation-lib/plugins/in_tree_volume.go
generated
vendored
196
vendor/k8s.io/csi-translation-lib/plugins/in_tree_volume.go
generated
vendored
@ -1,196 +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 plugins
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
cloudvolume "k8s.io/cloud-provider/volume"
|
||||
)
|
||||
|
||||
// InTreePlugin handles translations between CSI and in-tree sources in a PV
|
||||
type InTreePlugin interface {
|
||||
|
||||
// TranslateInTreeStorageClassToCSI takes in-tree volume options
|
||||
// and translates them to a volume options consumable by CSI plugin
|
||||
TranslateInTreeStorageClassToCSI(sc *storage.StorageClass) (*storage.StorageClass, error)
|
||||
|
||||
// TranslateInTreeInlineVolumeToCSI takes a inline volume and will translate
|
||||
// the in-tree inline volume source to a CSIPersistentVolumeSource
|
||||
// A PV object containing the CSIPersistentVolumeSource in it's spec is returned
|
||||
TranslateInTreeInlineVolumeToCSI(volume *v1.Volume) (*v1.PersistentVolume, error)
|
||||
|
||||
// TranslateInTreePVToCSI takes a persistent volume and will translate
|
||||
// the in-tree pv source to a CSI Source. The input persistent volume can be modified
|
||||
TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error)
|
||||
|
||||
// TranslateCSIPVToInTree takes a PV with a CSI PersistentVolume Source and will translate
|
||||
// it to a in-tree Persistent Volume Source for the in-tree volume
|
||||
// by the `Driver` field in the CSI Source. The input PV object can be modified
|
||||
TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error)
|
||||
|
||||
// CanSupport tests whether the plugin supports a given persistent volume
|
||||
// specification from the API.
|
||||
CanSupport(pv *v1.PersistentVolume) bool
|
||||
|
||||
// CanSupportInline tests whether the plugin supports a given inline volume
|
||||
// specification from the API.
|
||||
CanSupportInline(vol *v1.Volume) bool
|
||||
|
||||
// GetInTreePluginName returns the in-tree plugin name this migrates
|
||||
GetInTreePluginName() string
|
||||
|
||||
// GetCSIPluginName returns the name of the CSI plugin that supersedes the in-tree plugin
|
||||
GetCSIPluginName() string
|
||||
|
||||
// RepairVolumeHandle generates a correct volume handle based on node ID information.
|
||||
RepairVolumeHandle(volumeHandle, nodeID string) (string, error)
|
||||
}
|
||||
|
||||
const (
|
||||
// fsTypeKey is the deprecated storage class parameter key for fstype
|
||||
fsTypeKey = "fstype"
|
||||
// csiFsTypeKey is the storage class parameter key for CSI fstype
|
||||
csiFsTypeKey = "csi.storage.k8s.io/fstype"
|
||||
// zoneKey is the deprecated storage class parameter key for zone
|
||||
zoneKey = "zone"
|
||||
// zonesKey is the deprecated storage class parameter key for zones
|
||||
zonesKey = "zones"
|
||||
)
|
||||
|
||||
// replaceTopology overwrites an existing topology key by a new one.
|
||||
func replaceTopology(pv *v1.PersistentVolume, oldKey, newKey string) error {
|
||||
for i := range pv.Spec.NodeAffinity.Required.NodeSelectorTerms {
|
||||
for j, r := range pv.Spec.NodeAffinity.Required.NodeSelectorTerms[i].MatchExpressions {
|
||||
if r.Key == oldKey {
|
||||
pv.Spec.NodeAffinity.Required.NodeSelectorTerms[i].MatchExpressions[j].Key = newKey
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// getTopologyZones returns all topology zones with the given key found in the PV.
|
||||
func getTopologyZones(pv *v1.PersistentVolume, key string) []string {
|
||||
if pv.Spec.NodeAffinity == nil ||
|
||||
pv.Spec.NodeAffinity.Required == nil ||
|
||||
len(pv.Spec.NodeAffinity.Required.NodeSelectorTerms) < 1 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var values []string
|
||||
for i := range pv.Spec.NodeAffinity.Required.NodeSelectorTerms {
|
||||
for _, r := range pv.Spec.NodeAffinity.Required.NodeSelectorTerms[i].MatchExpressions {
|
||||
if r.Key == key {
|
||||
values = append(values, r.Values...)
|
||||
}
|
||||
}
|
||||
}
|
||||
return values
|
||||
}
|
||||
|
||||
// addTopology appends the topology to the given PV.
|
||||
func addTopology(pv *v1.PersistentVolume, topologyKey string, zones []string) error {
|
||||
// Make sure there are no duplicate or empty strings
|
||||
filteredZones := sets.String{}
|
||||
for i := range zones {
|
||||
zone := strings.TrimSpace(zones[i])
|
||||
if len(zone) > 0 {
|
||||
filteredZones.Insert(zone)
|
||||
}
|
||||
}
|
||||
|
||||
zones = filteredZones.List()
|
||||
if len(zones) < 1 {
|
||||
return errors.New("there are no valid zones to add to pv")
|
||||
}
|
||||
|
||||
// Make sure the necessary fields exist
|
||||
pv.Spec.NodeAffinity = new(v1.VolumeNodeAffinity)
|
||||
pv.Spec.NodeAffinity.Required = new(v1.NodeSelector)
|
||||
pv.Spec.NodeAffinity.Required.NodeSelectorTerms = make([]v1.NodeSelectorTerm, 1)
|
||||
|
||||
topology := v1.NodeSelectorRequirement{
|
||||
Key: topologyKey,
|
||||
Operator: v1.NodeSelectorOpIn,
|
||||
Values: zones,
|
||||
}
|
||||
|
||||
pv.Spec.NodeAffinity.Required.NodeSelectorTerms[0].MatchExpressions = append(
|
||||
pv.Spec.NodeAffinity.Required.NodeSelectorTerms[0].MatchExpressions,
|
||||
topology,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// translateTopology converts existing zone labels or in-tree topology to CSI topology.
|
||||
// In-tree topology has precedence over zone labels.
|
||||
func translateTopology(pv *v1.PersistentVolume, topologyKey string) error {
|
||||
// If topology is already set, assume the content is accurate
|
||||
if len(getTopologyZones(pv, topologyKey)) > 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
zones := getTopologyZones(pv, v1.LabelZoneFailureDomain)
|
||||
if len(zones) > 0 {
|
||||
return replaceTopology(pv, v1.LabelZoneFailureDomain, topologyKey)
|
||||
}
|
||||
|
||||
if label, ok := pv.Labels[v1.LabelZoneFailureDomain]; ok {
|
||||
zones = strings.Split(label, cloudvolume.LabelMultiZoneDelimiter)
|
||||
if len(zones) > 0 {
|
||||
return addTopology(pv, topologyKey, zones)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// translateAllowedTopologies translates allowed topologies within storage class
|
||||
// from legacy failure domain to given CSI topology key
|
||||
func translateAllowedTopologies(terms []v1.TopologySelectorTerm, key string) ([]v1.TopologySelectorTerm, error) {
|
||||
if terms == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
newTopologies := []v1.TopologySelectorTerm{}
|
||||
for _, term := range terms {
|
||||
newTerm := v1.TopologySelectorTerm{}
|
||||
for _, exp := range term.MatchLabelExpressions {
|
||||
var newExp v1.TopologySelectorLabelRequirement
|
||||
if exp.Key == v1.LabelZoneFailureDomain {
|
||||
newExp = v1.TopologySelectorLabelRequirement{
|
||||
Key: key,
|
||||
Values: exp.Values,
|
||||
}
|
||||
} else if exp.Key == key {
|
||||
newExp = exp
|
||||
} else {
|
||||
return nil, fmt.Errorf("unknown topology key: %v", exp.Key)
|
||||
}
|
||||
newTerm.MatchLabelExpressions = append(newTerm.MatchLabelExpressions, newExp)
|
||||
}
|
||||
newTopologies = append(newTopologies, newTerm)
|
||||
}
|
||||
return newTopologies, nil
|
||||
}
|
153
vendor/k8s.io/csi-translation-lib/plugins/openstack_cinder.go
generated
vendored
153
vendor/k8s.io/csi-translation-lib/plugins/openstack_cinder.go
generated
vendored
@ -1,153 +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 plugins
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
// CinderDriverName is the name of the CSI driver for Cinder
|
||||
CinderDriverName = "cinder.csi.openstack.org"
|
||||
// CinderTopologyKey is the zonal topology key for Cinder CSI Driver
|
||||
CinderTopologyKey = "topology.cinder.csi.openstack.org/zone"
|
||||
// CinderInTreePluginName is the name of the intree plugin for Cinder
|
||||
CinderInTreePluginName = "kubernetes.io/cinder"
|
||||
)
|
||||
|
||||
var _ InTreePlugin = (*osCinderCSITranslator)(nil)
|
||||
|
||||
// osCinderCSITranslator handles translation of PV spec from In-tree Cinder to CSI Cinder and vice versa
|
||||
type osCinderCSITranslator struct{}
|
||||
|
||||
// NewOpenStackCinderCSITranslator returns a new instance of osCinderCSITranslator
|
||||
func NewOpenStackCinderCSITranslator() InTreePlugin {
|
||||
return &osCinderCSITranslator{}
|
||||
}
|
||||
|
||||
// TranslateInTreeStorageClassParametersToCSI translates InTree Cinder storage class parameters to CSI storage class
|
||||
func (t *osCinderCSITranslator) TranslateInTreeStorageClassToCSI(sc *storage.StorageClass) (*storage.StorageClass, error) {
|
||||
return sc, nil
|
||||
}
|
||||
|
||||
// TranslateInTreeInlineVolumeToCSI takes a Volume with Cinder set from in-tree
|
||||
// and converts the Cinder source to a CSIPersistentVolumeSource
|
||||
func (t *osCinderCSITranslator) TranslateInTreeInlineVolumeToCSI(volume *v1.Volume) (*v1.PersistentVolume, error) {
|
||||
if volume == nil || volume.Cinder == nil {
|
||||
return nil, fmt.Errorf("volume is nil or Cinder not defined on volume")
|
||||
}
|
||||
|
||||
cinderSource := volume.Cinder
|
||||
pv := &v1.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
// Must be unique per disk as it is used as the unique part of the
|
||||
// staging path
|
||||
Name: fmt.Sprintf("%s-%s", CinderDriverName, cinderSource.VolumeID),
|
||||
},
|
||||
Spec: v1.PersistentVolumeSpec{
|
||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||
CSI: &v1.CSIPersistentVolumeSource{
|
||||
Driver: CinderDriverName,
|
||||
VolumeHandle: cinderSource.VolumeID,
|
||||
ReadOnly: cinderSource.ReadOnly,
|
||||
FSType: cinderSource.FSType,
|
||||
VolumeAttributes: map[string]string{},
|
||||
},
|
||||
},
|
||||
AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce},
|
||||
},
|
||||
}
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// TranslateInTreePVToCSI takes a PV with Cinder set from in-tree
|
||||
// and converts the Cinder source to a CSIPersistentVolumeSource
|
||||
func (t *osCinderCSITranslator) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
if pv == nil || pv.Spec.Cinder == nil {
|
||||
return nil, fmt.Errorf("pv is nil or Cinder not defined on pv")
|
||||
}
|
||||
|
||||
cinderSource := pv.Spec.Cinder
|
||||
|
||||
csiSource := &v1.CSIPersistentVolumeSource{
|
||||
Driver: CinderDriverName,
|
||||
VolumeHandle: cinderSource.VolumeID,
|
||||
ReadOnly: cinderSource.ReadOnly,
|
||||
FSType: cinderSource.FSType,
|
||||
VolumeAttributes: map[string]string{},
|
||||
}
|
||||
|
||||
if err := translateTopology(pv, CinderTopologyKey); err != nil {
|
||||
return nil, fmt.Errorf("failed to translate topology: %v", err)
|
||||
}
|
||||
|
||||
pv.Spec.Cinder = nil
|
||||
pv.Spec.CSI = csiSource
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// TranslateCSIPVToInTree takes a PV with CSIPersistentVolumeSource set and
|
||||
// translates the Cinder CSI source to a Cinder In-tree source.
|
||||
func (t *osCinderCSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
if pv == nil || pv.Spec.CSI == nil {
|
||||
return nil, fmt.Errorf("pv is nil or CSI source not defined on pv")
|
||||
}
|
||||
|
||||
csiSource := pv.Spec.CSI
|
||||
|
||||
cinderSource := &v1.CinderPersistentVolumeSource{
|
||||
VolumeID: csiSource.VolumeHandle,
|
||||
FSType: csiSource.FSType,
|
||||
ReadOnly: csiSource.ReadOnly,
|
||||
}
|
||||
|
||||
pv.Spec.CSI = nil
|
||||
pv.Spec.Cinder = cinderSource
|
||||
return pv, nil
|
||||
}
|
||||
|
||||
// CanSupport tests whether the plugin supports a given persistent volume
|
||||
// specification from the API. The spec pointer should be considered
|
||||
// const.
|
||||
func (t *osCinderCSITranslator) CanSupport(pv *v1.PersistentVolume) bool {
|
||||
return pv != nil && pv.Spec.Cinder != nil
|
||||
}
|
||||
|
||||
// CanSupportInline tests whether the plugin supports a given inline volume
|
||||
// specification from the API. The spec pointer should be considered
|
||||
// const.
|
||||
func (t *osCinderCSITranslator) CanSupportInline(volume *v1.Volume) bool {
|
||||
return volume != nil && volume.Cinder != nil
|
||||
}
|
||||
|
||||
// GetInTreePluginName returns the name of the intree plugin driver
|
||||
func (t *osCinderCSITranslator) GetInTreePluginName() string {
|
||||
return CinderInTreePluginName
|
||||
}
|
||||
|
||||
// GetCSIPluginName returns the name of the CSI plugin
|
||||
func (t *osCinderCSITranslator) GetCSIPluginName() string {
|
||||
return CinderDriverName
|
||||
}
|
||||
|
||||
func (t *osCinderCSITranslator) RepairVolumeHandle(volumeHandle, nodeID string) (string, error) {
|
||||
return volumeHandle, nil
|
||||
}
|
209
vendor/k8s.io/csi-translation-lib/translate.go
generated
vendored
209
vendor/k8s.io/csi-translation-lib/translate.go
generated
vendored
@ -1,209 +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 csitranslation
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
"k8s.io/csi-translation-lib/plugins"
|
||||
)
|
||||
|
||||
var (
|
||||
inTreePlugins = map[string]plugins.InTreePlugin{
|
||||
plugins.GCEPDDriverName: plugins.NewGCEPersistentDiskCSITranslator(),
|
||||
plugins.AWSEBSDriverName: plugins.NewAWSElasticBlockStoreCSITranslator(),
|
||||
plugins.CinderDriverName: plugins.NewOpenStackCinderCSITranslator(),
|
||||
plugins.AzureDiskDriverName: plugins.NewAzureDiskCSITranslator(),
|
||||
plugins.AzureFileDriverName: plugins.NewAzureFileCSITranslator(),
|
||||
}
|
||||
)
|
||||
|
||||
// CSITranslator translates in-tree storage API objects to their equivalent CSI
|
||||
// API objects. It also provides many helper functions to determine whether
|
||||
// translation logic exists and the mappings between "in-tree plugin <-> csi driver"
|
||||
type CSITranslator struct{}
|
||||
|
||||
// New creates a new CSITranslator which does real translation
|
||||
// for "in-tree plugins <-> csi drivers"
|
||||
func New() CSITranslator {
|
||||
return CSITranslator{}
|
||||
}
|
||||
|
||||
// TranslateInTreeStorageClassToCSI takes in-tree Storage Class
|
||||
// and translates it to a set of parameters consumable by CSI plugin
|
||||
func (CSITranslator) TranslateInTreeStorageClassToCSI(inTreePluginName string, sc *storage.StorageClass) (*storage.StorageClass, error) {
|
||||
newSC := sc.DeepCopy()
|
||||
for _, curPlugin := range inTreePlugins {
|
||||
if inTreePluginName == curPlugin.GetInTreePluginName() {
|
||||
return curPlugin.TranslateInTreeStorageClassToCSI(newSC)
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("could not find in-tree storage class parameter translation logic for %#v", inTreePluginName)
|
||||
}
|
||||
|
||||
// TranslateInTreeInlineVolumeToCSI takes a inline volume and will translate
|
||||
// the in-tree volume source to a CSIPersistentVolumeSource (wrapped in a PV)
|
||||
// if the translation logic has been implemented.
|
||||
func (CSITranslator) TranslateInTreeInlineVolumeToCSI(volume *v1.Volume) (*v1.PersistentVolume, error) {
|
||||
if volume == nil {
|
||||
return nil, fmt.Errorf("persistent volume was nil")
|
||||
}
|
||||
for _, curPlugin := range inTreePlugins {
|
||||
if curPlugin.CanSupportInline(volume) {
|
||||
pv, err := curPlugin.TranslateInTreeInlineVolumeToCSI(volume)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Inline volumes only support PersistentVolumeFilesystem (and not block).
|
||||
// If VolumeMode has not been set explicitly by plugin-specific
|
||||
// translator, set it to Filesystem here.
|
||||
// This is only necessary for inline volumes as the default PV
|
||||
// initialization that populates VolumeMode does not apply to inline volumes.
|
||||
if pv.Spec.VolumeMode == nil {
|
||||
volumeMode := v1.PersistentVolumeFilesystem
|
||||
pv.Spec.VolumeMode = &volumeMode
|
||||
}
|
||||
return pv, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("could not find in-tree plugin translation logic for %#v", volume.Name)
|
||||
}
|
||||
|
||||
// TranslateInTreePVToCSI takes a persistent volume and will translate
|
||||
// the in-tree source to a CSI Source if the translation logic
|
||||
// has been implemented. The input persistent volume will not
|
||||
// be modified
|
||||
func (CSITranslator) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
if pv == nil {
|
||||
return nil, errors.New("persistent volume was nil")
|
||||
}
|
||||
copiedPV := pv.DeepCopy()
|
||||
for _, curPlugin := range inTreePlugins {
|
||||
if curPlugin.CanSupport(copiedPV) {
|
||||
return curPlugin.TranslateInTreePVToCSI(copiedPV)
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("could not find in-tree plugin translation logic for %#v", copiedPV.Name)
|
||||
}
|
||||
|
||||
// TranslateCSIPVToInTree takes a PV with a CSI PersistentVolume Source and will translate
|
||||
// it to a in-tree Persistent Volume Source for the specific in-tree volume specified
|
||||
// by the `Driver` field in the CSI Source. The input PV object will not be modified.
|
||||
func (CSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||
if pv == nil || pv.Spec.CSI == nil {
|
||||
return nil, errors.New("CSI persistent volume was nil")
|
||||
}
|
||||
copiedPV := pv.DeepCopy()
|
||||
for driverName, curPlugin := range inTreePlugins {
|
||||
if copiedPV.Spec.CSI.Driver == driverName {
|
||||
return curPlugin.TranslateCSIPVToInTree(copiedPV)
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("could not find in-tree plugin translation logic for %s", copiedPV.Spec.CSI.Driver)
|
||||
}
|
||||
|
||||
// IsMigratableIntreePluginByName tests whether there is migration logic for the in-tree plugin
|
||||
// whose name matches the given name
|
||||
func (CSITranslator) IsMigratableIntreePluginByName(inTreePluginName string) bool {
|
||||
for _, curPlugin := range inTreePlugins {
|
||||
if curPlugin.GetInTreePluginName() == inTreePluginName {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsMigratedCSIDriverByName tests whether there exists an in-tree plugin with logic
|
||||
// to migrate to the CSI driver with given name
|
||||
func (CSITranslator) IsMigratedCSIDriverByName(csiPluginName string) bool {
|
||||
if _, ok := inTreePlugins[csiPluginName]; ok {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetInTreePluginNameFromSpec returns the plugin name
|
||||
func (CSITranslator) GetInTreePluginNameFromSpec(pv *v1.PersistentVolume, vol *v1.Volume) (string, error) {
|
||||
if pv != nil {
|
||||
for _, curPlugin := range inTreePlugins {
|
||||
if curPlugin.CanSupport(pv) {
|
||||
return curPlugin.GetInTreePluginName(), nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("could not find in-tree plugin name from persistent volume %v", pv)
|
||||
} else if vol != nil {
|
||||
for _, curPlugin := range inTreePlugins {
|
||||
if curPlugin.CanSupportInline(vol) {
|
||||
return curPlugin.GetInTreePluginName(), nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("could not find in-tree plugin name from volume %v", vol)
|
||||
} else {
|
||||
return "", errors.New("both persistent volume and volume are nil")
|
||||
}
|
||||
}
|
||||
|
||||
// GetCSINameFromInTreeName returns the name of a CSI driver that supersedes the
|
||||
// in-tree plugin with the given name
|
||||
func (CSITranslator) GetCSINameFromInTreeName(pluginName string) (string, error) {
|
||||
for csiDriverName, curPlugin := range inTreePlugins {
|
||||
if curPlugin.GetInTreePluginName() == pluginName {
|
||||
return csiDriverName, nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("could not find CSI Driver name for plugin %v", pluginName)
|
||||
}
|
||||
|
||||
// GetInTreeNameFromCSIName returns the name of the in-tree plugin superseded by
|
||||
// a CSI driver with the given name
|
||||
func (CSITranslator) GetInTreeNameFromCSIName(pluginName string) (string, error) {
|
||||
if plugin, ok := inTreePlugins[pluginName]; ok {
|
||||
return plugin.GetInTreePluginName(), nil
|
||||
}
|
||||
return "", fmt.Errorf("could not find In-Tree driver name for CSI plugin %v", pluginName)
|
||||
}
|
||||
|
||||
// IsPVMigratable tests whether there is migration logic for the given Persistent Volume
|
||||
func (CSITranslator) IsPVMigratable(pv *v1.PersistentVolume) bool {
|
||||
for _, curPlugin := range inTreePlugins {
|
||||
if curPlugin.CanSupport(pv) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsInlineMigratable tests whether there is Migration logic for the given Inline Volume
|
||||
func (CSITranslator) IsInlineMigratable(vol *v1.Volume) bool {
|
||||
for _, curPlugin := range inTreePlugins {
|
||||
if curPlugin.CanSupportInline(vol) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// RepairVolumeHandle generates a correct volume handle based on node ID information.
|
||||
func (CSITranslator) RepairVolumeHandle(driverName, volumeHandle, nodeID string) (string, error) {
|
||||
if plugin, ok := inTreePlugins[driverName]; ok {
|
||||
return plugin.RepairVolumeHandle(volumeHandle, nodeID)
|
||||
}
|
||||
return "", fmt.Errorf("could not find In-Tree driver name for CSI plugin %v", driverName)
|
||||
}
|
Reference in New Issue
Block a user