Addition of ScaleIO Kubernetes Volume Plugin

This commits implements the Kubernetes volume plugin allowing pods to seamlessly access and use data stored on ScaleIO volumes.
pull/6/head
Vladimir Vivien 2016-11-19 15:46:23 -05:00
parent a2c7eb2754
commit 915a54180d
96 changed files with 18739 additions and 3319 deletions

8
Godeps/Godeps.json generated
View File

@ -401,6 +401,14 @@
"ImportPath": "github.com/clusterhq/flocker-go",
"Rev": "2b8b7259d3139c96c4a6871031355808ab3fd3b3"
},
{
"ImportPath": "github.com/codedellemc/goscaleio",
"Rev": "8ed64a07d23f79bab973f1630651841ccc656887"
},
{
"ImportPath": "github.com/codedellemc/goscaleio/types/v1",
"Rev": "8ed64a07d23f79bab973f1630651841ccc656887"
},
{
"ImportPath": "github.com/codegangsta/negroni",
"Comment": "v0.1.0-62-g8d75e11",

420
Godeps/LICENSES generated
View File

@ -11475,6 +11475,426 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================================================
================================================================================
= vendor/github.com/codedellemc/goscaleio licensed under: =
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.
= vendor/github.com/codedellemc/goscaleio/LICENSE d2794c0df5b907fdace235a619d80314 -
================================================================================
================================================================================
= vendor/github.com/codedellemc/goscaleio/types/v1 licensed under: =
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.
= vendor/github.com/codedellemc/goscaleio/LICENSE d2794c0df5b907fdace235a619d80314 -
================================================================================
================================================================================
= vendor/github.com/codegangsta/negroni licensed under: =

View File

@ -40590,6 +40590,10 @@
"description": "RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.RBDVolumeSource"
},
"scaleIO": {
"description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.ScaleIOVolumeSource"
},
"storageClassName": {
"description": "Name of StorageClass to which this persistent volume belongs. Empty value means that this volume does not belong to any StorageClass.",
"type": "string"
@ -41567,6 +41571,56 @@
}
}
},
"io.k8s.kubernetes.pkg.api.v1.ScaleIOVolumeSource": {
"description": "ScaleIOVolumeSource represents a persistent ScaleIO volume",
"required": [
"gateway",
"system",
"secretRef"
],
"properties": {
"fsType": {
"description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
"type": "string"
},
"gateway": {
"description": "The host address of the ScaleIO API Gateway.",
"type": "string"
},
"protectionDomain": {
"description": "The name of the Protection Domain for the configured storage (defaults to \"default\").",
"type": "string"
},
"readOnly": {
"description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
"type": "boolean"
},
"secretRef": {
"description": "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.LocalObjectReference"
},
"sslEnabled": {
"description": "Flag to enable/disable SSL communication with Gateway, default false",
"type": "boolean"
},
"storageMode": {
"description": "Indicates whether the storage for a volume should be thick or thin (defaults to \"thin\").",
"type": "string"
},
"storagePool": {
"description": "The Storage Pool associated with the protection domain (defaults to \"default\").",
"type": "string"
},
"system": {
"description": "The name of the storage system as configured in ScaleIO.",
"type": "string"
},
"volumeName": {
"description": "The name of a volume already created in the ScaleIO system that is associated with this volume source.",
"type": "string"
}
}
},
"io.k8s.kubernetes.pkg.api.v1.Secret": {
"description": "Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.",
"properties": {
@ -42158,6 +42212,10 @@
"description": "RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.RBDVolumeSource"
},
"scaleIO": {
"description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.ScaleIOVolumeSource"
},
"secret": {
"description": "Secret represents a secret that should populate this volume. More info: http://kubernetes.io/docs/user-guide/volumes#secrets",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.SecretVolumeSource"

View File

@ -2722,6 +2722,10 @@
"portworxVolume": {
"$ref": "v1.PortworxVolumeSource",
"description": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine"
},
"scaleIO": {
"$ref": "v1.ScaleIOVolumeSource",
"description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes."
}
}
},
@ -3502,6 +3506,57 @@
}
}
},
"v1.ScaleIOVolumeSource": {
"id": "v1.ScaleIOVolumeSource",
"description": "ScaleIOVolumeSource represents a persistent ScaleIO volume",
"required": [
"gateway",
"system",
"secretRef"
],
"properties": {
"gateway": {
"type": "string",
"description": "The host address of the ScaleIO API Gateway."
},
"system": {
"type": "string",
"description": "The name of the storage system as configured in ScaleIO."
},
"secretRef": {
"$ref": "v1.LocalObjectReference",
"description": "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail."
},
"sslEnabled": {
"type": "boolean",
"description": "Flag to enable/disable SSL communication with Gateway, default false"
},
"protectionDomain": {
"type": "string",
"description": "The name of the Protection Domain for the configured storage (defaults to \"default\")."
},
"storagePool": {
"type": "string",
"description": "The Storage Pool associated with the protection domain (defaults to \"default\")."
},
"storageMode": {
"type": "string",
"description": "Indicates whether the storage for a volume should be thick or thin (defaults to \"thin\")."
},
"volumeName": {
"type": "string",
"description": "The name of a volume already created in the ScaleIO system that is associated with this volume source."
},
"fsType": {
"type": "string",
"description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified."
},
"readOnly": {
"type": "boolean",
"description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
}
}
},
"v1.Container": {
"id": "v1.Container",
"description": "A single application container that you want to run within a pod.",

View File

@ -1505,6 +1505,10 @@
"portworxVolume": {
"$ref": "v1.PortworxVolumeSource",
"description": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine"
},
"scaleIO": {
"$ref": "v1.ScaleIOVolumeSource",
"description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes."
}
}
},
@ -2285,6 +2289,57 @@
}
}
},
"v1.ScaleIOVolumeSource": {
"id": "v1.ScaleIOVolumeSource",
"description": "ScaleIOVolumeSource represents a persistent ScaleIO volume",
"required": [
"gateway",
"system",
"secretRef"
],
"properties": {
"gateway": {
"type": "string",
"description": "The host address of the ScaleIO API Gateway."
},
"system": {
"type": "string",
"description": "The name of the storage system as configured in ScaleIO."
},
"secretRef": {
"$ref": "v1.LocalObjectReference",
"description": "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail."
},
"sslEnabled": {
"type": "boolean",
"description": "Flag to enable/disable SSL communication with Gateway, default false"
},
"protectionDomain": {
"type": "string",
"description": "The name of the Protection Domain for the configured storage (defaults to \"default\")."
},
"storagePool": {
"type": "string",
"description": "The Storage Pool associated with the protection domain (defaults to \"default\")."
},
"storageMode": {
"type": "string",
"description": "Indicates whether the storage for a volume should be thick or thin (defaults to \"thin\")."
},
"volumeName": {
"type": "string",
"description": "The name of a volume already created in the ScaleIO system that is associated with this volume source."
},
"fsType": {
"type": "string",
"description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified."
},
"readOnly": {
"type": "boolean",
"description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
}
}
},
"v1.Container": {
"id": "v1.Container",
"description": "A single application container that you want to run within a pod.",

View File

@ -6969,6 +6969,10 @@
"portworxVolume": {
"$ref": "v1.PortworxVolumeSource",
"description": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine"
},
"scaleIO": {
"$ref": "v1.ScaleIOVolumeSource",
"description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes."
}
}
},
@ -7749,6 +7753,57 @@
}
}
},
"v1.ScaleIOVolumeSource": {
"id": "v1.ScaleIOVolumeSource",
"description": "ScaleIOVolumeSource represents a persistent ScaleIO volume",
"required": [
"gateway",
"system",
"secretRef"
],
"properties": {
"gateway": {
"type": "string",
"description": "The host address of the ScaleIO API Gateway."
},
"system": {
"type": "string",
"description": "The name of the storage system as configured in ScaleIO."
},
"secretRef": {
"$ref": "v1.LocalObjectReference",
"description": "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail."
},
"sslEnabled": {
"type": "boolean",
"description": "Flag to enable/disable SSL communication with Gateway, default false"
},
"protectionDomain": {
"type": "string",
"description": "The name of the Protection Domain for the configured storage (defaults to \"default\")."
},
"storagePool": {
"type": "string",
"description": "The Storage Pool associated with the protection domain (defaults to \"default\")."
},
"storageMode": {
"type": "string",
"description": "Indicates whether the storage for a volume should be thick or thin (defaults to \"thin\")."
},
"volumeName": {
"type": "string",
"description": "The name of a volume already created in the ScaleIO system that is associated with this volume source."
},
"fsType": {
"type": "string",
"description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified."
},
"readOnly": {
"type": "boolean",
"description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
}
}
},
"v1.Container": {
"id": "v1.Container",
"description": "A single application container that you want to run within a pod.",

View File

@ -1377,6 +1377,10 @@
"portworxVolume": {
"$ref": "v1.PortworxVolumeSource",
"description": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine"
},
"scaleIO": {
"$ref": "v1.ScaleIOVolumeSource",
"description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes."
}
}
},
@ -2119,6 +2123,57 @@
}
}
},
"v1.ScaleIOVolumeSource": {
"id": "v1.ScaleIOVolumeSource",
"description": "ScaleIOVolumeSource represents a persistent ScaleIO volume",
"required": [
"gateway",
"system",
"secretRef"
],
"properties": {
"gateway": {
"type": "string",
"description": "The host address of the ScaleIO API Gateway."
},
"system": {
"type": "string",
"description": "The name of the storage system as configured in ScaleIO."
},
"secretRef": {
"$ref": "v1.LocalObjectReference",
"description": "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail."
},
"sslEnabled": {
"type": "boolean",
"description": "Flag to enable/disable SSL communication with Gateway, default false"
},
"protectionDomain": {
"type": "string",
"description": "The name of the Protection Domain for the configured storage (defaults to \"default\")."
},
"storagePool": {
"type": "string",
"description": "The Storage Pool associated with the protection domain (defaults to \"default\")."
},
"storageMode": {
"type": "string",
"description": "Indicates whether the storage for a volume should be thick or thin (defaults to \"thin\")."
},
"volumeName": {
"type": "string",
"description": "The name of a volume already created in the ScaleIO system that is associated with this volume source."
},
"fsType": {
"type": "string",
"description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified."
},
"readOnly": {
"type": "boolean",
"description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
}
}
},
"v1.VolumeMount": {
"id": "v1.VolumeMount",
"description": "VolumeMount describes a mounting of a Volume within a container.",

View File

@ -18013,6 +18013,10 @@
"$ref": "v1.PortworxVolumeSource",
"description": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine"
},
"scaleIO": {
"$ref": "v1.ScaleIOVolumeSource",
"description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes."
},
"accessModes": {
"type": "array",
"items": {
@ -18512,6 +18516,57 @@
}
}
},
"v1.ScaleIOVolumeSource": {
"id": "v1.ScaleIOVolumeSource",
"description": "ScaleIOVolumeSource represents a persistent ScaleIO volume",
"required": [
"gateway",
"system",
"secretRef"
],
"properties": {
"gateway": {
"type": "string",
"description": "The host address of the ScaleIO API Gateway."
},
"system": {
"type": "string",
"description": "The name of the storage system as configured in ScaleIO."
},
"secretRef": {
"$ref": "v1.LocalObjectReference",
"description": "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail."
},
"sslEnabled": {
"type": "boolean",
"description": "Flag to enable/disable SSL communication with Gateway, default false"
},
"protectionDomain": {
"type": "string",
"description": "The name of the Protection Domain for the configured storage (defaults to \"default\")."
},
"storagePool": {
"type": "string",
"description": "The Storage Pool associated with the protection domain (defaults to \"default\")."
},
"storageMode": {
"type": "string",
"description": "Indicates whether the storage for a volume should be thick or thin (defaults to \"thin\")."
},
"volumeName": {
"type": "string",
"description": "The name of a volume already created in the ScaleIO system that is associated with this volume source."
},
"fsType": {
"type": "string",
"description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified."
},
"readOnly": {
"type": "boolean",
"description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
}
}
},
"v1.PersistentVolumeStatus": {
"id": "v1.PersistentVolumeStatus",
"description": "PersistentVolumeStatus is the current status of a persistent volume.",
@ -18808,6 +18863,10 @@
"portworxVolume": {
"$ref": "v1.PortworxVolumeSource",
"description": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine"
},
"scaleIO": {
"$ref": "v1.ScaleIOVolumeSource",
"description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes."
}
}
},

View File

@ -87,6 +87,7 @@ go_library(
"//pkg/volume/portworx:go_default_library",
"//pkg/volume/quobyte:go_default_library",
"//pkg/volume/rbd:go_default_library",
"//pkg/volume/scaleio:go_default_library",
"//pkg/volume/vsphere_volume:go_default_library",
"//vendor:github.com/golang/glog",
"//vendor:github.com/prometheus/client_golang/prometheus",

View File

@ -53,6 +53,7 @@ import (
"k8s.io/kubernetes/pkg/volume/portworx"
"k8s.io/kubernetes/pkg/volume/quobyte"
"k8s.io/kubernetes/pkg/volume/rbd"
"k8s.io/kubernetes/pkg/volume/scaleio"
"k8s.io/kubernetes/pkg/volume/vsphere_volume"
)
@ -73,6 +74,7 @@ func ProbeAttachableVolumePlugins(config componentconfig.VolumeConfiguration) []
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, azure_dd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, photon_pd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, scaleio.ProbeVolumePlugins()...)
return allPlugins
}
@ -118,6 +120,7 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config componen
allPlugins = append(allPlugins, flocker.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, scaleio.ProbeVolumePlugins()...)
if cloud != nil {
switch {

View File

@ -94,6 +94,7 @@ go_library(
"//pkg/volume/projected:go_default_library",
"//pkg/volume/quobyte:go_default_library",
"//pkg/volume/rbd:go_default_library",
"//pkg/volume/scaleio:go_default_library",
"//pkg/volume/secret:go_default_library",
"//pkg/volume/vsphere_volume:go_default_library",
"//vendor:github.com/golang/glog",

View File

@ -50,6 +50,7 @@ import (
"k8s.io/kubernetes/pkg/volume/projected"
"k8s.io/kubernetes/pkg/volume/quobyte"
"k8s.io/kubernetes/pkg/volume/rbd"
"k8s.io/kubernetes/pkg/volume/scaleio"
"k8s.io/kubernetes/pkg/volume/secret"
"k8s.io/kubernetes/pkg/volume/vsphere_volume"
// Cloud providers
@ -92,6 +93,7 @@ func ProbeVolumePlugins(pluginDir string) []volume.VolumePlugin {
allPlugins = append(allPlugins, photon_pd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, projected.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, scaleio.ProbeVolumePlugins()...)
return allPlugins
}

View File

@ -3018,6 +3018,13 @@ The StatefulSet guarantees that a given network identity will always map to the
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_portworxvolumesource">v1.PortworxVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">scaleIO</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_scaleiovolumesource">v1.ScaleIOVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
@ -3438,68 +3445,6 @@ The StatefulSet guarantees that a given network identity will always map to the
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_containerport">v1.ContainerPort</h3>
<div class="paragraph">
<p>ContainerPort represents a network port in a single container.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the host. If specified, this must be a valid port number, 0 &lt; x &lt; 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">containerPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the pod&#8217;s IP address. This must be a valid port number, 0 &lt; x &lt; 65536.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">protocol</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Protocol for port. Must be UDP or TCP. Defaults to "TCP".</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostIP</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">What host IP to bind the external port to.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_podspec">v1.PodSpec</h3>
@ -3681,6 +3626,68 @@ The StatefulSet guarantees that a given network identity will always map to the
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_containerport">v1.ContainerPort</h3>
<div class="paragraph">
<p>ContainerPort represents a network port in a single container.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the host. If specified, this must be a valid port number, 0 &lt; x &lt; 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">containerPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the pod&#8217;s IP address. This must be a valid port number, 0 &lt; x &lt; 65536.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">protocol</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Protocol for port. Must be UDP or TCP. Defaults to "TCP".</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostIP</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">What host IP to bind the external port to.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_lifecycle">v1.Lifecycle</h3>
@ -4183,6 +4190,103 @@ Examples:<br>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_scaleiovolumesource">v1.ScaleIOVolumeSource</h3>
<div class="paragraph">
<p>ScaleIOVolumeSource represents a persistent ScaleIO volume</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">gateway</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The host address of the ScaleIO API Gateway.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">system</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the storage system as configured in ScaleIO.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">secretRef</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_localobjectreference">v1.LocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">sslEnabled</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Flag to enable/disable SSL communication with Gateway, default false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">protectionDomain</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the Protection Domain for the configured storage (defaults to "default").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">storagePool</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The Storage Pool associated with the protection domain (defaults to "default").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">storageMode</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Indicates whether the storage for a volume should be thick or thin (defaults to "thin").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">volumeName</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of a volume already created in the ScaleIO system that is associated with this volume source.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">fsType</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">readOnly</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_photonpersistentdiskvolumesource">v1.PhotonPersistentDiskVolumeSource</h3>
@ -6152,7 +6256,7 @@ Examples:<br>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2017-03-02 03:12:49 UTC
Last updated 2017-03-03 18:17:45 UTC
</div>
</div>
</body>

View File

@ -576,6 +576,103 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_scaleiovolumesource">v1.ScaleIOVolumeSource</h3>
<div class="paragraph">
<p>ScaleIOVolumeSource represents a persistent ScaleIO volume</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">gateway</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The host address of the ScaleIO API Gateway.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">system</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the storage system as configured in ScaleIO.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">secretRef</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_localobjectreference">v1.LocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">sslEnabled</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Flag to enable/disable SSL communication with Gateway, default false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">protectionDomain</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the Protection Domain for the configured storage (defaults to "default").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">storagePool</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The Storage Pool associated with the protection domain (defaults to "default").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">storageMode</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Indicates whether the storage for a volume should be thick or thin (defaults to "thin").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">volumeName</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of a volume already created in the ScaleIO system that is associated with this volume source.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">fsType</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">readOnly</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_nodeselectorterm">v1.NodeSelectorTerm</h3>
@ -4297,6 +4394,13 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_portworxvolumesource">v1.PortworxVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">scaleIO</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_scaleiovolumesource">v1.ScaleIOVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
@ -4753,6 +4857,68 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_containerport">v1.ContainerPort</h3>
<div class="paragraph">
<p>ContainerPort represents a network port in a single container.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the host. If specified, this must be a valid port number, 0 &lt; x &lt; 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">containerPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the pod&#8217;s IP address. This must be a valid port number, 0 &lt; x &lt; 65536.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">protocol</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Protocol for port. Must be UDP or TCP. Defaults to "TCP".</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostIP</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">What host IP to bind the external port to.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_podspec">v1.PodSpec</h3>
@ -4934,68 +5100,6 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_containerport">v1.ContainerPort</h3>
<div class="paragraph">
<p>ContainerPort represents a network port in a single container.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the host. If specified, this must be a valid port number, 0 &lt; x &lt; 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">containerPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the pod&#8217;s IP address. This must be a valid port number, 0 &lt; x &lt; 65536.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">protocol</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Protocol for port. Must be UDP or TCP. Defaults to "TCP".</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostIP</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">What host IP to bind the external port to.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_lifecycle">v1.Lifecycle</h3>
@ -5394,7 +5498,7 @@ Examples:<br>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2017-03-02 03:13:25 UTC
Last updated 2017-03-03 18:18:12 UTC
</div>
</div>
</body>

View File

@ -3699,6 +3699,13 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_portworxvolumesource">v1.PortworxVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">scaleIO</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_scaleiovolumesource">v1.ScaleIOVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
@ -4229,68 +4236,6 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_containerport">v1.ContainerPort</h3>
<div class="paragraph">
<p>ContainerPort represents a network port in a single container.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the host. If specified, this must be a valid port number, 0 &lt; x &lt; 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">containerPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the pod&#8217;s IP address. This must be a valid port number, 0 &lt; x &lt; 65536.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">protocol</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Protocol for port. Must be UDP or TCP. Defaults to "TCP".</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostIP</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">What host IP to bind the external port to.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_podspec">v1.PodSpec</h3>
@ -4472,6 +4417,68 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_containerport">v1.ContainerPort</h3>
<div class="paragraph">
<p>ContainerPort represents a network port in a single container.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the host. If specified, this must be a valid port number, 0 &lt; x &lt; 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">containerPort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number of port to expose on the pod&#8217;s IP address. This must be a valid port number, 0 &lt; x &lt; 65536.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">protocol</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Protocol for port. Must be UDP or TCP. Defaults to "TCP".</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">hostIP</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">What host IP to bind the external port to.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_lifecycle">v1.Lifecycle</h3>
@ -4960,6 +4967,103 @@ Examples:<br>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_scaleiovolumesource">v1.ScaleIOVolumeSource</h3>
<div class="paragraph">
<p>ScaleIOVolumeSource represents a persistent ScaleIO volume</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">gateway</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The host address of the ScaleIO API Gateway.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">system</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the storage system as configured in ScaleIO.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">secretRef</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_localobjectreference">v1.LocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">sslEnabled</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Flag to enable/disable SSL communication with Gateway, default false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">protectionDomain</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the Protection Domain for the configured storage (defaults to "default").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">storagePool</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The Storage Pool associated with the protection domain (defaults to "default").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">storageMode</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Indicates whether the storage for a volume should be thick or thin (defaults to "thin").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">volumeName</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of a volume already created in the ScaleIO system that is associated with this volume source.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">fsType</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">readOnly</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_photonpersistentdiskvolumesource">v1.PhotonPersistentDiskVolumeSource</h3>
@ -5594,40 +5698,6 @@ Examples:<br>
<div class="sect2">
<h3 id="_v1_deletionpropagation">v1.DeletionPropagation</h3>
</div>
<div class="sect2">
<h3 id="_v1_tcpsocketaction">v1.TCPSocketAction</h3>
<div class="paragraph">
<p>TCPSocketAction describes an action based on opening a socket</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">port</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1beta1_deploymentstrategy">v1beta1.DeploymentStrategy</h3>
@ -5669,6 +5739,40 @@ Examples:<br>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_tcpsocketaction">v1.TCPSocketAction</h3>
<div class="paragraph">
<p>TCPSocketAction describes an action based on opening a socket</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">port</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1beta1_ingressrule">v1beta1.IngressRule</h3>
@ -7799,7 +7903,7 @@ Both these may change in the future. Incoming requests are matched against the h
</div>
<div id="footer">
<div id="footer-text">
Last updated 2017-03-02 03:13:41 UTC
Last updated 2017-03-03 18:18:23 UTC
</div>
</div>
</body>

View File

@ -487,6 +487,103 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_scaleiovolumesource">v1.ScaleIOVolumeSource</h3>
<div class="paragraph">
<p>ScaleIOVolumeSource represents a persistent ScaleIO volume</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">gateway</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The host address of the ScaleIO API Gateway.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">system</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the storage system as configured in ScaleIO.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">secretRef</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_localobjectreference">v1.LocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">sslEnabled</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Flag to enable/disable SSL communication with Gateway, default false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">protectionDomain</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the Protection Domain for the configured storage (defaults to "default").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">storagePool</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The Storage Pool associated with the protection domain (defaults to "default").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">storageMode</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Indicates whether the storage for a volume should be thick or thin (defaults to "thin").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">volumeName</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of a volume already created in the ScaleIO system that is associated with this volume source.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">fsType</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">readOnly</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_photonpersistentdiskvolumesource">v1.PhotonPersistentDiskVolumeSource</h3>
@ -3202,6 +3299,13 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_portworxvolumesource">v1.PortworxVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">scaleIO</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_scaleiovolumesource">v1.ScaleIOVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
@ -3695,7 +3799,7 @@ Examples:<br>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2017-03-01 18:58:24 UTC
Last updated 2017-03-02 13:01:30 UTC
</div>
</div>
</body>

View File

@ -4412,6 +4412,13 @@ The resulting set of endpoints can be viewed as:<br>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_portworxvolumesource">v1.PortworxVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">scaleIO</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_scaleiovolumesource">v1.ScaleIOVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
@ -6045,6 +6052,103 @@ Examples:<br>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_scaleiovolumesource">v1.ScaleIOVolumeSource</h3>
<div class="paragraph">
<p>ScaleIOVolumeSource represents a persistent ScaleIO volume</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">gateway</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The host address of the ScaleIO API Gateway.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">system</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the storage system as configured in ScaleIO.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">secretRef</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_localobjectreference">v1.LocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">sslEnabled</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Flag to enable/disable SSL communication with Gateway, default false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">protectionDomain</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the Protection Domain for the configured storage (defaults to "default").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">storagePool</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The Storage Pool associated with the protection domain (defaults to "default").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">storageMode</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Indicates whether the storage for a volume should be thick or thin (defaults to "thin").</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">volumeName</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of a volume already created in the ScaleIO system that is associated with this volume source.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">fsType</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">readOnly</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_status">v1.Status</h3>
@ -7090,6 +7194,13 @@ Examples:<br>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">scaleIO</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_scaleiovolumesource">v1.ScaleIOVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">accessModes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">AccessModes contains all ways the volume can be mounted. More info: <a href="http://kubernetes.io/docs/user-guide/persistent-volumes#access-modes">http://kubernetes.io/docs/user-guide/persistent-volumes#access-modes</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
@ -9732,7 +9843,7 @@ Examples:<br>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2017-03-02 03:12:42 UTC
Last updated 2017-03-03 18:17:39 UTC
</div>
</div>
</body>

View File

@ -0,0 +1,278 @@
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
<!-- BEGIN STRIP_FOR_RELEASE -->
<img src="http://kubernetes.io/kubernetes/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/kubernetes/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/kubernetes/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/kubernetes/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/kubernetes/img/warning.png" alt="WARNING"
width="25" height="25">
<h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>
If you are using a released version of Kubernetes, you should
refer to the docs that go with that version.
Documentation for other releases can be found at
[releases.k8s.io](http://releases.k8s.io).
</strong>
--
<!-- END STRIP_FOR_RELEASE -->
<!-- END MUNGE: UNVERSIONED_WARNING -->
# Dell EMC ScaleIO Volume Plugin for Kubernetes
This document shows how to configure Kubernetes resources to consume storage from volumes hosted on ScaleIO cluster.
## Pre-Requisites
* Kubernetes ver 1.6 or later
* ScaleIO ver 2.0 or later
* A ScaleIO cluster with an API gateway
* ScaleIO SDC binary installed/configured on each Kubernetes node that will consume storage
## ScaleIO Setup
This document assumes you are familiar with ScaleIO and have a cluster ready to go. If you are *not familiar* with ScaleIO, please review *Learn how to setup a 3-node* [ScaleIO cluster on Vagrant](https://github.com/codedellemc/labs/tree/master/setup-scaleio-vagrant) and see *General instructions on* [setting up ScaleIO](https://www.emc.com/products-solutions/trial-software-download/scaleio.htm)
For this demonstration, ensure the followings:
- the ScaleIO `SDC` component is installed and properly configured on all Kubernetes nodes where deployed pods will consume ScaleIO-backed volumes.
- You have a configured ScaleIO gateway that is accessible from the Kubernetes nodes.
## Deploy Kubernetes Secret for ScaleIO
The ScaleIO plugin uses Kubernetes Secret object to store the `username` and `password` credentials used to connect to the ScaleIO gateway API server. In this step, let us create a secret object to save the data. To avoid storing secrets in as clear text, let us encode the ScaleIO credentials as `base64` using the following steps.
```
$> echo -n "siouser" | base64
c2lvdXNlcg==
$> echo -n "sc@l3I0" | base64
c2NAbDNJMA==
```
The previous will generate `base64-encoded` values for the username and password. Remember to generate the credentials for your own environment (not the username/password shown above) . Next, create a secret file, with the encoded values from above, as shown in the following.
File: [secret.yaml](secret.yaml)
```
apiVersion: v1
kind: Secret
metadata:
name: sio-secret
type: kubernetes.io/scaleio
data:
username: c2lvdXNlcg==
password: c2NAbDNJMA==
```
Notice the name of the secret specified above as `sio-secret`. It will be referred in other YAML files. Next, deploy the secret.
```
$ kubectl create -f ./examples/volumes/scaleio/secret.yaml
```
## Deploying Pods with Persistent Volumes
The following example shows how the ScaleIO volume plugin for Kubernetes automatically attach, format, and mount a volume for a deployed pod. This approach requires an existing ScaleIO volume.
### Create Volume
Static persistent volumes require that the volume, to be consumed by the pod, be already created in ScaleIO. You can use your ScaleIO tooling to create a new volume or use the name of a volume that already exists in ScaleIO. For this demo, we assume there's a volume named `vol-0`. If you want to use an existing volume, ensure its name is reflected properly in the `volumeName` attribute below.
### Deploy Pod YAML
Create a pod YAML file that declares the volume (above) to be used.
File: [pod.yaml](pod.yaml)
```
apiVersion: v1
kind: Pod
metadata:
name: pod-0
spec:
containers:
- image: gcr.io/google_containers/test-webserver
name: pod-0
volumeMounts:
- mountPath: /test-pd
name: vol-0
volumes:
- name: vol-0
scaleIO:
gateway: https://localhost:443/api
system: scaleio
volumeName: vol-0
secretRef:
name: sio-secret
fsType: xfs
```
Notice the followings in the previous YAML:
- Update the `gatewway` to point to your ScaleIO gateway endpoint.
- The `volumeName` attribute refers to the name of an existing volume in ScaleIO.
- The `secretRef` attribute references the name of the secret object deployed earlier.
Next, deploy the pod.
```
$> kubectl create -f examples/volumes/scaleio/pod.yaml
```
You can verify the pod:
```
$> kubectl get pod
NAME READY STATUS RESTARTS AGE
pod-0 1/1 Running 0 33s
```
Or for more detail, use
```
kubectl describe pod pod-0
```
You can see the attached/mapped volume on the node:
```
$> lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
...
scinia 252:0 0 8G 0 disk /var/lib/kubelet/pods/135986c7-dcb7-11e6-9fbf-080027c990a7/volumes/kubernetes.io~scaleio/vol-0
```
## StorageClass and Dynamic Provisioning
In this example, we will see how the ScaleIO volume plugin can automatically provision a new volume as described in a `StorageClass`.
### StorageClass
Define a new `StorageClass` as shown in the following YAML.
File [sc.yaml](sc.yaml)
```
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
name: sio-small
provisioner: kubernetes.io/scaleio
parameters:
gateway: https://localhost:443/api
system: scaleio
protectionDomain: default
secretRef: sio-secret
fsType: xfs
```
Note the followings:
- The `name` attribute is set to `sio-small` . It will be referenced later.
- The `provisioner` attribute is set to `kubernetes.io/scaleio` to trigger the ScaleIO plugin.
- The use of the `parameters:` section in the yaml for configurations.
- The `secretRef` attribute matches the name of the Secret object created earlier.
Next, deploy the storage class file.
```
$> kubectl create -f examples/volumes/scaleio/sc.yaml
$> kubectl get sc
NAME TYPE
sio-small kubernetes.io/scaleio
```
### PVC for the StorageClass
The next step is to define/deploy a `PeristentVolumeClaim` that will use the StorageClass.
File [sc-pvc.yaml](sc-pvc.yaml)
```
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-sio-small
annotations:
volume.beta.kubernetes.io/storage-class: sio-small
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
```
Note the `annotations:` entry which specifies annotation `volume.beta.kubernetes.io/storage-class: sio-small` which references the name of the storage class defined earlier.
Next, we deploy PVC file for the storage class. This step will cause the Kubernetes ScaleIO plugin to create the volume in the storage system.
```
$> kubectl create -f examples/volumes/scaleio/sc-pvc.yaml
```
You verify that a new volume created in the ScaleIO dashboard. You can also verify the newly created volume as follows.
```
kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESSMODES AGE
pvc-sio-small Bound pvc-5fc78518-dcae-11e6-a263-080027c990a7 10Gi RWO 1h
```
###Pod for PVC and SC
At this point, the volume is created (by the claim) in the storage system. To use it, we must define a pod that references the volume as done in this YAML.
File [pod-sc-pvc.yaml](pod-sc-pvc.yaml)
```
kind: Pod
apiVersion: v1
metadata:
name: pod-sio-small
spec:
containers:
- name: pod-sio-small-container
image: gcr.io/google_containers/test-webserver
volumeMounts:
- mountPath: /test
name: test-data
volumes:
- name: test-data
persistentVolumeClaim:
claimName: pvc-sio-small
```
Notice that the `claimName:` attribute refers to the name of the PVC defined and deployed earlier. Next, let us deploy the file.
```
$> kubectl create -f examples/volumes/scaleio/pod-sc-pvc.yaml
```
We can now verify that the new pod is deployed OK.
```
kubectl get pod
NAME READY STATUS RESTARTS AGE
pod-0 1/1 Running 0 23m
pod-sio-small 1/1 Running 0 5s
```
You can use the ScaleIO dashboard to verify that the new volume has one attachment. You can verify the volume information for the pod:
```
$> kubectl describe pod pod-sio-small
...
Volumes:
test-data:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: pvc-sio-small
ReadOnly: false
...
```
Lastly, you can see the volume's attachment on the Kubernetes node:
```
$> lsblk
...
scinia 252:0 0 8G 0 disk /var/lib/kubelet/pods/135986c7-dcb7-11e6-9fbf-080027c990a7/volumes/kubernetes.io~scaleio/vol-0
scinib 252:16 0 16G 0 disk /var/lib/kubelet/pods/62db442e-dcba-11e6-9fbf-080027c990a7/volumes/kubernetes.io~scaleio/sio-5fc9154ddcae11e68db708002
```
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/examples/volumes/scaleio/README.md?pixel)]()
<!-- END MUNGE: GENERATED_ANALYTICS -->

View File

@ -0,0 +1,15 @@
kind: Pod
apiVersion: v1
metadata:
name: pod-sio-small
spec:
containers:
- name: pod-sio-small-container
image: gcr.io/google_containers/test-webserver
volumeMounts:
- mountPath: /test
name: test-data
volumes:
- name: test-data
persistentVolumeClaim:
claimName: pvc-sio-small

View File

@ -0,0 +1,20 @@
apiVersion: v1
kind: Pod
metadata:
name: pod-0
spec:
containers:
- image: gcr.io/google_containers/test-webserver
name: pod-0
volumeMounts:
- mountPath: /test-pd
name: vol-0
volumes:
- name: vol-0
scaleIO:
gateway: https://localhost:443/api
system: scaleio
volumeName: vol-0
secretRef:
name: sio-secret
fsType: xfs

View File

@ -0,0 +1,12 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-sio-small
annotations:
volume.beta.kubernetes.io/storage-class: sio-small
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi

View File

@ -0,0 +1,11 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
name: sio-small
provisioner: kubernetes.io/scaleio
parameters:
gateway: https://localhost:443/api
system: scaleio
protectionDomain: default
secretRef: sio-secret
fsType: xfs

View File

@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: sio-secret
type: kubernetes.io/scaleio
data:
username: YWRtaW4=
password: c0NhbGVpbzEyMw==

View File

@ -12961,6 +12961,56 @@
}
}
},
"io.k8s.kubernetes.pkg.api.v1.ScaleIOVolumeSource": {
"description": "ScaleIOVolumeSource represents a persistent ScaleIO volume",
"required": [
"gateway",
"system",
"secretRef"
],
"properties": {
"fsType": {
"description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
"type": "string"
},
"gateway": {
"description": "The host address of the ScaleIO API Gateway.",
"type": "string"
},
"protectionDomain": {
"description": "The name of the Protection Domain for the configured storage (defaults to \"default\").",
"type": "string"
},
"readOnly": {
"description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
"type": "boolean"
},
"secretRef": {
"description": "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.LocalObjectReference"
},
"sslEnabled": {
"description": "Flag to enable/disable SSL communication with Gateway, default false",
"type": "boolean"
},
"storageMode": {
"description": "Indicates whether the storage for a volume should be thick or thin (defaults to \"thin\").",
"type": "string"
},
"storagePool": {
"description": "The Storage Pool associated with the protection domain (defaults to \"default\").",
"type": "string"
},
"system": {
"description": "The name of the storage system as configured in ScaleIO.",
"type": "string"
},
"volumeName": {
"description": "The name of a volume already created in the ScaleIO system that is associated with this volume source.",
"type": "string"
}
}
},
"io.k8s.kubernetes.pkg.api.v1.Secret": {
"description": "Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.",
"properties": {
@ -13451,6 +13501,10 @@
"description": "RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.RBDVolumeSource"
},
"scaleIO": {
"description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.ScaleIOVolumeSource"
},
"secret": {
"description": "Secret represents a secret that should populate this volume. More info: http://kubernetes.io/docs/user-guide/volumes#secrets",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.SecretVolumeSource"

View File

@ -84,6 +84,10 @@ func VisitPodSecretNames(pod *api.Pod, visitor func(string) bool) bool {
if !visitor(source.Secret.SecretName) {
return false
}
case source.ScaleIO != nil:
if source.ScaleIO.SecretRef != nil && !visitor(source.ScaleIO.SecretRef.Name) {
return false
}
}
}
return true

View File

@ -81,7 +81,11 @@ func TestPodSecrets(t *testing.T) {
SecretName: "Spec.Volumes[*].VolumeSource.Secret.SecretName"}}}, {
VolumeSource: api.VolumeSource{
Secret: &api.SecretVolumeSource{
SecretName: "Spec.Volumes[*].VolumeSource.Secret"}}}},
SecretName: "Spec.Volumes[*].VolumeSource.Secret"}}}, {
VolumeSource: api.VolumeSource{
ScaleIO: &api.ScaleIOVolumeSource{
SecretRef: &api.LocalObjectReference{
Name: "Spec.Volumes[*].VolumeSource.ScaleIO.SecretRef"}}}}},
},
}
extractedNames := sets.NewString()
@ -109,6 +113,7 @@ func TestPodSecrets(t *testing.T) {
"Spec.Volumes[*].VolumeSource.RBD.SecretRef",
"Spec.Volumes[*].VolumeSource.Secret",
"Spec.Volumes[*].VolumeSource.Secret.SecretName",
"Spec.Volumes[*].VolumeSource.ScaleIO.SecretRef",
)
secretPaths := collectSecretPaths(t, nil, "", reflect.TypeOf(&api.Pod{}))
secretPaths = secretPaths.Difference(excludedSecretPaths)

View File

@ -434,6 +434,24 @@ func coreFuncs(t apitesting.TestingCommon) []interface{} {
*obj.ReadOnly = false
}
},
func(sio *api.ScaleIOVolumeSource, c fuzz.Continue) {
sio.ProtectionDomain = c.RandString()
if sio.ProtectionDomain == "" {
sio.ProtectionDomain = "default"
}
sio.StoragePool = c.RandString()
if sio.StoragePool == "" {
sio.StoragePool = "default"
}
sio.StorageMode = c.RandString()
if sio.StorageMode == "" {
sio.StorageMode = "ThinProvisioned"
}
sio.FSType = c.RandString()
if sio.FSType == "" {
sio.FSType = "xfs"
}
},
func(s *api.NamespaceSpec, c fuzz.Continue) {
s.Finalizers = []api.FinalizerName{api.FinalizerKubernetes}
},

View File

@ -299,6 +299,9 @@ type VolumeSource struct {
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
PortworxVolume *PortworxVolumeSource
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
ScaleIO *ScaleIOVolumeSource
}
// Similar to VolumeSource but meant for the administrator who creates PVs.
@ -364,6 +367,9 @@ type PersistentVolumeSource struct {
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
PortworxVolume *PortworxVolumeSource
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
ScaleIO *ScaleIOVolumeSource
}
type PersistentVolumeClaimVolumeSource struct {
@ -1056,6 +1062,41 @@ type AzureDiskVolumeSource struct {
ReadOnly *bool
}
// ScaleIOVolumeSource represents a persistent ScaleIO volume
type ScaleIOVolumeSource struct {
// The host address of the ScaleIO API Gateway.
Gateway string
// The name of the storage system as configured in ScaleIO.
System string
// SecretRef references to the secret for ScaleIO user and other
// sensitive information. If this is not provided, Login operation will fail.
SecretRef *LocalObjectReference
// Flag to enable/disable SSL communication with Gateway, default false
// +optional
SSLEnabled bool
// The name of the Protection Domain for the configured storage (defaults to "default").
// +optional
ProtectionDomain string
// The Storage Pool associated with the protection domain (defaults to "default").
// +optional
StoragePool string
// Indicates whether the storage for a volume should be thick or thin (defaults to "thin").
// +optional
StorageMode string
// The name of a volume already created in the ScaleIO system
// that is associated with this volume source.
VolumeName string
// Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
// +optional
FSType string
// Defaults to false (read/write). ReadOnly here will force
// the ReadOnly setting in VolumeMounts.
// +optional
ReadOnly bool
}
// Adapts a ConfigMap into a volume.
//
// The contents of the target ConfigMap's Data field will be presented in a

View File

@ -359,3 +359,18 @@ func SetDefaults_RBDVolumeSource(obj *RBDVolumeSource) {
obj.Keyring = "/etc/ceph/keyring"
}
}
func SetDefaults_ScaleIOVolumeSource(obj *ScaleIOVolumeSource) {
if obj.ProtectionDomain == "" {
obj.ProtectionDomain = "default"
}
if obj.StoragePool == "" {
obj.StoragePool = "default"
}
if obj.StorageMode == "" {
obj.StorageMode = "ThinProvisioned"
}
if obj.FSType == "" {
obj.FSType = "xfs"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2140,6 +2140,10 @@ message PersistentVolumeSource {
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
optional PortworxVolumeSource portworxVolume = 18;
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
optional ScaleIOVolumeSource scaleIO = 19;
}
// PersistentVolumeSpec is the specification of a persistent volume.
@ -3210,6 +3214,50 @@ message SELinuxOptions {
optional string level = 4;
}
// ScaleIOVolumeSource represents a persistent ScaleIO volume
message ScaleIOVolumeSource {
// The host address of the ScaleIO API Gateway.
optional string gateway = 1;
// The name of the storage system as configured in ScaleIO.
optional string system = 2;
// SecretRef references to the secret for ScaleIO user and other
// sensitive information. If this is not provided, Login operation will fail.
optional LocalObjectReference secretRef = 3;
// Flag to enable/disable SSL communication with Gateway, default false
// +optional
optional bool sslEnabled = 4;
// The name of the Protection Domain for the configured storage (defaults to "default").
// +optional
optional string protectionDomain = 5;
// The Storage Pool associated with the protection domain (defaults to "default").
// +optional
optional string storagePool = 6;
// Indicates whether the storage for a volume should be thick or thin (defaults to "thin").
// +optional
optional string storageMode = 7;
// The name of a volume already created in the ScaleIO system
// that is associated with this volume source.
optional string volumeName = 8;
// Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
// +optional
optional string fsType = 9;
// Defaults to false (read/write). ReadOnly here will force
// the ReadOnly setting in VolumeMounts.
// +optional
optional bool readOnly = 10;
}
// Secret holds secret data of a certain type. The total bytes of the values in
// the Data field must be less than MaxSecretSize bytes.
message Secret {
@ -3840,11 +3888,15 @@ message VolumeSource {
optional PhotonPersistentDiskVolumeSource photonPersistentDisk = 23;
// Items for all in one resources secrets, configmaps, and downward API
optional ProjectedVolumeSource projected = 25;
optional ProjectedVolumeSource projected = 26;
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
optional PortworxVolumeSource portworxVolume = 24;
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
optional ScaleIOVolumeSource scaleIO = 25;
}
// Represents a vSphere volume resource.

View File

@ -172,6 +172,11 @@ func VisitPodSecretNames(pod *v1.Pod, visitor func(string) bool) bool {
if !visitor(source.Secret.SecretName) {
return false
}
case source.ScaleIO != nil:
if source.ScaleIO.SecretRef != nil && !visitor(source.ScaleIO.SecretRef.Name) {
return false
}
}
}
return true

View File

@ -249,7 +249,11 @@ func TestPodSecrets(t *testing.T) {
SecretName: "Spec.Volumes[*].VolumeSource.Secret.SecretName"}}}, {
VolumeSource: v1.VolumeSource{
Secret: &v1.SecretVolumeSource{
SecretName: "Spec.Volumes[*].VolumeSource.Secret"}}}},
SecretName: "Spec.Volumes[*].VolumeSource.Secret"}}}, {
VolumeSource: v1.VolumeSource{
ScaleIO: &v1.ScaleIOVolumeSource{
SecretRef: &v1.LocalObjectReference{
Name: "Spec.Volumes[*].VolumeSource.ScaleIO.SecretRef"}}}}},
},
}
extractedNames := sets.NewString()
@ -277,6 +281,7 @@ func TestPodSecrets(t *testing.T) {
"Spec.Volumes[*].VolumeSource.RBD.SecretRef",
"Spec.Volumes[*].VolumeSource.Secret",
"Spec.Volumes[*].VolumeSource.Secret.SecretName",
"Spec.Volumes[*].VolumeSource.ScaleIO.SecretRef",
)
secretPaths := collectSecretPaths(t, nil, "", reflect.TypeOf(&v1.Pod{}))
secretPaths = secretPaths.Difference(excludedSecretPaths)

File diff suppressed because it is too large Load Diff

View File

@ -331,6 +331,9 @@ type VolumeSource struct {
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,24,opt,name=portworxVolume"`
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
ScaleIO *ScaleIOVolumeSource `json:"scaleIO,omitempty" protobuf:"bytes,25,opt,name=scaleIO"`
}
// PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace.
@ -419,6 +422,9 @@ type PersistentVolumeSource struct {
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,18,opt,name=portworxVolume"`
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
ScaleIO *ScaleIOVolumeSource `json:"scaleIO,omitempty" protobuf:"bytes,19,opt,name=scaleIO"`
}
const (
@ -1138,6 +1144,41 @@ type PortworxVolumeSource struct {
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"`
}
// ScaleIOVolumeSource represents a persistent ScaleIO volume
type ScaleIOVolumeSource struct {
// The host address of the ScaleIO API Gateway.
Gateway string `json:"gateway" protobuf:"bytes,1,opt,name=gateway"`
// The name of the storage system as configured in ScaleIO.
System string `json:"system" protobuf:"bytes,2,opt,name=system"`
// SecretRef references to the secret for ScaleIO user and other
// sensitive information. If this is not provided, Login operation will fail.
SecretRef *LocalObjectReference `json:"secretRef" protobuf:"bytes,3,opt,name=secretRef"`
// Flag to enable/disable SSL communication with Gateway, default false
// +optional
SSLEnabled bool `json:"sslEnabled,omitempty" protobuf:"varint,4,opt,name=sslEnabled"`
// The name of the Protection Domain for the configured storage (defaults to "default").
// +optional
ProtectionDomain string `json:"protectionDomain,omitempty" protobuf:"bytes,5,opt,name=protectionDomain"`
// The Storage Pool associated with the protection domain (defaults to "default").
// +optional
StoragePool string `json:"storagePool,omitempty" protobuf:"bytes,6,opt,name=storagePool"`
// Indicates whether the storage for a volume should be thick or thin (defaults to "thin").
// +optional
StorageMode string `json:"storageMode,omitempty" protobuf:"bytes,7,opt,name=storageMode"`
// The name of a volume already created in the ScaleIO system
// that is associated with this volume source.
VolumeName string `json:"volumeName,omitempty" protobuf:"bytes,8,opt,name=volumeName"`
// Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
// +optional
FSType string `json:"fsType,omitempty" protobuf:"bytes,9,opt,name=fsType"`
// Defaults to false (read/write). ReadOnly here will force
// the ReadOnly setting in VolumeMounts.
// +optional
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,10,opt,name=readOnly"`
}
// Adapts a ConfigMap into a volume.
//
// The contents of the target ConfigMap's Data field will be presented in a

View File

@ -1124,6 +1124,7 @@ var map_PersistentVolumeSource = map[string]string{
"azureDisk": "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.",
"photonPersistentDisk": "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine",
"portworxVolume": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine",
"scaleIO": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
}
func (PersistentVolumeSource) SwaggerDoc() map[string]string {
@ -1640,6 +1641,24 @@ func (SELinuxOptions) SwaggerDoc() map[string]string {
return map_SELinuxOptions
}
var map_ScaleIOVolumeSource = map[string]string{
"": "ScaleIOVolumeSource represents a persistent ScaleIO volume",
"gateway": "The host address of the ScaleIO API Gateway.",
"system": "The name of the storage system as configured in ScaleIO.",
"secretRef": "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.",
"sslEnabled": "Flag to enable/disable SSL communication with Gateway, default false",
"protectionDomain": "The name of the Protection Domain for the configured storage (defaults to \"default\").",
"storagePool": "The Storage Pool associated with the protection domain (defaults to \"default\").",
"storageMode": "Indicates whether the storage for a volume should be thick or thin (defaults to \"thin\").",
"volumeName": "The name of a volume already created in the ScaleIO system that is associated with this volume source.",
"fsType": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
"readOnly": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
}
func (ScaleIOVolumeSource) SwaggerDoc() map[string]string {
return map_ScaleIOVolumeSource
}
var map_Secret = map[string]string{
"": "Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.",
"metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
@ -1911,6 +1930,7 @@ var map_VolumeSource = map[string]string{
"photonPersistentDisk": "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine",
"projected": "Items for all in one resources secrets, configmaps, and downward API",
"portworxVolume": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine",
"scaleIO": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
}
func (VolumeSource) SwaggerDoc() map[string]string {

View File

@ -317,6 +317,8 @@ func RegisterConversions(scheme *runtime.Scheme) error {
Convert_api_ResourceRequirements_To_v1_ResourceRequirements,
Convert_v1_SELinuxOptions_To_api_SELinuxOptions,
Convert_api_SELinuxOptions_To_v1_SELinuxOptions,
Convert_v1_ScaleIOVolumeSource_To_api_ScaleIOVolumeSource,
Convert_api_ScaleIOVolumeSource_To_v1_ScaleIOVolumeSource,
Convert_v1_Secret_To_api_Secret,
Convert_api_Secret_To_v1_Secret,
Convert_v1_SecretEnvSource_To_api_SecretEnvSource,
@ -2711,6 +2713,7 @@ func autoConvert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(in *Per
out.AzureDisk = (*api.AzureDiskVolumeSource)(unsafe.Pointer(in.AzureDisk))
out.PhotonPersistentDisk = (*api.PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.PortworxVolume = (*api.PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*api.ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
return nil
}
@ -2737,6 +2740,7 @@ func autoConvert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(in *api
out.AzureDisk = (*AzureDiskVolumeSource)(unsafe.Pointer(in.AzureDisk))
out.PhotonPersistentDisk = (*PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.PortworxVolume = (*PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
return nil
}
@ -3887,6 +3891,42 @@ func Convert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, out
return autoConvert_api_SELinuxOptions_To_v1_SELinuxOptions(in, out, s)
}
func autoConvert_v1_ScaleIOVolumeSource_To_api_ScaleIOVolumeSource(in *ScaleIOVolumeSource, out *api.ScaleIOVolumeSource, s conversion.Scope) error {
out.Gateway = in.Gateway
out.System = in.System
out.SecretRef = (*api.LocalObjectReference)(unsafe.Pointer(in.SecretRef))
out.SSLEnabled = in.SSLEnabled
out.ProtectionDomain = in.ProtectionDomain
out.StoragePool = in.StoragePool
out.StorageMode = in.StorageMode
out.VolumeName = in.VolumeName
out.FSType = in.FSType
out.ReadOnly = in.ReadOnly
return nil
}
func Convert_v1_ScaleIOVolumeSource_To_api_ScaleIOVolumeSource(in *ScaleIOVolumeSource, out *api.ScaleIOVolumeSource, s conversion.Scope) error {
return autoConvert_v1_ScaleIOVolumeSource_To_api_ScaleIOVolumeSource(in, out, s)
}
func autoConvert_api_ScaleIOVolumeSource_To_v1_ScaleIOVolumeSource(in *api.ScaleIOVolumeSource, out *ScaleIOVolumeSource, s conversion.Scope) error {
out.Gateway = in.Gateway
out.System = in.System
out.SecretRef = (*LocalObjectReference)(unsafe.Pointer(in.SecretRef))
out.SSLEnabled = in.SSLEnabled
out.ProtectionDomain = in.ProtectionDomain
out.StoragePool = in.StoragePool
out.StorageMode = in.StorageMode
out.VolumeName = in.VolumeName
out.FSType = in.FSType
out.ReadOnly = in.ReadOnly
return nil
}
func Convert_api_ScaleIOVolumeSource_To_v1_ScaleIOVolumeSource(in *api.ScaleIOVolumeSource, out *ScaleIOVolumeSource, s conversion.Scope) error {
return autoConvert_api_ScaleIOVolumeSource_To_v1_ScaleIOVolumeSource(in, out, s)
}
func autoConvert_v1_Secret_To_api_Secret(in *Secret, out *api.Secret, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Data = *(*map[string][]byte)(unsafe.Pointer(&in.Data))
@ -4487,6 +4527,7 @@ func autoConvert_v1_VolumeSource_To_api_VolumeSource(in *VolumeSource, out *api.
out.PhotonPersistentDisk = (*api.PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.Projected = (*api.ProjectedVolumeSource)(unsafe.Pointer(in.Projected))
out.PortworxVolume = (*api.PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*api.ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
return nil
}
@ -4520,6 +4561,7 @@ func autoConvert_api_VolumeSource_To_v1_VolumeSource(in *api.VolumeSource, out *
out.PhotonPersistentDisk = (*PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.Projected = (*ProjectedVolumeSource)(unsafe.Pointer(in.Projected))
out.PortworxVolume = (*PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
return nil
}

View File

@ -176,6 +176,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ResourceQuotaStatus, InType: reflect.TypeOf(&ResourceQuotaStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ResourceRequirements, InType: reflect.TypeOf(&ResourceRequirements{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_SELinuxOptions, InType: reflect.TypeOf(&SELinuxOptions{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ScaleIOVolumeSource, InType: reflect.TypeOf(&ScaleIOVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Secret, InType: reflect.TypeOf(&Secret{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_SecretEnvSource, InType: reflect.TypeOf(&SecretEnvSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_SecretKeySelector, InType: reflect.TypeOf(&SecretKeySelector{})},
@ -2026,6 +2027,13 @@ func DeepCopy_v1_PersistentVolumeSource(in interface{}, out interface{}, c *conv
*out = new(PortworxVolumeSource)
**out = **in
}
if in.ScaleIO != nil {
in, out := &in.ScaleIO, &out.ScaleIO
*out = new(ScaleIOVolumeSource)
if err := DeepCopy_v1_ScaleIOVolumeSource(*in, *out, c); err != nil {
return err
}
}
return nil
}
}
@ -2872,6 +2880,20 @@ func DeepCopy_v1_SELinuxOptions(in interface{}, out interface{}, c *conversion.C
}
}
func DeepCopy_v1_ScaleIOVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScaleIOVolumeSource)
out := out.(*ScaleIOVolumeSource)
*out = *in
if in.SecretRef != nil {
in, out := &in.SecretRef, &out.SecretRef
*out = new(LocalObjectReference)
**out = **in
}
return nil
}
}
func DeepCopy_v1_Secret(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Secret)
@ -3445,6 +3467,13 @@ func DeepCopy_v1_VolumeSource(in interface{}, out interface{}, c *conversion.Clo
*out = new(PortworxVolumeSource)
**out = **in
}
if in.ScaleIO != nil {
in, out := &in.ScaleIO, &out.ScaleIO
*out = new(ScaleIOVolumeSource)
if err := DeepCopy_v1_ScaleIOVolumeSource(*in, *out, c); err != nil {
return err
}
}
return nil
}
}

View File

@ -137,6 +137,9 @@ func SetObjectDefaults_PersistentVolume(in *PersistentVolume) {
if in.Spec.PersistentVolumeSource.AzureDisk != nil {
SetDefaults_AzureDiskVolumeSource(in.Spec.PersistentVolumeSource.AzureDisk)
}
if in.Spec.PersistentVolumeSource.ScaleIO != nil {
SetDefaults_ScaleIOVolumeSource(in.Spec.PersistentVolumeSource.ScaleIO)
}
}
func SetObjectDefaults_PersistentVolumeClaim(in *PersistentVolumeClaim) {
@ -204,6 +207,9 @@ func SetObjectDefaults_Pod(in *Pod) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.InitContainers {
a := &in.Spec.InitContainers[i]
@ -349,6 +355,9 @@ func SetObjectDefaults_PodTemplate(in *PodTemplate) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Template.Spec.InitContainers {
a := &in.Template.Spec.InitContainers[i]
@ -488,6 +497,9 @@ func SetObjectDefaults_ReplicationController(in *ReplicationController) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]

View File

@ -540,6 +540,14 @@ func validateVolumeSource(source *api.VolumeSource, fldPath *field.Path) field.E
allErrs = append(allErrs, validateProjectedVolumeSource(source.Projected, fldPath.Child("projected"))...)
}
}
if source.ScaleIO != nil {
if numVolumes > 0 {
allErrs = append(allErrs, field.Forbidden(fldPath.Child("scaleIO"), "may not specify more than 1 volume type"))
} else {
numVolumes++
allErrs = append(allErrs, validateScaleIOVolumeSource(source.ScaleIO, fldPath.Child("scaleIO"))...)
}
}
if numVolumes == 0 {
allErrs = append(allErrs, field.Required(fldPath, "must specify a volume type"))
@ -1004,6 +1012,20 @@ func validatePortworxVolumeSource(pwx *api.PortworxVolumeSource, fldPath *field.
return allErrs
}
func validateScaleIOVolumeSource(sio *api.ScaleIOVolumeSource, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if sio.Gateway == "" {
allErrs = append(allErrs, field.Required(fldPath.Child("gateway"), ""))
}
if sio.System == "" {
allErrs = append(allErrs, field.Required(fldPath.Child("system"), ""))
}
if sio.VolumeName == "" {
allErrs = append(allErrs, field.Required(fldPath.Child("volumeName"), ""))
}
return allErrs
}
// ValidatePersistentVolumeName checks that a name is appropriate for a
// PersistentVolumeName object.
var ValidatePersistentVolumeName = NameIsDNSSubdomain
@ -1189,6 +1211,14 @@ func ValidatePersistentVolume(pv *api.PersistentVolume) field.ErrorList {
numVolumes++
allErrs = append(allErrs, validateAzureDisk(pv.Spec.AzureDisk, specPath.Child("azureDisk"))...)
}
if pv.Spec.ScaleIO != nil {
if numVolumes > 0 {
allErrs = append(allErrs, field.Forbidden(specPath.Child("scaleIO"), "may not specify more than 1 volume type"))
} else {
numVolumes++
allErrs = append(allErrs, validateScaleIOVolumeSource(pv.Spec.ScaleIO, specPath.Child("scaleIO"))...)
}
}
if numVolumes == 0 {
allErrs = append(allErrs, field.Required(specPath, "must specify a volume type"))

View File

@ -1968,6 +1968,65 @@ func TestValidateVolumes(t *testing.T) {
errtype: field.ErrorTypeRequired,
errfield: "azureDisk.diskURI",
},
// ScaleIO
{
name: "valid scaleio volume",
vol: api.Volume{
Name: "scaleio-volume",
VolumeSource: api.VolumeSource{
ScaleIO: &api.ScaleIOVolumeSource{
Gateway: "http://abcd/efg",
System: "test-system",
VolumeName: "test-vol-1",
},
},
},
},
{
name: "ScaleIO with empty name",
vol: api.Volume{
Name: "scaleio-volume",
VolumeSource: api.VolumeSource{
ScaleIO: &api.ScaleIOVolumeSource{
Gateway: "http://abcd/efg",
System: "test-system",
VolumeName: "",
},
},
},
errtype: field.ErrorTypeRequired,
errfield: "scaleIO.volumeName",
},
{
name: "ScaleIO with empty gateway",
vol: api.Volume{
Name: "scaleio-volume",
VolumeSource: api.VolumeSource{
ScaleIO: &api.ScaleIOVolumeSource{
Gateway: "",
System: "test-system",
VolumeName: "test-vol-1",
},
},
},
errtype: field.ErrorTypeRequired,
errfield: "scaleIO.gateway",
},
{
name: "ScaleIO with empty system",
vol: api.Volume{
Name: "scaleio-volume",
VolumeSource: api.VolumeSource{
ScaleIO: &api.ScaleIOVolumeSource{
Gateway: "http://agc/efg/gateway",
System: "",
VolumeName: "test-vol-1",
},
},
},
errtype: field.ErrorTypeRequired,
errfield: "scaleIO.system",
},
}
for i, tc := range testCases {

View File

@ -179,6 +179,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_ResourceQuotaStatus, InType: reflect.TypeOf(&ResourceQuotaStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_ResourceRequirements, InType: reflect.TypeOf(&ResourceRequirements{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_SELinuxOptions, InType: reflect.TypeOf(&SELinuxOptions{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_ScaleIOVolumeSource, InType: reflect.TypeOf(&ScaleIOVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_Secret, InType: reflect.TypeOf(&Secret{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_SecretEnvSource, InType: reflect.TypeOf(&SecretEnvSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_SecretKeySelector, InType: reflect.TypeOf(&SecretKeySelector{})},
@ -2070,6 +2071,13 @@ func DeepCopy_api_PersistentVolumeSource(in interface{}, out interface{}, c *con
*out = new(PortworxVolumeSource)
**out = **in
}
if in.ScaleIO != nil {
in, out := &in.ScaleIO, &out.ScaleIO
*out = new(ScaleIOVolumeSource)
if err := DeepCopy_api_ScaleIOVolumeSource(*in, *out, c); err != nil {
return err
}
}
return nil
}
}
@ -2911,6 +2919,20 @@ func DeepCopy_api_SELinuxOptions(in interface{}, out interface{}, c *conversion.
}
}
func DeepCopy_api_ScaleIOVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScaleIOVolumeSource)
out := out.(*ScaleIOVolumeSource)
*out = *in
if in.SecretRef != nil {
in, out := &in.SecretRef, &out.SecretRef
*out = new(LocalObjectReference)
**out = **in
}
return nil
}
}
func DeepCopy_api_Secret(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Secret)
@ -3472,6 +3494,13 @@ func DeepCopy_api_VolumeSource(in interface{}, out interface{}, c *conversion.Cl
*out = new(PortworxVolumeSource)
**out = **in
}
if in.ScaleIO != nil {
in, out := &in.ScaleIO, &out.ScaleIO
*out = new(ScaleIOVolumeSource)
if err := DeepCopy_api_ScaleIOVolumeSource(*in, *out, c); err != nil {
return err
}
}
return nil
}
}

View File

@ -80,6 +80,9 @@ func SetObjectDefaults_Deployment(in *Deployment) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]
@ -218,6 +221,9 @@ func SetObjectDefaults_StatefulSet(in *StatefulSet) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]

View File

@ -78,6 +78,9 @@ func SetObjectDefaults_Job(in *Job) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
api_v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]

View File

@ -81,6 +81,9 @@ func SetObjectDefaults_CronJob(in *CronJob) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.JobTemplate.Spec.Template.Spec.InitContainers {
a := &in.Spec.JobTemplate.Spec.Template.Spec.InitContainers[i]
@ -219,6 +222,9 @@ func SetObjectDefaults_Job(in *Job) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]
@ -356,6 +362,9 @@ func SetObjectDefaults_JobTemplate(in *JobTemplate) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Template.Spec.Template.Spec.InitContainers {
a := &in.Template.Spec.Template.Spec.InitContainers[i]

View File

@ -918,6 +918,7 @@ var (
PhotonPersistentDisk FSType = "photonPersistentDisk"
Projected FSType = "projected"
PortworxVolume FSType = "portworxVolume"
ScaleIO FSType = "scaleIO"
All FSType = "*"
)

View File

@ -84,6 +84,9 @@ func SetObjectDefaults_DaemonSet(in *DaemonSet) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]
@ -222,6 +225,9 @@ func SetObjectDefaults_Deployment(in *Deployment) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]
@ -371,6 +377,9 @@ func SetObjectDefaults_ReplicaSet(in *ReplicaSet) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]

View File

@ -84,6 +84,9 @@ func SetObjectDefaults_PodPreset(in *PodPreset) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
}

View File

@ -5592,11 +5592,17 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
Ref: ref("k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource"),
},
},
"scaleIO": {
SchemaProps: spec.SchemaProps{
Description: "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
Ref: ref("k8s.io/kubernetes/pkg/api/v1.ScaleIOVolumeSource"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/kubernetes/pkg/api/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureFileVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CephFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CinderVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FCVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlexVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlockerVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GCEPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GlusterfsVolumeSource", "k8s.io/kubernetes/pkg/api/v1.HostPathVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ISCSIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.NFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PhotonPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource", "k8s.io/kubernetes/pkg/api/v1.QuobyteVolumeSource", "k8s.io/kubernetes/pkg/api/v1.RBDVolumeSource", "k8s.io/kubernetes/pkg/api/v1.VsphereVirtualDiskVolumeSource"},
"k8s.io/kubernetes/pkg/api/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureFileVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CephFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CinderVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FCVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlexVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlockerVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GCEPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GlusterfsVolumeSource", "k8s.io/kubernetes/pkg/api/v1.HostPathVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ISCSIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.NFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PhotonPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource", "k8s.io/kubernetes/pkg/api/v1.QuobyteVolumeSource", "k8s.io/kubernetes/pkg/api/v1.RBDVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ScaleIOVolumeSource", "k8s.io/kubernetes/pkg/api/v1.VsphereVirtualDiskVolumeSource"},
},
"k8s.io/kubernetes/pkg/api/v1.PersistentVolumeSpec": {
Schema: spec.Schema{
@ -5724,6 +5730,12 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
Ref: ref("k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource"),
},
},
"scaleIO": {
SchemaProps: spec.SchemaProps{
Description: "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
Ref: ref("k8s.io/kubernetes/pkg/api/v1.ScaleIOVolumeSource"),
},
},
"accessModes": {
SchemaProps: spec.SchemaProps{
Description: "AccessModes contains all ways the volume can be mounted. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#access-modes",
@ -5762,7 +5774,7 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/api/resource.Quantity", "k8s.io/kubernetes/pkg/api/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureFileVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CephFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CinderVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FCVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlexVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlockerVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GCEPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GlusterfsVolumeSource", "k8s.io/kubernetes/pkg/api/v1.HostPathVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ISCSIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.NFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ObjectReference", "k8s.io/kubernetes/pkg/api/v1.PhotonPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource", "k8s.io/kubernetes/pkg/api/v1.QuobyteVolumeSource", "k8s.io/kubernetes/pkg/api/v1.RBDVolumeSource", "k8s.io/kubernetes/pkg/api/v1.VsphereVirtualDiskVolumeSource"},
"k8s.io/apimachinery/pkg/api/resource.Quantity", "k8s.io/kubernetes/pkg/api/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureFileVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CephFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CinderVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FCVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlexVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlockerVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GCEPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GlusterfsVolumeSource", "k8s.io/kubernetes/pkg/api/v1.HostPathVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ISCSIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.NFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ObjectReference", "k8s.io/kubernetes/pkg/api/v1.PhotonPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource", "k8s.io/kubernetes/pkg/api/v1.QuobyteVolumeSource", "k8s.io/kubernetes/pkg/api/v1.RBDVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ScaleIOVolumeSource", "k8s.io/kubernetes/pkg/api/v1.VsphereVirtualDiskVolumeSource"},
},
"k8s.io/kubernetes/pkg/api/v1.PersistentVolumeStatus": {
Schema: spec.Schema{
@ -7731,6 +7743,87 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
},
Dependencies: []string{},
},
"k8s.io/kubernetes/pkg/api/v1.ScaleIOVolumeSource": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ScaleIOVolumeSource represents a persistent ScaleIO volume",
Properties: map[string]spec.Schema{
"gateway": {
SchemaProps: spec.SchemaProps{
Description: "The host address of the ScaleIO API Gateway.",
Type: []string{"string"},
Format: "",
},
},
"system": {
SchemaProps: spec.SchemaProps{
Description: "The name of the storage system as configured in ScaleIO.",
Type: []string{"string"},
Format: "",
},
},
"secretRef": {
SchemaProps: spec.SchemaProps{
Description: "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.",
Ref: ref("k8s.io/kubernetes/pkg/api/v1.LocalObjectReference"),
},
},
"sslEnabled": {
SchemaProps: spec.SchemaProps{
Description: "Flag to enable/disable SSL communication with Gateway, default false",
Type: []string{"boolean"},
Format: "",
},
},
"protectionDomain": {
SchemaProps: spec.SchemaProps{
Description: "The name of the Protection Domain for the configured storage (defaults to \"default\").",
Type: []string{"string"},
Format: "",
},
},
"storagePool": {
SchemaProps: spec.SchemaProps{
Description: "The Storage Pool associated with the protection domain (defaults to \"default\").",
Type: []string{"string"},
Format: "",
},
},
"storageMode": {
SchemaProps: spec.SchemaProps{
Description: "Indicates whether the storage for a volume should be thick or thin (defaults to \"thin\").",
Type: []string{"string"},
Format: "",
},
},
"volumeName": {
SchemaProps: spec.SchemaProps{
Description: "The name of a volume already created in the ScaleIO system that is associated with this volume source.",
Type: []string{"string"},
Format: "",
},
},
"fsType": {
SchemaProps: spec.SchemaProps{
Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
Type: []string{"string"},
Format: "",
},
},
"readOnly": {
SchemaProps: spec.SchemaProps{
Description: "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
Type: []string{"boolean"},
Format: "",
},
},
},
Required: []string{"gateway", "system", "secretRef"},
},
},
Dependencies: []string{
"k8s.io/kubernetes/pkg/api/v1.LocalObjectReference"},
},
"k8s.io/kubernetes/pkg/api/v1.Secret": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
@ -8755,12 +8848,18 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
Ref: ref("k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource"),
},
},
"scaleIO": {
SchemaProps: spec.SchemaProps{
Description: "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
Ref: ref("k8s.io/kubernetes/pkg/api/v1.ScaleIOVolumeSource"),
},
},
},
Required: []string{"name"},
},
},
Dependencies: []string{
"k8s.io/kubernetes/pkg/api/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureFileVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CephFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CinderVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ConfigMapVolumeSource", "k8s.io/kubernetes/pkg/api/v1.DownwardAPIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.EmptyDirVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FCVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlexVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlockerVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GCEPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GitRepoVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GlusterfsVolumeSource", "k8s.io/kubernetes/pkg/api/v1.HostPathVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ISCSIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.NFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PersistentVolumeClaimVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PhotonPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ProjectedVolumeSource", "k8s.io/kubernetes/pkg/api/v1.QuobyteVolumeSource", "k8s.io/kubernetes/pkg/api/v1.RBDVolumeSource", "k8s.io/kubernetes/pkg/api/v1.SecretVolumeSource", "k8s.io/kubernetes/pkg/api/v1.VsphereVirtualDiskVolumeSource"},
"k8s.io/kubernetes/pkg/api/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureFileVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CephFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CinderVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ConfigMapVolumeSource", "k8s.io/kubernetes/pkg/api/v1.DownwardAPIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.EmptyDirVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FCVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlexVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlockerVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GCEPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GitRepoVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GlusterfsVolumeSource", "k8s.io/kubernetes/pkg/api/v1.HostPathVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ISCSIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.NFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PersistentVolumeClaimVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PhotonPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ProjectedVolumeSource", "k8s.io/kubernetes/pkg/api/v1.QuobyteVolumeSource", "k8s.io/kubernetes/pkg/api/v1.RBDVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ScaleIOVolumeSource", "k8s.io/kubernetes/pkg/api/v1.SecretVolumeSource", "k8s.io/kubernetes/pkg/api/v1.VsphereVirtualDiskVolumeSource"},
},
"k8s.io/kubernetes/pkg/api/v1.VolumeMount": {
Schema: spec.Schema{
@ -8985,11 +9084,17 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
Ref: ref("k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource"),
},
},
"scaleIO": {
SchemaProps: spec.SchemaProps{
Description: "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
Ref: ref("k8s.io/kubernetes/pkg/api/v1.ScaleIOVolumeSource"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/kubernetes/pkg/api/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureFileVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CephFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CinderVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ConfigMapVolumeSource", "k8s.io/kubernetes/pkg/api/v1.DownwardAPIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.EmptyDirVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FCVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlexVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlockerVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GCEPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GitRepoVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GlusterfsVolumeSource", "k8s.io/kubernetes/pkg/api/v1.HostPathVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ISCSIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.NFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PersistentVolumeClaimVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PhotonPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ProjectedVolumeSource", "k8s.io/kubernetes/pkg/api/v1.QuobyteVolumeSource", "k8s.io/kubernetes/pkg/api/v1.RBDVolumeSource", "k8s.io/kubernetes/pkg/api/v1.SecretVolumeSource", "k8s.io/kubernetes/pkg/api/v1.VsphereVirtualDiskVolumeSource"},
"k8s.io/kubernetes/pkg/api/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.AzureFileVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CephFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.CinderVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ConfigMapVolumeSource", "k8s.io/kubernetes/pkg/api/v1.DownwardAPIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.EmptyDirVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FCVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlexVolumeSource", "k8s.io/kubernetes/pkg/api/v1.FlockerVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GCEPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GitRepoVolumeSource", "k8s.io/kubernetes/pkg/api/v1.GlusterfsVolumeSource", "k8s.io/kubernetes/pkg/api/v1.HostPathVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ISCSIVolumeSource", "k8s.io/kubernetes/pkg/api/v1.NFSVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PersistentVolumeClaimVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PhotonPersistentDiskVolumeSource", "k8s.io/kubernetes/pkg/api/v1.PortworxVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ProjectedVolumeSource", "k8s.io/kubernetes/pkg/api/v1.QuobyteVolumeSource", "k8s.io/kubernetes/pkg/api/v1.RBDVolumeSource", "k8s.io/kubernetes/pkg/api/v1.ScaleIOVolumeSource", "k8s.io/kubernetes/pkg/api/v1.SecretVolumeSource", "k8s.io/kubernetes/pkg/api/v1.VsphereVirtualDiskVolumeSource"},
},
"k8s.io/kubernetes/pkg/api/v1.VsphereVirtualDiskVolumeSource": {
Schema: spec.Schema{

View File

@ -626,6 +626,8 @@ func describeVolumes(volumes []api.Volume, w *PrefixWriter, space string) {
printPhotonPersistentDiskVolumeSource(volume.VolumeSource.PhotonPersistentDisk, w)
case volume.VolumeSource.PortworxVolume != nil:
printPortworxVolumeSource(volume.VolumeSource.PortworxVolume, w)
case volume.VolumeSource.ScaleIO != nil:
printScaleIOVolumeSource(volume.VolumeSource.ScaleIO, w)
default:
w.Write(LEVEL_1, "<unknown>\n")
}
@ -788,6 +790,19 @@ func printCinderVolumeSource(cinder *api.CinderVolumeSource, w *PrefixWriter) {
cinder.VolumeID, cinder.FSType, cinder.ReadOnly)
}
func printScaleIOVolumeSource(sio *api.ScaleIOVolumeSource, w *PrefixWriter) {
w.Write(LEVEL_2, "Type:\tScaleIO (a persistent volume backed by a block device in ScaleIO)\n"+
" Gateway:\t%v\n"+
" System:\t%v\n"+
" Protection Domain:\t%v\n"+
" Storage Pool:\t%v\n"+
" Storage Mode:\t%v\n"+
" VolumeName:\t%v\n"+
" FSType:\t%v\n"+
" ReadOnly:\t%v\n",
sio.Gateway, sio.System, sio.ProtectionDomain, sio.StoragePool, sio.StorageMode, sio.VolumeName, sio.FSType, sio.ReadOnly)
}
type PersistentVolumeDescriber struct {
clientset.Interface
}
@ -852,6 +867,8 @@ func (d *PersistentVolumeDescriber) Describe(namespace, name string, describerSe
printPhotonPersistentDiskVolumeSource(pv.Spec.PhotonPersistentDisk, w)
case pv.Spec.PortworxVolume != nil:
printPortworxVolumeSource(pv.Spec.PortworxVolume, w)
case pv.Spec.ScaleIO != nil:
printScaleIOVolumeSource(pv.Spec.ScaleIO, w)
}
if events != nil {

View File

@ -64,6 +64,7 @@ func GetAllFSTypesAsSet() sets.String {
string(extensions.PhotonPersistentDisk),
string(extensions.Projected),
string(extensions.PortworxVolume),
string(extensions.ScaleIO),
)
return fstypes
}
@ -121,6 +122,8 @@ func GetVolumeFSType(v api.Volume) (extensions.FSType, error) {
return extensions.Projected, nil
case v.PortworxVolume != nil:
return extensions.PortworxVolume, nil
case v.ScaleIO != nil:
return extensions.ScaleIO, nil
}
return "", fmt.Errorf("unknown volume type for volume: %#v", v)

View File

@ -114,6 +114,7 @@ filegroup(
"//pkg/volume/projected:all-srcs",
"//pkg/volume/quobyte:all-srcs",
"//pkg/volume/rbd:all-srcs",
"//pkg/volume/scaleio:all-srcs",
"//pkg/volume/secret:all-srcs",
"//pkg/volume/testing:all-srcs",
"//pkg/volume/util:all-srcs",

72
pkg/volume/scaleio/BUILD Normal file
View File

@ -0,0 +1,72 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
go_test(
name = "go_default_test",
srcs = [
"sio_mgr_test.go",
"sio_util_test.go",
"sio_volume_test.go",
],
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//pkg/api/v1:go_default_library",
"//pkg/client/clientset_generated/clientset/fake:go_default_library",
"//pkg/util/mount:go_default_library",
"//pkg/volume:go_default_library",
"//pkg/volume/testing:go_default_library",
"//vendor:github.com/codedellemc/goscaleio/types/v1",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/client-go/util/testing",
],
)
go_library(
name = "go_default_library",
srcs = [
"sio_client.go",
"sio_mgr.go",
"sio_plugin.go",
"sio_util.go",
"sio_volume.go",
],
tags = ["automanaged"],
deps = [
"//pkg/api/v1:go_default_library",
"//pkg/util/exec:go_default_library",
"//pkg/util/keymutex:go_default_library",
"//pkg/util/mount:go_default_library",
"//pkg/util/strings:go_default_library",
"//pkg/volume:go_default_library",
"//pkg/volume/util:go_default_library",
"//vendor:github.com/codedellemc/goscaleio",
"//vendor:github.com/codedellemc/goscaleio/types/v1",
"//vendor:github.com/golang/glog",
"//vendor:k8s.io/apimachinery/pkg/api/resource",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/apimachinery/pkg/util/uuid",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)

View File

@ -0,0 +1,539 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scaleio
import (
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"path/filepath"
"regexp"
"strconv"
"strings"
"sync"
"time"
sio "github.com/codedellemc/goscaleio"
siotypes "github.com/codedellemc/goscaleio/types/v1"
"github.com/golang/glog"
)
var (
sioDiskIDPath = "/dev/disk/by-id"
)
type sioVolumeID string
type sioInterface interface {
FindVolume(name string) (*siotypes.Volume, error)
Volume(sioVolumeID) (*siotypes.Volume, error)
CreateVolume(name string, sizeGB int64) (*siotypes.Volume, error)
AttachVolume(sioVolumeID) error
DetachVolume(sioVolumeID) error
DeleteVolume(sioVolumeID) error
IID() (string, error)
Devs() (map[string]string, error)
WaitForAttachedDevice(token string) (string, error)
WaitForDetachedDevice(token string) error
GetVolumeRefs(sioVolumeID) (int, error)
}
type sioClient struct {
client *sio.Client
gateway string
username string
password string
insecure bool
certsEnabled bool
system *siotypes.System
sysName string
sysClient *sio.System
protectionDomain *siotypes.ProtectionDomain
pdName string
pdClient *sio.ProtectionDomain
storagePool *siotypes.StoragePool
spName string
spClient *sio.StoragePool
provisionMode string
sdcPath string
instanceID string
inited bool
diskRegex *regexp.Regexp
mtx sync.Mutex
}
func newSioClient(gateway, username, password string, sslEnabled bool) (*sioClient, error) {
client := new(sioClient)
client.gateway = gateway
client.username = username
client.password = password
if sslEnabled {
client.insecure = false
client.certsEnabled = true
} else {
client.insecure = true
client.certsEnabled = false
}
r, err := regexp.Compile(`^emc-vol-\w*-\w*$`)
if err != nil {
glog.Error(log("failed to compile regex: %v", err))
return nil, err
}
client.diskRegex = r
// delay client setup/login until init()
return client, nil
}
// init setups client and authenticate
func (c *sioClient) init() error {
c.mtx.Lock()
defer c.mtx.Unlock()
if c.inited {
return nil
}
glog.V(4).Infoln(log("initializing scaleio client"))
client, err := sio.NewClientWithArgs(c.gateway, "", c.insecure, c.certsEnabled)
if err != nil {
glog.Error(log("failed to create client: %v", err))
return err
}
c.client = client
if _, err = c.client.Authenticate(
&sio.ConfigConnect{
Endpoint: c.gateway,
Version: "",
Username: c.username,
Password: c.password},
); err != nil {
glog.Error(log("client authentication failed: %v", err))
return err
}
// retrieve system
if c.system, err = c.findSystem(c.sysName); err != nil {
glog.Error(log("unable to find system %s: %v", c.sysName, err))
return err
}
// retrieve protection domain
if c.protectionDomain, err = c.findProtectionDomain(c.pdName); err != nil {
glog.Error(log("unable to find protection domain %s: %v", c.protectionDomain, err))
return err
}
// retrieve storage pool
if c.storagePool, err = c.findStoragePool(c.spName); err != nil {
glog.Error(log("unable to find storage pool %s: %v", c.storagePool, err))
return err
}
c.inited = true
return nil
}
func (c *sioClient) Volumes() ([]*siotypes.Volume, error) {
if err := c.init(); err != nil {
return nil, err
}
vols, err := c.getVolumes()
if err != nil {
glog.Error(log("failed to retrieve volumes: %v", err))
return nil, err
}
return vols, nil
}
func (c *sioClient) Volume(id sioVolumeID) (*siotypes.Volume, error) {
if err := c.init(); err != nil {
return nil, err
}
vols, err := c.getVolumesByID(id)
if err != nil {
glog.Error(log("failed to retrieve volume by id: %v", err))
return nil, err
}
vol := vols[0]
if vol == nil {
glog.V(4).Info(log("volume not found, id %s", id))
return nil, errors.New("volume not found")
}
return vol, nil
}
func (c *sioClient) FindVolume(name string) (*siotypes.Volume, error) {
if err := c.init(); err != nil {
return nil, err
}
glog.V(4).Info(log("searching for volume %s", name))
volumes, err := c.getVolumesByName(name)
if err != nil {
glog.Error(log("failed to find volume by name %v", err))
return nil, err
}
for _, volume := range volumes {
if volume.Name == name {
glog.V(4).Info(log("found volume %s", name))
return volume, nil
}
}
glog.V(4).Info(log("volume not found, name %s", name))
return nil, errors.New("volume not found")
}
func (c *sioClient) CreateVolume(name string, sizeGB int64) (*siotypes.Volume, error) {
if err := c.init(); err != nil {
return nil, err
}
params := &siotypes.VolumeParam{
Name: name,
VolumeSizeInKb: strconv.Itoa(int(sizeGB) * 1024 * 1024),
VolumeType: c.provisionMode,
}
createResponse, err := c.client.CreateVolume(params, c.storagePool.Name)
if err != nil {
glog.Error(log("failed to create volume %s: %v", name, err))
return nil, err
}
return c.Volume(sioVolumeID(createResponse.ID))
}
// AttachVolume maps the scaleio volume to an sdc node.
func (c *sioClient) AttachVolume(id sioVolumeID) error {
if err := c.init(); err != nil {
glog.Error(log("failed to init'd client in attach volume: %v", err))
return err
}
iid, err := c.IID()
if err != nil {
glog.Error(log("failed to get instanceIID for attach volume: %v", err))
return err
}
params := &siotypes.MapVolumeSdcParam{
SdcID: iid,
AllowMultipleMappings: "false",
AllSdcs: "",
}
volClient := sio.NewVolume(c.client)
volClient.Volume = &siotypes.Volume{ID: string(id)}
if err := volClient.MapVolumeSdc(params); err != nil {
glog.Error(log("failed to attach volume id %s: %v", id, err))
return err
}
glog.V(4).Info(log("volume %s attached successfully", id))
return nil
}
// DetachVolume detaches the volume with specified id.
func (c *sioClient) DetachVolume(id sioVolumeID) error {
if err := c.init(); err != nil {
return err
}
iid, err := c.IID()
if err != nil {
return err
}
params := &siotypes.UnmapVolumeSdcParam{
SdcID: "",
IgnoreScsiInitiators: "true",
AllSdcs: iid,
}
volClient := sio.NewVolume(c.client)
volClient.Volume = &siotypes.Volume{ID: string(id)}
if err := volClient.UnmapVolumeSdc(params); err != nil {
return err
}
return nil
}
// DeleteVolume deletes the volume with the specified id
func (c *sioClient) DeleteVolume(id sioVolumeID) error {
if err := c.init(); err != nil {
return err
}
vol, err := c.Volume(id)
if err != nil {
return err
}
volClient := sio.NewVolume(c.client)
volClient.Volume = vol
if err := volClient.RemoveVolume("ONLY_ME"); err != nil {
return err
}
return nil
}
func (c *sioClient) IID() (string, error) {
if err := c.init(); err != nil {
return "", err
}
if c.instanceID == "" {
cmd := c.getSdcCmd()
output, err := exec.Command(cmd, "--query_guid").Output()
if err != nil {
glog.Error(log("drv_cfg --query_guid failed: %v", err))
return "", err
}
guid := strings.TrimSpace(string(output))
sdc, err := c.sysClient.FindSdc("SdcGuid", guid)
if err != nil {
glog.Error(log("failed to get sdc info %s", err))
return "", err
}
c.instanceID = sdc.Sdc.ID
glog.V(4).Info(log("got instanceID %s", c.instanceID))
}
return c.instanceID, nil
}
// getSioDiskPaths traverse local disk devices to retrieve device path
// The path is extracted from /dev/disk/by-id; each sio device path has format:
// emc-vol-<mdmID-volID> e.g.:
// emc-vol-788d9efb0a8f20cb-a2b8419300000000
func (c *sioClient) getSioDiskPaths() ([]os.FileInfo, error) {
files, err := ioutil.ReadDir(sioDiskIDPath)
if err != nil {
glog.Error(log("failed to ReadDir %s: %v", sioDiskIDPath, err))
return nil, err
}
result := []os.FileInfo{}
for _, file := range files {
if c.diskRegex.MatchString(file.Name()) {
result = append(result, file)
}
}
return result, nil
}
// GetVolumeRefs counts the number of references an SIO volume has a disk device.
// This is useful in preventing premature detach.
func (c *sioClient) GetVolumeRefs(volId sioVolumeID) (refs int, err error) {
files, err := c.getSioDiskPaths()
if err != nil {
return 0, err
}
for _, file := range files {
if strings.Contains(file.Name(), string(volId)) {
refs++
}
}
return
}
// Devs returns a map of local devices as map[<volume.id>]<deviceName>
func (c *sioClient) Devs() (map[string]string, error) {
volumeMap := make(map[string]string)
// grab the sdc tool output
out, err := exec.Command(c.getSdcCmd(), "--query_vols").Output()
if err != nil {
glog.Error(log("sdc --query_vols failed: %v", err))
return nil, err
}
// --query_vols output is a heading followed by list of attached vols as follows:
// Retrieve ? volume(s)
// VOL-ID a2b8419300000000 MDM-ID 788d9efb0a8f20cb
// ...
// parse output and store it in a map as map[<mdmID-volID>]volID
// that map is used later to retrieve device path (next section)
result := string(out)
mdmMap := make(map[string]string)
lines := strings.Split(result, "\n")
for _, line := range lines {
//line e.g.: "VOL-ID a2b8419300000000 MDM-ID 788d9efb0a8f20cb"
if strings.HasPrefix(line, "VOL-ID") {
//split[1] = volID; split[3] = mdmID
split := strings.Split(line, " ")
key := fmt.Sprintf("%s-%s", split[3], split[1])
mdmMap[key] = split[1]
}
}
files, err := c.getSioDiskPaths()
if err != nil {
return nil, err
}
for _, f := range files {
// remove emec-vol- prefix to be left with concated mdmID-volID
mdmVolumeID := strings.Replace(f.Name(), "emc-vol-", "", 1)
devPath, err := filepath.EvalSymlinks(fmt.Sprintf("%s/%s", sioDiskIDPath, f.Name()))
if err != nil {
glog.Error(log("devicepath-to-volID mapping error: %v", err))
return nil, err
}
// map volID to devicePath
if volumeID, ok := mdmMap[mdmVolumeID]; ok {
volumeMap[volumeID] = devPath
}
}
return volumeMap, nil
}
// WaitForAttachedDevice sets up a timer to wait for an attached device to appear in the instance's list.
func (c *sioClient) WaitForAttachedDevice(token string) (string, error) {
if token == "" {
return "", fmt.Errorf("invalid attach token")
}
// wait for device to show up in local device list
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
timer := time.NewTimer(30 * time.Second)
defer ticker.Stop()
for {
select {
case <-ticker.C:
devMap, err := c.Devs()
if err != nil {
glog.Error(log("failed while waiting for volume to attach: %v", err))
return "", err
}
go func() {
glog.V(4).Infof(log("waiting for volume %s to be mapped/attached", token))
}()
if path, ok := devMap[token]; ok {
glog.V(4).Info(log("device %s mapped to vol %s", path, token))
return path, nil
}
case <-timer.C:
glog.Error(log("timed out while waiting for volume to be mapped to a device"))
return "", fmt.Errorf("volume attach timeout")
}
}
}
// waitForDetachedDevice waits for device to be detached
func (c *sioClient) WaitForDetachedDevice(token string) error {
if token == "" {
return fmt.Errorf("invalid detach token")
}
// wait for attach.Token to show up in local device list
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
timer := time.NewTimer(30 * time.Second)
defer ticker.Stop()
for {
select {
case <-ticker.C:
devMap, err := c.Devs()
if err != nil {
glog.Error(log("failed while waiting for volume to unmap/detach: %v", err))
return err
}
go func() {
glog.V(4).Infof(log("waiting for volume %s to be unmapped/detached", token))
}()
// cant find vol id, then ok.
if _, ok := devMap[token]; !ok {
return nil
}
case <-timer.C:
glog.Error(log("timed out while waiting for volume %s to be unmapped/detached", token))
return fmt.Errorf("volume detach timeout")
}
}
}
// ***********************************************************************
// Little Helpers!
// ***********************************************************************
func (c *sioClient) findSystem(sysname string) (sys *siotypes.System, err error) {
if c.sysClient, err = c.client.FindSystem("", sysname, ""); err != nil {
return nil, err
}
systems, err := c.client.GetInstance("")
if err != nil {
glog.Error(log("failed to retrieve instances: %v", err))
return nil, err
}
for _, sys = range systems {
if sys.Name == sysname {
return sys, nil
}
}
glog.Error(log("system %s not found", sysname))
return nil, errors.New("system not found")
}
func (c *sioClient) findProtectionDomain(pdname string) (*siotypes.ProtectionDomain, error) {
c.pdClient = sio.NewProtectionDomain(c.client)
if c.sysClient != nil {
protectionDomain, err := c.sysClient.FindProtectionDomain("", pdname, "")
if err != nil {
glog.Error(log("failed to retrieve protection domains: %v", err))
return nil, err
}
c.pdClient.ProtectionDomain = protectionDomain
return protectionDomain, nil
}
glog.Error(log("protection domain %s not set", pdname))
return nil, errors.New("protection domain not set")
}
func (c *sioClient) findStoragePool(spname string) (*siotypes.StoragePool, error) {
c.spClient = sio.NewStoragePool(c.client)
if c.pdClient != nil {
sp, err := c.pdClient.FindStoragePool("", spname, "")
if err != nil {
glog.Error(log("failed to retrieve storage pool: %v", err))
return nil, err
}
c.spClient.StoragePool = sp
return sp, nil
}
glog.Error(log("storage pool %s not set", spname))
return nil, errors.New("storage pool not set")
}
func (c *sioClient) getVolumes() ([]*siotypes.Volume, error) {
return c.client.GetVolume("", "", "", "", true)
}
func (c *sioClient) getVolumesByID(id sioVolumeID) ([]*siotypes.Volume, error) {
return c.client.GetVolume("", string(id), "", "", true)
}
func (c *sioClient) getVolumesByName(name string) ([]*siotypes.Volume, error) {
return c.client.GetVolume("", "", "", name, true)
}
func (c *sioClient) getSdcPath() string {
return sdcRootPath
}
func (c *sioClient) getSdcCmd() string {
return path.Join(c.getSdcPath(), "drv_cfg")
}

View File

@ -0,0 +1,258 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scaleio
import (
"errors"
"strconv"
"github.com/golang/glog"
siotypes "github.com/codedellemc/goscaleio/types/v1"
)
type storageInterface interface {
CreateVolume(string, int64) (*siotypes.Volume, error)
AttachVolume(string) (string, error)
IsAttached(string) (bool, error)
DetachVolume(string) error
DeleteVolume(string) error
}
type sioMgr struct {
client sioInterface
configData map[string]string
}
func newSioMgr(configs map[string]string) (*sioMgr, error) {
if configs == nil {
return nil, errors.New("missing configuration data")
}
configs[confKey.protectionDomain] = defaultString(configs[confKey.protectionDomain], "default")
configs[confKey.storagePool] = defaultString(configs[confKey.storagePool], "default")
configs[confKey.sdcRootPath] = defaultString(configs[confKey.sdcRootPath], sdcRootPath)
configs[confKey.storageMode] = defaultString(configs[confKey.storageMode], "ThinProvisioned")
mgr := &sioMgr{configData: configs}
return mgr, nil
}
// getClient safely returns an sioInterface
func (m *sioMgr) getClient() (sioInterface, error) {
if m.client == nil {
glog.V(4).Info(log("creating scaleio client"))
configs := m.configData
username := configs[confKey.username]
password := configs[confKey.password]
gateway := configs[confKey.gateway]
b, err := strconv.ParseBool(configs[confKey.sslEnabled])
if err != nil {
glog.Error(log("failed to parse sslEnabled, must be either \"true\" or \"false\""))
return nil, err
}
certsEnabled := b
glog.V(4).Info(log("creating new client for gateway %s", gateway))
client, err := newSioClient(gateway, username, password, certsEnabled)
if err != nil {
glog.Error(log("failed to create scaleio client: %v", err))
return nil, err
}
client.sysName = configs[confKey.system]
client.pdName = configs[confKey.protectionDomain]
client.spName = configs[confKey.storagePool]
client.sdcPath = configs[confKey.sdcRootPath]
client.provisionMode = configs[confKey.storageMode]
m.client = client
glog.V(4).Info(log("client created successfully [gateway=%s]", gateway))
}
return m.client, nil
}
// CreateVolume creates a new ScaleIO volume
func (m *sioMgr) CreateVolume(volName string, sizeGB int64) (*siotypes.Volume, error) {
client, err := m.getClient()
if err != nil {
return nil, err
}
glog.V(4).Infof("scaleio: creating volume %s", volName)
vol, err := client.CreateVolume(volName, sizeGB)
if err != nil {
glog.V(4).Infof("scaleio: failed creating volume %s: %v", volName, err)
return nil, err
}
glog.V(4).Infof("scaleio: created volume %s successfully", volName)
return vol, nil
}
// AttachVolume maps a ScaleIO volume to the running node
func (m *sioMgr) AttachVolume(volName string) (string, error) {
client, err := m.getClient()
if err != nil {
glog.Error(log("attach volume failed: %v", err))
return "", err
}
glog.V(4).Infoln(log("attaching volume %s", volName))
iid, err := client.IID()
if err != nil {
glog.Error(log("failed to get instanceID"))
return "", err
}
glog.V(4).Info(log("attaching volume %s to host instance %s", volName, iid))
devs, err := client.Devs()
if err != nil {
return "", err
}
vol, err := client.FindVolume(volName)
if err != nil {
glog.Error(log("failed to find volume %s: %v", volName, err))
return "", err
}
// handle vol if already attached
if len(vol.MappedSdcInfo) > 0 {
if m.isSdcMappedToVol(iid, vol) {
glog.V(4).Info(log("skippping attachment, volume %s already attached to sdc %s", volName, iid))
return devs[vol.ID], nil
}
}
// attach volume, get deviceName
if err := client.AttachVolume(sioVolumeID(vol.ID)); err != nil {
glog.Error(log("attachment for volume %s failed :%v", volName, err))
return "", err
}
device, err := client.WaitForAttachedDevice(vol.ID)
if err != nil {
glog.Error(log("failed while waiting for device to attach: %v", err))
return "", err
}
glog.V(4).Info(log("volume %s attached succesfully as %s to instance %s", volName, device, iid))
return device, nil
}
// IsAttached verifies that the named ScaleIO volume is still attached
func (m *sioMgr) IsAttached(volName string) (bool, error) {
client, err := m.getClient()
if err != nil {
return false, err
}
iid, err := client.IID()
if err != nil {
glog.Error("scaleio: failed to get instanceID")
return false, err
}
vol, err := client.FindVolume(volName)
if err != nil {
return false, err
}
return m.isSdcMappedToVol(iid, vol), nil
}
// DetachVolume detaches the name ScaleIO volume from an instance
func (m *sioMgr) DetachVolume(volName string) error {
client, err := m.getClient()
if err != nil {
return err
}
iid, err := client.IID()
if err != nil {
glog.Error(log("failed to get instanceID: %v", err))
return err
}
vol, err := client.FindVolume(volName)
if err != nil {
return err
}
if !m.isSdcMappedToVol(iid, vol) {
glog.Warning(log(
"skipping detached, vol %s not attached to instance %s",
volName, iid,
))
return nil
}
if err := client.DetachVolume(sioVolumeID(vol.ID)); err != nil {
glog.Error(log("failed to detach vol %s: %v", volName, err))
return err
}
glog.V(4).Info(log("volume %s detached successfully", volName))
return nil
}
// DeleteVolumes removes the ScaleIO volume
func (m *sioMgr) DeleteVolume(volName string) error {
client, err := m.getClient()
if err != nil {
return err
}
iid, err := client.IID()
if err != nil {
glog.Error(log("failed to get instanceID: %v", err))
return err
}
vol, err := client.FindVolume(volName)
if err != nil {
return err
}
// if still attached, stop
if m.isSdcMappedToVol(iid, vol) {
glog.Error(log("volume %s still attached, unable to delete", volName))
return errors.New("volume still attached")
}
if err := client.DeleteVolume(sioVolumeID(vol.ID)); err != nil {
glog.Error(log("failed to delete volume %s: %v", volName, err))
return err
}
glog.V(4).Info(log("deleted volume %s successfully", volName))
return nil
}
//*****************************************************************
// Helpers
//*****************************************************************
// isSdcMappedToVol returns true if the sdc is mapped to the volume
func (m *sioMgr) isSdcMappedToVol(sdcID string, vol *siotypes.Volume) bool {
if len(vol.MappedSdcInfo) == 0 {
glog.V(4).Info(log("no attachment found"))
return false
}
for _, sdcInfo := range vol.MappedSdcInfo {
if sdcInfo.SdcID == sdcID {
return true
}
}
return false
}

View File

@ -0,0 +1,333 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scaleio
import (
"errors"
"testing"
"time"
siotypes "github.com/codedellemc/goscaleio/types/v1"
)
var (
fakeSdcID = "test-sdc-123456789"
fakeVolumeName = "test-vol-0001"
fakeVolumeID = "1234567890"
fakeDev = "/dev/testABC"
fakeConfig = map[string]string{
confKey.gateway: "http://sio.gateway:1234",
confKey.sslEnabled: "false",
confKey.system: "scaleio",
confKey.volumeName: "sio-0001",
confKey.secretRef: "sio-secret",
confKey.username: "c2lvdXNlcgo=", // siouser
confKey.password: "c2lvcGFzc3dvcmQK", // siopassword
}
)
func newTestMgr(t *testing.T) *sioMgr {
mgr, err := newSioMgr(fakeConfig)
if err != nil {
t.Error(err)
}
mgr.client = newFakeSio()
return mgr
}
func TestMgrNew(t *testing.T) {
mgr, err := newSioMgr(fakeConfig)
if err != nil {
t.Fatal(err)
}
if mgr.configData == nil {
t.Fatal("configuration data not set")
}
if mgr.configData[confKey.volumeName] != "sio-0001" {
t.Errorf("expecting %s, got %s", "sio-0001", mgr.configData[confKey.volumeName])
}
// check defaults
if mgr.configData[confKey.protectionDomain] != "default" {
t.Errorf("unexpected value for confData[protectionDomain] %s", mgr.configData[confKey.protectionDomain])
}
if mgr.configData[confKey.storagePool] != "default" {
t.Errorf("unexpected value for confData[storagePool] %s", mgr.configData[confKey.storagePool])
}
if mgr.configData[confKey.storageMode] != "ThinProvisioned" {
t.Errorf("unexpected value for confData[storageMode] %s", mgr.configData[confKey.storageMode])
}
}
func TestMgrGetClient(t *testing.T) {
mgr := newTestMgr(t)
_, err := mgr.getClient()
if err != nil {
t.Fatal(err)
}
if mgr.client == nil {
t.Fatal("mgr.client not set")
}
}
func TestMgrCreateVolume(t *testing.T) {
mgr := newTestMgr(t)
vol, err := mgr.CreateVolume("test-vol-0001", 8*1024*1024)
if err != nil {
t.Fatal(err)
}
if vol.Name != "test-vol-0001" {
t.Errorf("unexpected vol.Name %s", vol.Name)
}
}
func TestMgrAttachVolume(t *testing.T) {
mgr := newTestMgr(t)
mgr.CreateVolume("test-vol-0001", 8*1024*1024)
device, err := mgr.AttachVolume("test-vol-0001")
if err != nil {
t.Fatal(err)
}
if device != "/dev/testABC" {
t.Errorf("unexpected value for mapped device %s", device)
}
}
func TestMgrAttachVolume_AlreadyAttached(t *testing.T) {
mgr := newTestMgr(t)
mgr.CreateVolume("test-vol-0001", 8*1024*1024)
mgr.AttachVolume("test-vol-0001")
dev, err := mgr.AttachVolume("test-vol-0001")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if dev != "/dev/testABC" {
t.Errorf("unexpected value for mapped device %s", dev)
}
}
func TestMgrAttachVolume_VolumeNotFoundError(t *testing.T) {
mgr := newTestMgr(t)
mgr.CreateVolume("test-vol-0001", 8*1024*1024)
_, err := mgr.AttachVolume("test-vol-0002")
if err == nil {
t.Error("attachVolume should fail with volume not found error")
}
}
func TestMgrAttachVolume_WaitForAttachError(t *testing.T) {
mgr := newTestMgr(t)
mgr.CreateVolume("test-vol-0001", 8*1024*1024)
go func() {
c := mgr.client.(*fakeSio)
close(c.waitAttachCtrl)
}()
_, err := mgr.AttachVolume("test-vol-0001")
if err == nil {
t.Error("attachVolume should fail with attach timeout error")
}
}
func TestMgrDetachVolume(t *testing.T) {
mgr := newTestMgr(t)
mgr.CreateVolume("test-vol-0001", 8*1024*1024)
mgr.AttachVolume("test-vol-0001")
if err := mgr.DetachVolume("test-vol-0001"); err != nil {
t.Fatal(err)
}
fakeSio := mgr.client.(*fakeSio)
if len(fakeSio.volume.MappedSdcInfo) != 0 {
t.Errorf("expecting attached sdc to 0, got %d", len(fakeSio.volume.MappedSdcInfo))
}
if len(fakeSio.devs) != 0 {
t.Errorf("expecting local devs to be 0, got %d", len(fakeSio.devs))
}
}
func TestMgrDetachVolume_VolumeNotFound(t *testing.T) {
mgr := newTestMgr(t)
mgr.CreateVolume("test-vol-0001", 8*1024*1024)
mgr.AttachVolume("test-vol-0001")
err := mgr.DetachVolume("test-vol-0002")
if err == nil {
t.Fatal("expected a volume not found failure")
}
}
func TestMgrDetachVolume_VolumeNotAttached(t *testing.T) {
mgr := newTestMgr(t)
mgr.CreateVolume("test-vol-0001", 8*1024*1024)
err := mgr.DetachVolume("test-vol-0001")
if err != nil {
t.Fatal(err)
}
}
func TestMgrDetachVolume_VolumeAlreadyDetached(t *testing.T) {
mgr := newTestMgr(t)
mgr.CreateVolume("test-vol-0001", 8*1024*1024)
mgr.AttachVolume("test-vol-0001")
mgr.DetachVolume("test-vol-0001")
err := mgr.DetachVolume("test-vol-0001")
if err != nil {
t.Fatal("failed detaching a volume already detached")
}
}
func TestMgrDetachVolume_WaitForDetachError(t *testing.T) {
mgr := newTestMgr(t)
mgr.CreateVolume("test-vol-0001", 8*1024*1024)
mgr.AttachVolume("test-vol-0001")
err := mgr.DetachVolume("test-vol-0001")
if err != nil {
t.Error("detachVolume failed")
}
}
func TestMgrDeleteVolume(t *testing.T) {
mgr := newTestMgr(t)
mgr.CreateVolume("test-vol-0001", 8*1024*1024)
err := mgr.DeleteVolume("test-vol-0001")
if err != nil {
t.Fatal(err)
}
sio := mgr.client.(*fakeSio)
if sio.volume != nil {
t.Errorf("volume not nil after delete operation")
}
}
func TestMgrDeleteVolume_VolumeNotFound(t *testing.T) {
mgr := newTestMgr(t)
mgr.CreateVolume("test-vol-0001", 8*1024*1024)
err := mgr.DeleteVolume("test-vol-0002")
if err == nil {
t.Fatal("expected volume not found error")
}
}
// ************************************************************
// Helper Test Types
// ************************************************************
type fakeSio struct {
volume *siotypes.Volume
waitAttachCtrl chan struct{}
waitDetachCtrl chan struct{}
devs map[string]string
}
func newFakeSio() *fakeSio {
return &fakeSio{
waitAttachCtrl: make(chan struct{}),
waitDetachCtrl: make(chan struct{}),
}
}
func (f *fakeSio) FindVolume(volumeName string) (*siotypes.Volume, error) {
if f.volume == nil || f.volume.Name != volumeName {
return nil, errors.New("volume not found")
}
return f.volume, nil
}
func (f *fakeSio) Volume(id sioVolumeID) (*siotypes.Volume, error) {
if f.volume == nil || f.volume.ID != string(id) {
return nil, errors.New("volume not found")
}
return f.volume, nil
}
func (f *fakeSio) CreateVolume(volName string, sizeGB int64) (*siotypes.Volume, error) {
f.volume = &siotypes.Volume{
ID: fakeVolumeID,
Name: volName,
SizeInKb: int(sizeGB),
VolumeType: "test",
}
return f.volume, nil
}
func (f *fakeSio) AttachVolume(id sioVolumeID) error {
_, err := f.Volume(id)
if err != nil {
return err
}
f.volume.MappedSdcInfo = []*siotypes.MappedSdcInfo{
{SdcID: fakeSdcID},
}
return nil
}
func (f *fakeSio) DetachVolume(id sioVolumeID) error {
if _, err := f.Volume(id); err != nil {
return err
}
f.volume.MappedSdcInfo = nil
delete(f.devs, f.volume.ID)
return nil
}
func (f *fakeSio) DeleteVolume(id sioVolumeID) error {
if _, err := f.Volume(id); err != nil {
return err
}
f.volume = nil
return nil
}
func (f *fakeSio) IID() (string, error) {
return fakeSdcID, nil
}
func (f *fakeSio) Devs() (map[string]string, error) {
if f.volume == nil {
return nil, errors.New("volume not found")
}
f.devs = map[string]string{
f.volume.ID: fakeDev,
}
return f.devs, nil
}
func (f *fakeSio) GetVolumeRefs(volId sioVolumeID) (int, error) {
if f.volume == nil {
return 0, nil
}
return 1, nil
}
func (f *fakeSio) WaitForAttachedDevice(token string) (string, error) {
select {
case <-time.After(500 * time.Millisecond):
return fakeDev, nil
case <-f.waitAttachCtrl:
return "", errors.New("attached device timeout")
}
}
func (f *fakeSio) WaitForDetachedDevice(token string) error {
select {
case <-time.After(500 * time.Millisecond):
delete(f.devs, f.volume.ID)
return nil
case <-f.waitDetachCtrl:
return errors.New("detach device timeout")
}
}

View File

@ -0,0 +1,203 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scaleio
import (
"errors"
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/types"
api "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/util/keymutex"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
)
const (
sioName = "scaleio"
sioPluginName = "kubernetes.io/scaleio"
sioConfigFileName = "sioconf.dat"
)
type sioPlugin struct {
host volume.VolumeHost
mounter mount.Interface
volumeMtx keymutex.KeyMutex
}
func ProbeVolumePlugins() []volume.VolumePlugin {
p := &sioPlugin{
host: nil,
}
return []volume.VolumePlugin{p}
}
// *******************
// VolumePlugin Impl
// *******************
var _ volume.VolumePlugin = &sioPlugin{}
func (p *sioPlugin) Init(host volume.VolumeHost) error {
p.host = host
p.mounter = host.GetMounter()
p.volumeMtx = keymutex.NewKeyMutex()
return nil
}
func (p *sioPlugin) GetPluginName() string {
return sioPluginName
}
func (p *sioPlugin) GetVolumeName(spec *volume.Spec) (string, error) {
source, err := getVolumeSourceFromSpec(spec)
if err != nil {
return "", err
}
return source.VolumeName, nil
}
func (p *sioPlugin) CanSupport(spec *volume.Spec) bool {
return (spec.PersistentVolume != nil && spec.PersistentVolume.Spec.ScaleIO != nil) ||
(spec.Volume != nil && spec.Volume.ScaleIO != nil)
}
func (p *sioPlugin) RequiresRemount() bool {
return false
}
func (p *sioPlugin) NewMounter(
spec *volume.Spec,
pod *api.Pod,
_ volume.VolumeOptions) (volume.Mounter, error) {
sioSource, err := getVolumeSourceFromSpec(spec)
if err != nil {
glog.Error(log("failed to extract ScaleIOVolumeSource from spec: %v", err))
return nil, err
}
return &sioVolume{
pod: pod,
spec: spec,
source: sioSource,
namespace: pod.Namespace,
volSpecName: spec.Name(),
volName: sioSource.VolumeName,
podUID: pod.UID,
readOnly: sioSource.ReadOnly,
fsType: sioSource.FSType,
plugin: p,
}, nil
}
// NewUnmounter creates a representation of the volume to unmount
// The specName param can be used to carry the namespace value (if needed) using format:
// specName = [<namespace>nsSep]<somevalue> where the specname is pre-pended with the namespace
func (p *sioPlugin) NewUnmounter(specName string, podUID types.UID) (volume.Unmounter, error) {
glog.V(4).Info(log("Unmounter for %s", specName))
return &sioVolume{
podUID: podUID,
volSpecName: specName,
plugin: p,
}, nil
}
func (p *sioPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
sioVol := &api.Volume{
Name: volumeName,
VolumeSource: api.VolumeSource{
ScaleIO: &api.ScaleIOVolumeSource{},
},
}
return volume.NewSpecFromVolume(sioVol), nil
}
// SupportsMountOption returns true if volume plugins supports Mount options
// Specifying mount options in a volume plugin that doesn't support
// user specified mount options will result in error creating persistent volumes
func (p *sioPlugin) SupportsMountOption() bool {
return false
}
// SupportsBulkVolumeVerification checks if volume plugin type is capable
// of enabling bulk polling of all nodes. This can speed up verification of
// attached volumes by quite a bit, but underlying pluging must support it.
func (p *sioPlugin) SupportsBulkVolumeVerification() bool {
return false
}
//******************************
// PersistentVolumePlugin Impl
// *****************************
var _ volume.PersistentVolumePlugin = &sioPlugin{}
func (p *sioPlugin) GetAccessModes() []api.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{
api.ReadWriteOnce,
}
}
// ***************************
// DeletableVolumePlugin Impl
//****************************
var _ volume.DeletableVolumePlugin = &sioPlugin{}
func (p *sioPlugin) NewDeleter(spec *volume.Spec) (volume.Deleter, error) {
sioSource, err := getVolumeSourceFromSpec(spec)
if err != nil {
glog.Error(log("deleter failed to extract source from spec: %v", err))
return nil, err
}
namespace := spec.PersistentVolume.Spec.ClaimRef.Namespace
return &sioVolume{
spec: spec,
source: sioSource,
namespace: namespace,
volSpecName: spec.Name(),
volName: sioSource.VolumeName,
plugin: p,
readOnly: sioSource.ReadOnly,
}, nil
}
// *********************************
// ProvisionableVolumePlugin Impl
// *********************************
var _ volume.ProvisionableVolumePlugin = &sioPlugin{}
func (p *sioPlugin) NewProvisioner(options volume.VolumeOptions) (volume.Provisioner, error) {
glog.V(4).Info(log("creating Provisioner"))
configData := options.Parameters
if configData == nil {
glog.Error(log("provisioner missing parameters, unable to continue"))
return nil, errors.New("option parameters missing")
}
namespace := options.PVC.Namespace
return &sioVolume{
configData: configData,
plugin: p,
options: options,
namespace: namespace,
volSpecName: options.PVName,
}, nil
}

View File

@ -0,0 +1,227 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scaleio
import (
"encoding/gob"
"errors"
"fmt"
"os"
"path"
"strconv"
"github.com/golang/glog"
api "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/volume"
volutil "k8s.io/kubernetes/pkg/volume/util"
)
var (
confKey = struct {
gateway,
sslEnabled,
secretRef,
system,
protectionDomain,
storagePool,
storageMode,
sdcRootPath,
volumeName,
volSpecName,
fsType,
readOnly,
username,
password,
namespace string
}{
gateway: "gateway",
sslEnabled: "sslEnabled",
secretRef: "secretRef",
system: "system",
protectionDomain: "protectionDomain",
storagePool: "storagePool",
storageMode: "storageMode",
sdcRootPath: "sdcRootPath",
volumeName: "volumeName",
volSpecName: "volSpecName",
fsType: "fsType",
readOnly: "readOnly",
username: "username",
password: "password",
namespace: "namespace",
}
nsSep = "%"
sdcRootPath = "/opt/emc/scaleio/sdc/bin"
secretNotFoundErr = errors.New("secret not found")
configMapNotFoundErr = errors.New("configMap not found")
gatewayNotProvidedErr = errors.New("gateway not provided")
secretRefNotProvidedErr = errors.New("secret ref not provided")
systemNotProvidedErr = errors.New("secret not provided")
)
// mapScaleIOVolumeSource maps attributes from a ScaleIOVolumeSource to config
func mapVolumeSource(config map[string]string, source *api.ScaleIOVolumeSource) {
config[confKey.gateway] = source.Gateway
config[confKey.secretRef] = func() string {
if source.SecretRef != nil {
return string(source.SecretRef.Name)
}
return ""
}()
config[confKey.system] = source.System
config[confKey.volumeName] = source.VolumeName
config[confKey.sslEnabled] = strconv.FormatBool(source.SSLEnabled)
config[confKey.protectionDomain] = source.ProtectionDomain
config[confKey.storagePool] = source.StoragePool
config[confKey.storageMode] = source.StorageMode
config[confKey.fsType] = source.FSType
config[confKey.readOnly] = strconv.FormatBool(source.ReadOnly)
//optionals
applyConfigDefaults(config)
}
func validateConfigs(config map[string]string) error {
if config[confKey.gateway] == "" {
return gatewayNotProvidedErr
}
if config[confKey.secretRef] == "" {
return secretRefNotProvidedErr
}
if config[confKey.system] == "" {
return systemNotProvidedErr
}
return nil
}
// applyConfigDefaults apply known defaults to incoming spec for dynamic PVCs.
func applyConfigDefaults(config map[string]string) {
b, err := strconv.ParseBool(config[confKey.sslEnabled])
if err != nil {
glog.Warning(log("failed to parse param sslEnabled, setting it to false"))
b = false
}
config[confKey.sslEnabled] = strconv.FormatBool(b)
config[confKey.protectionDomain] = defaultString(config[confKey.protectionDomain], "default")
config[confKey.storagePool] = defaultString(config[confKey.storagePool], "default")
config[confKey.storageMode] = defaultString(config[confKey.storageMode], "ThinProvisioned")
config[confKey.fsType] = defaultString(config[confKey.fsType], "xfs")
b, err = strconv.ParseBool(config[confKey.readOnly])
if err != nil {
glog.Warning(log("failed to parse param readOnly, setting it to true"))
b = true
}
config[confKey.readOnly] = strconv.FormatBool(b)
}
func defaultString(val, defVal string) string {
if val == "" {
return defVal
}
return val
}
// loadConfig loads configuration data from a file on disk
func loadConfig(configName string) (map[string]string, error) {
glog.V(4).Info(log("loading config file %s", configName))
file, err := os.Open(configName)
if err != nil {
glog.Error(log("failed to open config file %s: %v", configName, err))
return nil, err
}
defer file.Close()
data := map[string]string{}
if err := gob.NewDecoder(file).Decode(&data); err != nil {
glog.Error(log("failed to parse config data %s: %v", configName, err))
return nil, err
}
applyConfigDefaults(data)
if err := validateConfigs(data); err != nil {
glog.Error(log("failed to load ConfigMap %s: %v", err))
return nil, err
}
return data, nil
}
// saveConfig saves the configuration data to local disk
func saveConfig(configName string, data map[string]string) error {
glog.V(4).Info(log("saving config file %s", configName))
dir := path.Dir(configName)
if _, err := os.Stat(dir); err != nil {
if !os.IsNotExist(err) {
return err
}
glog.V(4).Info(log("creating config dir for config data: %s", dir))
if err := os.MkdirAll(dir, 0750); err != nil {
glog.Error(log("failed to create config data dir %v", err))
return err
}
}
file, err := os.Create(configName)
if err != nil {
glog.V(4).Info(log("failed to save config data file %s: %v", configName, err))
return err
}
defer file.Close()
if err := gob.NewEncoder(file).Encode(data); err != nil {
glog.Error(log("failed to save config %s: %v", configName, err))
return err
}
glog.V(4).Info(log("config data file saved successfully as %s", configName))
return nil
}
// attachSecret loads secret object and attaches to configData
func attachSecret(plug *sioPlugin, namespace string, configData map[string]string) error {
// load secret
secretRefName := configData[confKey.secretRef]
kubeClient := plug.host.GetKubeClient()
secretMap, err := volutil.GetSecretForPV(namespace, secretRefName, sioPluginName, kubeClient)
if err != nil {
glog.Error(log("failed to get secret: %v", err))
return secretNotFoundErr
}
// merge secret data
for key, val := range secretMap {
configData[key] = val
}
return nil
}
// getVolumeSourceFromSpec safely extracts ScaleIOVolumeSource from spec
func getVolumeSourceFromSpec(spec *volume.Spec) (*api.ScaleIOVolumeSource, error) {
if spec.Volume != nil && spec.Volume.ScaleIO != nil {
return spec.Volume.ScaleIO, nil
}
if spec.PersistentVolume != nil &&
spec.PersistentVolume.Spec.ScaleIO != nil {
return spec.PersistentVolume.Spec.ScaleIO, nil
}
return nil, fmt.Errorf("ScaleIO not defined in spec")
}
func log(msg string, parts ...interface{}) string {
return fmt.Sprintf(fmt.Sprintf("scaleio: %s", msg), parts...)
}

View File

@ -0,0 +1,222 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scaleio
import (
"encoding/gob"
"os"
"path"
"reflect"
"testing"
utiltesting "k8s.io/client-go/util/testing"
api "k8s.io/kubernetes/pkg/api/v1"
)
var (
vol = &api.Volume{
Name: testSioVolName,
VolumeSource: api.VolumeSource{
ScaleIO: &api.ScaleIOVolumeSource{
Gateway: "http://test.scaleio:1111",
System: "sio",
ProtectionDomain: "defaultPD",
StoragePool: "defaultSP",
VolumeName: "test-vol",
FSType: "ext4",
SecretRef: &api.LocalObjectReference{Name: "test-secret"},
},
},
}
config = map[string]string{
confKey.system: "sio",
confKey.gateway: "http://sio/",
confKey.volSpecName: testSioVolName,
confKey.volumeName: "sio-vol",
confKey.secretRef: "sio-secret",
confKey.protectionDomain: "defaultPD",
confKey.storagePool: "deraultSP",
confKey.fsType: "xfs",
confKey.readOnly: "true",
}
testConfigFile = "conf.dat"
)
func TestUtilMapVolumeSource(t *testing.T) {
data := make(map[string]string)
mapVolumeSource(data, vol.VolumeSource.ScaleIO)
if data[confKey.gateway] != "http://test.scaleio:1111" {
t.Error("Unexpected gateway value")
}
if data[confKey.system] != "sio" {
t.Error("Unexpected system value")
}
if data[confKey.protectionDomain] != "defaultPD" {
t.Error("Unexpected protection domain value")
}
if data[confKey.storagePool] != "defaultSP" {
t.Error("Unexpected storage pool value")
}
if data[confKey.volumeName] != "test-vol" {
t.Error("Unexpected volume name value")
}
if data[confKey.fsType] != "ext4" {
t.Error("Unexpected fstype value")
}
if data[confKey.secretRef] != "test-secret" {
t.Error("Unexpected secret ref value")
}
if data[confKey.sslEnabled] != "false" {
t.Error("Unexpected sslEnabled value")
}
if data[confKey.readOnly] != "false" {
t.Error("Unexpected readOnly value: ", data[confKey.readOnly])
}
}
func TestUtilValidateConfigs(t *testing.T) {
data := map[string]string{
confKey.secretRef: "sio-secret",
confKey.system: "sio",
}
if err := validateConfigs(data); err != gatewayNotProvidedErr {
t.Error("Expecting error for missing gateway, but did not get it")
}
}
func TestUtilApplyConfigDefaults(t *testing.T) {
data := map[string]string{
confKey.system: "sio",
confKey.gateway: "http://sio/",
confKey.volumeName: "sio-vol",
confKey.secretRef: "test-secret",
}
applyConfigDefaults(data)
if data[confKey.gateway] != "http://sio/" {
t.Error("Unexpected gateway value")
}
if data[confKey.system] != "sio" {
t.Error("Unexpected system value")
}
if data[confKey.protectionDomain] != "default" {
t.Error("Unexpected protection domain value")
}
if data[confKey.storagePool] != "default" {
t.Error("Unexpected storage pool value")
}
if data[confKey.volumeName] != "sio-vol" {
t.Error("Unexpected volume name value")
}
if data[confKey.fsType] != "xfs" {
t.Error("Unexpected fstype value")
}
if data[confKey.storageMode] != "ThinProvisioned" {
t.Error("Unexpected storage mode value")
}
if data[confKey.secretRef] != "test-secret" {
t.Error("Unexpected secret ref value")
}
if data[confKey.sslEnabled] != "false" {
t.Error("Unexpected sslEnabled value")
}
if data[confKey.readOnly] != "true" {
t.Error("Unexpected readOnly value: ", data[confKey.readOnly])
}
}
func TestUtilDefaultString(t *testing.T) {
if defaultString("", "foo") != "foo" {
t.Error("Unexpected value for default value")
}
}
func TestUtilSaveConfig(t *testing.T) {
tmpDir, err := utiltesting.MkTmpdir("scaleio-test")
if err != nil {
t.Fatalf("can't make a temp dir: %v", err)
}
defer os.RemoveAll(tmpDir)
config := path.Join(tmpDir, testConfigFile)
data := map[string]string{
confKey.gateway: "https://test-gateway/",
confKey.secretRef: "sio-secret",
confKey.sslEnabled: "false",
}
if err := saveConfig(config, data); err != nil {
t.Fatal("failed while saving data", err)
}
file, err := os.Open(config)
if err != nil {
t.Fatal("failed to open conf file: ", file)
}
dataRcvd := map[string]string{}
if err := gob.NewDecoder(file).Decode(&dataRcvd); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(data, dataRcvd) {
t.Error("we got problem, config data not the same")
}
}
func TestUtilAttachSecret(t *testing.T) {
plugMgr, tmpDir := newPluginMgr(t)
defer os.RemoveAll(tmpDir)
plug, err := plugMgr.FindPluginByName(sioPluginName)
if err != nil {
t.Errorf("Can't find the plugin %v", sioPluginName)
}
sioPlug, ok := plug.(*sioPlugin)
if !ok {
t.Errorf("Cannot assert plugin to be type sioPlugin")
}
data := make(map[string]string)
for k, v := range config {
data[k] = v
}
if err := attachSecret(sioPlug, "default", data); err != nil {
t.Errorf("failed to setupConfigData %v", err)
}
if data[confKey.username] == "" {
t.Errorf("failed to merge secret")
}
}
func TestUtilLoadConfig(t *testing.T) {
tmpDir, err := utiltesting.MkTmpdir("scaleio-test")
if err != nil {
t.Fatalf("can't make a temp dir: %v", err)
}
defer os.RemoveAll(tmpDir)
configFile := path.Join(tmpDir, sioConfigFileName)
if err := saveConfig(configFile, config); err != nil {
t.Fatal("failed while saving data", err)
}
dataRcvd, err := loadConfig(configFile)
if dataRcvd[confKey.gateway] != config[confKey.gateway] ||
dataRcvd[confKey.system] != config[confKey.system] {
t.Fatal("loaded config data not matching saved config data")
}
}

View File

@ -0,0 +1,455 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scaleio
import (
"fmt"
"os"
"path"
"strconv"
"strings"
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/api/resource"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/uuid"
api "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/util/mount"
kstrings "k8s.io/kubernetes/pkg/util/strings"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
)
type sioVolume struct {
sioMgr *sioMgr
plugin *sioPlugin
pod *api.Pod
podUID types.UID
spec *volume.Spec
source *api.ScaleIOVolumeSource
namespace string
volSpecName string
volName string
readOnly bool
fsType string
options volume.VolumeOptions
configData map[string]string
volume.MetricsNil
}
// *******************
// volume.Volume Impl
var _ volume.Volume = &sioVolume{}
// GetPath returns the path where the volume will be mounted.
// The volumeName is prefixed with the pod's namespace a <pod.Namespace>-<volumeName>
func (v *sioVolume) GetPath() string {
return v.plugin.host.GetPodVolumeDir(
v.podUID,
kstrings.EscapeQualifiedNameForDisk(sioPluginName),
v.volSpecName)
}
// *************
// Mounter Impl
// *************
var _ volume.Mounter = &sioVolume{}
// CanMount checks to verify that the volume can be mounted prior to Setup.
// A nil error indicates that the volume is ready for mounitnig.
func (v *sioVolume) CanMount() error {
return nil
}
func (v *sioVolume) SetUp(fsGroup *int64) error {
return v.SetUpAt(v.GetPath(), fsGroup)
}
// SetUp bind mounts the disk global mount to the volume path.
func (v *sioVolume) SetUpAt(dir string, fsGroup *int64) error {
v.plugin.volumeMtx.LockKey(v.volSpecName)
defer v.plugin.volumeMtx.UnlockKey(v.volSpecName)
glog.V(4).Info(log("setting up volume %s", v.volSpecName))
if err := v.setSioMgr(); err != nil {
glog.Error(log("setup failed to create scalio manager: %v", err))
return err
}
notDevMnt, err := v.plugin.mounter.IsLikelyNotMountPoint(dir)
if err != nil && !os.IsNotExist(err) {
glog.Error(log("IsLikelyNotMountPoint test failed for dir %v", dir))
return err
}
if !notDevMnt {
glog.V(4).Info(log("skipping setup, dir %s already a mount point", v.volName))
return nil
}
// attach the volume and mount
volName := v.volName
devicePath, err := v.sioMgr.AttachVolume(volName)
if err != nil {
glog.Error(log("setup of volume %v: %v", v.volSpecName, err))
return err
}
options := []string{}
if v.source.ReadOnly {
options = append(options, "ro")
} else {
options = append(options, "rw")
}
glog.V(4).Info(log("mounting device %s -> %s", devicePath, dir))
if err := os.MkdirAll(dir, 0750); err != nil {
glog.Error(log("failed to create dir %#v: %v", dir, err))
return err
}
glog.V(4).Info(log("setup created mount point directory %s", dir))
diskMounter := &mount.SafeFormatAndMount{
Interface: v.plugin.mounter,
Runner: exec.New(),
}
err = diskMounter.FormatAndMount(devicePath, dir, v.fsType, options)
if err != nil {
glog.Error(log("mount operation failed during setup: %v", err))
if err := os.Remove(dir); err != nil && !os.IsNotExist(err) {
glog.Error(log("failed to remove dir %s during a failed mount at setup: %v", dir, err))
return err
}
return err
}
glog.V(4).Info(log("successfully setup volume %s attached %s:%s as %s", v.volSpecName, v.volName, devicePath, dir))
return nil
}
func (v *sioVolume) GetAttributes() volume.Attributes {
return volume.Attributes{
ReadOnly: v.readOnly,
Managed: !v.readOnly,
SupportsSELinux: true,
}
}
// **********************
// volume.Unmounter Impl
// *********************
var _ volume.Unmounter = &sioVolume{}
// TearDownAt unmounts the bind mount
func (v *sioVolume) TearDown() error {
return v.TearDownAt(v.GetPath())
}
// TearDown unmounts and remove the volume
func (v *sioVolume) TearDownAt(dir string) error {
v.plugin.volumeMtx.LockKey(v.volSpecName)
defer v.plugin.volumeMtx.UnlockKey(v.volSpecName)
dev, _, err := mount.GetDeviceNameFromMount(v.plugin.mounter, dir)
if err != nil {
glog.Errorf(log("failed to get reference count for volume: %s", dir))
return err
}
glog.V(4).Info(log("attempting to unmount %s", dir))
if err := util.UnmountPath(dir, v.plugin.mounter); err != nil {
glog.Error(log("teardown failed while unmounting dir %s: %v ", dir, err))
return err
}
glog.V(4).Info(log("dir %s unmounted successfully", dir))
// detach/unmap
deviceBusy, err := v.plugin.mounter.DeviceOpened(dev)
if err != nil {
glog.Error(log("teardown unable to get status for device %s: %v", dev, err))
return err
}
// Detach volume from node:
// use "last attempt wins" strategy to detach volume from node
// only allow volume to detach when it is not busy (not being used by other pods)
if !deviceBusy {
glog.V(4).Info(log("teardown is attempting to detach/unmap volume for %s", v.volSpecName))
if err := v.resetSioMgr(); err != nil {
glog.Error(log("teardown failed, unable to reset scalio mgr: %v", err))
}
volName := v.volName
if err := v.sioMgr.DetachVolume(volName); err != nil {
glog.Warning(log("warning: detaching failed for volume %s: %v", volName, err))
return nil
}
glog.V(4).Infof(log("teardown of volume %v detached successfully", volName))
}
return nil
}
// ********************
// volume.Deleter Impl
// ********************
var _ volume.Deleter = &sioVolume{}
func (v *sioVolume) Delete() error {
glog.V(4).Info(log("deleting pvc %s", v.volSpecName))
if err := v.setSioMgrFromSpec(); err != nil {
glog.Error(log("delete failed while setting sio manager: %v", err))
return err
}
err := v.sioMgr.DeleteVolume(v.volName)
if err != nil {
glog.Error(log("failed to delete volume %s: %v", v.volName, err))
return err
}
glog.V(4).Info(log("successfully deleted pvc %s", v.volSpecName))
return nil
}
// ************************
// volume.Provisioner Impl
// ************************
var _ volume.Provisioner = &sioVolume{}
func (v *sioVolume) Provision() (*api.PersistentVolume, error) {
glog.V(4).Info(log("attempting to dynamically provision pvc %v", v.options.PVName))
// setup volume attrributes
name := v.generateVolName()
capacity := v.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)]
volSizeBytes := capacity.Value()
volSizeGB := int64(volume.RoundUpSize(volSizeBytes, 1024*1024*1024))
// create sio manager
if err := v.setSioMgrFromConfig(); err != nil {
glog.Error(log("provision failed while setting up sio mgr: %v", err))
return nil, err
}
// create volume
vol, err := v.sioMgr.CreateVolume(name, volSizeGB)
if err != nil {
glog.Error(log("provision failed while creating volume: %v", err))
return nil, err
}
// prepare data for pv
v.configData[confKey.volumeName] = name
sslEnabled, err := strconv.ParseBool(v.configData[confKey.sslEnabled])
if err != nil {
glog.Warning(log("failed to parse parameter sslEnabled, setting to false"))
sslEnabled = false
}
readOnly, err := strconv.ParseBool(v.configData[confKey.readOnly])
if err != nil {
glog.Warning(log("failed to parse parameter readOnly, setting it to true"))
readOnly = true
}
// describe created pv
pv := &api.PersistentVolume{
ObjectMeta: meta.ObjectMeta{
Name: v.options.PVName,
Namespace: v.options.PVC.Namespace,
Labels: map[string]string{},
Annotations: map[string]string{
"kubernetes.io/createdby": "scaleio-dynamic-provisioner",
},
},
Spec: api.PersistentVolumeSpec{
PersistentVolumeReclaimPolicy: v.options.PersistentVolumeReclaimPolicy,
AccessModes: v.options.PVC.Spec.AccessModes,
Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse(
fmt.Sprintf("%dGi", volSizeGB),
),
},
PersistentVolumeSource: api.PersistentVolumeSource{
ScaleIO: &api.ScaleIOVolumeSource{
Gateway: v.configData[confKey.gateway],
SSLEnabled: sslEnabled,
SecretRef: &api.LocalObjectReference{Name: v.configData[confKey.secretRef]},
System: v.configData[confKey.system],
ProtectionDomain: v.configData[confKey.protectionDomain],
StoragePool: v.configData[confKey.storagePool],
StorageMode: v.configData[confKey.storageMode],
VolumeName: name,
FSType: v.configData[confKey.fsType],
ReadOnly: readOnly,
},
},
},
}
if len(v.options.PVC.Spec.AccessModes) == 0 {
pv.Spec.AccessModes = v.plugin.GetAccessModes()
}
glog.V(4).Info(log("provisioner dynamically created pvc %v with volume %s successfully", pv.Name, vol.Name))
return pv, nil
}
// setSioMgr creates scaleio mgr from cached config data if found
// otherwise, setups new config data and create mgr
func (v *sioVolume) setSioMgr() error {
glog.V(4).Info(log("setting up sio mgr for vol %s", v.volSpecName))
podDir := v.plugin.host.GetPodPluginDir(v.podUID, sioPluginName)
configName := path.Join(podDir, sioConfigFileName)
if v.sioMgr == nil {
configData, err := loadConfig(configName) // try to load config if exist
if err != nil {
if !os.IsNotExist(err) {
glog.Error(log("failed to load config %s : %v", configName, err))
return err
}
glog.V(4).Info(log("previous config file not found, creating new one"))
// prepare config data
configData = make(map[string]string)
mapVolumeSource(configData, v.source)
if err := validateConfigs(configData); err != nil {
glog.Error(log("config setup failed: %s", err))
return err
}
configData[confKey.namespace] = v.namespace
configData[confKey.volSpecName] = v.volSpecName
// persist config
if err := saveConfig(configName, configData); err != nil {
glog.Error(log("failed to save config data: %v", err))
return err
}
}
// merge in secret
if err := attachSecret(v.plugin, v.namespace, configData); err != nil {
glog.Error(log("failed to load secret: %v", err))
return err
}
mgr, err := newSioMgr(configData)
if err != nil {
glog.Error(log("failed to reset sio manager: %v", err))
return err
}
v.sioMgr = mgr
}
return nil
}
// resetSioMgr creates scaleio manager from existing (cached) config data
func (v *sioVolume) resetSioMgr() error {
podDir := v.plugin.host.GetPodPluginDir(v.podUID, sioPluginName)
configName := path.Join(podDir, sioConfigFileName)
if v.sioMgr == nil {
// load config data from disk
configData, err := loadConfig(configName)
if err != nil {
glog.Error(log("failed to load config data: %v", err))
return err
}
v.namespace = configData[confKey.namespace]
v.volName = configData[confKey.volumeName]
v.volSpecName = configData[confKey.volSpecName]
// attach secret
if err := attachSecret(v.plugin, v.namespace, configData); err != nil {
glog.Error(log("failed to load secret: %v", err))
return err
}
mgr, err := newSioMgr(configData)
if err != nil {
glog.Error(log("failed to reset scaleio mgr: %v", err))
return err
}
v.sioMgr = mgr
}
return nil
}
// setSioFromConfig sets up scaleio mgr from an available config data map
// designed to be called from dynamic provisioner
func (v *sioVolume) setSioMgrFromConfig() error {
glog.V(4).Info(log("setting scaleio mgr from available config"))
if v.sioMgr == nil {
configData := v.configData
applyConfigDefaults(configData)
if err := validateConfigs(configData); err != nil {
glog.Error(log("config data setup failed: %s", err))
return err
}
configData[confKey.namespace] = v.namespace
configData[confKey.volSpecName] = v.volSpecName
// copy config and attach secret
data := map[string]string{}
for k, v := range configData {
data[k] = v
}
if err := attachSecret(v.plugin, v.namespace, data); err != nil {
glog.Error(log("failed to load secret: %v", err))
return err
}
mgr, err := newSioMgr(data)
if err != nil {
glog.Error(log("failed while setting scaleio mgr from config: %v", err))
return err
}
v.sioMgr = mgr
}
return nil
}
func (v *sioVolume) setSioMgrFromSpec() error {
glog.V(4).Info(log("setting sio manager from spec"))
if v.sioMgr == nil {
// get config data form spec volume source
configData := map[string]string{}
mapVolumeSource(configData, v.source)
if err := validateConfigs(configData); err != nil {
glog.Error(log("config setup failed: %s", err))
return err
}
configData[confKey.namespace] = v.namespace
configData[confKey.volSpecName] = v.volSpecName
// attach secret object to config data
if err := attachSecret(v.plugin, v.namespace, configData); err != nil {
glog.Error(log("failed to load secret: %v", err))
return err
}
mgr, err := newSioMgr(configData)
if err != nil {
glog.Error(log("failed to reset sio manager: %v", err))
return err
}
v.sioMgr = mgr
}
return nil
}
func (v *sioVolume) generateVolName() string {
return "sio-" + strings.Replace(string(uuid.NewUUID()), "-", "", -1)[0:25]
}

View File

@ -0,0 +1,353 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scaleio
import (
"fmt"
"os"
"path"
"strings"
"testing"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
utiltesting "k8s.io/client-go/util/testing"
api "k8s.io/kubernetes/pkg/api/v1"
fakeclient "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/fake"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
volumetest "k8s.io/kubernetes/pkg/volume/testing"
)
var (
testSioSystem = "sio"
testSioPD = "default"
testSioVol = "vol-0001"
testns = "default"
testSioVolName = fmt.Sprintf("%s%s%s", testns, "-", testSioVol)
podUID = types.UID("sio-pod")
)
func newPluginMgr(t *testing.T) (*volume.VolumePluginMgr, string) {
tmpDir, err := utiltesting.MkTmpdir("scaleio-test")
if err != nil {
t.Fatalf("can't make a temp dir: %v", err)
}
config := &api.Secret{
ObjectMeta: meta.ObjectMeta{
Name: "sio-secret",
Namespace: testns,
UID: "1234567890",
},
Type: api.SecretType("kubernetes.io/scaleio"),
Data: map[string][]byte{
"username": []byte("username"),
"password": []byte("password"),
},
}
fakeClient := fakeclient.NewSimpleClientset(config)
host := volumetest.NewFakeVolumeHost(tmpDir, fakeClient, nil)
plugMgr := &volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(), host)
return plugMgr, tmpDir
}
func TestVolumeCanSupport(t *testing.T) {
plugMgr, tmpDir := newPluginMgr(t)
defer os.RemoveAll(tmpDir)
plug, err := plugMgr.FindPluginByName(sioPluginName)
if err != nil {
t.Errorf("Can't find the plugin %s by name", sioPluginName)
}
if plug.GetPluginName() != "kubernetes.io/scaleio" {
t.Errorf("Wrong name: %s", plug.GetPluginName())
}
if !plug.CanSupport(
&volume.Spec{
Volume: &api.Volume{
VolumeSource: api.VolumeSource{
ScaleIO: &api.ScaleIOVolumeSource{},
},
},
},
) {
t.Errorf("Expected true for CanSupport LibStorage VolumeSource")
}
if !plug.CanSupport(
&volume.Spec{
PersistentVolume: &api.PersistentVolume{
Spec: api.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{
ScaleIO: &api.ScaleIOVolumeSource{},
},
},
},
},
) {
t.Errorf("Expected true for CanSupport LibStorage PersistentVolumeSource")
}
}
func TestVolumeGetAccessModes(t *testing.T) {
plugMgr, tmpDir := newPluginMgr(t)
defer os.RemoveAll(tmpDir)
plug, err := plugMgr.FindPersistentPluginByName(sioPluginName)
if err != nil {
t.Errorf("Can't find the plugin %v", sioPluginName)
}
if !containsMode(plug.GetAccessModes(), api.ReadWriteOnce) {
t.Errorf("Expected two AccessModeTypes: %s or %s", api.ReadWriteOnce, api.ReadOnlyMany)
}
}
func containsMode(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool {
for _, m := range modes {
if m == mode {
return true
}
}
return false
}
func TestVolumeMounterUnmounter(t *testing.T) {
plugMgr, tmpDir := newPluginMgr(t)
defer os.RemoveAll(tmpDir)
plug, err := plugMgr.FindPluginByName(sioPluginName)
if err != nil {
t.Errorf("Can't find the plugin %v", sioPluginName)
}
sioPlug, ok := plug.(*sioPlugin)
if !ok {
t.Errorf("Cannot assert plugin to be type sioPlugin")
}
sioPlug.mounter = &mount.FakeMounter{}
vol := &api.Volume{
Name: testSioVolName,
VolumeSource: api.VolumeSource{
ScaleIO: &api.ScaleIOVolumeSource{
Gateway: "http://test.scaleio:1111",
System: testSioSystem,
ProtectionDomain: testSioPD,
StoragePool: "default",
VolumeName: testSioVol,
FSType: "ext4",
SecretRef: &api.LocalObjectReference{Name: "sio-secret"},
},
},
}
sioMounter, err := sioPlug.NewMounter(
volume.NewSpecFromVolume(vol),
&api.Pod{ObjectMeta: meta.ObjectMeta{UID: podUID, Namespace: testns}},
volume.VolumeOptions{},
)
if err != nil {
t.Fatalf("Failed to make a new Mounter: %v", err)
}
if sioMounter == nil {
t.Fatal("Got a nil Mounter")
}
sio := newFakeSio()
sioVol := sioMounter.(*sioVolume)
if err := sioVol.setSioMgr(); err != nil {
t.Fatalf("failed to create sio mgr: %v", err)
}
sioVol.sioMgr.client = sio
sioVol.sioMgr.CreateVolume(testSioVol, 8) //create vol ahead of time
volPath := path.Join(tmpDir, fmt.Sprintf("pods/%s/volumes/kubernetes.io~scaleio/%s", podUID, testSioVolName))
path := sioMounter.GetPath()
if path != volPath {
t.Errorf("Got unexpected path: %s", path)
}
if err := sioMounter.SetUp(nil); err != nil {
t.Errorf("Expected success, got: %v", err)
}
if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
t.Errorf("SetUp() failed, volume path not created: %s", path)
} else {
t.Errorf("SetUp() failed: %v", err)
}
}
// rebuild spec
builtSpec, err := sioPlug.ConstructVolumeSpec(volume.NewSpecFromVolume(vol).Name(), path)
if err != nil {
t.Errorf("ConstructVolumeSpec failed %v", err)
}
if builtSpec.Name() != vol.Name {
t.Errorf("Unexpected spec name %s", builtSpec.Name())
}
// unmount
sioUnmounter, err := sioPlug.NewUnmounter(volume.NewSpecFromVolume(vol).Name(), podUID)
if err != nil {
t.Fatalf("Failed to make a new Unmounter: %v", err)
}
if sioUnmounter == nil {
t.Fatal("Got a nil Unmounter")
}
sioVol = sioUnmounter.(*sioVolume)
if err := sioVol.resetSioMgr(); err != nil {
t.Fatalf("failed to reset sio mgr: %v", err)
}
sioVol.sioMgr.client = sio
if err := sioUnmounter.TearDown(); err != nil {
t.Errorf("Expected success, got: %v", err)
}
// is mount point gone ?
if _, err := os.Stat(path); err == nil {
t.Errorf("TearDown() failed, volume path still exists: %s", path)
} else if !os.IsNotExist(err) {
t.Errorf("SetUp() failed: %v", err)
}
// are we still mapped
if sio.volume.MappedSdcInfo != nil {
t.Errorf("expected SdcMappedInfo to be nil, volume may still be mapped")
}
}
func TestVolumeProvisioner(t *testing.T) {
plugMgr, tmpDir := newPluginMgr(t)
defer os.RemoveAll(tmpDir)
plug, err := plugMgr.FindPluginByName(sioPluginName)
if err != nil {
t.Errorf("Can't find the plugin %v", sioPluginName)
}
sioPlug, ok := plug.(*sioPlugin)
if !ok {
t.Errorf("Cannot assert plugin to be type sioPlugin")
}
options := volume.VolumeOptions{
ClusterName: "testcluster",
PVName: "pvc-sio-dynamic-vol",
PVC: volumetest.CreateTestPVC("100Mi", []api.PersistentVolumeAccessMode{api.ReadWriteOnce}),
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete,
}
options.PVC.Namespace = testns
// incomplete options, test should fail
_, err = sioPlug.NewProvisioner(options)
if err == nil {
t.Fatal("expected failure due to incomplete options")
}
options.Parameters = map[string]string{
confKey.gateway: "http://test.scaleio:11111",
confKey.system: "sio",
confKey.protectionDomain: testSioPD,
confKey.storagePool: "default",
confKey.secretRef: "sio-secret",
}
provisioner, err := sioPlug.NewProvisioner(options)
if err != nil {
t.Fatalf("failed to create new provisioner: %v", err)
}
if provisioner == nil {
t.Fatal("got a nil provisioner")
}
sio := newFakeSio()
sioVol := provisioner.(*sioVolume)
if err := sioVol.setSioMgrFromConfig(); err != nil {
t.Fatalf("failed to create scaleio mgr from config: %v", err)
}
sioVol.sioMgr.client = sio
spec, err := provisioner.Provision()
if err != nil {
t.Fatalf("call to Provision() failed: %v", err)
}
spec.Spec.ClaimRef = &api.ObjectReference{Namespace: testns}
// validate provision
actualSpecName := spec.Name
actualVolName := spec.Spec.PersistentVolumeSource.ScaleIO.VolumeName
if !strings.HasPrefix(actualSpecName, "pvc-") {
t.Errorf("expecting volume name to start with pov-, got %s", actualSpecName)
}
vol, err := sio.FindVolume(actualVolName)
if err != nil {
t.Fatalf("failed getting volume %v: %v", actualVolName, err)
}
if vol.Name != actualVolName {
t.Errorf("expected volume name to be %s, got %s", actualVolName, vol.Name)
}
// mount dynamic vol
sioMounter, err := sioPlug.NewMounter(
volume.NewSpecFromPersistentVolume(spec, false),
&api.Pod{ObjectMeta: meta.ObjectMeta{UID: podUID, Namespace: testns}},
volume.VolumeOptions{},
)
if err != nil {
t.Fatalf("Failed to make a new Mounter: %v", err)
}
sioVol = sioMounter.(*sioVolume)
if err := sioVol.setSioMgr(); err != nil {
t.Fatalf("failed to create sio mgr: %v", err)
}
sioVol.sioMgr.client = sio
if err := sioMounter.SetUp(nil); err != nil {
t.Errorf("Expected success, got: %v", err)
}
// teardown dynamic vol
sioUnmounter, err := sioPlug.NewUnmounter(spec.Name, podUID)
if err != nil {
t.Fatalf("Failed to make a new Unmounter: %v", err)
}
sioVol = sioUnmounter.(*sioVolume)
if err := sioVol.resetSioMgr(); err != nil {
t.Fatalf("failed to reset sio mgr: %v", err)
}
sioVol.sioMgr.client = sio
if err := sioUnmounter.TearDown(); err != nil {
t.Errorf("Expected success, got: %v", err)
}
// test deleter
deleter, err := sioPlug.NewDeleter(volume.NewSpecFromPersistentVolume(spec, false))
if err != nil {
t.Fatalf("failed to create a deleter %v", err)
}
sioVol = deleter.(*sioVolume)
if err := sioVol.setSioMgrFromSpec(); err != nil {
t.Fatalf("failed to set sio mgr: %v", err)
}
sioVol.sioMgr.client = sio
if err := deleter.Delete(); err != nil {
t.Fatalf("failed while deleteing vol: %v", err)
}
path := deleter.GetPath()
if _, err := os.Stat(path); err == nil {
t.Errorf("TearDown() failed, volume path still exists: %s", path)
} else if !os.IsNotExist(err) {
t.Errorf("Deleter did not delete path %v: %v", path, err)
}
}

View File

@ -299,6 +299,9 @@ type VolumeSource struct {
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
PortworxVolume *PortworxVolumeSource
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
ScaleIO *ScaleIOVolumeSource
}
// Similar to VolumeSource but meant for the administrator who creates PVs.
@ -364,6 +367,9 @@ type PersistentVolumeSource struct {
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
PortworxVolume *PortworxVolumeSource
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
ScaleIO *ScaleIOVolumeSource
}
type PersistentVolumeClaimVolumeSource struct {
@ -1056,6 +1062,41 @@ type AzureDiskVolumeSource struct {
ReadOnly *bool
}
// ScaleIOVolumeSource represents a persistent ScaleIO volume
type ScaleIOVolumeSource struct {
// The host address of the ScaleIO API Gateway.
Gateway string
// The name of the storage system as configured in ScaleIO.
System string
// SecretRef references to the secret for ScaleIO user and other
// sensitive information. If this is not provided, Login operation will fail.
SecretRef *LocalObjectReference
// Flag to enable/disable SSL communication with Gateway, default false
// +optional
SSLEnabled bool
// The name of the Protection Domain for the configured storage (defaults to "default").
// +optional
ProtectionDomain string
// The Storage Pool associated with the protection domain (defaults to "default").
// +optional
StoragePool string
// Indicates whether the storage for a volume should be thick or thin (defaults to "thin").
// +optional
StorageMode string
// The name of a volume already created in the ScaleIO system
// that is associated with this volume source.
VolumeName string
// Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
// +optional
FSType string
// Defaults to false (read/write). ReadOnly here will force
// the ReadOnly setting in VolumeMounts.
// +optional
ReadOnly bool
}
// Adapts a ConfigMap into a volume.
//
// The contents of the target ConfigMap's Data field will be presented in a

View File

@ -359,3 +359,18 @@ func SetDefaults_RBDVolumeSource(obj *RBDVolumeSource) {
obj.Keyring = "/etc/ceph/keyring"
}
}
func SetDefaults_ScaleIOVolumeSource(obj *ScaleIOVolumeSource) {
if obj.ProtectionDomain == "" {
obj.ProtectionDomain = "default"
}
if obj.StoragePool == "" {
obj.StoragePool = "default"
}
if obj.StorageMode == "" {
obj.StorageMode = "ThinProvisioned"
}
if obj.FSType == "" {
obj.FSType = "xfs"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2140,6 +2140,10 @@ message PersistentVolumeSource {
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
optional PortworxVolumeSource portworxVolume = 18;
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
optional ScaleIOVolumeSource scaleIO = 19;
}
// PersistentVolumeSpec is the specification of a persistent volume.
@ -3210,6 +3214,50 @@ message SELinuxOptions {
optional string level = 4;
}
// ScaleIOVolumeSource represents a persistent ScaleIO volume
message ScaleIOVolumeSource {
// The host address of the ScaleIO API Gateway.
optional string gateway = 1;
// The name of the storage system as configured in ScaleIO.
optional string system = 2;
// SecretRef references to the secret for ScaleIO user and other
// sensitive information. If this is not provided, Login operation will fail.
optional LocalObjectReference secretRef = 3;
// Flag to enable/disable SSL communication with Gateway, default false
// +optional
optional bool sslEnabled = 4;
// The name of the Protection Domain for the configured storage (defaults to "default").
// +optional
optional string protectionDomain = 5;
// The Storage Pool associated with the protection domain (defaults to "default").
// +optional
optional string storagePool = 6;
// Indicates whether the storage for a volume should be thick or thin (defaults to "thin").
// +optional
optional string storageMode = 7;
// The name of a volume already created in the ScaleIO system
// that is associated with this volume source.
optional string volumeName = 8;
// Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
// +optional
optional string fsType = 9;
// Defaults to false (read/write). ReadOnly here will force
// the ReadOnly setting in VolumeMounts.
// +optional
optional bool readOnly = 10;
}
// Secret holds secret data of a certain type. The total bytes of the values in
// the Data field must be less than MaxSecretSize bytes.
message Secret {
@ -3840,11 +3888,15 @@ message VolumeSource {
optional PhotonPersistentDiskVolumeSource photonPersistentDisk = 23;
// Items for all in one resources secrets, configmaps, and downward API
optional ProjectedVolumeSource projected = 25;
optional ProjectedVolumeSource projected = 26;
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
optional PortworxVolumeSource portworxVolume = 24;
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
optional ScaleIOVolumeSource scaleIO = 25;
}
// Represents a vSphere volume resource.

File diff suppressed because it is too large Load Diff

View File

@ -331,6 +331,9 @@ type VolumeSource struct {
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,24,opt,name=portworxVolume"`
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
ScaleIO *ScaleIOVolumeSource `json:"scaleIO,omitempty" protobuf:"bytes,25,opt,name=scaleIO"`
}
// PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace.
@ -419,6 +422,9 @@ type PersistentVolumeSource struct {
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,18,opt,name=portworxVolume"`
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
ScaleIO *ScaleIOVolumeSource `json:"scaleIO,omitempty" protobuf:"bytes,19,opt,name=scaleIO"`
}
const (
@ -1138,6 +1144,41 @@ type PortworxVolumeSource struct {
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"`
}
// ScaleIOVolumeSource represents a persistent ScaleIO volume
type ScaleIOVolumeSource struct {
// The host address of the ScaleIO API Gateway.
Gateway string `json:"gateway" protobuf:"bytes,1,opt,name=gateway"`
// The name of the storage system as configured in ScaleIO.
System string `json:"system" protobuf:"bytes,2,opt,name=system"`
// SecretRef references to the secret for ScaleIO user and other
// sensitive information. If this is not provided, Login operation will fail.
SecretRef *LocalObjectReference `json:"secretRef" protobuf:"bytes,3,opt,name=secretRef"`
// Flag to enable/disable SSL communication with Gateway, default false
// +optional
SSLEnabled bool `json:"sslEnabled,omitempty" protobuf:"varint,4,opt,name=sslEnabled"`
// The name of the Protection Domain for the configured storage (defaults to "default").
// +optional
ProtectionDomain string `json:"protectionDomain,omitempty" protobuf:"bytes,5,opt,name=protectionDomain"`
// The Storage Pool associated with the protection domain (defaults to "default").
// +optional
StoragePool string `json:"storagePool,omitempty" protobuf:"bytes,6,opt,name=storagePool"`
// Indicates whether the storage for a volume should be thick or thin (defaults to "thin").
// +optional
StorageMode string `json:"storageMode,omitempty" protobuf:"bytes,7,opt,name=storageMode"`
// The name of a volume already created in the ScaleIO system
// that is associated with this volume source.
VolumeName string `json:"volumeName,omitempty" protobuf:"bytes,8,opt,name=volumeName"`
// Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
// +optional
FSType string `json:"fsType,omitempty" protobuf:"bytes,9,opt,name=fsType"`
// Defaults to false (read/write). ReadOnly here will force
// the ReadOnly setting in VolumeMounts.
// +optional
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,10,opt,name=readOnly"`
}
// Adapts a ConfigMap into a volume.
//
// The contents of the target ConfigMap's Data field will be presented in a

View File

@ -1124,6 +1124,7 @@ var map_PersistentVolumeSource = map[string]string{
"azureDisk": "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.",
"photonPersistentDisk": "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine",
"portworxVolume": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine",
"scaleIO": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
}
func (PersistentVolumeSource) SwaggerDoc() map[string]string {
@ -1640,6 +1641,24 @@ func (SELinuxOptions) SwaggerDoc() map[string]string {
return map_SELinuxOptions
}
var map_ScaleIOVolumeSource = map[string]string{
"": "ScaleIOVolumeSource represents a persistent ScaleIO volume",
"gateway": "The host address of the ScaleIO API Gateway.",
"system": "The name of the storage system as configured in ScaleIO.",
"secretRef": "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.",
"sslEnabled": "Flag to enable/disable SSL communication with Gateway, default false",
"protectionDomain": "The name of the Protection Domain for the configured storage (defaults to \"default\").",
"storagePool": "The Storage Pool associated with the protection domain (defaults to \"default\").",
"storageMode": "Indicates whether the storage for a volume should be thick or thin (defaults to \"thin\").",
"volumeName": "The name of a volume already created in the ScaleIO system that is associated with this volume source.",
"fsType": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
"readOnly": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
}
func (ScaleIOVolumeSource) SwaggerDoc() map[string]string {
return map_ScaleIOVolumeSource
}
var map_Secret = map[string]string{
"": "Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.",
"metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
@ -1911,6 +1930,7 @@ var map_VolumeSource = map[string]string{
"photonPersistentDisk": "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine",
"projected": "Items for all in one resources secrets, configmaps, and downward API",
"portworxVolume": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine",
"scaleIO": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
}
func (VolumeSource) SwaggerDoc() map[string]string {

View File

@ -317,6 +317,8 @@ func RegisterConversions(scheme *runtime.Scheme) error {
Convert_api_ResourceRequirements_To_v1_ResourceRequirements,
Convert_v1_SELinuxOptions_To_api_SELinuxOptions,
Convert_api_SELinuxOptions_To_v1_SELinuxOptions,
Convert_v1_ScaleIOVolumeSource_To_api_ScaleIOVolumeSource,
Convert_api_ScaleIOVolumeSource_To_v1_ScaleIOVolumeSource,
Convert_v1_Secret_To_api_Secret,
Convert_api_Secret_To_v1_Secret,
Convert_v1_SecretEnvSource_To_api_SecretEnvSource,
@ -2711,6 +2713,7 @@ func autoConvert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(in *Per
out.AzureDisk = (*api.AzureDiskVolumeSource)(unsafe.Pointer(in.AzureDisk))
out.PhotonPersistentDisk = (*api.PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.PortworxVolume = (*api.PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*api.ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
return nil
}
@ -2737,6 +2740,7 @@ func autoConvert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(in *api
out.AzureDisk = (*AzureDiskVolumeSource)(unsafe.Pointer(in.AzureDisk))
out.PhotonPersistentDisk = (*PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.PortworxVolume = (*PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
return nil
}
@ -3887,6 +3891,42 @@ func Convert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, out
return autoConvert_api_SELinuxOptions_To_v1_SELinuxOptions(in, out, s)
}
func autoConvert_v1_ScaleIOVolumeSource_To_api_ScaleIOVolumeSource(in *ScaleIOVolumeSource, out *api.ScaleIOVolumeSource, s conversion.Scope) error {
out.Gateway = in.Gateway
out.System = in.System
out.SecretRef = (*api.LocalObjectReference)(unsafe.Pointer(in.SecretRef))
out.SSLEnabled = in.SSLEnabled
out.ProtectionDomain = in.ProtectionDomain
out.StoragePool = in.StoragePool
out.StorageMode = in.StorageMode
out.VolumeName = in.VolumeName
out.FSType = in.FSType
out.ReadOnly = in.ReadOnly
return nil
}
func Convert_v1_ScaleIOVolumeSource_To_api_ScaleIOVolumeSource(in *ScaleIOVolumeSource, out *api.ScaleIOVolumeSource, s conversion.Scope) error {
return autoConvert_v1_ScaleIOVolumeSource_To_api_ScaleIOVolumeSource(in, out, s)
}
func autoConvert_api_ScaleIOVolumeSource_To_v1_ScaleIOVolumeSource(in *api.ScaleIOVolumeSource, out *ScaleIOVolumeSource, s conversion.Scope) error {
out.Gateway = in.Gateway
out.System = in.System
out.SecretRef = (*LocalObjectReference)(unsafe.Pointer(in.SecretRef))
out.SSLEnabled = in.SSLEnabled
out.ProtectionDomain = in.ProtectionDomain
out.StoragePool = in.StoragePool
out.StorageMode = in.StorageMode
out.VolumeName = in.VolumeName
out.FSType = in.FSType
out.ReadOnly = in.ReadOnly
return nil
}
func Convert_api_ScaleIOVolumeSource_To_v1_ScaleIOVolumeSource(in *api.ScaleIOVolumeSource, out *ScaleIOVolumeSource, s conversion.Scope) error {
return autoConvert_api_ScaleIOVolumeSource_To_v1_ScaleIOVolumeSource(in, out, s)
}
func autoConvert_v1_Secret_To_api_Secret(in *Secret, out *api.Secret, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Data = *(*map[string][]byte)(unsafe.Pointer(&in.Data))
@ -4487,6 +4527,7 @@ func autoConvert_v1_VolumeSource_To_api_VolumeSource(in *VolumeSource, out *api.
out.PhotonPersistentDisk = (*api.PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.Projected = (*api.ProjectedVolumeSource)(unsafe.Pointer(in.Projected))
out.PortworxVolume = (*api.PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*api.ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
return nil
}
@ -4520,6 +4561,7 @@ func autoConvert_api_VolumeSource_To_v1_VolumeSource(in *api.VolumeSource, out *
out.PhotonPersistentDisk = (*PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.Projected = (*ProjectedVolumeSource)(unsafe.Pointer(in.Projected))
out.PortworxVolume = (*PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
return nil
}

View File

@ -176,6 +176,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ResourceQuotaStatus, InType: reflect.TypeOf(&ResourceQuotaStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ResourceRequirements, InType: reflect.TypeOf(&ResourceRequirements{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_SELinuxOptions, InType: reflect.TypeOf(&SELinuxOptions{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ScaleIOVolumeSource, InType: reflect.TypeOf(&ScaleIOVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Secret, InType: reflect.TypeOf(&Secret{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_SecretEnvSource, InType: reflect.TypeOf(&SecretEnvSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_SecretKeySelector, InType: reflect.TypeOf(&SecretKeySelector{})},
@ -2026,6 +2027,13 @@ func DeepCopy_v1_PersistentVolumeSource(in interface{}, out interface{}, c *conv
*out = new(PortworxVolumeSource)
**out = **in
}
if in.ScaleIO != nil {
in, out := &in.ScaleIO, &out.ScaleIO
*out = new(ScaleIOVolumeSource)
if err := DeepCopy_v1_ScaleIOVolumeSource(*in, *out, c); err != nil {
return err
}
}
return nil
}
}
@ -2872,6 +2880,20 @@ func DeepCopy_v1_SELinuxOptions(in interface{}, out interface{}, c *conversion.C
}
}
func DeepCopy_v1_ScaleIOVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScaleIOVolumeSource)
out := out.(*ScaleIOVolumeSource)
*out = *in
if in.SecretRef != nil {
in, out := &in.SecretRef, &out.SecretRef
*out = new(LocalObjectReference)
**out = **in
}
return nil
}
}
func DeepCopy_v1_Secret(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Secret)
@ -3445,6 +3467,13 @@ func DeepCopy_v1_VolumeSource(in interface{}, out interface{}, c *conversion.Clo
*out = new(PortworxVolumeSource)
**out = **in
}
if in.ScaleIO != nil {
in, out := &in.ScaleIO, &out.ScaleIO
*out = new(ScaleIOVolumeSource)
if err := DeepCopy_v1_ScaleIOVolumeSource(*in, *out, c); err != nil {
return err
}
}
return nil
}
}

View File

@ -137,6 +137,9 @@ func SetObjectDefaults_PersistentVolume(in *PersistentVolume) {
if in.Spec.PersistentVolumeSource.AzureDisk != nil {
SetDefaults_AzureDiskVolumeSource(in.Spec.PersistentVolumeSource.AzureDisk)
}
if in.Spec.PersistentVolumeSource.ScaleIO != nil {
SetDefaults_ScaleIOVolumeSource(in.Spec.PersistentVolumeSource.ScaleIO)
}
}
func SetObjectDefaults_PersistentVolumeClaim(in *PersistentVolumeClaim) {
@ -204,6 +207,9 @@ func SetObjectDefaults_Pod(in *Pod) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.InitContainers {
a := &in.Spec.InitContainers[i]
@ -349,6 +355,9 @@ func SetObjectDefaults_PodTemplate(in *PodTemplate) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Template.Spec.InitContainers {
a := &in.Template.Spec.InitContainers[i]
@ -488,6 +497,9 @@ func SetObjectDefaults_ReplicationController(in *ReplicationController) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]

View File

@ -179,6 +179,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_ResourceQuotaStatus, InType: reflect.TypeOf(&ResourceQuotaStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_ResourceRequirements, InType: reflect.TypeOf(&ResourceRequirements{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_SELinuxOptions, InType: reflect.TypeOf(&SELinuxOptions{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_ScaleIOVolumeSource, InType: reflect.TypeOf(&ScaleIOVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_Secret, InType: reflect.TypeOf(&Secret{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_SecretEnvSource, InType: reflect.TypeOf(&SecretEnvSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_SecretKeySelector, InType: reflect.TypeOf(&SecretKeySelector{})},
@ -2070,6 +2071,13 @@ func DeepCopy_api_PersistentVolumeSource(in interface{}, out interface{}, c *con
*out = new(PortworxVolumeSource)
**out = **in
}
if in.ScaleIO != nil {
in, out := &in.ScaleIO, &out.ScaleIO
*out = new(ScaleIOVolumeSource)
if err := DeepCopy_api_ScaleIOVolumeSource(*in, *out, c); err != nil {
return err
}
}
return nil
}
}
@ -2911,6 +2919,20 @@ func DeepCopy_api_SELinuxOptions(in interface{}, out interface{}, c *conversion.
}
}
func DeepCopy_api_ScaleIOVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScaleIOVolumeSource)
out := out.(*ScaleIOVolumeSource)
*out = *in
if in.SecretRef != nil {
in, out := &in.SecretRef, &out.SecretRef
*out = new(LocalObjectReference)
**out = **in
}
return nil
}
}
func DeepCopy_api_Secret(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Secret)
@ -3472,6 +3494,13 @@ func DeepCopy_api_VolumeSource(in interface{}, out interface{}, c *conversion.Cl
*out = new(PortworxVolumeSource)
**out = **in
}
if in.ScaleIO != nil {
in, out := &in.ScaleIO, &out.ScaleIO
*out = new(ScaleIOVolumeSource)
if err := DeepCopy_api_ScaleIOVolumeSource(*in, *out, c); err != nil {
return err
}
}
return nil
}
}

View File

@ -80,6 +80,9 @@ func SetObjectDefaults_Deployment(in *Deployment) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]
@ -218,6 +221,9 @@ func SetObjectDefaults_StatefulSet(in *StatefulSet) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]

View File

@ -78,6 +78,9 @@ func SetObjectDefaults_Job(in *Job) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
api_v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]

View File

@ -81,6 +81,9 @@ func SetObjectDefaults_CronJob(in *CronJob) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.JobTemplate.Spec.Template.Spec.InitContainers {
a := &in.Spec.JobTemplate.Spec.Template.Spec.InitContainers[i]
@ -219,6 +222,9 @@ func SetObjectDefaults_Job(in *Job) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]
@ -356,6 +362,9 @@ func SetObjectDefaults_JobTemplate(in *JobTemplate) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Template.Spec.Template.Spec.InitContainers {
a := &in.Template.Spec.Template.Spec.InitContainers[i]

View File

@ -918,6 +918,7 @@ var (
PhotonPersistentDisk FSType = "photonPersistentDisk"
Projected FSType = "projected"
PortworxVolume FSType = "portworxVolume"
ScaleIO FSType = "scaleIO"
All FSType = "*"
)

View File

@ -84,6 +84,9 @@ func SetObjectDefaults_DaemonSet(in *DaemonSet) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]
@ -222,6 +225,9 @@ func SetObjectDefaults_Deployment(in *Deployment) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]
@ -371,6 +377,9 @@ func SetObjectDefaults_ReplicaSet(in *ReplicaSet) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]

View File

@ -84,6 +84,9 @@ func SetObjectDefaults_PodPreset(in *PodPreset) {
}
}
}
if a.VolumeSource.ScaleIO != nil {
v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO)
}
}
}

29
vendor/BUILD vendored
View File

@ -16262,3 +16262,32 @@ filegroup(
srcs = [":package-srcs"],
tags = ["automanaged"],
)
go_library(
name = "github.com/codedellemc/goscaleio",
srcs = [
"github.com/codedellemc/goscaleio/api.go",
"github.com/codedellemc/goscaleio/certs.go",
"github.com/codedellemc/goscaleio/device.go",
"github.com/codedellemc/goscaleio/instance.go",
"github.com/codedellemc/goscaleio/protectiondomain.go",
"github.com/codedellemc/goscaleio/scsiinitiator.go",
"github.com/codedellemc/goscaleio/sdc.go",
"github.com/codedellemc/goscaleio/sds.go",
"github.com/codedellemc/goscaleio/storagepool.go",
"github.com/codedellemc/goscaleio/system.go",
"github.com/codedellemc/goscaleio/user.go",
"github.com/codedellemc/goscaleio/volume.go",
],
tags = ["automanaged"],
deps = [
"//vendor:github.com/Sirupsen/logrus",
"//vendor:github.com/codedellemc/goscaleio/types/v1",
],
)
go_library(
name = "github.com/codedellemc/goscaleio/types/v1",
srcs = ["github.com/codedellemc/goscaleio/types/v1/types.go"],
tags = ["automanaged"],
)

420
vendor/github.com/codedellemc/goscaleio/.gitignore generated vendored Normal file
View File

@ -0,0 +1,420 @@
*.*-e
.*-e
*-e
vendor/
.build/
.rpmbuild/
example
release/*
golang-crosscompile/
.project
*.d
*.out
.gaesdk/
# Created by https://www.gitignore.io
### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Eclipse ###
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
### Go ###
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
### SublimeText ###
# cache files for sublime text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# workspace files are user-specific
*.sublime-workspace
# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project
# sftp configuration file
sftp-config.json
### VisualStudio ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studo 2015 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
*.[Cc]ache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
### Java ###
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml
# Gradle:
# .idea/gradle.xml
# .idea/libraries
# Mongo Explorer plugin:
# .idea/mongoSettings.xml
## File-based project format:
*.ipr
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties

10
vendor/github.com/codedellemc/goscaleio/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,10 @@
language: go
install:
- go get -t ./...
- go get code.google.com/p/go.tools/cmd/cover
- go get github.com/mattn/goveralls
script:
- PATH="$HOME/gopath/bin:$PATH"
- script/coverage --coveralls

202
vendor/github.com/codedellemc/goscaleio/LICENSE generated vendored Normal file
View File

@ -0,0 +1,202 @@
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.

80
vendor/github.com/codedellemc/goscaleio/README.md generated vendored Normal file
View File

@ -0,0 +1,80 @@
# Goscaleio
The *Goscaleio* project represents API bindings that can be used to provide ScaleIO functionality into other Go applications.
- [Current State](#state)
- [Usage](#usage)
- [Licensing](#licensing)
- [Support](#support)
## Use Cases
Any application written in Go can take advantage of these bindings. Specifically, things that are involved in monitoring, management, and more specifically infrastructrue as code would find these bindings relevant.
## <a id="state">Current State</a>
Early build-out and pre-documentation stages. The basics around authentication and object models are there.
## <a id="usage">Usage</a>
### Logging in
client, err := goscaleio.NewClient()
if err != nil {
log.Fatalf("err: %v", err)
}
_, err = client.Authenticate(&goscaleio.ConfigConnect{endpoint, username, password})
if err != nil {
log.Fatalf("error authenticating: %v", err)
}
fmt.Println("Successfuly logged in to ScaleIO Gateway at", client.SIOEndpoint.String())
### Reusing the authentication token
Once a client struct is created via the ```NewClient()``` function, you can replace the ```Token``` with the saved token.
client, err := goscaleio.NewClient()
if err != nil {
log.Fatalf("error with NewClient: %s", err)
}
client.Token = oldToken
### Get Systems
Retrieving systems is the first step after authentication which enables you to work with other necessary methods.
#### All Systems
systems, err := client.GetInstance()
if err != nil {
log.Fatalf("err: problem getting instance %v", err)
}
#### Find a System
system, err := client.FindSystem(systemid,"","")
if err != nil {
log.Fatalf("err: problem getting instance %v", err)
}
### Get Protection Domains
Once you have a ```System``` struct you can then get other things like ```Protection Domains```.
protectiondomains, err := system.GetProtectionDomain()
if err != nil {
log.Fatalf("error getting protection domains: %v", err)
}
<a id="licensing">Licensing</a>
---------
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.
<a id="support">Support</a>
-------
Please file bugs and issues at the Github issues page. For more general discussions you can contact the EMC Code team at <a href="https://groups.google.com/forum/#!forum/emccode-users">Google Groups</a> or tagged with **EMC** on <a href="https://stackoverflow.com">Stackoverflow.com</a>. The code and documentation are released with no warranties or SLAs and are intended to be supported through a community driven process.

401
vendor/github.com/codedellemc/goscaleio/api.go generated vendored Normal file
View File

@ -0,0 +1,401 @@
package goscaleio
import (
"bytes"
"crypto/tls"
"crypto/x509"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"regexp"
"strings"
"time"
log "github.com/Sirupsen/logrus"
types "github.com/codedellemc/goscaleio/types/v1"
)
type Client struct {
Token string
SIOEndpoint url.URL
Http http.Client
Insecure string
ShowBody bool
configConnect *ConfigConnect
}
type Cluster struct {
}
type ConfigConnect struct {
Endpoint string
Version string
Username string
Password string
}
type ClientPersistent struct {
configConnect *ConfigConnect
client *Client
}
func (client *Client) getVersion() (string, error) {
endpoint := client.SIOEndpoint
endpoint.Path = "/api/version"
req := client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", client.Token)
resp, err := client.retryCheckResp(&client.Http, req)
if err != nil {
return "", fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
bs, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", errors.New("error reading body")
}
version := string(bs)
if client.ShowBody {
log.WithField("body", version).Debug(
"printing version message body")
}
version = strings.TrimRight(version, `"`)
version = strings.TrimLeft(version, `"`)
versionRX := regexp.MustCompile(`^(\d+?\.\d+?).*$`)
if m := versionRX.FindStringSubmatch(version); len(m) > 0 {
return m[1], nil
}
return version, nil
}
func (client *Client) updateVersion() error {
version, err := client.getVersion()
if err != nil {
return err
}
client.configConnect.Version = version
return nil
}
func (client *Client) Authenticate(configConnect *ConfigConnect) (Cluster, error) {
configConnect.Version = client.configConnect.Version
client.configConnect = configConnect
endpoint := client.SIOEndpoint
endpoint.Path += "/login"
req := client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth(configConnect.Username, configConnect.Password)
httpClient := &client.Http
resp, errBody, err := client.checkResp(httpClient.Do(req))
if errBody == nil && err != nil {
return Cluster{}, err
} else if errBody != nil && err != nil {
if resp == nil {
return Cluster{}, errors.New("Problem getting response from endpoint")
}
return Cluster{}, errors.New(errBody.Message)
}
defer resp.Body.Close()
bs, err := ioutil.ReadAll(resp.Body)
if err != nil {
return Cluster{}, errors.New("error reading body")
}
token := string(bs)
if client.ShowBody {
log.WithField("body", token).Debug(
"printing authentication message body")
}
token = strings.TrimRight(token, `"`)
token = strings.TrimLeft(token, `"`)
client.Token = token
if client.configConnect.Version == "" {
err = client.updateVersion()
if err != nil {
return Cluster{}, errors.New("error getting version of ScaleIO")
}
}
return Cluster{}, nil
}
//https://github.com/chrislusf/teeproxy/blob/master/teeproxy.go
type nopCloser struct {
io.Reader
}
func (nopCloser) Close() error { return nil }
func DuplicateRequest(request *http.Request) (request1 *http.Request, request2 *http.Request) {
request1 = &http.Request{
Method: request.Method,
URL: request.URL,
Proto: "HTTP/1.1",
ProtoMajor: 1,
ProtoMinor: 1,
Header: request.Header,
Host: request.Host,
ContentLength: request.ContentLength,
}
request2 = &http.Request{
Method: request.Method,
URL: request.URL,
Proto: "HTTP/1.1",
ProtoMajor: 1,
ProtoMinor: 1,
Header: request.Header,
Host: request.Host,
ContentLength: request.ContentLength,
}
if request.Body != nil {
b1 := new(bytes.Buffer)
b2 := new(bytes.Buffer)
w := io.MultiWriter(b1, b2)
io.Copy(w, request.Body)
request1.Body = nopCloser{b1}
request2.Body = nopCloser{b2}
defer request.Body.Close()
}
return
}
func (client *Client) retryCheckResp(httpClient *http.Client, req *http.Request) (*http.Response, error) {
req1, req2 := DuplicateRequest(req)
resp, errBody, err := client.checkResp(httpClient.Do(req1))
if errBody == nil && err != nil {
return &http.Response{}, err
} else if errBody != nil && err != nil {
if resp == nil {
return nil, errors.New("Problem getting response from endpoint")
}
if resp.StatusCode == 401 && errBody.MajorErrorCode == 0 {
_, err := client.Authenticate(client.configConnect)
if err != nil {
return nil, fmt.Errorf("Error re-authenticating: %s", err)
}
ioutil.ReadAll(resp.Body)
resp.Body.Close()
req2.SetBasicAuth("", client.Token)
resp, errBody, err = client.checkResp(httpClient.Do(req2))
if err != nil {
return &http.Response{}, errors.New(errBody.Message)
}
} else {
return &http.Response{}, errors.New(errBody.Message)
}
}
return resp, nil
}
func (client *Client) checkResp(resp *http.Response, err error) (*http.Response, *types.Error, error) {
if err != nil {
return resp, &types.Error{}, err
}
switch i := resp.StatusCode; {
// Valid request, return the response.
case i == 200 || i == 201 || i == 202 || i == 204:
return resp, &types.Error{}, nil
// Invalid request, parse the XML error returned and return it.
case i == 400 || i == 401 || i == 403 || i == 404 || i == 405 || i == 406 || i == 409 || i == 415 || i == 500 || i == 503 || i == 504:
errBody, err := client.parseErr(resp)
return resp, errBody, err
// Unhandled response.
default:
return nil, &types.Error{}, fmt.Errorf("unhandled API response, please report this issue, status code: %s", resp.Status)
}
}
func (client *Client) decodeBody(resp *http.Response, out interface{}) error {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
if client.ShowBody {
var prettyJSON bytes.Buffer
_ = json.Indent(&prettyJSON, body, "", " ")
log.WithField("body", prettyJSON.String()).Debug(
"print decoded body")
}
if err = json.Unmarshal(body, &out); err != nil {
return err
}
return nil
}
func (client *Client) parseErr(resp *http.Response) (*types.Error, error) {
errBody := new(types.Error)
// if there was an error decoding the body, just return that
if err := client.decodeBody(resp, errBody); err != nil {
return &types.Error{}, fmt.Errorf("error parsing error body for non-200 request: %s", err)
}
return errBody, fmt.Errorf("API (%d) Error: %d: %s", resp.StatusCode, errBody.MajorErrorCode, errBody.Message)
}
func (c *Client) NewRequest(params map[string]string, method string, u url.URL, body io.Reader) *http.Request {
if log.GetLevel() == log.DebugLevel && c.ShowBody && body != nil {
buf := new(bytes.Buffer)
buf.ReadFrom(body)
log.WithField("body", buf.String()).Debug("print new request body")
}
p := url.Values{}
for k, v := range params {
p.Add(k, v)
}
u.RawQuery = p.Encode()
req, _ := http.NewRequest(method, u.String(), body)
return req
}
func NewClient() (client *Client, err error) {
return NewClientWithArgs(
os.Getenv("GOSCALEIO_ENDPOINT"),
os.Getenv("GOSCALEIO_VERSION"),
os.Getenv("GOSCALEIO_INSECURE") == "true",
os.Getenv("GOSCALEIO_USECERTS") == "true")
}
func NewClientWithArgs(
endpoint string,
version string,
insecure,
useCerts bool) (client *Client, err error) {
fields := map[string]interface{}{
"endpoint": endpoint,
"insecure": insecure,
"useCerts": useCerts,
"version": version,
}
var uri *url.URL
if endpoint != "" {
uri, err = url.ParseRequestURI(endpoint)
if err != nil {
return &Client{},
withFieldsE(fields, "error parsing endpoint", err)
}
} else {
return &Client{},
withFields(fields, "endpoint is required")
}
client = &Client{
SIOEndpoint: *uri,
Http: http.Client{
Transport: &http.Transport{
TLSHandshakeTimeout: 120 * time.Second,
TLSClientConfig: &tls.Config{
InsecureSkipVerify: insecure,
},
},
},
}
if useCerts {
pool := x509.NewCertPool()
pool.AppendCertsFromPEM(pemCerts)
client.Http.Transport = &http.Transport{
TLSHandshakeTimeout: 120 * time.Second,
TLSClientConfig: &tls.Config{
RootCAs: pool,
InsecureSkipVerify: insecure,
},
}
}
client.configConnect = &ConfigConnect{
Version: version,
}
return client, nil
}
func GetLink(links []*types.Link, rel string) (*types.Link, error) {
for _, link := range links {
if link.Rel == rel {
return link, nil
}
}
return &types.Link{}, errors.New("Couldn't find link")
}
func withFields(fields map[string]interface{}, message string) error {
return withFieldsE(fields, message, nil)
}
func withFieldsE(
fields map[string]interface{}, message string, inner error) error {
if fields == nil {
fields = make(map[string]interface{})
}
if inner != nil {
fields["inner"] = inner
}
x := 0
l := len(fields)
var b bytes.Buffer
for k, v := range fields {
if x < l-1 {
b.WriteString(fmt.Sprintf("%s=%v,", k, v))
} else {
b.WriteString(fmt.Sprintf("%s=%v", k, v))
}
x = x + 1
}
return newf("%s %s", message, b.String())
}
func newf(format string, a ...interface{}) error {
return errors.New(fmt.Sprintf(format, a))
}

4232
vendor/github.com/codedellemc/goscaleio/certs.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

110
vendor/github.com/codedellemc/goscaleio/device.go generated vendored Normal file
View File

@ -0,0 +1,110 @@
package goscaleio
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"reflect"
types "github.com/codedellemc/goscaleio/types/v1"
)
type Device struct {
Device *types.Device
client *Client
}
func NewDevice(client *Client) *Device {
return &Device{
Device: new(types.Device),
client: client,
}
}
func NewDeviceEx(client *Client, device *types.Device) *Device {
return &Device{
Device: device,
client: client,
}
}
func (storagePool *StoragePool) AttachDevice(path string, sdsID string) (string, error) {
endpoint := storagePool.client.SIOEndpoint
deviceParam := &types.DeviceParam{}
deviceParam.Name = path
deviceParam.DeviceCurrentPathname = path
deviceParam.StoragePoolID = storagePool.StoragePool.ID
deviceParam.SdsID = sdsID
deviceParam.TestMode = "testAndActivate"
jsonOutput, err := json.Marshal(&deviceParam)
if err != nil {
return "", fmt.Errorf("error marshaling: %s", err)
}
endpoint.Path = fmt.Sprintf("/api/types/Device/instances")
req := storagePool.client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", storagePool.client.Token)
req.Header.Add("Accept", "application/json;version="+storagePool.client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+storagePool.client.configConnect.Version)
resp, err := storagePool.client.retryCheckResp(&storagePool.client.Http, req)
if err != nil {
return "", err
}
defer resp.Body.Close()
bs, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", errors.New("error reading body")
}
var dev types.DeviceResp
err = json.Unmarshal(bs, &dev)
if err != nil {
return "", err
}
return dev.ID, nil
}
func (storagePool *StoragePool) GetDevice() (devices []types.Device, err error) {
endpoint := storagePool.client.SIOEndpoint
endpoint.Path = fmt.Sprintf("/api/instances/StoragePool::%v/relationships/Device", storagePool.StoragePool.ID)
req := storagePool.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", storagePool.client.Token)
req.Header.Add("Accept", "application/json;version="+storagePool.client.configConnect.Version)
resp, err := storagePool.client.retryCheckResp(&storagePool.client.Http, req)
if err != nil {
return []types.Device{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = storagePool.client.decodeBody(resp, &devices); err != nil {
return []types.Device{}, fmt.Errorf("error decoding instances response: %s", err)
}
return devices, nil
}
func (storagePool *StoragePool) FindDevice(field, value string) (device *types.Device, err error) {
devices, err := storagePool.GetDevice()
if err != nil {
return &types.Device{}, nil
}
for _, device := range devices {
valueOf := reflect.ValueOf(device)
switch {
case reflect.Indirect(valueOf).FieldByName(field).String() == value:
return &device, nil
}
}
return &types.Device{}, errors.New("Couldn't find DEV")
}

228
vendor/github.com/codedellemc/goscaleio/instance.go generated vendored Normal file
View File

@ -0,0 +1,228 @@
package goscaleio
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"strings"
types "github.com/codedellemc/goscaleio/types/v1"
)
func (client *Client) GetInstance(systemhref string) (systems []*types.System, err error) {
endpoint := client.SIOEndpoint
if systemhref == "" {
endpoint.Path += "/types/System/instances"
} else {
endpoint.Path = systemhref
}
req := client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", client.Token)
req.Header.Add("Accept", "application/json;version="+client.configConnect.Version)
resp, err := client.retryCheckResp(&client.Http, req)
if err != nil {
return []*types.System{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if systemhref == "" {
if err = client.decodeBody(resp, &systems); err != nil {
return []*types.System{}, fmt.Errorf("error decoding instances response: %s", err)
}
} else {
system := &types.System{}
if err = client.decodeBody(resp, &system); err != nil {
return []*types.System{}, fmt.Errorf("error decoding instances response: %s", err)
}
systems = append(systems, system)
}
// bs, err := ioutil.ReadAll(resp.Body)
// if err != nil {
// return types.Systems{}, errors.New("error reading body")
// }
return systems, nil
}
func (client *Client) GetVolume(volumehref, volumeid, ancestorvolumeid, volumename string, getSnapshots bool) (volumes []*types.Volume, err error) {
endpoint := client.SIOEndpoint
if volumename != "" {
volumeid, err = client.FindVolumeID(volumename)
if err != nil && err.Error() == "Not found" {
return nil, nil
}
if err != nil {
return []*types.Volume{}, fmt.Errorf("Error: problem finding volume: %s", err)
}
}
if volumeid != "" {
endpoint.Path = fmt.Sprintf("/api/instances/Volume::%s", volumeid)
} else if volumehref == "" {
endpoint.Path = "/api/types/Volume/instances"
} else {
endpoint.Path = volumehref
}
req := client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", client.Token)
req.Header.Add("Accept", "application/json;version="+client.configConnect.Version)
resp, err := client.retryCheckResp(&client.Http, req)
if err != nil {
return []*types.Volume{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if volumehref == "" && volumeid == "" {
if err = client.decodeBody(resp, &volumes); err != nil {
return []*types.Volume{}, fmt.Errorf("error decoding storage pool response: %s", err)
}
var volumesNew []*types.Volume
for _, volume := range volumes {
if (!getSnapshots && volume.AncestorVolumeID == ancestorvolumeid) || (getSnapshots && volume.AncestorVolumeID != "") {
volumesNew = append(volumesNew, volume)
}
}
volumes = volumesNew
} else {
volume := &types.Volume{}
if err = client.decodeBody(resp, &volume); err != nil {
return []*types.Volume{}, fmt.Errorf("error decoding instances response: %s", err)
}
volumes = append(volumes, volume)
}
return volumes, nil
}
func (client *Client) FindVolumeID(volumename string) (volumeID string, err error) {
endpoint := client.SIOEndpoint
volumeQeryIdByKeyParam := &types.VolumeQeryIdByKeyParam{}
volumeQeryIdByKeyParam.Name = volumename
jsonOutput, err := json.Marshal(&volumeQeryIdByKeyParam)
if err != nil {
return "", fmt.Errorf("error marshaling: %s", err)
}
endpoint.Path = fmt.Sprintf("/api/types/Volume/instances/action/queryIdByKey")
req := client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", client.Token)
req.Header.Add("Accept", "application/json;version="+client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+client.configConnect.Version)
resp, err := client.retryCheckResp(&client.Http, req)
if err != nil {
return "", err
}
defer resp.Body.Close()
bs, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", errors.New("error reading body")
}
volumeID = string(bs)
volumeID = strings.TrimRight(volumeID, `"`)
volumeID = strings.TrimLeft(volumeID, `"`)
return volumeID, nil
}
func (client *Client) CreateVolume(volume *types.VolumeParam, storagePoolName string) (volumeResp *types.VolumeResp, err error) {
endpoint := client.SIOEndpoint
endpoint.Path = "/api/types/Volume/instances"
storagePool, err := client.FindStoragePool("", storagePoolName, "")
if err != nil {
return nil, err
}
volume.StoragePoolID = storagePool.ID
volume.ProtectionDomainID = storagePool.ProtectionDomainID
jsonOutput, err := json.Marshal(&volume)
if err != nil {
return &types.VolumeResp{}, fmt.Errorf("error marshaling: %s", err)
}
req := client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", client.Token)
req.Header.Add("Accept", "application/json;version="+client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+client.configConnect.Version)
resp, err := client.retryCheckResp(&client.Http, req)
if err != nil {
return &types.VolumeResp{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = client.decodeBody(resp, &volumeResp); err != nil {
return &types.VolumeResp{}, fmt.Errorf("error decoding volume creation response: %s", err)
}
return volumeResp, nil
}
func (client *Client) GetStoragePool(storagepoolhref string) (storagePools []*types.StoragePool, err error) {
endpoint := client.SIOEndpoint
if storagepoolhref == "" {
endpoint.Path = "/api/types/StoragePool/instances"
} else {
endpoint.Path = storagepoolhref
}
req := client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", client.Token)
req.Header.Add("Accept", "application/json;version="+client.configConnect.Version)
resp, err := client.retryCheckResp(&client.Http, req)
if err != nil {
return []*types.StoragePool{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if storagepoolhref == "" {
if err = client.decodeBody(resp, &storagePools); err != nil {
return []*types.StoragePool{}, fmt.Errorf("error decoding storage pool response: %s", err)
}
} else {
storagePool := &types.StoragePool{}
if err = client.decodeBody(resp, &storagePool); err != nil {
return []*types.StoragePool{}, fmt.Errorf("error decoding instances response: %s", err)
}
storagePools = append(storagePools, storagePool)
}
return storagePools, nil
}
func (client *Client) FindStoragePool(id, name, href string) (storagePool *types.StoragePool, err error) {
storagePools, err := client.GetStoragePool(href)
if err != nil {
return &types.StoragePool{}, fmt.Errorf("Error getting storage pool %s", err)
}
for _, storagePool = range storagePools {
if storagePool.ID == id || storagePool.Name == name || href != "" {
return storagePool, nil
}
}
return &types.StoragePool{}, errors.New("Couldn't find storage pool")
}

View File

@ -0,0 +1,131 @@
package goscaleio
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
types "github.com/codedellemc/goscaleio/types/v1"
)
type ProtectionDomain struct {
ProtectionDomain *types.ProtectionDomain
client *Client
}
func NewProtectionDomain(client *Client) *ProtectionDomain {
return &ProtectionDomain{
ProtectionDomain: new(types.ProtectionDomain),
client: client,
}
}
func NewProtectionDomainEx(client *Client, pd *types.ProtectionDomain) *ProtectionDomain {
return &ProtectionDomain{
ProtectionDomain: pd,
client: client,
}
}
func (system *System) CreateProtectionDomain(name string) (string, error) {
endpoint := system.client.SIOEndpoint
protectionDomainParam := &types.ProtectionDomainParam{}
protectionDomainParam.Name = name
jsonOutput, err := json.Marshal(&protectionDomainParam)
if err != nil {
return "", fmt.Errorf("error marshaling: %s", err)
}
endpoint.Path = fmt.Sprintf("/api/types/ProtectionDomain/instances")
req := system.client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", system.client.Token)
req.Header.Add("Accept", "application/json;version="+system.client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+system.client.configConnect.Version)
resp, err := system.client.retryCheckResp(&system.client.Http, req)
if err != nil {
return "", err
}
defer resp.Body.Close()
bs, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", errors.New("error reading body")
}
var pd types.ProtectionDomainResp
err = json.Unmarshal(bs, &pd)
if err != nil {
return "", err
}
return pd.ID, nil
}
func (system *System) GetProtectionDomain(protectiondomainhref string) (protectionDomains []*types.ProtectionDomain, err error) {
endpoint := system.client.SIOEndpoint
if protectiondomainhref == "" {
link, err := GetLink(system.System.Links, "/api/System/relationship/ProtectionDomain")
if err != nil {
return []*types.ProtectionDomain{}, errors.New("Error: problem finding link")
}
endpoint.Path = link.HREF
} else {
endpoint.Path = protectiondomainhref
}
req := system.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", system.client.Token)
req.Header.Add("Accept", "application/json;version="+system.client.configConnect.Version)
resp, err := system.client.retryCheckResp(&system.client.Http, req)
if err != nil {
return []*types.ProtectionDomain{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if protectiondomainhref == "" {
if err = system.client.decodeBody(resp, &protectionDomains); err != nil {
return []*types.ProtectionDomain{}, fmt.Errorf("error decoding instances response: %s", err)
}
} else {
protectionDomain := &types.ProtectionDomain{}
if err = system.client.decodeBody(resp, &protectionDomain); err != nil {
return []*types.ProtectionDomain{}, fmt.Errorf("error decoding instances response: %s", err)
}
protectionDomains = append(protectionDomains, protectionDomain)
}
//
// bs, err := ioutil.ReadAll(resp.Body)
// if err != nil {
// return []types.ProtectionDomain{}, errors.New("error reading body")
// }
//
// fmt.Println(string(bs))
// log.Fatalf("here")
// return []types.ProtectionDomain{}, nil
return protectionDomains, nil
}
func (system *System) FindProtectionDomain(id, name, href string) (protectionDomain *types.ProtectionDomain, err error) {
protectionDomains, err := system.GetProtectionDomain(href)
if err != nil {
return &types.ProtectionDomain{}, fmt.Errorf("Error getting protection domains %s", err)
}
for _, protectionDomain = range protectionDomains {
if protectionDomain.ID == id || protectionDomain.Name == name || href != "" {
return protectionDomain, nil
}
}
return &types.ProtectionDomain{}, errors.New("Couldn't find protection domain")
}

View File

@ -0,0 +1,35 @@
package goscaleio
import (
"fmt"
types "github.com/codedellemc/goscaleio/types/v1"
)
func (system *System) GetScsiInitiator() (scsiInitiators []types.ScsiInitiator, err error) {
endpoint := system.client.SIOEndpoint
endpoint.Path = fmt.Sprintf("/api/instances/System::%v/relationships/ScsiInitiator", system.System.ID)
req := system.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", system.client.Token)
req.Header.Add("Accept", "application/json;version="+system.client.configConnect.Version)
resp, err := system.client.retryCheckResp(&system.client.Http, req)
if err != nil {
return []types.ScsiInitiator{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = system.client.decodeBody(resp, &scsiInitiators); err != nil {
return []types.ScsiInitiator{}, fmt.Errorf("error decoding instances response: %s", err)
}
// bs, err := ioutil.ReadAll(resp.Body)
// if err != nil {
// return types.ScsiInitiator{}, errors.New("error reading body")
// }
//
// log.Fatalf("here")
// return types.ScsiInitiator{}, nil
return scsiInitiators, nil
}

188
vendor/github.com/codedellemc/goscaleio/sdc.go generated vendored Normal file
View File

@ -0,0 +1,188 @@
package goscaleio
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"log"
"os/exec"
"reflect"
"strings"
types "github.com/codedellemc/goscaleio/types/v1"
)
type Sdc struct {
Sdc *types.Sdc
client *Client
}
func NewSdc(client *Client, sdc *types.Sdc) *Sdc {
return &Sdc{
Sdc: sdc,
client: client,
}
}
func (system *System) GetSdc() (sdcs []types.Sdc, err error) {
endpoint := system.client.SIOEndpoint
endpoint.Path = fmt.Sprintf("/api/instances/System::%v/relationships/Sdc", system.System.ID)
req := system.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", system.client.Token)
req.Header.Add("Accept", "application/json;version="+system.client.configConnect.Version)
resp, err := system.client.retryCheckResp(&system.client.Http, req)
if err != nil {
return []types.Sdc{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = system.client.decodeBody(resp, &sdcs); err != nil {
return []types.Sdc{}, fmt.Errorf("error decoding instances response: %s", err)
}
// bs, err := ioutil.ReadAll(resp.Body)
// if err != nil {
// return []types.Sdc{}, errors.New("error reading body")
// }
//
// fmt.Println(string(bs))
// log.Fatalf("here")
// return []types.Sdc{}, nil
return sdcs, nil
}
func (system *System) FindSdc(field, value string) (sdc *Sdc, err error) {
sdcs, err := system.GetSdc()
if err != nil {
return &Sdc{}, nil
}
for _, sdc := range sdcs {
valueOf := reflect.ValueOf(sdc)
switch {
case reflect.Indirect(valueOf).FieldByName(field).String() == value:
return NewSdc(system.client, &sdc), nil
}
}
return &Sdc{}, errors.New("Couldn't find SDC")
}
func (sdc *Sdc) GetStatistics() (statistics *types.Statistics, err error) {
endpoint := sdc.client.SIOEndpoint
link, err := GetLink(sdc.Sdc.Links, "/api/Sdc/relationship/Statistics")
if err != nil {
return &types.Statistics{}, errors.New("Error: problem finding link")
}
endpoint.Path = link.HREF
req := sdc.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", sdc.client.Token)
req.Header.Add("Accept", "application/json;version="+sdc.client.configConnect.Version)
resp, err := sdc.client.retryCheckResp(&sdc.client.Http, req)
if err != nil {
return &types.Statistics{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = sdc.client.decodeBody(resp, &statistics); err != nil {
return &types.Statistics{}, fmt.Errorf("error decoding instances response: %s", err)
}
return statistics, nil
}
func (sdc *Sdc) GetVolume() (volumes []*types.Volume, err error) {
endpoint := sdc.client.SIOEndpoint
link, err := GetLink(sdc.Sdc.Links, "/api/Sdc/relationship/Volume")
if err != nil {
return []*types.Volume{}, errors.New("Error: problem finding link")
}
endpoint.Path = link.HREF
req := sdc.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", sdc.client.Token)
req.Header.Add("Accept", "application/json;version="+sdc.client.configConnect.Version)
resp, err := sdc.client.retryCheckResp(&sdc.client.Http, req)
if err != nil {
return []*types.Volume{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = sdc.client.decodeBody(resp, &volumes); err != nil {
return []*types.Volume{}, fmt.Errorf("error decoding instances response: %s", err)
}
return volumes, nil
}
func GetSdcLocalGUID() (sdcGUID string, err error) {
// get sdc kernel guid
// /bin/emc/scaleio/drv_cfg --query_guid
// sdcKernelGuid := "271bad82-08ee-44f2-a2b1-7e2787c27be1"
out, err := exec.Command("/opt/emc/scaleio/sdc/bin/drv_cfg", "--query_guid").Output()
if err != nil {
return "", fmt.Errorf("Error querying volumes: ", err)
}
sdcGUID = strings.Replace(string(out), "\n", "", -1)
return sdcGUID, nil
}
func (volume *Volume) MapVolumeSdc(mapVolumeSdcParam *types.MapVolumeSdcParam) (err error) {
endpoint := volume.client.SIOEndpoint
endpoint.Path = fmt.Sprintf("/api/instances/Volume::%s/action/addMappedSdc", volume.Volume.ID)
jsonOutput, err := json.Marshal(&mapVolumeSdcParam)
if err != nil {
log.Fatalf("error marshaling: %s", err)
}
req := volume.client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", volume.client.Token)
req.Header.Add("Accept", "application/json;version="+volume.client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+volume.client.configConnect.Version)
resp, err := volume.client.retryCheckResp(&volume.client.Http, req)
if err != nil {
return fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
return nil
}
func (volume *Volume) UnmapVolumeSdc(unmapVolumeSdcParam *types.UnmapVolumeSdcParam) (err error) {
endpoint := volume.client.SIOEndpoint
endpoint.Path = fmt.Sprintf("/api/instances/Volume::%s/action/removeMappedSdc", volume.Volume.ID)
jsonOutput, err := json.Marshal(&unmapVolumeSdcParam)
if err != nil {
return fmt.Errorf("error marshaling: %s", err)
}
req := volume.client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", volume.client.Token)
req.Header.Add("Accept", "application/json;version="+volume.client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+volume.client.configConnect.Version)
resp, err := volume.client.retryCheckResp(&volume.client.Http, req)
if err != nil {
return fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
return nil
}

122
vendor/github.com/codedellemc/goscaleio/sds.go generated vendored Normal file
View File

@ -0,0 +1,122 @@
package goscaleio
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"reflect"
types "github.com/codedellemc/goscaleio/types/v1"
)
type Sds struct {
Sds *types.Sds
client *Client
}
func NewSds(client *Client) *Sds {
return &Sds{
Sds: new(types.Sds),
client: client,
}
}
func NewSdsEx(client *Client, sds *types.Sds) *Sds {
return &Sds{
Sds: sds,
client: client,
}
}
func (protectionDomain *ProtectionDomain) CreateSds(name string, ipList []string) (string, error) {
endpoint := protectionDomain.client.SIOEndpoint
sdsParam := &types.SdsParam{}
sdsParam.Name = name
sdsParam.ProtectionDomainID = protectionDomain.ProtectionDomain.ID
if len(ipList) == 0 {
return "", fmt.Errorf("Must provide at least 1 SDS IP")
} else if len(ipList) == 1 {
sdsIP := types.SdsIp{IP: ipList[0], Role: "all"}
sdsIPList := &types.SdsIpList{sdsIP}
sdsParam.IPList = append(sdsParam.IPList, sdsIPList)
} else if len(ipList) >= 2 {
sdsIP1 := types.SdsIp{IP: ipList[0], Role: "sdcOnly"}
sdsIP2 := types.SdsIp{IP: ipList[1], Role: "sdsOnly"}
sdsIPList1 := &types.SdsIpList{sdsIP1}
sdsIPList2 := &types.SdsIpList{sdsIP2}
sdsParam.IPList = append(sdsParam.IPList, sdsIPList1)
sdsParam.IPList = append(sdsParam.IPList, sdsIPList2)
}
jsonOutput, err := json.Marshal(&sdsParam)
if err != nil {
return "", fmt.Errorf("error marshaling: %s", err)
}
endpoint.Path = fmt.Sprintf("/api/types/Sds/instances")
req := protectionDomain.client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", protectionDomain.client.Token)
req.Header.Add("Accept", "application/json;version="+protectionDomain.client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+protectionDomain.client.configConnect.Version)
resp, err := protectionDomain.client.retryCheckResp(&protectionDomain.client.Http, req)
if err != nil {
return "", err
}
defer resp.Body.Close()
bs, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", errors.New("error reading body")
}
var sds types.SdsResp
err = json.Unmarshal(bs, &sds)
if err != nil {
return "", err
}
return sds.ID, nil
}
func (protectionDomain *ProtectionDomain) GetSds() (sdss []types.Sds, err error) {
endpoint := protectionDomain.client.SIOEndpoint
endpoint.Path = fmt.Sprintf("/api/instances/ProtectionDomain::%v/relationships/Sds", protectionDomain.ProtectionDomain.ID)
req := protectionDomain.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", protectionDomain.client.Token)
req.Header.Add("Accept", "application/json;version="+protectionDomain.client.configConnect.Version)
resp, err := protectionDomain.client.retryCheckResp(&protectionDomain.client.Http, req)
if err != nil {
return []types.Sds{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = protectionDomain.client.decodeBody(resp, &sdss); err != nil {
return []types.Sds{}, fmt.Errorf("error decoding instances response: %s", err)
}
return sdss, nil
}
func (protectionDomain *ProtectionDomain) FindSds(field, value string) (sds *types.Sds, err error) {
sdss, err := protectionDomain.GetSds()
if err != nil {
return &types.Sds{}, nil
}
for _, sds := range sdss {
valueOf := reflect.ValueOf(sds)
switch {
case reflect.Indirect(valueOf).FieldByName(field).String() == value:
return &sds, nil
}
}
return &types.Sds{}, errors.New("Couldn't find SDS")
}

148
vendor/github.com/codedellemc/goscaleio/storagepool.go generated vendored Normal file
View File

@ -0,0 +1,148 @@
package goscaleio
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
types "github.com/codedellemc/goscaleio/types/v1"
)
type StoragePool struct {
StoragePool *types.StoragePool
client *Client
}
func NewStoragePool(client *Client) *StoragePool {
return &StoragePool{
StoragePool: new(types.StoragePool),
client: client,
}
}
func NewStoragePoolEx(client *Client, pool *types.StoragePool) *StoragePool {
return &StoragePool{
StoragePool: pool,
client: client,
}
}
func (protectionDomain *ProtectionDomain) CreateStoragePool(name string) (string, error) {
endpoint := protectionDomain.client.SIOEndpoint
storagePoolParam := &types.StoragePoolParam{}
storagePoolParam.Name = name
storagePoolParam.ProtectionDomainID = protectionDomain.ProtectionDomain.ID
jsonOutput, err := json.Marshal(&storagePoolParam)
if err != nil {
return "", fmt.Errorf("error marshaling: %s", err)
}
endpoint.Path = fmt.Sprintf("/api/types/StoragePool/instances")
req := protectionDomain.client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", protectionDomain.client.Token)
req.Header.Add("Accept", "application/json;version="+protectionDomain.client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+protectionDomain.client.configConnect.Version)
resp, err := protectionDomain.client.retryCheckResp(&protectionDomain.client.Http, req)
if err != nil {
return "", err
}
defer resp.Body.Close()
bs, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", errors.New("error reading body")
}
var sp types.StoragePoolResp
err = json.Unmarshal(bs, &sp)
if err != nil {
return "", err
}
return sp.ID, nil
}
func (protectionDomain *ProtectionDomain) GetStoragePool(storagepoolhref string) (storagePools []*types.StoragePool, err error) {
endpoint := protectionDomain.client.SIOEndpoint
if storagepoolhref == "" {
link, err := GetLink(protectionDomain.ProtectionDomain.Links, "/api/ProtectionDomain/relationship/StoragePool")
if err != nil {
return []*types.StoragePool{}, errors.New("Error: problem finding link")
}
endpoint.Path = link.HREF
} else {
endpoint.Path = storagepoolhref
}
req := protectionDomain.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", protectionDomain.client.Token)
req.Header.Add("Accept", "application/json;version="+protectionDomain.client.configConnect.Version)
resp, err := protectionDomain.client.retryCheckResp(&protectionDomain.client.Http, req)
if err != nil {
return []*types.StoragePool{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if storagepoolhref == "" {
if err = protectionDomain.client.decodeBody(resp, &storagePools); err != nil {
return []*types.StoragePool{}, fmt.Errorf("error decoding storage pool response: %s", err)
}
} else {
storagePool := &types.StoragePool{}
if err = protectionDomain.client.decodeBody(resp, &storagePool); err != nil {
return []*types.StoragePool{}, fmt.Errorf("error decoding instances response: %s", err)
}
storagePools = append(storagePools, storagePool)
}
return storagePools, nil
}
func (protectionDomain *ProtectionDomain) FindStoragePool(id, name, href string) (storagePool *types.StoragePool, err error) {
storagePools, err := protectionDomain.GetStoragePool(href)
if err != nil {
return &types.StoragePool{}, fmt.Errorf("Error getting protection domains %s", err)
}
for _, storagePool = range storagePools {
if storagePool.ID == id || storagePool.Name == name || href != "" {
return storagePool, nil
}
}
return &types.StoragePool{}, errors.New("Couldn't find protection domain")
}
func (storagePool *StoragePool) GetStatistics() (statistics *types.Statistics, err error) {
link, err := GetLink(storagePool.StoragePool.Links, "/api/StoragePool/relationship/Statistics")
if err != nil {
return &types.Statistics{}, errors.New("Error: problem finding link")
}
endpoint := storagePool.client.SIOEndpoint
endpoint.Path = link.HREF
req := storagePool.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", storagePool.client.Token)
req.Header.Add("Accept", "application/json;version="+storagePool.client.configConnect.Version)
resp, err := storagePool.client.retryCheckResp(&storagePool.client.Http, req)
if err != nil {
return &types.Statistics{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = storagePool.client.decodeBody(resp, &statistics); err != nil {
return &types.Statistics{}, fmt.Errorf("error decoding instances response: %s", err)
}
return statistics, nil
}

106
vendor/github.com/codedellemc/goscaleio/system.go generated vendored Normal file
View File

@ -0,0 +1,106 @@
package goscaleio
import (
"bytes"
"encoding/json"
"errors"
"fmt"
types "github.com/codedellemc/goscaleio/types/v1"
)
type System struct {
System *types.System
client *Client
}
func NewSystem(client *Client) *System {
return &System{
System: new(types.System),
client: client,
}
}
func (client *Client) FindSystem(instanceID, name, href string) (*System, error) {
systems, err := client.GetInstance(href)
if err != nil {
return &System{}, fmt.Errorf("err: problem getting instances: %s", err)
}
for _, system := range systems {
if system.ID == instanceID || system.Name == name || href != "" {
outSystem := NewSystem(client)
outSystem.System = system
return outSystem, nil
}
}
return &System{}, fmt.Errorf("err: systemid or systemname not found")
}
func (system *System) GetStatistics() (statistics *types.Statistics, err error) {
endpoint := system.client.SIOEndpoint
// endpoint.Path = fmt.Sprintf("/api/instances/System::%v/relationships/Statistics", system.System.ID)
link, err := GetLink(system.System.Links, "/api/System/relationship/Statistics")
if err != nil {
return &types.Statistics{}, errors.New("Error: problem finding link")
}
endpoint.Path = link.HREF
req := system.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", system.client.Token)
req.Header.Add("Accept", "application/json;version="+system.client.configConnect.Version)
resp, err := system.client.retryCheckResp(&system.client.Http, req)
if err != nil {
return &types.Statistics{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = system.client.decodeBody(resp, &statistics); err != nil {
return &types.Statistics{}, fmt.Errorf("error decoding instances response: %s", err)
}
// bs, err := ioutil.ReadAll(resp.Body)
// if err != nil {
// return errors.New("error reading body")
// }
//
// fmt.Println(string(bs))
return statistics, nil
}
func (system *System) CreateSnapshotConsistencyGroup(snapshotVolumesParam *types.SnapshotVolumesParam) (snapshotVolumesResp *types.SnapshotVolumesResp, err error) {
endpoint := system.client.SIOEndpoint
link, err := GetLink(system.System.Links, "self")
if err != nil {
return &types.SnapshotVolumesResp{}, errors.New("Error: problem finding link")
}
endpoint.Path = fmt.Sprintf("%v/action/snapshotVolumes", link.HREF)
jsonOutput, err := json.Marshal(&snapshotVolumesParam)
if err != nil {
return &types.SnapshotVolumesResp{}, fmt.Errorf("error marshaling: %s", err)
}
req := system.client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", system.client.Token)
req.Header.Add("Accept", "application/json;version="+system.client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+system.client.configConnect.Version)
resp, err := system.client.retryCheckResp(&system.client.Http, req)
if err != nil {
return &types.SnapshotVolumesResp{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = system.client.decodeBody(resp, &snapshotVolumesResp); err != nil {
return &types.SnapshotVolumesResp{}, fmt.Errorf("error decoding snapshotvolumes response: %s", err)
}
return snapshotVolumesResp, nil
}

View File

@ -0,0 +1,388 @@
package goscaleio
type Error struct {
Message string `xml:"message,attr"`
MajorErrorCode int `xml:"majorErrorCode,attr"`
MinorErrorCode string `xml:"minorErrorCode,attr"`
VendorSpecificErrorCode string `xml:"vendorSpecificErrorCode,attr,omitempty"`
StackTrace string `xml:"stackTrace,attr,omitempty"`
}
// type session struct {
// Link []*types.Link `xml:"Link"`
// }
type System struct {
MdmMode string `json:"mdmMode"`
MdmClusterState string `json:"mdmClusterState"`
SecondaryMdmActorIPList []string `json:"secondaryMdmActorIpList"`
InstallID string `json:"installId"`
PrimaryActorIPList []string `json:"primaryMdmActorIpList"`
SystemVersionName string `json:"systemVersionName"`
CapacityAlertHighThresholdPercent int `json:"capacityAlertHighThresholdPercent"`
CapacityAlertCriticalThresholdPercent int `json:"capacityAlertCriticalThresholdPercent"`
RemoteReadOnlyLimitState bool `json:"remoteReadOnlyLimitState"`
PrimaryMdmActorPort int `json:"primaryMdmActorPort"`
SecondaryMdmActorPort int `json:"secondaryMdmActorPort"`
TiebreakerMdmActorPort int `json:"tiebreakerMdmActorPort"`
MdmManagementPort int `json:"mdmManagementPort"`
TiebreakerMdmIPList []string `json:"tiebreakerMdmIpList"`
MdmManagementIPList []string `json:"mdmManagementIPList"`
DefaultIsVolumeObfuscated bool `json:"defaultIsVolumeObfuscated"`
RestrictedSdcModeEnabled bool `json:"restrictedSdcModeEnabled"`
Swid string `json:"swid"`
DaysInstalled int `json:"daysInstalled"`
MaxCapacityInGb string `json:"maxCapacityInGb"`
CapacityTimeLeftInDays string `json:"capacityTimeLeftInDays"`
EnterpriseFeaturesEnabled bool `json:"enterpriseFeaturesEnabled"`
IsInitialLicense bool `json:"isInitialLicense"`
Name string `json:"name"`
ID string `json:"id"`
Links []*Link `json:"links"`
}
type Link struct {
Rel string `json:"rel"`
HREF string `json:"href"`
}
type BWC struct {
TotalWeightInKb int `json:"totalWeightInKb"`
NumOccured int `json:"numOccured"`
NumSeconds int `json:"numSeconds"`
}
type Statistics struct {
PrimaryReadFromDevBwc BWC `json:"primaryReadFromDevBwc"`
NumOfStoragePools int `json:"numOfStoragePools"`
ProtectedCapacityInKb int `json:"protectedCapacityInKb"`
MovingCapacityInKb int `json:"movingCapacityInKb"`
SnapCapacityInUseOccupiedInKb int `json:"snapCapacityInUseOccupiedInKb"`
SnapCapacityInUseInKb int `json:"snapCapacityInUseInKb"`
ActiveFwdRebuildCapacityInKb int `json:"activeFwdRebuildCapacityInKb"`
DegradedHealthyVacInKb int `json:"degradedHealthyVacInKb"`
ActiveMovingRebalanceJobs int `json:"activeMovingRebalanceJobs"`
TotalReadBwc BWC `json:"totalReadBwc"`
MaxCapacityInKb int `json:"maxCapacityInKb"`
PendingBckRebuildCapacityInKb int `json:"pendingBckRebuildCapacityInKb"`
ActiveMovingOutFwdRebuildJobs int `json:"activeMovingOutFwdRebuildJobs"`
CapacityLimitInKb int `json:"capacityLimitInKb"`
SecondaryVacInKb int `json:"secondaryVacInKb"`
PendingFwdRebuildCapacityInKb int `json:"pendingFwdRebuildCapacityInKb"`
ThinCapacityInUseInKb int `json:"thinCapacityInUseInKb"`
AtRestCapacityInKb int `json:"atRestCapacityInKb"`
ActiveMovingInBckRebuildJobs int `json:"activeMovingInBckRebuildJobs"`
DegradedHealthyCapacityInKb int `json:"degradedHealthyCapacityInKb"`
NumOfScsiInitiators int `json:"numOfScsiInitiators"`
NumOfUnmappedVolumes int `json:"numOfUnmappedVolumes"`
FailedCapacityInKb int `json:"failedCapacityInKb"`
SecondaryReadFromDevBwc BWC `json:"secondaryReadFromDevBwc"`
NumOfVolumes int `json:"numOfVolumes"`
SecondaryWriteBwc BWC `json:"secondaryWriteBwc"`
ActiveBckRebuildCapacityInKb int `json:"activeBckRebuildCapacityInKb"`
FailedVacInKb int `json:"failedVacInKb"`
PendingMovingCapacityInKb int `json:"pendingMovingCapacityInKb"`
ActiveMovingInRebalanceJobs int `json:"activeMovingInRebalanceJobs"`
PendingMovingInRebalanceJobs int `json:"pendingMovingInRebalanceJobs"`
BckRebuildReadBwc BWC `json:"bckRebuildReadBwc"`
DegradedFailedVacInKb int `json:"degradedFailedVacInKb"`
NumOfSnapshots int `json:"numOfSnapshots"`
RebalanceCapacityInKb int `json:"rebalanceCapacityInKb"`
fwdRebuildReadBwc BWC `json:"fwdRebuildReadBwc"`
NumOfSdc int `json:"numOfSdc"`
ActiveMovingInFwdRebuildJobs int `json:"activeMovingInFwdRebuildJobs"`
NumOfVtrees int `json:"numOfVtrees"`
ThickCapacityInUseInKb int `json:"thickCapacityInUseInKb"`
ProtectedVacInKb int `json:"protectedVacInKb"`
PendingMovingInBckRebuildJobs int `json:"pendingMovingInBckRebuildJobs"`
CapacityAvailableForVolumeAllocationInKb int `json:"capacityAvailableForVolumeAllocationInKb"`
PendingRebalanceCapacityInKb int `json:"pendingRebalanceCapacityInKb"`
PendingMovingRebalanceJobs int `json:"pendingMovingRebalanceJobs"`
NumOfProtectionDomains int `json:"numOfProtectionDomains"`
NumOfSds int `json:"numOfSds"`
CapacityInUseInKb int `json:"capacityInUseInKb"`
BckRebuildWriteBwc BWC `json:"bckRebuildWriteBwc"`
DegradedFailedCapacityInKb int `json:"degradedFailedCapacityInKb"`
NumOfThinBaseVolumes int `json:"numOfThinBaseVolumes"`
PendingMovingOutFwdRebuildJobs int `json:"pendingMovingOutFwdRebuildJobs"`
SecondaryReadBwc BWC `json:"secondaryReadBwc"`
PendingMovingOutBckRebuildJobs int `json:"pendingMovingOutBckRebuildJobs"`
RebalanceWriteBwc BWC `json:"rebalanceWriteBwc"`
PrimaryReadBwc BWC `json:"primaryReadBwc"`
NumOfVolumesInDeletion int `json:"numOfVolumesInDeletion"`
NumOfDevices int `json:"numOfDevices"`
RebalanceReadBwc BWC `json:"rebalanceReadBwc"`
InUseVacInKb int `json:"inUseVacInKb"`
UnreachableUnusedCapacityInKb int `json:"unreachableUnusedCapacityInKb"`
TotalWriteBwc BWC `json:"totalWriteBwc"`
SpareCapacityInKb int `json:"spareCapacityInKb"`
ActiveMovingOutBckRebuildJobs int `json:"activeMovingOutBckRebuildJobs"`
PrimaryVacInKb int `json:"primaryVacInKb"`
NumOfThickBaseVolumes int `json:"numOfThickBaseVolumes"`
BckRebuildCapacityInKb int `json:"bckRebuildCapacityInKb"`
NumOfMappedToAllVolumes int `json:"numOfMappedToAllVolumes"`
ActiveMovingCapacityInKb int `json:"activeMovingCapacityInKb"`
PendingMovingInFwdRebuildJobs int `json:"pendingMovingInFwdRebuildJobs"`
ActiveRebalanceCapacityInKb int `json:"activeRebalanceCapacityInKb"`
RmcacheSizeInKb int `json:"rmcacheSizeInKb"`
FwdRebuildCapacityInKb int `json:"fwdRebuildCapacityInKb"`
FwdRebuildWriteBwc BWC `json:"fwdRebuildWriteBwc"`
PrimaryWriteBwc BWC `json:"primaryWriteBwc"`
}
type User struct {
SystemID string `json:"systemId"`
UserRole string `json:"userRole"`
PasswordChangeRequire bool `json:"passwordChangeRequired"`
Name string `json:"name"`
ID string `json:"id"`
Links []*Link `json:"links"`
}
type ScsiInitiator struct {
Name string `json:"name"`
IQN string `json:"iqn"`
SystemID string `json:"systemID"`
Links []*Link `json:"links"`
}
type ProtectionDomain struct {
SystemID string `json:"systemId"`
RebuildNetworkThrottlingInKbps int `json:"rebuildNetworkThrottlingInKbps"`
RebalanceNetworkThrottlingInKbps int `json:"rebalanceNetworkThrottlingInKbps"`
OverallIoNetworkThrottlingInKbps int `json:"overallIoNetworkThrottlingInKbps"`
OverallIoNetworkThrottlingEnabled bool `json:"overallIoNetworkThrottlingEnabled"`
RebuildNetworkThrottlingEnabled bool `json:"rebuildNetworkThrottlingEnabled"`
RebalanceNetworkThrottlingEnabled bool `json:"rebalanceNetworkThrottlingEnabled"`
ProtectionDomainState string `json:"protectionDomainState"`
Name string `json:"name"`
ID string `json:"id"`
Links []*Link `json:"links"`
}
type ProtectionDomainParam struct {
Name string `json:"name"`
}
type ProtectionDomainResp struct {
ID string `json:"id"`
}
type Sdc struct {
SystemID string `json:"systemId"`
SdcApproved bool `json:"sdcApproved"`
SdcIp string `json:"SdcIp"`
OnVmWare bool `json:"onVmWare"`
SdcGuid string `json:"sdcGuid"`
MdmConnectionState string `json:"mdmConnectionState"`
Name string `json:"name"`
ID string `json:"id"`
Links []*Link `json:"links"`
}
type SdsIp struct {
IP string `json:"ip"`
Role string `json:"role"`
}
type SdsIpList struct {
SdsIP SdsIp `json:"SdsIp"`
}
type Sds struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
ProtectionDomainID string `json:"protectionDomainId"`
IPList []*SdsIpList `json:"ipList"`
Port int `json:"port,omitempty"`
SdsState string `json:"sdsState"`
MembershipState string `json:"membershipState"`
MdmConnectionState string `json:"mdmConnectionState"`
DrlMode string `json:"drlMode,omitempty"`
RmcacheEnabled bool `json:"rmcacheEnabled,omitempty"`
RmcacheSizeInKb int `json:"rmcacheSizeInKb,omitempty"`
RmcacheFrozen bool `json:"rmcacheFrozen,omitempty"`
IsOnVMware bool `json:"isOnVmWare,omitempty"`
FaultSetID string `json:"faultSetId,omitempty"`
NumOfIoBuffers int `json:"numOfIoBuffers,omitempty"`
RmcacheMemoryAllocationState string `json:"RmcacheMemoryAllocationState,omitempty"`
}
type DeviceInfo struct {
DevicePath string `json:"devicePath"`
StoragePoolID string `json:"storagePoolId"`
DeviceName string `json:"deviceName,omitempty"`
}
type SdsParam struct {
Name string `json:"name,omitempty"`
IPList []*SdsIpList `json:"sdsIpList"`
Port int `json:"sdsPort,omitempty"`
DrlMode string `json:"drlMode,omitempty"`
RmcacheEnabled bool `json:"rmcacheEnabled,omitempty"`
RmcacheSizeInKb int `json:"rmcacheSizeInKb,omitempty"`
RmcacheFrozen bool `json:"rmcacheFrozen,omitempty"`
ProtectionDomainID string `json:"protectionDomainId"`
FaultSetID string `json:"faultSetId,omitempty"`
NumOfIoBuffers int `json:"numOfIoBuffers,omitempty"`
DeviceInfoList []*DeviceInfo `json:"deviceInfoList,omitempty"`
ForceClean bool `json:"forceClean,omitempty"`
DeviceTestTimeSecs int `json:"deviceTestTimeSecs ,omitempty"`
DeviceTestMode string `json:"deviceTestMode,omitempty"`
}
type SdsResp struct {
ID string `json:"id"`
}
type Device struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
DeviceCurrentPathname string `json:"deviceCurrentPathname"`
DeviceOriginalPathname string `json:"deviceOriginalPathname,omitempty"`
DeviceState string `json:"deviceState,omitempty"`
ErrorState string `json:"errorState,omitempty"`
CapacityLimitInKb int `json:"capacityLimitInKb,omitempty"`
MaxCapacityInKb int `json:"maxCapacityInKb,omitempty"`
StoragePoolID string `json:"storagePoolId"`
SdsID string `json:"sdsId"`
}
type DeviceParam struct {
Name string `json:"name,omitempty"`
DeviceCurrentPathname string `json:"deviceCurrentPathname"`
CapacityLimitInKb int `json:"capacityLimitInKb,omitempty"`
StoragePoolID string `json:"storagePoolId"`
SdsID string `json:"sdsId"`
TestTimeSecs int `json:"testTimeSecs,omitempty"`
TestMode string `json:"testMode,omitempty"`
}
type DeviceResp struct {
ID string `json:"id"`
}
type StoragePool struct {
ProtectionDomainID string `json:"protectionDomainId"`
RebalanceioPriorityPolicy string `json:"rebalanceIoPriorityPolicy"`
RebuildioPriorityPolicy string `json:"rebuildIoPriorityPolicy"`
RebuildioPriorityBwLimitPerDeviceInKbps int `json:"rebuildIoPriorityBwLimitPerDeviceInKbps"`
RebuildioPriorityNumOfConcurrentIosPerDevice int `json:"rebuildIoPriorityNumOfConcurrentIosPerDevice"`
RebalanceioPriorityNumOfConcurrentIosPerDevice int `json:"rebalanceIoPriorityNumOfConcurrentIosPerDevice"`
RebalanceioPriorityBwLimitPerDeviceInKbps int `json:"rebalanceIoPriorityBwLimitPerDeviceInKbps"`
RebuildioPriorityAppIopsPerDeviceThreshold int `json:"rebuildIoPriorityAppIopsPerDeviceThreshold"`
RebalanceioPriorityAppIopsPerDeviceThreshold int `json:"rebalanceIoPriorityAppIopsPerDeviceThreshold"`
RebuildioPriorityAppBwPerDeviceThresholdInKbps int `json:"rebuildIoPriorityAppBwPerDeviceThresholdInKbps"`
RebalanceioPriorityAppBwPerDeviceThresholdInKbps int `json:"rebalanceIoPriorityAppBwPerDeviceThresholdInKbps"`
RebuildioPriorityQuietPeriodInMsec int `json:"rebuildIoPriorityQuietPeriodInMsec"`
RebalanceioPriorityQuietPeriodInMsec int `json:"rebalanceIoPriorityQuietPeriodInMsec"`
ZeroPaddingEnabled bool `json:"zeroPaddingEnabled"`
UseRmcache bool `json:"useRmcache"`
SparePercentage int `json:"sparePercentage"`
RmCacheWriteHandlingMode string `json:"rmcacheWriteHandlingMode"`
RebuildEnabled bool `json:"rebuildEnabled"`
RebalanceEnabled bool `json:"rebalanceEnabled"`
NumofParallelRebuildRebalanceJobsPerDevice int `json:"numOfParallelRebuildRebalanceJobsPerDevice"`
Name string `json:"name"`
ID string `json:"id"`
Links []*Link `json:"links"`
}
type StoragePoolParam struct {
Name string `json:"name"`
SparePercentage int `json:"sparePercentage,omitempty"`
RebuildEnabled bool `json:"rebuildEnabled,omitempty"`
RebalanceEnabled bool `json:"rebalanceEnabled,omitempty"`
ProtectionDomainID string `json:"protectionDomainId"`
ZeroPaddingEnabled bool `json:"zeroPaddingEnabled,omitempty"`
UseRmcache bool `json:"useRmcache,omitempty"`
RmcacheWriteHandlingMode string `json:"rmcacheWriteHandlingMode,omitempty"`
}
type StoragePoolResp struct {
ID string `json:"id"`
}
type MappedSdcInfo struct {
SdcID string `json:"sdcId"`
SdcIP string `json:"sdcIp"`
LimitIops int `json:"limitIops"`
LimitBwInMbps int `json:"limitBwInMbps"`
}
type Volume struct {
StoragePoolID string `json:"storagePoolId"`
UseRmCache bool `json:"useRmcache"`
MappingToAllSdcsEnabled bool `json:"mappingToAllSdcsEnabled"`
MappedSdcInfo []*MappedSdcInfo `json:"mappedSdcInfo"`
IsObfuscated bool `json:"isObfuscated"`
VolumeType string `json:"volumeType"`
ConsistencyGroupID string `json:"consistencyGroupId"`
VTreeID string `json:"vtreeId"`
AncestorVolumeID string `json:"ancestorVolumeId"`
MappedScsiInitiatorInfo string `json:"mappedScsiInitiatorInfo"`
SizeInKb int `json:"sizeInKb"`
CreationTime int `json:"creationTime"`
Name string `json:"name"`
ID string `json:"id"`
Links []*Link `json:"links"`
}
type VolumeParam struct {
ProtectionDomainID string `json:"protectionDomainId,omitempty"`
StoragePoolID string `json:"storagePoolId,omitempty"`
UseRmCache string `json:"useRmcache,omitempty"`
VolumeType string `json:"volumeType,omitempty"`
VolumeSizeInKb string `json:"volumeSizeInKb,omitempty"`
Name string `json:"name,omitempty"`
}
type VolumeResp struct {
ID string `json:"id"`
}
type VolumeQeryIdByKeyParam struct {
Name string `json:"name"`
}
type VolumeQeryBySelectedIdsParam struct {
IDs []string `json:"ids"`
}
type MapVolumeSdcParam struct {
SdcID string `json:"sdcId,omitempty"`
AllowMultipleMappings string `json:"allowMultipleMappings,omitempty"`
AllSdcs string `json:"allSdcs,omitempty"`
}
type UnmapVolumeSdcParam struct {
SdcID string `json:"sdcId,omitempty"`
IgnoreScsiInitiators string `json:"ignoreScsiInitiators,omitempty"`
AllSdcs string `json:"allSdcs,omitempty"`
}
type SnapshotDef struct {
VolumeID string `json:"volumeId,omitempty"`
SnapshotName string `json:"snapshotName,omitempty"`
}
type SnapshotVolumesParam struct {
SnapshotDefs []*SnapshotDef `json:"snapshotDefs"`
}
type SnapshotVolumesResp struct {
VolumeIDList []string `json:"volumeIdList"`
SnapshotGroupID string `json:"snapshotGroupId"`
}
type VTree struct {
ID string `json:"id"`
Name string `json:"name"`
BaseVolumeID string `json:"baseVolumeId"`
StoragePoolID string `json:"storagePoolId"`
Links []*Link `json:"links"`
}
type RemoveVolumeParam struct {
RemoveMode string `json:"removeMode"`
}

35
vendor/github.com/codedellemc/goscaleio/user.go generated vendored Normal file
View File

@ -0,0 +1,35 @@
package goscaleio
import (
"fmt"
types "github.com/codedellemc/goscaleio/types/v1"
)
func (system *System) GetUser() (user []types.User, err error) {
endpoint := system.client.SIOEndpoint
endpoint.Path = fmt.Sprintf("/api/instances/System::%v/relationships/User", system.System.ID)
req := system.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", system.client.Token)
req.Header.Add("Accept", "application/json;version="+system.client.configConnect.Version)
resp, err := system.client.retryCheckResp(&system.client.Http, req)
if err != nil {
return []types.User{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = system.client.decodeBody(resp, &user); err != nil {
return []types.User{}, fmt.Errorf("error decoding instances response: %s", err)
}
// bs, err := ioutil.ReadAll(resp.Body)
// if err != nil {
// return types.User{}, errors.New("error reading body")
// }
//
// fmt.Println(string(bs))
// return types.User{}, nil
return user, nil
}

278
vendor/github.com/codedellemc/goscaleio/volume.go generated vendored Normal file
View File

@ -0,0 +1,278 @@
package goscaleio
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os/exec"
"path/filepath"
"regexp"
"sort"
"strings"
types "github.com/codedellemc/goscaleio/types/v1"
)
type SdcMappedVolume struct {
MdmID string
VolumeID string
SdcDevice string
// Mounted bool
// MountPath bool
// Mapped bool
}
type Volume struct {
Volume *types.Volume
client *Client
}
func NewVolume(client *Client) *Volume {
return &Volume{
Volume: new(types.Volume),
client: client,
}
}
func (storagePool *StoragePool) GetVolume(volumehref, volumeid, ancestorvolumeid, volumename string, getSnapshots bool) (volumes []*types.Volume, err error) {
endpoint := storagePool.client.SIOEndpoint
if volumename != "" {
volumeid, err = storagePool.FindVolumeID(volumename)
if err != nil && err.Error() == "Not found" {
return nil, nil
}
if err != nil {
return []*types.Volume{}, fmt.Errorf("Error: problem finding volume: %s", err)
}
}
if volumeid != "" {
endpoint.Path = fmt.Sprintf("/api/instances/Volume::%s", volumeid)
} else if volumehref == "" {
link, err := GetLink(storagePool.StoragePool.Links, "/api/StoragePool/relationship/Volume")
if err != nil {
return []*types.Volume{}, errors.New("Error: problem finding link")
}
endpoint.Path = link.HREF
} else {
endpoint.Path = volumehref
}
req := storagePool.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", storagePool.client.Token)
req.Header.Add("Accept", "application/json;version="+storagePool.client.configConnect.Version)
resp, err := storagePool.client.retryCheckResp(&storagePool.client.Http, req)
if err != nil {
return []*types.Volume{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if volumehref == "" && volumeid == "" {
if err = storagePool.client.decodeBody(resp, &volumes); err != nil {
return []*types.Volume{}, fmt.Errorf("error decoding storage pool response: %s", err)
}
var volumesNew []*types.Volume
for _, volume := range volumes {
if (!getSnapshots && volume.AncestorVolumeID == ancestorvolumeid) || (getSnapshots && volume.AncestorVolumeID != "") {
volumesNew = append(volumesNew, volume)
}
}
volumes = volumesNew
} else {
volume := &types.Volume{}
if err = storagePool.client.decodeBody(resp, &volume); err != nil {
return []*types.Volume{}, fmt.Errorf("error decoding instances response: %s", err)
}
volumes = append(volumes, volume)
}
return volumes, nil
}
func (storagePool *StoragePool) FindVolumeID(volumename string) (volumeID string, err error) {
endpoint := storagePool.client.SIOEndpoint
volumeQeryIdByKeyParam := &types.VolumeQeryIdByKeyParam{}
volumeQeryIdByKeyParam.Name = volumename
jsonOutput, err := json.Marshal(&volumeQeryIdByKeyParam)
if err != nil {
return "", fmt.Errorf("error marshaling: %s", err)
}
endpoint.Path = fmt.Sprintf("/api/types/Volume/instances/action/queryIdByKey")
req := storagePool.client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", storagePool.client.Token)
req.Header.Add("Accept", "application/json;version="+storagePool.client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+storagePool.client.configConnect.Version)
resp, err := storagePool.client.retryCheckResp(&storagePool.client.Http, req)
if err != nil {
return "", err
}
defer resp.Body.Close()
bs, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", errors.New("error reading body")
}
volumeID = string(bs)
volumeID = strings.TrimRight(volumeID, `"`)
volumeID = strings.TrimLeft(volumeID, `"`)
return volumeID, nil
}
func GetLocalVolumeMap() (mappedVolumes []*SdcMappedVolume, err error) {
// get sdc kernel guid
// /bin/emc/scaleio/drv_cfg --query_guid
// sdcKernelGuid := "271bad82-08ee-44f2-a2b1-7e2787c27be1"
mappedVolumesMap := make(map[string]*SdcMappedVolume)
out, err := exec.Command("/opt/emc/scaleio/sdc/bin/drv_cfg", "--query_vols").Output()
if err != nil {
return []*SdcMappedVolume{}, fmt.Errorf("Error querying volumes: ", err)
}
result := string(out)
lines := strings.Split(result, "\n")
for _, line := range lines {
split := strings.Split(line, " ")
if split[0] == "VOL-ID" {
mappedVolume := &SdcMappedVolume{MdmID: split[3], VolumeID: split[1]}
mdmVolumeID := fmt.Sprintf("%s-%s", mappedVolume.MdmID, mappedVolume.VolumeID)
mappedVolumesMap[mdmVolumeID] = mappedVolume
}
}
diskIDPath := "/dev/disk/by-id"
files, _ := ioutil.ReadDir(diskIDPath)
r, _ := regexp.Compile(`^emc-vol-\w*-\w*$`)
for _, f := range files {
matched := r.MatchString(f.Name())
if matched {
mdmVolumeID := strings.Replace(f.Name(), "emc-vol-", "", 1)
devPath, _ := filepath.EvalSymlinks(fmt.Sprintf("%s/%s", diskIDPath, f.Name()))
if _, ok := mappedVolumesMap[mdmVolumeID]; ok {
mappedVolumesMap[mdmVolumeID].SdcDevice = devPath
}
}
}
keys := make([]string, 0, len(mappedVolumesMap))
for key := range mappedVolumesMap {
keys = append(keys, key)
}
sort.Strings(keys)
for _, key := range keys {
mappedVolumes = append(mappedVolumes, mappedVolumesMap[key])
}
return mappedVolumes, nil
}
func (storagePool *StoragePool) CreateVolume(volume *types.VolumeParam) (volumeResp *types.VolumeResp, err error) {
endpoint := storagePool.client.SIOEndpoint
endpoint.Path = "/api/types/Volume/instances"
volume.StoragePoolID = storagePool.StoragePool.ID
volume.ProtectionDomainID = storagePool.StoragePool.ProtectionDomainID
jsonOutput, err := json.Marshal(&volume)
if err != nil {
return &types.VolumeResp{}, fmt.Errorf("error marshaling: %s", err)
}
req := storagePool.client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", storagePool.client.Token)
req.Header.Add("Accept", "application/json;version="+storagePool.client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+storagePool.client.configConnect.Version)
resp, err := storagePool.client.retryCheckResp(&storagePool.client.Http, req)
if err != nil {
return &types.VolumeResp{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = storagePool.client.decodeBody(resp, &volumeResp); err != nil {
return &types.VolumeResp{}, fmt.Errorf("error decoding volume creation response: %s", err)
}
return volumeResp, nil
}
func (volume *Volume) GetVTree() (vtree *types.VTree, err error) {
endpoint := volume.client.SIOEndpoint
link, err := GetLink(volume.Volume.Links, "/api/parent/relationship/vtreeId")
if err != nil {
return &types.VTree{}, errors.New("Error: problem finding link")
}
endpoint.Path = link.HREF
req := volume.client.NewRequest(map[string]string{}, "GET", endpoint, nil)
req.SetBasicAuth("", volume.client.Token)
req.Header.Add("Accept", "application/json;version="+volume.client.configConnect.Version)
resp, err := volume.client.retryCheckResp(&volume.client.Http, req)
if err != nil {
return &types.VTree{}, fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
if err = volume.client.decodeBody(resp, &vtree); err != nil {
return &types.VTree{}, fmt.Errorf("error decoding vtree response: %s", err)
}
return vtree, nil
}
func (volume *Volume) RemoveVolume(removeMode string) (err error) {
endpoint := volume.client.SIOEndpoint
link, err := GetLink(volume.Volume.Links, "self")
if err != nil {
return errors.New("Error: problem finding link")
}
endpoint.Path = fmt.Sprintf("%v/action/removeVolume", link.HREF)
if removeMode == "" {
removeMode = "ONLY_ME"
}
removeVolumeParam := &types.RemoveVolumeParam{
RemoveMode: removeMode,
}
jsonOutput, err := json.Marshal(&removeVolumeParam)
if err != nil {
return fmt.Errorf("error marshaling: %s", err)
}
req := volume.client.NewRequest(map[string]string{}, "POST", endpoint, bytes.NewBufferString(string(jsonOutput)))
req.SetBasicAuth("", volume.client.Token)
req.Header.Add("Accept", "application/json;version="+volume.client.configConnect.Version)
req.Header.Add("Content-Type", "application/json;version="+volume.client.configConnect.Version)
resp, err := volume.client.retryCheckResp(&volume.client.Http, req)
if err != nil {
return fmt.Errorf("problem getting response: %v", err)
}
defer resp.Body.Close()
return nil
}