From e321cdaee4bf22bce018011884af33ea16fa5b62 Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Wed, 23 Jan 2019 21:19:50 -0500 Subject: [PATCH 1/7] vendor k8s.io/utils to 8a87304934321b4b0ad72a7cb3cbc715d67d38c7 --- Godeps/Godeps.json | 28 +- Godeps/LICENSES | 1050 +++++++++++++++++ .../Godeps/Godeps.json | 24 +- .../src/k8s.io/apiserver/Godeps/Godeps.json | 22 +- .../src/k8s.io/cli-runtime/Godeps/Godeps.json | 8 +- .../src/k8s.io/client-go/Godeps/Godeps.json | 8 + .../k8s.io/cloud-provider/Godeps/Godeps.json | 16 +- .../k8s.io/component-base/Godeps/Godeps.json | 2 +- staging/src/k8s.io/csi-api/Godeps/Godeps.json | 16 +- .../k8s.io/kube-aggregator/Godeps/Godeps.json | 24 +- .../Godeps/Godeps.json | 2 +- .../src/k8s.io/kube-proxy/Godeps/Godeps.json | 2 +- .../k8s.io/kube-scheduler/Godeps/Godeps.json | 2 +- staging/src/k8s.io/metrics/Godeps/Godeps.json | 8 +- .../src/k8s.io/node-api/Godeps/Godeps.json | 16 +- .../sample-apiserver/Godeps/Godeps.json | 24 +- .../sample-cli-plugin/Godeps/Godeps.json | 8 +- .../sample-controller/Godeps/Godeps.json | 16 +- vendor/BUILD | 5 + vendor/k8s.io/utils/buffer/BUILD | 23 + vendor/k8s.io/utils/buffer/ring_growing.go | 72 ++ vendor/k8s.io/utils/integer/BUILD | 23 + vendor/k8s.io/utils/integer/integer.go | 73 ++ vendor/k8s.io/utils/io/BUILD | 23 + vendor/k8s.io/utils/io/consistentread.go | 55 + vendor/k8s.io/utils/nsenter/BUILD | 65 + vendor/k8s.io/utils/nsenter/OWNERS | 8 + vendor/k8s.io/utils/nsenter/exec.go | 67 ++ .../k8s.io/utils/nsenter/exec_unsupported.go | 58 + vendor/k8s.io/utils/nsenter/nsenter.go | 235 ++++ .../utils/nsenter/nsenter_unsupported.go | 56 + vendor/k8s.io/utils/trace/BUILD | 24 + vendor/k8s.io/utils/trace/trace.go | 96 ++ 33 files changed, 2062 insertions(+), 97 deletions(-) create mode 100644 vendor/k8s.io/utils/buffer/BUILD create mode 100644 vendor/k8s.io/utils/buffer/ring_growing.go create mode 100644 vendor/k8s.io/utils/integer/BUILD create mode 100644 vendor/k8s.io/utils/integer/integer.go create mode 100644 vendor/k8s.io/utils/io/BUILD create mode 100644 vendor/k8s.io/utils/io/consistentread.go create mode 100644 vendor/k8s.io/utils/nsenter/BUILD create mode 100644 vendor/k8s.io/utils/nsenter/OWNERS create mode 100644 vendor/k8s.io/utils/nsenter/exec.go create mode 100644 vendor/k8s.io/utils/nsenter/exec_unsupported.go create mode 100644 vendor/k8s.io/utils/nsenter/nsenter.go create mode 100644 vendor/k8s.io/utils/nsenter/nsenter_unsupported.go create mode 100644 vendor/k8s.io/utils/trace/BUILD create mode 100644 vendor/k8s.io/utils/trace/trace.go diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 342f534b8e..6f9aabb738 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -4088,21 +4088,41 @@ "ImportPath": "k8s.io/repo-infra/kazel", "Rev": "00fe14e3d1a3f9a73c4cea62d9c33b29c1e03ac4" }, + { + "ImportPath": "k8s.io/utils/buffer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "k8s.io/utils/clock", - "Rev": "8e7ff06bf0e2d3289061230af203e430a15b6dcc" + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" }, { "ImportPath": "k8s.io/utils/exec", - "Rev": "8e7ff06bf0e2d3289061230af203e430a15b6dcc" + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" }, { "ImportPath": "k8s.io/utils/exec/testing", - "Rev": "8e7ff06bf0e2d3289061230af203e430a15b6dcc" + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/io", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/nsenter", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8e7ff06bf0e2d3289061230af203e430a15b6dcc" + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/trace", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/Godeps/LICENSES b/Godeps/LICENSES index a67ec0ba32..8c0bca5a0e 100644 --- a/Godeps/LICENSES +++ b/Godeps/LICENSES @@ -114953,6 +114953,216 @@ third-party archives. ================================================================================ +================================================================================ += vendor/k8s.io/utils/buffer 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/k8s.io/utils/LICENSE 3b83ef96387f14655fc854ddc3c6bd57 +================================================================================ + + ================================================================================ = vendor/k8s.io/utils/clock licensed under: = @@ -115583,6 +115793,636 @@ third-party archives. ================================================================================ +================================================================================ += vendor/k8s.io/utils/integer 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/k8s.io/utils/LICENSE 3b83ef96387f14655fc854ddc3c6bd57 +================================================================================ + + +================================================================================ += vendor/k8s.io/utils/io 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/k8s.io/utils/LICENSE 3b83ef96387f14655fc854ddc3c6bd57 +================================================================================ + + +================================================================================ += vendor/k8s.io/utils/nsenter 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/k8s.io/utils/LICENSE 3b83ef96387f14655fc854ddc3c6bd57 +================================================================================ + + ================================================================================ = vendor/k8s.io/utils/pointer licensed under: = @@ -115793,6 +116633,216 @@ third-party archives. ================================================================================ +================================================================================ += vendor/k8s.io/utils/trace 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/k8s.io/utils/LICENSE 3b83ef96387f14655fc854ddc3c6bd57 +================================================================================ + + ================================================================================ = vendor/sigs.k8s.io/yaml licensed under: = diff --git a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json index 1fc50f2bed..ce4ec0b0bd 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json @@ -1630,10 +1630,6 @@ "ImportPath": "k8s.io/apiserver/pkg/util/openapi", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/apiserver/pkg/util/trace", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/apiserver/pkg/util/webhook", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -2238,10 +2234,6 @@ "ImportPath": "k8s.io/client-go/transport", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/buffer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/cert", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -2258,10 +2250,6 @@ "ImportPath": "k8s.io/client-go/util/homedir", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/integer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/retry", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -2586,6 +2574,18 @@ "ImportPath": "k8s.io/component-base/logs", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, + { + "ImportPath": "k8s.io/utils/buffer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/trace", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "sigs.k8s.io/yaml", "Rev": "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" diff --git a/staging/src/k8s.io/apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiserver/Godeps/Godeps.json index 3c4e62c487..d26e78d139 100644 --- a/staging/src/k8s.io/apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiserver/Godeps/Godeps.json @@ -1938,10 +1938,6 @@ "ImportPath": "k8s.io/client-go/transport", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/buffer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/cert", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -1958,10 +1954,6 @@ "ImportPath": "k8s.io/client-go/util/homedir", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/integer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/retry", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -2078,9 +2070,21 @@ "ImportPath": "k8s.io/component-base/logs", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, + { + "ImportPath": "k8s.io/utils/buffer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8e7ff06bf0e2d3289061230af203e430a15b6dcc" + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/trace", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json index 6cb1250ecf..f4628015b9 100644 --- a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json +++ b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json @@ -566,10 +566,6 @@ "ImportPath": "k8s.io/client-go/util/homedir", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/integer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/klog", "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" @@ -618,6 +614,10 @@ "ImportPath": "k8s.io/client-go/util/testing", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "sigs.k8s.io/yaml", "Rev": "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" diff --git a/staging/src/k8s.io/client-go/Godeps/Godeps.json b/staging/src/k8s.io/client-go/Godeps/Godeps.json index c2ce6b066a..4e99e05472 100644 --- a/staging/src/k8s.io/client-go/Godeps/Godeps.json +++ b/staging/src/k8s.io/client-go/Godeps/Godeps.json @@ -618,6 +618,14 @@ "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", "Rev": "ced9eb3070a5f1c548ef46e8dfe2a97c208d9f03" }, + { + "ImportPath": "k8s.io/utils/buffer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "sigs.k8s.io/yaml", "Rev": "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" diff --git a/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json b/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json index c7f0a32f8a..4a3aa13be3 100644 --- a/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json +++ b/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json @@ -946,10 +946,6 @@ "ImportPath": "k8s.io/client-go/transport", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/buffer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/cert", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -962,10 +958,6 @@ "ImportPath": "k8s.io/client-go/util/flowcontrol", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/integer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/retry", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -974,6 +966,14 @@ "ImportPath": "k8s.io/klog", "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" }, + { + "ImportPath": "k8s.io/utils/buffer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "sigs.k8s.io/yaml", "Rev": "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" diff --git a/staging/src/k8s.io/component-base/Godeps/Godeps.json b/staging/src/k8s.io/component-base/Godeps/Godeps.json index 7bf2c4ed9b..774c215ba5 100644 --- a/staging/src/k8s.io/component-base/Godeps/Godeps.json +++ b/staging/src/k8s.io/component-base/Godeps/Godeps.json @@ -152,7 +152,7 @@ }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8e7ff06bf0e2d3289061230af203e430a15b6dcc" + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" } ] } diff --git a/staging/src/k8s.io/csi-api/Godeps/Godeps.json b/staging/src/k8s.io/csi-api/Godeps/Godeps.json index 86dbf7ced3..f78f497e87 100644 --- a/staging/src/k8s.io/csi-api/Godeps/Godeps.json +++ b/staging/src/k8s.io/csi-api/Godeps/Godeps.json @@ -526,10 +526,6 @@ "ImportPath": "k8s.io/client-go/transport", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/buffer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/cert", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -542,10 +538,6 @@ "ImportPath": "k8s.io/client-go/util/flowcontrol", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/integer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/retry", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -558,6 +550,14 @@ "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", "Rev": "ced9eb3070a5f1c548ef46e8dfe2a97c208d9f03" }, + { + "ImportPath": "k8s.io/utils/buffer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "sigs.k8s.io/yaml", "Rev": "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" diff --git a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json index 2cc85f781e..b67136c243 100644 --- a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json @@ -1222,10 +1222,6 @@ "ImportPath": "k8s.io/apiserver/pkg/util/proxy", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/apiserver/pkg/util/trace", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/apiserver/pkg/util/webhook", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -1798,10 +1794,6 @@ "ImportPath": "k8s.io/client-go/transport", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/buffer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/cert", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -1818,10 +1810,6 @@ "ImportPath": "k8s.io/client-go/util/homedir", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/integer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/retry", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -1862,6 +1850,18 @@ "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", "Rev": "ced9eb3070a5f1c548ef46e8dfe2a97c208d9f03" }, + { + "ImportPath": "k8s.io/utils/buffer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/trace", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "sigs.k8s.io/yaml", "Rev": "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" diff --git a/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json b/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json index 9a685bd046..7d41706b78 100644 --- a/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json @@ -152,7 +152,7 @@ }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8e7ff06bf0e2d3289061230af203e430a15b6dcc" + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" } ] } diff --git a/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json b/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json index e95e34a677..94aa516125 100644 --- a/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json @@ -152,7 +152,7 @@ }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8e7ff06bf0e2d3289061230af203e430a15b6dcc" + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" } ] } diff --git a/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json b/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json index a2d2fa638e..1532f61221 100644 --- a/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json @@ -152,7 +152,7 @@ }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8e7ff06bf0e2d3289061230af203e430a15b6dcc" + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" } ] } diff --git a/staging/src/k8s.io/metrics/Godeps/Godeps.json b/staging/src/k8s.io/metrics/Godeps/Godeps.json index a7e918f0f6..4573a656ce 100644 --- a/staging/src/k8s.io/metrics/Godeps/Godeps.json +++ b/staging/src/k8s.io/metrics/Godeps/Godeps.json @@ -518,10 +518,6 @@ "ImportPath": "k8s.io/client-go/util/flowcontrol", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/integer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/klog", "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" @@ -530,6 +526,10 @@ "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", "Rev": "ced9eb3070a5f1c548ef46e8dfe2a97c208d9f03" }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "sigs.k8s.io/yaml", "Rev": "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" diff --git a/staging/src/k8s.io/node-api/Godeps/Godeps.json b/staging/src/k8s.io/node-api/Godeps/Godeps.json index a30538004d..eeee4f8259 100644 --- a/staging/src/k8s.io/node-api/Godeps/Godeps.json +++ b/staging/src/k8s.io/node-api/Godeps/Godeps.json @@ -526,10 +526,6 @@ "ImportPath": "k8s.io/client-go/transport", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/buffer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/cert", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -542,10 +538,6 @@ "ImportPath": "k8s.io/client-go/util/flowcontrol", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/integer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/retry", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -558,6 +550,14 @@ "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", "Rev": "ced9eb3070a5f1c548ef46e8dfe2a97c208d9f03" }, + { + "ImportPath": "k8s.io/utils/buffer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "sigs.k8s.io/yaml", "Rev": "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" diff --git a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json index 224ed76c9a..776f58b799 100644 --- a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json @@ -1182,10 +1182,6 @@ "ImportPath": "k8s.io/apiserver/pkg/util/openapi", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/apiserver/pkg/util/trace", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/apiserver/pkg/util/webhook", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -1758,10 +1754,6 @@ "ImportPath": "k8s.io/client-go/transport", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/buffer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/cert", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -1778,10 +1770,6 @@ "ImportPath": "k8s.io/client-go/util/homedir", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/integer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/retry", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -1814,6 +1802,18 @@ "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", "Rev": "ced9eb3070a5f1c548ef46e8dfe2a97c208d9f03" }, + { + "ImportPath": "k8s.io/utils/buffer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/trace", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "sigs.k8s.io/yaml", "Rev": "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" diff --git a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json index 2ecca328a6..717ab141a8 100644 --- a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json @@ -570,10 +570,6 @@ "ImportPath": "k8s.io/client-go/util/homedir", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/integer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/jsonpath", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -582,6 +578,10 @@ "ImportPath": "k8s.io/klog", "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "sigs.k8s.io/yaml", "Rev": "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" diff --git a/staging/src/k8s.io/sample-controller/Godeps/Godeps.json b/staging/src/k8s.io/sample-controller/Godeps/Godeps.json index b5b090c17e..f903b6135d 100644 --- a/staging/src/k8s.io/sample-controller/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-controller/Godeps/Godeps.json @@ -1142,10 +1142,6 @@ "ImportPath": "k8s.io/client-go/transport", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/buffer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/cert", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -1162,10 +1158,6 @@ "ImportPath": "k8s.io/client-go/util/homedir", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { - "ImportPath": "k8s.io/client-go/util/integer", - "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, { "ImportPath": "k8s.io/client-go/util/retry", "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -1182,6 +1174,14 @@ "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", "Rev": "ced9eb3070a5f1c548ef46e8dfe2a97c208d9f03" }, + { + "ImportPath": "k8s.io/utils/buffer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, + { + "ImportPath": "k8s.io/utils/integer", + "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + }, { "ImportPath": "sigs.k8s.io/yaml", "Rev": "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" diff --git a/vendor/BUILD b/vendor/BUILD index 549798b758..dfbacdaab8 100644 --- a/vendor/BUILD +++ b/vendor/BUILD @@ -467,9 +467,14 @@ filegroup( "//vendor/k8s.io/kube-openapi/pkg/handler:all-srcs", "//vendor/k8s.io/kube-openapi/pkg/util:all-srcs", "//vendor/k8s.io/repo-infra/kazel:all-srcs", + "//vendor/k8s.io/utils/buffer:all-srcs", "//vendor/k8s.io/utils/clock:all-srcs", "//vendor/k8s.io/utils/exec:all-srcs", + "//vendor/k8s.io/utils/integer:all-srcs", + "//vendor/k8s.io/utils/io:all-srcs", + "//vendor/k8s.io/utils/nsenter:all-srcs", "//vendor/k8s.io/utils/pointer:all-srcs", + "//vendor/k8s.io/utils/trace:all-srcs", "//vendor/sigs.k8s.io/yaml:all-srcs", "//vendor/vbom.ml/util/sortorder:all-srcs", ], diff --git a/vendor/k8s.io/utils/buffer/BUILD b/vendor/k8s.io/utils/buffer/BUILD new file mode 100644 index 0000000000..0f44f14ad2 --- /dev/null +++ b/vendor/k8s.io/utils/buffer/BUILD @@ -0,0 +1,23 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["ring_growing.go"], + importmap = "k8s.io/kubernetes/vendor/k8s.io/utils/buffer", + importpath = "k8s.io/utils/buffer", + visibility = ["//visibility:public"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/k8s.io/utils/buffer/ring_growing.go b/vendor/k8s.io/utils/buffer/ring_growing.go new file mode 100644 index 0000000000..86965a5131 --- /dev/null +++ b/vendor/k8s.io/utils/buffer/ring_growing.go @@ -0,0 +1,72 @@ +/* +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 buffer + +// RingGrowing is a growing ring buffer. +// Not thread safe. +type RingGrowing struct { + data []interface{} + n int // Size of Data + beg int // First available element + readable int // Number of data items available +} + +// NewRingGrowing constructs a new RingGrowing instance with provided parameters. +func NewRingGrowing(initialSize int) *RingGrowing { + return &RingGrowing{ + data: make([]interface{}, initialSize), + n: initialSize, + } +} + +// ReadOne reads (consumes) first item from the buffer if it is available, otherwise returns false. +func (r *RingGrowing) ReadOne() (data interface{}, ok bool) { + if r.readable == 0 { + return nil, false + } + r.readable-- + element := r.data[r.beg] + r.data[r.beg] = nil // Remove reference to the object to help GC + if r.beg == r.n-1 { + // Was the last element + r.beg = 0 + } else { + r.beg++ + } + return element, true +} + +// WriteOne adds an item to the end of the buffer, growing it if it is full. +func (r *RingGrowing) WriteOne(data interface{}) { + if r.readable == r.n { + // Time to grow + newN := r.n * 2 + newData := make([]interface{}, newN) + to := r.beg + r.readable + if to <= r.n { + copy(newData, r.data[r.beg:to]) + } else { + copied := copy(newData, r.data[r.beg:]) + copy(newData[copied:], r.data[:(to%r.n)]) + } + r.beg = 0 + r.data = newData + r.n = newN + } + r.data[(r.readable+r.beg)%r.n] = data + r.readable++ +} diff --git a/vendor/k8s.io/utils/integer/BUILD b/vendor/k8s.io/utils/integer/BUILD new file mode 100644 index 0000000000..0999029515 --- /dev/null +++ b/vendor/k8s.io/utils/integer/BUILD @@ -0,0 +1,23 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["integer.go"], + importmap = "k8s.io/kubernetes/vendor/k8s.io/utils/integer", + importpath = "k8s.io/utils/integer", + visibility = ["//visibility:public"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/k8s.io/utils/integer/integer.go b/vendor/k8s.io/utils/integer/integer.go new file mode 100644 index 0000000000..e4e740cad4 --- /dev/null +++ b/vendor/k8s.io/utils/integer/integer.go @@ -0,0 +1,73 @@ +/* +Copyright 2016 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 integer + +// IntMax returns the maximum of the params +func IntMax(a, b int) int { + if b > a { + return b + } + return a +} + +// IntMin returns the minimum of the params +func IntMin(a, b int) int { + if b < a { + return b + } + return a +} + +// Int32Max returns the maximum of the params +func Int32Max(a, b int32) int32 { + if b > a { + return b + } + return a +} + +// Int32Min returns the minimum of the params +func Int32Min(a, b int32) int32 { + if b < a { + return b + } + return a +} + +// Int64Max returns the maximum of the params +func Int64Max(a, b int64) int64 { + if b > a { + return b + } + return a +} + +// Int64Min returns the minimum of the params +func Int64Min(a, b int64) int64 { + if b < a { + return b + } + return a +} + +// RoundToInt32 rounds floats into integer numbers. +func RoundToInt32(a float64) int32 { + if a < 0 { + return int32(a - 0.5) + } + return int32(a + 0.5) +} diff --git a/vendor/k8s.io/utils/io/BUILD b/vendor/k8s.io/utils/io/BUILD new file mode 100644 index 0000000000..caf537ddcf --- /dev/null +++ b/vendor/k8s.io/utils/io/BUILD @@ -0,0 +1,23 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["consistentread.go"], + importmap = "k8s.io/kubernetes/vendor/k8s.io/utils/io", + importpath = "k8s.io/utils/io", + visibility = ["//visibility:public"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/k8s.io/utils/io/consistentread.go b/vendor/k8s.io/utils/io/consistentread.go new file mode 100644 index 0000000000..1d79bed3ae --- /dev/null +++ b/vendor/k8s.io/utils/io/consistentread.go @@ -0,0 +1,55 @@ +/* +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 io + +import ( + "bytes" + "fmt" + "io/ioutil" +) + +// ConsistentRead repeatedly reads a file until it gets the same content twice. +// This is useful when reading files in /proc that are larger than page size +// and kernel may modify them between individual read() syscalls. +func ConsistentRead(filename string, attempts int) ([]byte, error) { + return consistentReadSync(filename, attempts, nil) +} + +// consistentReadSync is the main functionality of ConsistentRead but +// introduces a sync callback that can be used by the tests to mutate the file +// from which the test data is being read +func consistentReadSync(filename string, attempts int, sync func(int)) ([]byte, error) { + oldContent, err := ioutil.ReadFile(filename) + if err != nil { + return nil, err + } + for i := 0; i < attempts; i++ { + if sync != nil { + sync(i) + } + newContent, err := ioutil.ReadFile(filename) + if err != nil { + return nil, err + } + if bytes.Compare(oldContent, newContent) == 0 { + return newContent, nil + } + // Files are different, continue reading + oldContent = newContent + } + return nil, fmt.Errorf("could not get consistent content of %s after %d attempts", filename, attempts) +} diff --git a/vendor/k8s.io/utils/nsenter/BUILD b/vendor/k8s.io/utils/nsenter/BUILD new file mode 100644 index 0000000000..31fa8ba240 --- /dev/null +++ b/vendor/k8s.io/utils/nsenter/BUILD @@ -0,0 +1,65 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "exec.go", + "exec_unsupported.go", + "nsenter.go", + "nsenter_unsupported.go", + ], + importmap = "k8s.io/kubernetes/vendor/k8s.io/utils/nsenter", + importpath = "k8s.io/utils/nsenter", + visibility = ["//visibility:public"], + deps = select({ + "@io_bazel_rules_go//go/platform:android": [ + "//vendor/k8s.io/utils/exec:go_default_library", + ], + "@io_bazel_rules_go//go/platform:darwin": [ + "//vendor/k8s.io/utils/exec:go_default_library", + ], + "@io_bazel_rules_go//go/platform:dragonfly": [ + "//vendor/k8s.io/utils/exec:go_default_library", + ], + "@io_bazel_rules_go//go/platform:freebsd": [ + "//vendor/k8s.io/utils/exec:go_default_library", + ], + "@io_bazel_rules_go//go/platform:linux": [ + "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + ], + "@io_bazel_rules_go//go/platform:nacl": [ + "//vendor/k8s.io/utils/exec:go_default_library", + ], + "@io_bazel_rules_go//go/platform:netbsd": [ + "//vendor/k8s.io/utils/exec:go_default_library", + ], + "@io_bazel_rules_go//go/platform:openbsd": [ + "//vendor/k8s.io/utils/exec:go_default_library", + ], + "@io_bazel_rules_go//go/platform:plan9": [ + "//vendor/k8s.io/utils/exec:go_default_library", + ], + "@io_bazel_rules_go//go/platform:solaris": [ + "//vendor/k8s.io/utils/exec:go_default_library", + ], + "@io_bazel_rules_go//go/platform:windows": [ + "//vendor/k8s.io/utils/exec:go_default_library", + ], + "//conditions:default": [], + }), +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/k8s.io/utils/nsenter/OWNERS b/vendor/k8s.io/utils/nsenter/OWNERS new file mode 100644 index 0000000000..c4f27cb438 --- /dev/null +++ b/vendor/k8s.io/utils/nsenter/OWNERS @@ -0,0 +1,8 @@ +reviewers: + - jsafrane + - msau42 + - cofyc +approvers: + - jsafrane + - msau42 + - cofyc diff --git a/vendor/k8s.io/utils/nsenter/exec.go b/vendor/k8s.io/utils/nsenter/exec.go new file mode 100644 index 0000000000..134497f0a7 --- /dev/null +++ b/vendor/k8s.io/utils/nsenter/exec.go @@ -0,0 +1,67 @@ +// +build linux + +/* +Copyright 2018 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 nsenter + +import ( + "context" + "fmt" + "path/filepath" + + "k8s.io/klog" + "k8s.io/utils/exec" +) + +// Executor wraps executor interface to be executed via nsenter +type Executor struct { + // Exec implementation + executor exec.Interface + // Path to the host's root proc path + hostProcMountNsPath string +} + +// NewNsenterExecutor returns new nsenter based executor +func NewNsenterExecutor(hostRootFsPath string, executor exec.Interface) *Executor { + hostProcMountNsPath := filepath.Join(hostRootFsPath, mountNsPath) + nsExecutor := &Executor{ + hostProcMountNsPath: hostProcMountNsPath, + executor: executor, + } + return nsExecutor +} + +// Command returns a command wrapped with nenter +func (nsExecutor *Executor) Command(cmd string, args ...string) exec.Cmd { + fullArgs := append([]string{fmt.Sprintf("--mount=%s", nsExecutor.hostProcMountNsPath), "--"}, + append([]string{cmd}, args...)...) + klog.V(5).Infof("Running nsenter command: %v %v", nsenterPath, fullArgs) + return nsExecutor.executor.Command(nsenterPath, fullArgs...) +} + +// CommandContext returns a CommandContext wrapped with nsenter +func (nsExecutor *Executor) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd { + fullArgs := append([]string{fmt.Sprintf("--mount=%s", nsExecutor.hostProcMountNsPath), "--"}, + append([]string{cmd}, args...)...) + klog.V(5).Infof("Running nsenter command: %v %v", nsenterPath, fullArgs) + return nsExecutor.executor.CommandContext(ctx, nsenterPath, fullArgs...) +} + +// LookPath returns a LookPath wrapped with nsenter +func (nsExecutor *Executor) LookPath(file string) (string, error) { + return "", fmt.Errorf("not implemented, error looking up : %s", file) +} diff --git a/vendor/k8s.io/utils/nsenter/exec_unsupported.go b/vendor/k8s.io/utils/nsenter/exec_unsupported.go new file mode 100644 index 0000000000..eecbdfc292 --- /dev/null +++ b/vendor/k8s.io/utils/nsenter/exec_unsupported.go @@ -0,0 +1,58 @@ +// +build !linux + +/* +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 nsenter + +import ( + "context" + "fmt" + + "k8s.io/utils/exec" +) + +// Executor wraps executor interface to be executed via nsenter +type Executor struct { + // Exec implementation + executor exec.Interface + // Path to the host's root proc path + hostProcMountNsPath string +} + +// NewNsenterExecutor returns new nsenter based executor +func NewNsenterExecutor(hostRootFsPath string, executor exec.Interface) *Executor { + nsExecutor := &Executor{ + hostProcMountNsPath: hostRootFsPath, + executor: executor, + } + return nsExecutor +} + +// Command returns a command wrapped with nenter +func (nsExecutor *Executor) Command(cmd string, args ...string) exec.Cmd { + return nil +} + +// CommandContext returns a CommandContext wrapped with nsenter +func (nsExecutor *Executor) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd { + return nil +} + +// LookPath returns a LookPath wrapped with nsenter +func (nsExecutor *Executor) LookPath(file string) (string, error) { + return "", fmt.Errorf("not implemented, error looking up : %s", file) +} diff --git a/vendor/k8s.io/utils/nsenter/nsenter.go b/vendor/k8s.io/utils/nsenter/nsenter.go new file mode 100644 index 0000000000..13532f0633 --- /dev/null +++ b/vendor/k8s.io/utils/nsenter/nsenter.go @@ -0,0 +1,235 @@ +// +build linux + +/* +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 nsenter + +import ( + "context" + "errors" + "fmt" + "os" + "path/filepath" + "strings" + + "k8s.io/klog" + "k8s.io/utils/exec" +) + +const ( + // DefaultHostRootFsPath is path to host's filesystem mounted into container + // with kubelet. + DefaultHostRootFsPath = "/rootfs" + // mountNsPath is the default mount namespace of the host + mountNsPath = "/proc/1/ns/mnt" + // nsenterPath is the default nsenter command + nsenterPath = "nsenter" +) + +// Nsenter is part of experimental support for running the kubelet +// in a container. +// +// Nsenter requires: +// +// 1. Docker >= 1.6 due to the dependency on the slave propagation mode +// of the bind-mount of the kubelet root directory in the container. +// Docker 1.5 used a private propagation mode for bind-mounts, so mounts +// performed in the host's mount namespace do not propagate out to the +// bind-mount in this docker version. +// 2. The host's root filesystem must be available at /rootfs +// 3. The nsenter binary must be on the Kubelet process' PATH in the container's +// filesystem. +// 4. The Kubelet process must have CAP_SYS_ADMIN (required by nsenter); at +// the present, this effectively means that the kubelet is running in a +// privileged container. +// 5. The volume path used by the Kubelet must be the same inside and outside +// the container and be writable by the container (to initialize volume) +// contents. TODO: remove this requirement. +// 6. The host image must have "mount", "findmnt", "umount", "stat", "touch", +// "mkdir", "ls", "sh" and "chmod" binaries in /bin, /usr/sbin, or /usr/bin +// 7. The host image should have systemd-run in /bin, /usr/sbin, or /usr/bin if +// systemd is installed/enabled in the operating system. +// For more information about mount propagation modes, see: +// https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt +type Nsenter struct { + // a map of commands to their paths on the host filesystem + paths map[string]string + + // Path to the host filesystem, typically "/rootfs". Used only for testing. + hostRootFsPath string + + // Exec implementation, used only for testing + executor exec.Interface +} + +// NewNsenter constructs a new instance of Nsenter +func NewNsenter(hostRootFsPath string, executor exec.Interface) (*Nsenter, error) { + ne := &Nsenter{ + hostRootFsPath: hostRootFsPath, + executor: executor, + } + if err := ne.initPaths(); err != nil { + return nil, err + } + return ne, nil +} + +func (ne *Nsenter) initPaths() error { + ne.paths = map[string]string{} + binaries := []string{ + "mount", + "findmnt", + "umount", + "systemd-run", + "stat", + "touch", + "mkdir", + "sh", + "chmod", + "realpath", + } + // search for the required commands in other locations besides /usr/bin + for _, binary := range binaries { + // check for binary under the following directories + for _, path := range []string{"/", "/bin", "/usr/sbin", "/usr/bin"} { + binPath := filepath.Join(path, binary) + if _, err := os.Stat(filepath.Join(ne.hostRootFsPath, binPath)); err != nil { + continue + } + ne.paths[binary] = binPath + break + } + // systemd-run is optional, bailout if we don't find any of the other binaries + if ne.paths[binary] == "" && binary != "systemd-run" { + return fmt.Errorf("unable to find %v", binary) + } + } + return nil +} + +// Exec executes nsenter commands in hostProcMountNsPath mount namespace +func (ne *Nsenter) Exec(cmd string, args []string) exec.Cmd { + hostProcMountNsPath := filepath.Join(ne.hostRootFsPath, mountNsPath) + fullArgs := append([]string{fmt.Sprintf("--mount=%s", hostProcMountNsPath), "--"}, + append([]string{ne.AbsHostPath(cmd)}, args...)...) + klog.V(5).Infof("Running nsenter command: %v %v", nsenterPath, fullArgs) + return ne.executor.Command(nsenterPath, fullArgs...) +} + +// AbsHostPath returns the absolute runnable path for a specified command +func (ne *Nsenter) AbsHostPath(command string) string { + path, ok := ne.paths[command] + if !ok { + return command + } + return path +} + +// SupportsSystemd checks whether command systemd-run exists +func (ne *Nsenter) SupportsSystemd() (string, bool) { + systemdRunPath, ok := ne.paths["systemd-run"] + return systemdRunPath, ok && systemdRunPath != "" +} + +// EvalSymlinks returns the path name on the host after evaluating symlinks on the +// host. +// mustExist makes EvalSymlinks to return error when the path does not +// exist. When it's false, it evaluates symlinks of the existing part and +// blindly adds the non-existing part: +// pathname: /mnt/volume/non/existing/directory +// /mnt/volume exists +// non/existing/directory does not exist +// -> It resolves symlinks in /mnt/volume to say /mnt/foo and returns +// /mnt/foo/non/existing/directory. +// +// BEWARE! EvalSymlinks is not able to detect symlink looks with mustExist=false! +// If /tmp/link is symlink to /tmp/link, EvalSymlinks(/tmp/link/foo) returns /tmp/link/foo. +func (ne *Nsenter) EvalSymlinks(pathname string, mustExist bool) (string, error) { + var args []string + if mustExist { + // "realpath -e: all components of the path must exist" + args = []string{"-e", pathname} + } else { + // "realpath -m: no path components need exist or be a directory" + args = []string{"-m", pathname} + } + outBytes, err := ne.Exec("realpath", args).CombinedOutput() + if err != nil { + klog.Infof("failed to resolve symbolic links on %s: %v", pathname, err) + return "", err + } + return strings.TrimSpace(string(outBytes)), nil +} + +// KubeletPath returns the path name that can be accessed by containerized +// kubelet. It is recommended to resolve symlinks on the host by EvalSymlinks +// before calling this function +func (ne *Nsenter) KubeletPath(pathname string) string { + return filepath.Join(ne.hostRootFsPath, pathname) +} + +// NewFakeNsenter returns a Nsenter that does not run "nsenter --mount=... --", +// but runs everything in the same mount namespace as the unit test binary. +// rootfsPath is supposed to be a symlink, e.g. /tmp/xyz/rootfs -> /. +// This fake Nsenter is enough for most operations, e.g. to resolve symlinks, +// but it's not enough to call /bin/mount - unit tests don't run as root. +func NewFakeNsenter(rootfsPath string) (*Nsenter, error) { + executor := &fakeExec{ + rootfsPath: rootfsPath, + } + // prepare /rootfs/bin, usr/bin and usr/sbin + bin := filepath.Join(rootfsPath, "bin") + if err := os.Symlink("/bin", bin); err != nil { + return nil, err + } + + usr := filepath.Join(rootfsPath, "usr") + if err := os.Mkdir(usr, 0755); err != nil { + return nil, err + } + usrbin := filepath.Join(usr, "bin") + if err := os.Symlink("/usr/bin", usrbin); err != nil { + return nil, err + } + usrsbin := filepath.Join(usr, "sbin") + if err := os.Symlink("/usr/sbin", usrsbin); err != nil { + return nil, err + } + + return NewNsenter(rootfsPath, executor) +} + +type fakeExec struct { + rootfsPath string +} + +func (f fakeExec) Command(cmd string, args ...string) exec.Cmd { + // This will intentionaly panic if Nsenter does not provide enough arguments. + realCmd := args[2] + realArgs := args[3:] + return exec.New().Command(realCmd, realArgs...) +} + +func (fakeExec) LookPath(file string) (string, error) { + return "", errors.New("not implemented") +} + +func (fakeExec) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd { + return nil +} + +var _ exec.Interface = fakeExec{} diff --git a/vendor/k8s.io/utils/nsenter/nsenter_unsupported.go b/vendor/k8s.io/utils/nsenter/nsenter_unsupported.go new file mode 100644 index 0000000000..0618b9da46 --- /dev/null +++ b/vendor/k8s.io/utils/nsenter/nsenter_unsupported.go @@ -0,0 +1,56 @@ +// +build !linux + +/* +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 nsenter + +import ( + "k8s.io/utils/exec" +) + +const ( + // DefaultHostRootFsPath is path to host's filesystem mounted into container + // with kubelet. + DefaultHostRootFsPath = "/rootfs" +) + +// Nsenter is part of experimental support for running the kubelet +// in a container. +type Nsenter struct { + // a map of commands to their paths on the host filesystem + Paths map[string]string +} + +// NewNsenter constructs a new instance of Nsenter +func NewNsenter(hostRootFsPath string, executor exec.Interface) (*Nsenter, error) { + return &Nsenter{}, nil +} + +// Exec executes nsenter commands in hostProcMountNsPath mount namespace +func (ne *Nsenter) Exec(cmd string, args []string) exec.Cmd { + return nil +} + +// AbsHostPath returns the absolute runnable path for a specified command +func (ne *Nsenter) AbsHostPath(command string) string { + return "" +} + +// SupportsSystemd checks whether command systemd-run exists +func (ne *Nsenter) SupportsSystemd() (string, bool) { + return "", false +} diff --git a/vendor/k8s.io/utils/trace/BUILD b/vendor/k8s.io/utils/trace/BUILD new file mode 100644 index 0000000000..a099049be1 --- /dev/null +++ b/vendor/k8s.io/utils/trace/BUILD @@ -0,0 +1,24 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["trace.go"], + importmap = "k8s.io/kubernetes/vendor/k8s.io/utils/trace", + importpath = "k8s.io/utils/trace", + visibility = ["//visibility:public"], + deps = ["//vendor/k8s.io/klog:go_default_library"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/k8s.io/utils/trace/trace.go b/vendor/k8s.io/utils/trace/trace.go new file mode 100644 index 0000000000..3a1ecfc715 --- /dev/null +++ b/vendor/k8s.io/utils/trace/trace.go @@ -0,0 +1,96 @@ +/* +Copyright 2015 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 trace + +import ( + "bytes" + "fmt" + "math/rand" + "time" + + "k8s.io/klog" +) + +type traceStep struct { + stepTime time.Time + msg string +} + +// Trace keeps track of a set of "steps" and allows us to log a specific +// step if it took longer than its share of the total allowed time +type Trace struct { + name string + startTime time.Time + steps []traceStep +} + +// New creates a Trace with the specified name +func New(name string) *Trace { + return &Trace{name, time.Now(), nil} +} + +// Step adds a new step with a specific message +func (t *Trace) Step(msg string) { + if t.steps == nil { + // traces almost always have less than 6 steps, do this to avoid more than a single allocation + t.steps = make([]traceStep, 0, 6) + } + t.steps = append(t.steps, traceStep{time.Now(), msg}) +} + +// Log is used to dump all the steps in the Trace +func (t *Trace) Log() { + // an explicit logging request should dump all the steps out at the higher level + t.logWithStepThreshold(0) +} + +func (t *Trace) logWithStepThreshold(stepThreshold time.Duration) { + var buffer bytes.Buffer + tracenum := rand.Int31() + endTime := time.Now() + + totalTime := endTime.Sub(t.startTime) + buffer.WriteString(fmt.Sprintf("Trace[%d]: %q (started: %v) (total time: %v):\n", tracenum, t.name, t.startTime, totalTime)) + lastStepTime := t.startTime + for _, step := range t.steps { + stepDuration := step.stepTime.Sub(lastStepTime) + if stepThreshold == 0 || stepDuration > stepThreshold || klog.V(4) { + buffer.WriteString(fmt.Sprintf("Trace[%d]: [%v] [%v] %v\n", tracenum, step.stepTime.Sub(t.startTime), stepDuration, step.msg)) + } + lastStepTime = step.stepTime + } + stepDuration := endTime.Sub(lastStepTime) + if stepThreshold == 0 || stepDuration > stepThreshold || klog.V(4) { + buffer.WriteString(fmt.Sprintf("Trace[%d]: [%v] [%v] END\n", tracenum, endTime.Sub(t.startTime), stepDuration)) + } + + klog.Info(buffer.String()) +} + +// LogIfLong is used to dump steps that took longer than its share +func (t *Trace) LogIfLong(threshold time.Duration) { + if time.Since(t.startTime) >= threshold { + // if any step took more than it's share of the total allowed time, it deserves a higher log level + stepThreshold := threshold / time.Duration(len(t.steps)+1) + t.logWithStepThreshold(stepThreshold) + } +} + +// TotalTime can be used to figure out how long it took since the Trace was created +func (t *Trace) TotalTime() time.Duration { + return time.Since(t.startTime) +} From 123590d911e3edb600253488ab9267d7f2b0000d Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Wed, 23 Jan 2019 21:25:28 -0500 Subject: [PATCH 2/7] replace pkg/util/io with k8s.io/utils/io --- pkg/controller/.import-restrictions | 5 ++-- pkg/kubectl/.import-restrictions | 3 +- pkg/util/BUILD | 1 - pkg/util/io/BUILD | 25 ---------------- pkg/util/io/consistentread.go | 45 ----------------------------- pkg/util/mount/BUILD | 2 +- pkg/util/mount/mount_linux.go | 2 +- 7 files changed, 7 insertions(+), 76 deletions(-) delete mode 100644 pkg/util/io/BUILD delete mode 100644 pkg/util/io/consistentread.go diff --git a/pkg/controller/.import-restrictions b/pkg/controller/.import-restrictions index db246c010a..11cfe737a3 100644 --- a/pkg/controller/.import-restrictions +++ b/pkg/controller/.import-restrictions @@ -321,8 +321,7 @@ "k8s.io/kubernetes/pkg/util/resizefs", "k8s.io/kubernetes/pkg/util/version", "k8s.io/kubernetes/pkg/apis/apps", - "k8s.io/kubernetes/pkg/version", - "k8s.io/kubernetes/pkg/util/io" + "k8s.io/kubernetes/pkg/version" ] }, { @@ -343,6 +342,8 @@ "k8s.io/metrics/pkg/client/custom_metrics/fake", "k8s.io/metrics/pkg/client/external_metrics", "k8s.io/metrics/pkg/client/external_metrics/fake", + "k8s.io/utils/nsenter", + "k8s.io/utils/io", "k8s.io/utils/pointer", "k8s.io/utils/exec" ] diff --git a/pkg/kubectl/.import-restrictions b/pkg/kubectl/.import-restrictions index 72be55c189..ea5dcc52d3 100644 --- a/pkg/kubectl/.import-restrictions +++ b/pkg/kubectl/.import-restrictions @@ -131,7 +131,6 @@ "k8s.io/kubernetes/pkg/util/goroutinemap", "k8s.io/kubernetes/pkg/util/hash", "k8s.io/kubernetes/pkg/util/interrupt", - "k8s.io/kubernetes/pkg/util/io", "k8s.io/kubernetes/pkg/util/labels", "k8s.io/kubernetes/pkg/util/metrics", "k8s.io/kubernetes/pkg/util/mount", @@ -145,6 +144,8 @@ "k8s.io/kubernetes/pkg/version/prometheus", "k8s.io/kubernetes/pkg/volume", "k8s.io/kubernetes/pkg/volume/util", + "k8s.io/utils/nsenter", + "k8s.io/utils/io", "k8s.io/utils/pointer" ], "ForbiddenPrefixes": [] diff --git a/pkg/util/BUILD b/pkg/util/BUILD index e46513b965..335e605f07 100644 --- a/pkg/util/BUILD +++ b/pkg/util/BUILD @@ -28,7 +28,6 @@ filegroup( "//pkg/util/hash:all-srcs", "//pkg/util/initsystem:all-srcs", "//pkg/util/interrupt:all-srcs", - "//pkg/util/io:all-srcs", "//pkg/util/ipconfig:all-srcs", "//pkg/util/ipset:all-srcs", "//pkg/util/iptables:all-srcs", diff --git a/pkg/util/io/BUILD b/pkg/util/io/BUILD deleted file mode 100644 index 92e8f2ae78..0000000000 --- a/pkg/util/io/BUILD +++ /dev/null @@ -1,25 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = ["consistentread.go"], - importpath = "k8s.io/kubernetes/pkg/util/io", -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/util/io/consistentread.go b/pkg/util/io/consistentread.go deleted file mode 100644 index 6e1f17b098..0000000000 --- a/pkg/util/io/consistentread.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -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 io - -import ( - "bytes" - "fmt" - "io/ioutil" -) - -// ConsistentRead repeatedly reads a file until it gets the same content twice. -// This is useful when reading files in /proc that are larger than page size -// and kernel may modify them between individual read() syscalls. -func ConsistentRead(filename string, attempts int) ([]byte, error) { - oldContent, err := ioutil.ReadFile(filename) - if err != nil { - return nil, err - } - for i := 0; i < attempts; i++ { - newContent, err := ioutil.ReadFile(filename) - if err != nil { - return nil, err - } - if bytes.Compare(oldContent, newContent) == 0 { - return newContent, nil - } - // Files are different, continue reading - oldContent = newContent - } - return nil, fmt.Errorf("could not get consistent content of %s after %d attempts", filename, attempts) -} diff --git a/pkg/util/mount/BUILD b/pkg/util/mount/BUILD index c9b9ce8a47..5e77382eec 100644 --- a/pkg/util/mount/BUILD +++ b/pkg/util/mount/BUILD @@ -36,10 +36,10 @@ go_library( ], "@io_bazel_rules_go//go/platform:linux": [ "//pkg/util/file:go_default_library", - "//pkg/util/io:go_default_library", "//pkg/util/nsenter:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/golang.org/x/sys/unix:go_default_library", + "//vendor/k8s.io/utils/io:go_default_library", ], "@io_bazel_rules_go//go/platform:nacl": [ "//pkg/util/nsenter:go_default_library", diff --git a/pkg/util/mount/mount_linux.go b/pkg/util/mount/mount_linux.go index 8e7604a22c..b0ef01bae4 100644 --- a/pkg/util/mount/mount_linux.go +++ b/pkg/util/mount/mount_linux.go @@ -34,8 +34,8 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/klog" utilfile "k8s.io/kubernetes/pkg/util/file" - utilio "k8s.io/kubernetes/pkg/util/io" utilexec "k8s.io/utils/exec" + utilio "k8s.io/utils/io" ) const ( From 2ea82cea200cb2e4bf79b0488855b31e8f52b3ad Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Wed, 23 Jan 2019 21:32:26 -0500 Subject: [PATCH 3/7] replace pkg/util/nsenter with k8s.io/utils/nsenter --- cmd/kubelet/app/BUILD | 2 +- cmd/kubelet/app/server.go | 2 +- pkg/controller/.import-restrictions | 1 - pkg/kubectl/.import-restrictions | 1 - pkg/util/BUILD | 1 - pkg/util/mount/BUILD | 24 +- pkg/util/mount/nsenter_mount.go | 2 +- pkg/util/mount/nsenter_mount_test.go | 2 +- pkg/util/mount/nsenter_mount_unsupported.go | 2 +- pkg/util/nsenter/BUILD | 76 ----- pkg/util/nsenter/OWNERS | 10 - pkg/util/nsenter/exec.go | 67 ----- pkg/util/nsenter/exec_unsupported.go | 58 ---- pkg/util/nsenter/nsenter.go | 236 --------------- pkg/util/nsenter/nsenter_test.go | 311 -------------------- pkg/util/nsenter/nsenter_unsupported.go | 56 ---- 16 files changed, 17 insertions(+), 834 deletions(-) delete mode 100644 pkg/util/nsenter/BUILD delete mode 100644 pkg/util/nsenter/OWNERS delete mode 100644 pkg/util/nsenter/exec.go delete mode 100644 pkg/util/nsenter/exec_unsupported.go delete mode 100644 pkg/util/nsenter/nsenter.go delete mode 100644 pkg/util/nsenter/nsenter_test.go delete mode 100644 pkg/util/nsenter/nsenter_unsupported.go diff --git a/cmd/kubelet/app/BUILD b/cmd/kubelet/app/BUILD index 59e5a93605..9fc77d79b0 100644 --- a/cmd/kubelet/app/BUILD +++ b/cmd/kubelet/app/BUILD @@ -75,7 +75,6 @@ go_library( "//pkg/util/flock:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/node:go_default_library", - "//pkg/util/nsenter:go_default_library", "//pkg/util/oom:go_default_library", "//pkg/util/rlimit:go_default_library", "//pkg/version:go_default_library", @@ -142,6 +141,7 @@ go_library( "//vendor/github.com/spf13/pflag:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ] + select({ "@io_bazel_rules_go//go/platform:linux": [ "//vendor/github.com/sigma/go-inotify:go_default_library", diff --git a/cmd/kubelet/app/server.go b/cmd/kubelet/app/server.go index c84979fd61..bedd78500b 100644 --- a/cmd/kubelet/app/server.go +++ b/cmd/kubelet/app/server.go @@ -91,12 +91,12 @@ import ( "k8s.io/kubernetes/pkg/util/flock" "k8s.io/kubernetes/pkg/util/mount" nodeutil "k8s.io/kubernetes/pkg/util/node" - "k8s.io/kubernetes/pkg/util/nsenter" "k8s.io/kubernetes/pkg/util/oom" "k8s.io/kubernetes/pkg/util/rlimit" "k8s.io/kubernetes/pkg/version" "k8s.io/kubernetes/pkg/version/verflag" "k8s.io/utils/exec" + "k8s.io/utils/nsenter" ) const ( diff --git a/pkg/controller/.import-restrictions b/pkg/controller/.import-restrictions index 11cfe737a3..ea8e754077 100644 --- a/pkg/controller/.import-restrictions +++ b/pkg/controller/.import-restrictions @@ -317,7 +317,6 @@ "k8s.io/kubernetes/pkg/kubeapiserver/admission/util", "k8s.io/kubernetes/pkg/scheduler/volumebinder", "k8s.io/kubernetes/pkg/scheduler/internal/cache", - "k8s.io/kubernetes/pkg/util/nsenter", "k8s.io/kubernetes/pkg/util/resizefs", "k8s.io/kubernetes/pkg/util/version", "k8s.io/kubernetes/pkg/apis/apps", diff --git a/pkg/kubectl/.import-restrictions b/pkg/kubectl/.import-restrictions index ea5dcc52d3..f69dc9f281 100644 --- a/pkg/kubectl/.import-restrictions +++ b/pkg/kubectl/.import-restrictions @@ -136,7 +136,6 @@ "k8s.io/kubernetes/pkg/util/mount", "k8s.io/kubernetes/pkg/util/net/sets", "k8s.io/kubernetes/pkg/util/node", - "k8s.io/kubernetes/pkg/util/nsenter", "k8s.io/kubernetes/pkg/util/parsers", "k8s.io/kubernetes/pkg/util/slice", "k8s.io/kubernetes/pkg/util/taints", diff --git a/pkg/util/BUILD b/pkg/util/BUILD index 335e605f07..b2620448b6 100644 --- a/pkg/util/BUILD +++ b/pkg/util/BUILD @@ -41,7 +41,6 @@ filegroup( "//pkg/util/netsh:all-srcs", "//pkg/util/node:all-srcs", "//pkg/util/normalizer:all-srcs", - "//pkg/util/nsenter:all-srcs", "//pkg/util/oom:all-srcs", "//pkg/util/parsers:all-srcs", "//pkg/util/pod:all-srcs", diff --git a/pkg/util/mount/BUILD b/pkg/util/mount/BUILD index 5e77382eec..60998c1d22 100644 --- a/pkg/util/mount/BUILD +++ b/pkg/util/mount/BUILD @@ -23,42 +23,42 @@ go_library( "//vendor/k8s.io/utils/exec:go_default_library", ] + select({ "@io_bazel_rules_go//go/platform:android": [ - "//pkg/util/nsenter:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "@io_bazel_rules_go//go/platform:darwin": [ - "//pkg/util/nsenter:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "@io_bazel_rules_go//go/platform:dragonfly": [ - "//pkg/util/nsenter:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "@io_bazel_rules_go//go/platform:freebsd": [ - "//pkg/util/nsenter:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "@io_bazel_rules_go//go/platform:linux": [ "//pkg/util/file:go_default_library", - "//pkg/util/nsenter:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/golang.org/x/sys/unix:go_default_library", "//vendor/k8s.io/utils/io:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "@io_bazel_rules_go//go/platform:nacl": [ - "//pkg/util/nsenter:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "@io_bazel_rules_go//go/platform:netbsd": [ - "//pkg/util/nsenter:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "@io_bazel_rules_go//go/platform:openbsd": [ - "//pkg/util/nsenter:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "@io_bazel_rules_go//go/platform:plan9": [ - "//pkg/util/nsenter:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "@io_bazel_rules_go//go/platform:solaris": [ - "//pkg/util/nsenter:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "@io_bazel_rules_go//go/platform:windows": [ "//pkg/util/file:go_default_library", - "//pkg/util/nsenter:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "//conditions:default": [], }), @@ -80,10 +80,10 @@ go_test( "//vendor/k8s.io/utils/exec/testing:go_default_library", ] + select({ "@io_bazel_rules_go//go/platform:linux": [ - "//pkg/util/nsenter:go_default_library", "//vendor/golang.org/x/sys/unix:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/nsenter:go_default_library", ], "@io_bazel_rules_go//go/platform:windows": [ "//vendor/github.com/stretchr/testify/assert:go_default_library", diff --git a/pkg/util/mount/nsenter_mount.go b/pkg/util/mount/nsenter_mount.go index 215da6174f..e77ee6f75f 100644 --- a/pkg/util/mount/nsenter_mount.go +++ b/pkg/util/mount/nsenter_mount.go @@ -28,7 +28,7 @@ import ( "golang.org/x/sys/unix" "k8s.io/klog" utilfile "k8s.io/kubernetes/pkg/util/file" - "k8s.io/kubernetes/pkg/util/nsenter" + "k8s.io/utils/nsenter" ) const ( diff --git a/pkg/util/mount/nsenter_mount_test.go b/pkg/util/mount/nsenter_mount_test.go index 164eab2f1c..1ed4bd222b 100644 --- a/pkg/util/mount/nsenter_mount_test.go +++ b/pkg/util/mount/nsenter_mount_test.go @@ -27,7 +27,7 @@ import ( "testing" "golang.org/x/sys/unix" - "k8s.io/kubernetes/pkg/util/nsenter" + "k8s.io/utils/nsenter" ) func TestParseFindMnt(t *testing.T) { diff --git a/pkg/util/mount/nsenter_mount_unsupported.go b/pkg/util/mount/nsenter_mount_unsupported.go index ddc44742e8..d68f751af8 100644 --- a/pkg/util/mount/nsenter_mount_unsupported.go +++ b/pkg/util/mount/nsenter_mount_unsupported.go @@ -22,7 +22,7 @@ import ( "errors" "os" - "k8s.io/kubernetes/pkg/util/nsenter" + "k8s.io/utils/nsenter" ) type NsenterMounter struct{} diff --git a/pkg/util/nsenter/BUILD b/pkg/util/nsenter/BUILD deleted file mode 100644 index 9a94fae101..0000000000 --- a/pkg/util/nsenter/BUILD +++ /dev/null @@ -1,76 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "go_default_library", - srcs = [ - "exec.go", - "exec_unsupported.go", - "nsenter.go", - "nsenter_unsupported.go", - ], - importpath = "k8s.io/kubernetes/pkg/util/nsenter", - visibility = ["//visibility:public"], - deps = select({ - "@io_bazel_rules_go//go/platform:android": [ - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "@io_bazel_rules_go//go/platform:darwin": [ - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "@io_bazel_rules_go//go/platform:dragonfly": [ - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "@io_bazel_rules_go//go/platform:freebsd": [ - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "@io_bazel_rules_go//go/platform:linux": [ - "//vendor/k8s.io/klog:go_default_library", - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "@io_bazel_rules_go//go/platform:nacl": [ - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "@io_bazel_rules_go//go/platform:netbsd": [ - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "@io_bazel_rules_go//go/platform:openbsd": [ - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "@io_bazel_rules_go//go/platform:plan9": [ - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "@io_bazel_rules_go//go/platform:solaris": [ - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "@io_bazel_rules_go//go/platform:windows": [ - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "//conditions:default": [], - }), -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], - visibility = ["//visibility:public"], -) - -go_test( - name = "go_default_test", - srcs = ["nsenter_test.go"], - embed = [":go_default_library"], - deps = select({ - "@io_bazel_rules_go//go/platform:linux": [ - "//vendor/k8s.io/utils/exec:go_default_library", - ], - "//conditions:default": [], - }), -) diff --git a/pkg/util/nsenter/OWNERS b/pkg/util/nsenter/OWNERS deleted file mode 100644 index 273520d2c7..0000000000 --- a/pkg/util/nsenter/OWNERS +++ /dev/null @@ -1,10 +0,0 @@ -reviewers: - - jsafrane - - msau42 - - cofyc - - dixudx -approvers: - - jsafrane - - msau42 - - cofyc - - dixudx diff --git a/pkg/util/nsenter/exec.go b/pkg/util/nsenter/exec.go deleted file mode 100644 index 134497f0a7..0000000000 --- a/pkg/util/nsenter/exec.go +++ /dev/null @@ -1,67 +0,0 @@ -// +build linux - -/* -Copyright 2018 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 nsenter - -import ( - "context" - "fmt" - "path/filepath" - - "k8s.io/klog" - "k8s.io/utils/exec" -) - -// Executor wraps executor interface to be executed via nsenter -type Executor struct { - // Exec implementation - executor exec.Interface - // Path to the host's root proc path - hostProcMountNsPath string -} - -// NewNsenterExecutor returns new nsenter based executor -func NewNsenterExecutor(hostRootFsPath string, executor exec.Interface) *Executor { - hostProcMountNsPath := filepath.Join(hostRootFsPath, mountNsPath) - nsExecutor := &Executor{ - hostProcMountNsPath: hostProcMountNsPath, - executor: executor, - } - return nsExecutor -} - -// Command returns a command wrapped with nenter -func (nsExecutor *Executor) Command(cmd string, args ...string) exec.Cmd { - fullArgs := append([]string{fmt.Sprintf("--mount=%s", nsExecutor.hostProcMountNsPath), "--"}, - append([]string{cmd}, args...)...) - klog.V(5).Infof("Running nsenter command: %v %v", nsenterPath, fullArgs) - return nsExecutor.executor.Command(nsenterPath, fullArgs...) -} - -// CommandContext returns a CommandContext wrapped with nsenter -func (nsExecutor *Executor) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd { - fullArgs := append([]string{fmt.Sprintf("--mount=%s", nsExecutor.hostProcMountNsPath), "--"}, - append([]string{cmd}, args...)...) - klog.V(5).Infof("Running nsenter command: %v %v", nsenterPath, fullArgs) - return nsExecutor.executor.CommandContext(ctx, nsenterPath, fullArgs...) -} - -// LookPath returns a LookPath wrapped with nsenter -func (nsExecutor *Executor) LookPath(file string) (string, error) { - return "", fmt.Errorf("not implemented, error looking up : %s", file) -} diff --git a/pkg/util/nsenter/exec_unsupported.go b/pkg/util/nsenter/exec_unsupported.go deleted file mode 100644 index eecbdfc292..0000000000 --- a/pkg/util/nsenter/exec_unsupported.go +++ /dev/null @@ -1,58 +0,0 @@ -// +build !linux - -/* -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 nsenter - -import ( - "context" - "fmt" - - "k8s.io/utils/exec" -) - -// Executor wraps executor interface to be executed via nsenter -type Executor struct { - // Exec implementation - executor exec.Interface - // Path to the host's root proc path - hostProcMountNsPath string -} - -// NewNsenterExecutor returns new nsenter based executor -func NewNsenterExecutor(hostRootFsPath string, executor exec.Interface) *Executor { - nsExecutor := &Executor{ - hostProcMountNsPath: hostRootFsPath, - executor: executor, - } - return nsExecutor -} - -// Command returns a command wrapped with nenter -func (nsExecutor *Executor) Command(cmd string, args ...string) exec.Cmd { - return nil -} - -// CommandContext returns a CommandContext wrapped with nsenter -func (nsExecutor *Executor) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd { - return nil -} - -// LookPath returns a LookPath wrapped with nsenter -func (nsExecutor *Executor) LookPath(file string) (string, error) { - return "", fmt.Errorf("not implemented, error looking up : %s", file) -} diff --git a/pkg/util/nsenter/nsenter.go b/pkg/util/nsenter/nsenter.go deleted file mode 100644 index 56361e7846..0000000000 --- a/pkg/util/nsenter/nsenter.go +++ /dev/null @@ -1,236 +0,0 @@ -// +build linux - -/* -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 nsenter - -import ( - "context" - "errors" - "fmt" - "os" - "path/filepath" - "strings" - - "k8s.io/utils/exec" - - "k8s.io/klog" -) - -const ( - // DefaultHostRootFsPath is path to host's filesystem mounted into container - // with kubelet. - DefaultHostRootFsPath = "/rootfs" - // mountNsPath is the default mount namespace of the host - mountNsPath = "/proc/1/ns/mnt" - // nsenterPath is the default nsenter command - nsenterPath = "nsenter" -) - -// Nsenter is part of experimental support for running the kubelet -// in a container. -// -// Nsenter requires: -// -// 1. Docker >= 1.6 due to the dependency on the slave propagation mode -// of the bind-mount of the kubelet root directory in the container. -// Docker 1.5 used a private propagation mode for bind-mounts, so mounts -// performed in the host's mount namespace do not propagate out to the -// bind-mount in this docker version. -// 2. The host's root filesystem must be available at /rootfs -// 3. The nsenter binary must be on the Kubelet process' PATH in the container's -// filesystem. -// 4. The Kubelet process must have CAP_SYS_ADMIN (required by nsenter); at -// the present, this effectively means that the kubelet is running in a -// privileged container. -// 5. The volume path used by the Kubelet must be the same inside and outside -// the container and be writable by the container (to initialize volume) -// contents. TODO: remove this requirement. -// 6. The host image must have "mount", "findmnt", "umount", "stat", "touch", -// "mkdir", "ls", "sh" and "chmod" binaries in /bin, /usr/sbin, or /usr/bin -// 7. The host image should have systemd-run in /bin, /usr/sbin, or /usr/bin if -// systemd is installed/enabled in the operating system. -// For more information about mount propagation modes, see: -// https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt -type Nsenter struct { - // a map of commands to their paths on the host filesystem - paths map[string]string - - // Path to the host filesystem, typically "/rootfs". Used only for testing. - hostRootFsPath string - - // Exec implementation, used only for testing - executor exec.Interface -} - -// NewNsenter constructs a new instance of Nsenter -func NewNsenter(hostRootFsPath string, executor exec.Interface) (*Nsenter, error) { - ne := &Nsenter{ - hostRootFsPath: hostRootFsPath, - executor: executor, - } - if err := ne.initPaths(); err != nil { - return nil, err - } - return ne, nil -} - -func (ne *Nsenter) initPaths() error { - ne.paths = map[string]string{} - binaries := []string{ - "mount", - "findmnt", - "umount", - "systemd-run", - "stat", - "touch", - "mkdir", - "sh", - "chmod", - "realpath", - } - // search for the required commands in other locations besides /usr/bin - for _, binary := range binaries { - // check for binary under the following directories - for _, path := range []string{"/", "/bin", "/usr/sbin", "/usr/bin"} { - binPath := filepath.Join(path, binary) - if _, err := os.Stat(filepath.Join(ne.hostRootFsPath, binPath)); err != nil { - continue - } - ne.paths[binary] = binPath - break - } - // systemd-run is optional, bailout if we don't find any of the other binaries - if ne.paths[binary] == "" && binary != "systemd-run" { - return fmt.Errorf("unable to find %v", binary) - } - } - return nil -} - -// Exec executes nsenter commands in hostProcMountNsPath mount namespace -func (ne *Nsenter) Exec(cmd string, args []string) exec.Cmd { - hostProcMountNsPath := filepath.Join(ne.hostRootFsPath, mountNsPath) - fullArgs := append([]string{fmt.Sprintf("--mount=%s", hostProcMountNsPath), "--"}, - append([]string{ne.AbsHostPath(cmd)}, args...)...) - klog.V(5).Infof("Running nsenter command: %v %v", nsenterPath, fullArgs) - return ne.executor.Command(nsenterPath, fullArgs...) -} - -// AbsHostPath returns the absolute runnable path for a specified command -func (ne *Nsenter) AbsHostPath(command string) string { - path, ok := ne.paths[command] - if !ok { - return command - } - return path -} - -// SupportsSystemd checks whether command systemd-run exists -func (ne *Nsenter) SupportsSystemd() (string, bool) { - systemdRunPath, ok := ne.paths["systemd-run"] - return systemdRunPath, ok && systemdRunPath != "" -} - -// EvalSymlinks returns the path name on the host after evaluating symlinks on the -// host. -// mustExist makes EvalSymlinks to return error when the path does not -// exist. When it's false, it evaluates symlinks of the existing part and -// blindly adds the non-existing part: -// pathname: /mnt/volume/non/existing/directory -// /mnt/volume exists -// non/existing/directory does not exist -// -> It resolves symlinks in /mnt/volume to say /mnt/foo and returns -// /mnt/foo/non/existing/directory. -// -// BEWARE! EvalSymlinks is not able to detect symlink looks with mustExist=false! -// If /tmp/link is symlink to /tmp/link, EvalSymlinks(/tmp/link/foo) returns /tmp/link/foo. -func (ne *Nsenter) EvalSymlinks(pathname string, mustExist bool) (string, error) { - var args []string - if mustExist { - // "realpath -e: all components of the path must exist" - args = []string{"-e", pathname} - } else { - // "realpath -m: no path components need exist or be a directory" - args = []string{"-m", pathname} - } - outBytes, err := ne.Exec("realpath", args).CombinedOutput() - if err != nil { - klog.Infof("failed to resolve symbolic links on %s: %v", pathname, err) - return "", err - } - return strings.TrimSpace(string(outBytes)), nil -} - -// KubeletPath returns the path name that can be accessed by containerized -// kubelet. It is recommended to resolve symlinks on the host by EvalSymlinks -// before calling this function -func (ne *Nsenter) KubeletPath(pathname string) string { - return filepath.Join(ne.hostRootFsPath, pathname) -} - -// NewFakeNsenter returns a Nsenter that does not run "nsenter --mount=... --", -// but runs everything in the same mount namespace as the unit test binary. -// rootfsPath is supposed to be a symlink, e.g. /tmp/xyz/rootfs -> /. -// This fake Nsenter is enough for most operations, e.g. to resolve symlinks, -// but it's not enough to call /bin/mount - unit tests don't run as root. -func NewFakeNsenter(rootfsPath string) (*Nsenter, error) { - executor := &fakeExec{ - rootfsPath: rootfsPath, - } - // prepare /rootfs/bin, usr/bin and usr/sbin - bin := filepath.Join(rootfsPath, "bin") - if err := os.Symlink("/bin", bin); err != nil { - return nil, err - } - - usr := filepath.Join(rootfsPath, "usr") - if err := os.Mkdir(usr, 0755); err != nil { - return nil, err - } - usrbin := filepath.Join(usr, "bin") - if err := os.Symlink("/usr/bin", usrbin); err != nil { - return nil, err - } - usrsbin := filepath.Join(usr, "sbin") - if err := os.Symlink("/usr/sbin", usrsbin); err != nil { - return nil, err - } - - return NewNsenter(rootfsPath, executor) -} - -type fakeExec struct { - rootfsPath string -} - -func (f fakeExec) Command(cmd string, args ...string) exec.Cmd { - // This will intentionaly panic if Nsenter does not provide enough arguments. - realCmd := args[2] - realArgs := args[3:] - return exec.New().Command(realCmd, realArgs...) -} - -func (fakeExec) LookPath(file string) (string, error) { - return "", errors.New("not implemented") -} - -func (fakeExec) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd { - return nil -} - -var _ exec.Interface = fakeExec{} diff --git a/pkg/util/nsenter/nsenter_test.go b/pkg/util/nsenter/nsenter_test.go deleted file mode 100644 index 3158a55bbe..0000000000 --- a/pkg/util/nsenter/nsenter_test.go +++ /dev/null @@ -1,311 +0,0 @@ -// +build linux - -/* -Copyright 2018 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 nsenter - -import ( - "io/ioutil" - "os" - "path/filepath" - "testing" - - "k8s.io/utils/exec" -) - -func TestExec(t *testing.T) { - tests := []struct { - name string - command string - args []string - expectedOutput string - expectError bool - }{ - { - name: "simple command", - command: "echo", - args: []string{"hello", "world"}, - expectedOutput: "hello world\n", - }, - { - name: "nozero exit code", - command: "false", - expectError: true, - }, - } - - executor := fakeExec{ - rootfsPath: "/rootfs", - } - for _, test := range tests { - ns := Nsenter{ - hostRootFsPath: "/rootfs", - executor: executor, - } - cmd := ns.Exec(test.command, test.args) - outBytes, err := cmd.CombinedOutput() - out := string(outBytes) - if err != nil && !test.expectError { - t.Errorf("Test %q: unexpected error: %s", test.name, err) - } - if err == nil && test.expectError { - t.Errorf("Test %q: expected error, got none", test.name) - } - if test.expectedOutput != out { - t.Errorf("test %q: expected output %q, got %q", test.name, test.expectedOutput, out) - } - } -} - -func TestKubeletPath(t *testing.T) { - tests := []struct { - rootfs string - hostpath string - expectedKubeletPath string - }{ - { - // simple join - "/rootfs", - "/some/path", - "/rootfs/some/path", - }, - { - // squash slashes - "/rootfs/", - "//some/path", - "/rootfs/some/path", - }, - } - - for _, test := range tests { - ns := Nsenter{ - hostRootFsPath: test.rootfs, - } - out := ns.KubeletPath(test.hostpath) - if out != test.expectedKubeletPath { - t.Errorf("Expected path %q, got %q", test.expectedKubeletPath, out) - } - - } -} - -func TestEvalSymlinks(t *testing.T) { - tests := []struct { - name string - mustExist bool - prepare func(tmpdir string) (src string, expectedDst string, err error) - expectError bool - }{ - { - name: "simple file /src", - mustExist: true, - prepare: func(tmpdir string) (src string, expectedDst string, err error) { - src = filepath.Join(tmpdir, "src") - err = ioutil.WriteFile(src, []byte{}, 0644) - return src, src, err - }, - }, - { - name: "non-existing file /src", - mustExist: true, - prepare: func(tmpdir string) (src string, expectedDst string, err error) { - src = filepath.Join(tmpdir, "src") - return src, "", nil - }, - expectError: true, - }, - { - name: "non-existing file /src/ with mustExist=false", - mustExist: false, - prepare: func(tmpdir string) (src string, expectedDst string, err error) { - src = filepath.Join(tmpdir, "src") - return src, src, nil - }, - }, - { - name: "non-existing file /existing/path/src with mustExist=false with existing directories", - mustExist: false, - prepare: func(tmpdir string) (src string, expectedDst string, err error) { - src = filepath.Join(tmpdir, "existing/path") - if err := os.MkdirAll(src, 0755); err != nil { - return "", "", err - } - src = filepath.Join(src, "src") - return src, src, nil - }, - }, - { - name: "simple symlink /src -> /dst", - mustExist: false, - prepare: func(tmpdir string) (src string, expectedDst string, err error) { - dst := filepath.Join(tmpdir, "dst") - if err = ioutil.WriteFile(dst, []byte{}, 0644); err != nil { - return "", "", err - } - src = filepath.Join(tmpdir, "src") - err = os.Symlink(dst, src) - return src, dst, err - }, - }, - { - name: "dangling symlink /src -> /non-existing-path", - mustExist: true, - prepare: func(tmpdir string) (src string, expectedDst string, err error) { - dst := filepath.Join(tmpdir, "non-existing-path") - src = filepath.Join(tmpdir, "src") - err = os.Symlink(dst, src) - return src, "", err - }, - expectError: true, - }, - { - name: "dangling symlink /src -> /non-existing-path with mustExist=false", - mustExist: false, - prepare: func(tmpdir string) (src string, expectedDst string, err error) { - dst := filepath.Join(tmpdir, "non-existing-path") - src = filepath.Join(tmpdir, "src") - err = os.Symlink(dst, src) - return src, dst, err - }, - }, - { - name: "symlink to directory /src/file, where /src is link to /dst", - mustExist: true, - prepare: func(tmpdir string) (src string, expectedDst string, err error) { - dst := filepath.Join(tmpdir, "dst") - if err = os.Mkdir(dst, 0755); err != nil { - return "", "", err - } - dstFile := filepath.Join(dst, "file") - if err = ioutil.WriteFile(dstFile, []byte{}, 0644); err != nil { - return "", "", err - } - - src = filepath.Join(tmpdir, "src") - if err = os.Symlink(dst, src); err != nil { - return "", "", err - } - srcFile := filepath.Join(src, "file") - return srcFile, dstFile, nil - }, - }, - { - name: "symlink to non-existing directory: /src/file, where /src is link to /dst and dst does not exist", - mustExist: true, - prepare: func(tmpdir string) (src string, expectedDst string, err error) { - dst := filepath.Join(tmpdir, "dst") - - src = filepath.Join(tmpdir, "src") - if err = os.Symlink(dst, src); err != nil { - return "", "", err - } - srcFile := filepath.Join(src, "file") - return srcFile, "", nil - }, - expectError: true, - }, - { - name: "symlink to non-existing directory: /src/file, where /src is link to /dst and dst does not exist with mustExist=false", - mustExist: false, - prepare: func(tmpdir string) (src string, expectedDst string, err error) { - dst := filepath.Join(tmpdir, "dst") - dstFile := filepath.Join(dst, "file") - - src = filepath.Join(tmpdir, "src") - if err = os.Symlink(dst, src); err != nil { - return "", "", err - } - srcFile := filepath.Join(src, "file") - return srcFile, dstFile, nil - }, - }, - } - - for _, test := range tests { - ns := Nsenter{ - hostRootFsPath: "/rootfs", - executor: fakeExec{ - rootfsPath: "/rootfs", - }, - } - - tmpdir, err := ioutil.TempDir("", "nsenter-hostpath-") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tmpdir) - - src, expectedDst, err := test.prepare(tmpdir) - if err != nil { - t.Error(err) - continue - } - - dst, err := ns.EvalSymlinks(src, test.mustExist) - if err != nil && !test.expectError { - t.Errorf("Test %q: unexpected error: %s", test.name, err) - } - if err == nil && test.expectError { - t.Errorf("Test %q: expected error, got none", test.name) - } - if dst != expectedDst { - t.Errorf("Test %q: expected destination %q, got %q", test.name, expectedDst, dst) - } - } -} - -func TestNewNsenter(t *testing.T) { - // Create a symlink /tmp/xyz/rootfs -> / and use it as rootfs path - // It should resolve all binaries correctly, the test runs on Linux - - tmpdir, err := ioutil.TempDir("", "nsenter-hostpath-") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tmpdir) - - rootfs := filepath.Join(tmpdir, "rootfs") - if err = os.Symlink("/", rootfs); err != nil { - t.Fatal(err) - } - - _, err = NewNsenter(rootfs, exec.New()) - if err != nil { - t.Errorf("Error: %s", err) - } -} - -func TestNewNsenterError(t *testing.T) { - // Create empty dir /tmp/xyz/rootfs and use it as rootfs path - // It should resolve all binaries correctly, the test runs on Linux - - tmpdir, err := ioutil.TempDir("", "nsenter-hostpath-") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tmpdir) - - rootfs := filepath.Join(tmpdir, "rootfs") - if err = os.MkdirAll(rootfs, 0755); err != nil { - t.Fatal(err) - } - - _, err = NewNsenter(rootfs, exec.New()) - if err == nil { - t.Errorf("Expected error, got none") - } -} diff --git a/pkg/util/nsenter/nsenter_unsupported.go b/pkg/util/nsenter/nsenter_unsupported.go deleted file mode 100644 index 0618b9da46..0000000000 --- a/pkg/util/nsenter/nsenter_unsupported.go +++ /dev/null @@ -1,56 +0,0 @@ -// +build !linux - -/* -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 nsenter - -import ( - "k8s.io/utils/exec" -) - -const ( - // DefaultHostRootFsPath is path to host's filesystem mounted into container - // with kubelet. - DefaultHostRootFsPath = "/rootfs" -) - -// Nsenter is part of experimental support for running the kubelet -// in a container. -type Nsenter struct { - // a map of commands to their paths on the host filesystem - Paths map[string]string -} - -// NewNsenter constructs a new instance of Nsenter -func NewNsenter(hostRootFsPath string, executor exec.Interface) (*Nsenter, error) { - return &Nsenter{}, nil -} - -// Exec executes nsenter commands in hostProcMountNsPath mount namespace -func (ne *Nsenter) Exec(cmd string, args []string) exec.Cmd { - return nil -} - -// AbsHostPath returns the absolute runnable path for a specified command -func (ne *Nsenter) AbsHostPath(command string) string { - return "" -} - -// SupportsSystemd checks whether command systemd-run exists -func (ne *Nsenter) SupportsSystemd() (string, bool) { - return "", false -} From 0bc5508aca9a945e92ef2a83492a70bbfcc12d13 Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Thu, 24 Jan 2019 11:34:33 -0500 Subject: [PATCH 4/7] replace client-go/util/integer with k8s.io/utils/integer --- cmd/kubeadm/.import-restrictions | 1 + hack/.golint_failures | 1 - pkg/controller/.import-restrictions | 2 +- pkg/controller/BUILD | 2 +- pkg/controller/controller_utils.go | 2 +- pkg/controller/daemon/BUILD | 2 +- pkg/controller/daemon/daemon_controller.go | 2 +- pkg/controller/deployment/BUILD | 2 +- pkg/controller/deployment/rolling.go | 2 +- pkg/controller/deployment/util/BUILD | 2 +- .../deployment/util/deployment_util.go | 2 +- pkg/controller/job/BUILD | 2 +- pkg/controller/job/job_controller.go | 2 +- pkg/controller/replicaset/BUILD | 2 +- pkg/controller/replicaset/replica_set.go | 2 +- pkg/kubectl/BUILD | 2 +- pkg/kubectl/cmd/get/BUILD | 2 +- pkg/kubectl/cmd/get/sorter.go | 2 +- pkg/kubectl/rolling_updater.go | 2 +- pkg/kubectl/util/podutils/BUILD | 2 +- pkg/kubectl/util/podutils/podutils.go | 2 +- pkg/kubelet/BUILD | 2 +- pkg/kubelet/kubelet.go | 2 +- staging/src/BUILD | 1 - .../k8s.io/client-go/util/flowcontrol/BUILD | 2 +- .../client-go/util/flowcontrol/backoff.go | 2 +- .../src/k8s.io/client-go/util/integer/BUILD | 33 --- .../k8s.io/client-go/util/integer/integer.go | 67 ----- .../client-go/util/integer/integer_test.go | 244 ------------------ test/e2e/instrumentation/logging/utils/BUILD | 2 +- .../logging/utils/logging_agent.go | 2 +- 31 files changed, 26 insertions(+), 371 deletions(-) delete mode 100644 staging/src/k8s.io/client-go/util/integer/BUILD delete mode 100644 staging/src/k8s.io/client-go/util/integer/integer.go delete mode 100644 staging/src/k8s.io/client-go/util/integer/integer_test.go diff --git a/cmd/kubeadm/.import-restrictions b/cmd/kubeadm/.import-restrictions index b2ceea03ec..9b3791b9e6 100644 --- a/cmd/kubeadm/.import-restrictions +++ b/cmd/kubeadm/.import-restrictions @@ -40,6 +40,7 @@ "SelectorRegexp": "k8s[.]io/utils", "AllowedPrefixes": [ "k8s.io/utils/exec", + "k8s.io/utils/integer", "k8s.io/utils/pointer" ] }, diff --git a/hack/.golint_failures b/hack/.golint_failures index 2614b3fcb1..c7fcee78f1 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -645,7 +645,6 @@ staging/src/k8s.io/client-go/tools/reference staging/src/k8s.io/client-go/transport staging/src/k8s.io/client-go/util/exec staging/src/k8s.io/client-go/util/flowcontrol -staging/src/k8s.io/client-go/util/integer staging/src/k8s.io/client-go/util/jsonpath staging/src/k8s.io/client-go/util/retry staging/src/k8s.io/client-go/util/testing diff --git a/pkg/controller/.import-restrictions b/pkg/controller/.import-restrictions index ea8e754077..74713dc703 100644 --- a/pkg/controller/.import-restrictions +++ b/pkg/controller/.import-restrictions @@ -162,7 +162,6 @@ "k8s.io/client-go/tools/watch", "k8s.io/client-go/util/cert", "k8s.io/client-go/util/flowcontrol", - "k8s.io/client-go/util/integer", "k8s.io/client-go/util/retry", "k8s.io/client-go/util/testing", "k8s.io/client-go/util/workqueue" @@ -342,6 +341,7 @@ "k8s.io/metrics/pkg/client/external_metrics", "k8s.io/metrics/pkg/client/external_metrics/fake", "k8s.io/utils/nsenter", + "k8s.io/utils/integer", "k8s.io/utils/io", "k8s.io/utils/pointer", "k8s.io/utils/exec" diff --git a/pkg/controller/BUILD b/pkg/controller/BUILD index 57f6c8f70a..00e7f8efa3 100644 --- a/pkg/controller/BUILD +++ b/pkg/controller/BUILD @@ -85,10 +85,10 @@ go_library( "//staging/src/k8s.io/client-go/tools/cache:go_default_library", "//staging/src/k8s.io/client-go/tools/record:go_default_library", "//staging/src/k8s.io/client-go/tools/watch:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", "//staging/src/k8s.io/client-go/util/retry:go_default_library", "//vendor/github.com/golang/groupcache/lru:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", ], ) diff --git a/pkg/controller/controller_utils.go b/pkg/controller/controller_utils.go index 1a0324f7a8..0662434102 100644 --- a/pkg/controller/controller_utils.go +++ b/pkg/controller/controller_utils.go @@ -42,13 +42,13 @@ import ( clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" - "k8s.io/client-go/util/integer" clientretry "k8s.io/client-go/util/retry" podutil "k8s.io/kubernetes/pkg/api/v1/pod" _ "k8s.io/kubernetes/pkg/apis/core/install" "k8s.io/kubernetes/pkg/apis/core/validation" hashutil "k8s.io/kubernetes/pkg/util/hash" taintutils "k8s.io/kubernetes/pkg/util/taints" + "k8s.io/utils/integer" "k8s.io/klog" ) diff --git a/pkg/controller/daemon/BUILD b/pkg/controller/daemon/BUILD index f98dafce88..b1d3548ed8 100644 --- a/pkg/controller/daemon/BUILD +++ b/pkg/controller/daemon/BUILD @@ -49,9 +49,9 @@ go_library( "//staging/src/k8s.io/client-go/tools/cache:go_default_library", "//staging/src/k8s.io/client-go/tools/record:go_default_library", "//staging/src/k8s.io/client-go/util/flowcontrol:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", "//staging/src/k8s.io/client-go/util/workqueue:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", ], ) diff --git a/pkg/controller/daemon/daemon_controller.go b/pkg/controller/daemon/daemon_controller.go index d98ea75166..bf7019f117 100644 --- a/pkg/controller/daemon/daemon_controller.go +++ b/pkg/controller/daemon/daemon_controller.go @@ -47,7 +47,6 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/flowcontrol" - "k8s.io/client-go/util/integer" "k8s.io/client-go/util/workqueue" podutil "k8s.io/kubernetes/pkg/api/v1/pod" "k8s.io/kubernetes/pkg/controller" @@ -57,6 +56,7 @@ import ( "k8s.io/kubernetes/pkg/scheduler/algorithm/predicates" schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo" "k8s.io/kubernetes/pkg/util/metrics" + "k8s.io/utils/integer" ) const ( diff --git a/pkg/controller/deployment/BUILD b/pkg/controller/deployment/BUILD index 7f1964a4f7..53865847a3 100644 --- a/pkg/controller/deployment/BUILD +++ b/pkg/controller/deployment/BUILD @@ -40,9 +40,9 @@ go_library( "//staging/src/k8s.io/client-go/listers/core/v1:go_default_library", "//staging/src/k8s.io/client-go/tools/cache:go_default_library", "//staging/src/k8s.io/client-go/tools/record:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", "//staging/src/k8s.io/client-go/util/workqueue:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", ], ) diff --git a/pkg/controller/deployment/rolling.go b/pkg/controller/deployment/rolling.go index 6950c3e679..7cc40bbc53 100644 --- a/pkg/controller/deployment/rolling.go +++ b/pkg/controller/deployment/rolling.go @@ -21,10 +21,10 @@ import ( "sort" apps "k8s.io/api/apps/v1" - "k8s.io/client-go/util/integer" "k8s.io/klog" "k8s.io/kubernetes/pkg/controller" deploymentutil "k8s.io/kubernetes/pkg/controller/deployment/util" + "k8s.io/utils/integer" ) // rolloutRolling implements the logic for rolling a new replica set. diff --git a/pkg/controller/deployment/util/BUILD b/pkg/controller/deployment/util/BUILD index 2b563e00ae..3d9f752248 100644 --- a/pkg/controller/deployment/util/BUILD +++ b/pkg/controller/deployment/util/BUILD @@ -23,8 +23,8 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/apps/v1:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", ], ) diff --git a/pkg/controller/deployment/util/deployment_util.go b/pkg/controller/deployment/util/deployment_util.go index 00e5c4c36e..90c60c8461 100644 --- a/pkg/controller/deployment/util/deployment_util.go +++ b/pkg/controller/deployment/util/deployment_util.go @@ -36,9 +36,9 @@ import ( intstrutil "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/wait" appsclient "k8s.io/client-go/kubernetes/typed/apps/v1" - "k8s.io/client-go/util/integer" "k8s.io/kubernetes/pkg/controller" labelsutil "k8s.io/kubernetes/pkg/util/labels" + "k8s.io/utils/integer" ) const ( diff --git a/pkg/controller/job/BUILD b/pkg/controller/job/BUILD index cb12dbe575..2cdbcd4986 100644 --- a/pkg/controller/job/BUILD +++ b/pkg/controller/job/BUILD @@ -33,9 +33,9 @@ go_library( "//staging/src/k8s.io/client-go/listers/core/v1:go_default_library", "//staging/src/k8s.io/client-go/tools/cache:go_default_library", "//staging/src/k8s.io/client-go/tools/record:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", "//staging/src/k8s.io/client-go/util/workqueue:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", ], ) diff --git a/pkg/controller/job/job_controller.go b/pkg/controller/job/job_controller.go index ebdcd7e264..e3cecd9fc2 100644 --- a/pkg/controller/job/job_controller.go +++ b/pkg/controller/job/job_controller.go @@ -40,10 +40,10 @@ import ( corelisters "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" - "k8s.io/client-go/util/integer" "k8s.io/client-go/util/workqueue" "k8s.io/kubernetes/pkg/controller" "k8s.io/kubernetes/pkg/util/metrics" + "k8s.io/utils/integer" "k8s.io/klog" ) diff --git a/pkg/controller/replicaset/BUILD b/pkg/controller/replicaset/BUILD index e833fdf6e3..df8300c9fe 100644 --- a/pkg/controller/replicaset/BUILD +++ b/pkg/controller/replicaset/BUILD @@ -36,9 +36,9 @@ go_library( "//staging/src/k8s.io/client-go/listers/core/v1:go_default_library", "//staging/src/k8s.io/client-go/tools/cache:go_default_library", "//staging/src/k8s.io/client-go/tools/record:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", "//staging/src/k8s.io/client-go/util/workqueue:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", ], ) diff --git a/pkg/controller/replicaset/replica_set.go b/pkg/controller/replicaset/replica_set.go index 03edbe1365..1ee5f61160 100644 --- a/pkg/controller/replicaset/replica_set.go +++ b/pkg/controller/replicaset/replica_set.go @@ -52,12 +52,12 @@ import ( corelisters "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" - "k8s.io/client-go/util/integer" "k8s.io/client-go/util/workqueue" "k8s.io/klog" podutil "k8s.io/kubernetes/pkg/api/v1/pod" "k8s.io/kubernetes/pkg/controller" "k8s.io/kubernetes/pkg/util/metrics" + "k8s.io/utils/integer" ) const ( diff --git a/pkg/kubectl/BUILD b/pkg/kubectl/BUILD index cfb06a7645..1d56ac8a7d 100644 --- a/pkg/kubectl/BUILD +++ b/pkg/kubectl/BUILD @@ -87,8 +87,8 @@ go_library( "//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library", "//staging/src/k8s.io/client-go/rest:go_default_library", "//staging/src/k8s.io/client-go/scale:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", "//staging/src/k8s.io/client-go/util/retry:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", ], ) diff --git a/pkg/kubectl/cmd/get/BUILD b/pkg/kubectl/cmd/get/BUILD index 0aa20de3c0..9ab44eaec0 100644 --- a/pkg/kubectl/cmd/get/BUILD +++ b/pkg/kubectl/cmd/get/BUILD @@ -53,11 +53,11 @@ go_library( "//staging/src/k8s.io/cli-runtime/pkg/genericclioptions/resource:go_default_library", "//staging/src/k8s.io/client-go/rest:go_default_library", "//staging/src/k8s.io/client-go/tools/watch:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", "//staging/src/k8s.io/client-go/util/jsonpath:go_default_library", "//vendor/github.com/liggitt/tabwriter:go_default_library", "//vendor/github.com/spf13/cobra:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", "//vendor/vbom.ml/util/sortorder:go_default_library", ], ) diff --git a/pkg/kubectl/cmd/get/sorter.go b/pkg/kubectl/cmd/get/sorter.go index d806decd19..c486d76df1 100644 --- a/pkg/kubectl/cmd/get/sorter.go +++ b/pkg/kubectl/cmd/get/sorter.go @@ -31,8 +31,8 @@ import ( metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/cli-runtime/pkg/genericclioptions/printers" - "k8s.io/client-go/util/integer" "k8s.io/client-go/util/jsonpath" + "k8s.io/utils/integer" "vbom.ml/util/sortorder" ) diff --git a/pkg/kubectl/rolling_updater.go b/pkg/kubectl/rolling_updater.go index b6df08c412..3cea7c82fe 100644 --- a/pkg/kubectl/rolling_updater.go +++ b/pkg/kubectl/rolling_updater.go @@ -33,11 +33,11 @@ import ( "k8s.io/apimachinery/pkg/util/wait" corev1client "k8s.io/client-go/kubernetes/typed/core/v1" scaleclient "k8s.io/client-go/scale" - "k8s.io/client-go/util/integer" "k8s.io/client-go/util/retry" "k8s.io/kubernetes/pkg/kubectl/util" deploymentutil "k8s.io/kubernetes/pkg/kubectl/util/deployment" "k8s.io/kubernetes/pkg/kubectl/util/podutils" + "k8s.io/utils/integer" ) func newInt32Ptr(val int) *int32 { diff --git a/pkg/kubectl/util/podutils/BUILD b/pkg/kubectl/util/podutils/BUILD index 51522abeca..ec4c53d899 100644 --- a/pkg/kubectl/util/podutils/BUILD +++ b/pkg/kubectl/util/podutils/BUILD @@ -8,7 +8,7 @@ go_library( deps = [ "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", ], ) diff --git a/pkg/kubectl/util/podutils/podutils.go b/pkg/kubectl/util/podutils/podutils.go index 2da66ef9c3..142b887965 100644 --- a/pkg/kubectl/util/podutils/podutils.go +++ b/pkg/kubectl/util/podutils/podutils.go @@ -21,7 +21,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/util/integer" + "k8s.io/utils/integer" ) // IsPodAvailable returns true if a pod is available; false otherwise. diff --git a/pkg/kubelet/BUILD b/pkg/kubelet/BUILD index 61e9e649ed..722309afa4 100644 --- a/pkg/kubelet/BUILD +++ b/pkg/kubelet/BUILD @@ -140,7 +140,6 @@ go_library( "//staging/src/k8s.io/client-go/tools/record:go_default_library", "//staging/src/k8s.io/client-go/util/certificate:go_default_library", "//staging/src/k8s.io/client-go/util/flowcontrol:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", "//staging/src/k8s.io/cloud-provider:go_default_library", "//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned:go_default_library", "//third_party/forked/golang/expansion:go_default_library", @@ -150,6 +149,7 @@ go_library( "//vendor/github.com/google/cadvisor/info/v2:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", ], ) diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 45ae42629f..1592b558f6 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -51,7 +51,6 @@ import ( "k8s.io/client-go/tools/record" "k8s.io/client-go/util/certificate" "k8s.io/client-go/util/flowcontrol" - "k8s.io/client-go/util/integer" cloudprovider "k8s.io/cloud-provider" csiclientset "k8s.io/csi-api/pkg/client/clientset/versioned" "k8s.io/klog" @@ -116,6 +115,7 @@ import ( "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/csi" utilexec "k8s.io/utils/exec" + "k8s.io/utils/integer" ) const ( diff --git a/staging/src/BUILD b/staging/src/BUILD index 36142dfc7e..3be0becf8a 100644 --- a/staging/src/BUILD +++ b/staging/src/BUILD @@ -184,7 +184,6 @@ filegroup( "//staging/src/k8s.io/client-go/util/exec:all-srcs", "//staging/src/k8s.io/client-go/util/flowcontrol:all-srcs", "//staging/src/k8s.io/client-go/util/homedir:all-srcs", - "//staging/src/k8s.io/client-go/util/integer:all-srcs", "//staging/src/k8s.io/client-go/util/jsonpath:all-srcs", "//staging/src/k8s.io/client-go/util/retry:all-srcs", "//staging/src/k8s.io/client-go/util/testing:all-srcs", diff --git a/staging/src/k8s.io/client-go/util/flowcontrol/BUILD b/staging/src/k8s.io/client-go/util/flowcontrol/BUILD index a67ac494f0..526e8db020 100644 --- a/staging/src/k8s.io/client-go/util/flowcontrol/BUILD +++ b/staging/src/k8s.io/client-go/util/flowcontrol/BUILD @@ -26,8 +26,8 @@ go_library( importpath = "k8s.io/client-go/util/flowcontrol", deps = [ "//staging/src/k8s.io/apimachinery/pkg/util/clock:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", "//vendor/golang.org/x/time/rate:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", ], ) diff --git a/staging/src/k8s.io/client-go/util/flowcontrol/backoff.go b/staging/src/k8s.io/client-go/util/flowcontrol/backoff.go index 71d442a62b..b7cb70ea74 100644 --- a/staging/src/k8s.io/client-go/util/flowcontrol/backoff.go +++ b/staging/src/k8s.io/client-go/util/flowcontrol/backoff.go @@ -21,7 +21,7 @@ import ( "time" "k8s.io/apimachinery/pkg/util/clock" - "k8s.io/client-go/util/integer" + "k8s.io/utils/integer" ) type backoffEntry struct { diff --git a/staging/src/k8s.io/client-go/util/integer/BUILD b/staging/src/k8s.io/client-go/util/integer/BUILD deleted file mode 100644 index 338cd1b819..0000000000 --- a/staging/src/k8s.io/client-go/util/integer/BUILD +++ /dev/null @@ -1,33 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_test( - name = "go_default_test", - srcs = ["integer_test.go"], - embed = [":go_default_library"], -) - -go_library( - name = "go_default_library", - srcs = ["integer.go"], - importmap = "k8s.io/kubernetes/vendor/k8s.io/client-go/util/integer", - importpath = "k8s.io/client-go/util/integer", -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/staging/src/k8s.io/client-go/util/integer/integer.go b/staging/src/k8s.io/client-go/util/integer/integer.go deleted file mode 100644 index c6ea106f9b..0000000000 --- a/staging/src/k8s.io/client-go/util/integer/integer.go +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright 2016 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 integer - -func IntMax(a, b int) int { - if b > a { - return b - } - return a -} - -func IntMin(a, b int) int { - if b < a { - return b - } - return a -} - -func Int32Max(a, b int32) int32 { - if b > a { - return b - } - return a -} - -func Int32Min(a, b int32) int32 { - if b < a { - return b - } - return a -} - -func Int64Max(a, b int64) int64 { - if b > a { - return b - } - return a -} - -func Int64Min(a, b int64) int64 { - if b < a { - return b - } - return a -} - -// RoundToInt32 rounds floats into integer numbers. -func RoundToInt32(a float64) int32 { - if a < 0 { - return int32(a - 0.5) - } - return int32(a + 0.5) -} diff --git a/staging/src/k8s.io/client-go/util/integer/integer_test.go b/staging/src/k8s.io/client-go/util/integer/integer_test.go deleted file mode 100644 index e9f586888c..0000000000 --- a/staging/src/k8s.io/client-go/util/integer/integer_test.go +++ /dev/null @@ -1,244 +0,0 @@ -/* -Copyright 2016 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 integer - -import "testing" - -func TestIntMax(t *testing.T) { - tests := []struct { - nums []int - expectedMax int - }{ - { - nums: []int{-1, 0}, - expectedMax: 0, - }, - { - nums: []int{-1, -2}, - expectedMax: -1, - }, - { - nums: []int{0, 1}, - expectedMax: 1, - }, - { - nums: []int{1, 2}, - expectedMax: 2, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if max := IntMax(test.nums[0], test.nums[1]); max != test.expectedMax { - t.Errorf("expected %v, got %v", test.expectedMax, max) - } - } -} - -func TestIntMin(t *testing.T) { - tests := []struct { - nums []int - expectedMin int - }{ - { - nums: []int{-1, 0}, - expectedMin: -1, - }, - { - nums: []int{-1, -2}, - expectedMin: -2, - }, - { - nums: []int{0, 1}, - expectedMin: 0, - }, - { - nums: []int{1, 2}, - expectedMin: 1, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if min := IntMin(test.nums[0], test.nums[1]); min != test.expectedMin { - t.Errorf("expected %v, got %v", test.expectedMin, min) - } - } -} - -func TestInt32Max(t *testing.T) { - tests := []struct { - nums []int32 - expectedMax int32 - }{ - { - nums: []int32{-1, 0}, - expectedMax: 0, - }, - { - nums: []int32{-1, -2}, - expectedMax: -1, - }, - { - nums: []int32{0, 1}, - expectedMax: 1, - }, - { - nums: []int32{1, 2}, - expectedMax: 2, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if max := Int32Max(test.nums[0], test.nums[1]); max != test.expectedMax { - t.Errorf("expected %v, got %v", test.expectedMax, max) - } - } -} - -func TestInt32Min(t *testing.T) { - tests := []struct { - nums []int32 - expectedMin int32 - }{ - { - nums: []int32{-1, 0}, - expectedMin: -1, - }, - { - nums: []int32{-1, -2}, - expectedMin: -2, - }, - { - nums: []int32{0, 1}, - expectedMin: 0, - }, - { - nums: []int32{1, 2}, - expectedMin: 1, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if min := Int32Min(test.nums[0], test.nums[1]); min != test.expectedMin { - t.Errorf("expected %v, got %v", test.expectedMin, min) - } - } -} - -func TestInt64Max(t *testing.T) { - tests := []struct { - nums []int64 - expectedMax int64 - }{ - { - nums: []int64{-1, 0}, - expectedMax: 0, - }, - { - nums: []int64{-1, -2}, - expectedMax: -1, - }, - { - nums: []int64{0, 1}, - expectedMax: 1, - }, - { - nums: []int64{1, 2}, - expectedMax: 2, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if max := Int64Max(test.nums[0], test.nums[1]); max != test.expectedMax { - t.Errorf("expected %v, got %v", test.expectedMax, max) - } - } -} - -func TestInt64Min(t *testing.T) { - tests := []struct { - nums []int64 - expectedMin int64 - }{ - { - nums: []int64{-1, 0}, - expectedMin: -1, - }, - { - nums: []int64{-1, -2}, - expectedMin: -2, - }, - { - nums: []int64{0, 1}, - expectedMin: 0, - }, - { - nums: []int64{1, 2}, - expectedMin: 1, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if min := Int64Min(test.nums[0], test.nums[1]); min != test.expectedMin { - t.Errorf("expected %v, got %v", test.expectedMin, min) - } - } -} - -func TestRoundToInt32(t *testing.T) { - tests := []struct { - num float64 - exp int32 - }{ - { - num: 5.5, - exp: 6, - }, - { - num: -3.7, - exp: -4, - }, - { - num: 3.49, - exp: 3, - }, - { - num: -7.9, - exp: -8, - }, - { - num: -4.499999, - exp: -4, - }, - { - num: 0, - exp: 0, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if got := RoundToInt32(test.num); got != test.exp { - t.Errorf("expected %d, got %d", test.exp, got) - } - } -} diff --git a/test/e2e/instrumentation/logging/utils/BUILD b/test/e2e/instrumentation/logging/utils/BUILD index 6d1c4dba0f..b8c5ab7771 100644 --- a/test/e2e/instrumentation/logging/utils/BUILD +++ b/test/e2e/instrumentation/logging/utils/BUILD @@ -24,9 +24,9 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library", - "//staging/src/k8s.io/client-go/util/integer:go_default_library", "//test/e2e/framework:go_default_library", "//test/utils/image:go_default_library", + "//vendor/k8s.io/utils/integer:go_default_library", ], ) diff --git a/test/e2e/instrumentation/logging/utils/logging_agent.go b/test/e2e/instrumentation/logging/utils/logging_agent.go index cf5a98c0ce..0673fed737 100644 --- a/test/e2e/instrumentation/logging/utils/logging_agent.go +++ b/test/e2e/instrumentation/logging/utils/logging_agent.go @@ -22,9 +22,9 @@ import ( api_v1 "k8s.io/api/core/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/util/integer" api "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/test/e2e/framework" + "k8s.io/utils/integer" ) // EnsureLoggingAgentDeployment checks that logging agent is present on each From 2358e75da3379720d2cc1d86384d4830a1557b88 Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Thu, 24 Jan 2019 11:37:48 -0500 Subject: [PATCH 5/7] replace client-go/util/buffer with k8s.io/utils/buffer --- staging/src/BUILD | 1 - .../src/k8s.io/client-go/tools/cache/BUILD | 2 +- .../client-go/tools/cache/shared_informer.go | 2 +- .../src/k8s.io/client-go/util/buffer/BUILD | 30 -------- .../client-go/util/buffer/ring_growing.go | 72 ------------------- .../util/buffer/ring_growing_test.go | 50 ------------- 6 files changed, 2 insertions(+), 155 deletions(-) delete mode 100644 staging/src/k8s.io/client-go/util/buffer/BUILD delete mode 100644 staging/src/k8s.io/client-go/util/buffer/ring_growing.go delete mode 100644 staging/src/k8s.io/client-go/util/buffer/ring_growing_test.go diff --git a/staging/src/BUILD b/staging/src/BUILD index 3be0becf8a..0de07354dd 100644 --- a/staging/src/BUILD +++ b/staging/src/BUILD @@ -177,7 +177,6 @@ filegroup( "//staging/src/k8s.io/client-go/tools/remotecommand:all-srcs", "//staging/src/k8s.io/client-go/tools/watch:all-srcs", "//staging/src/k8s.io/client-go/transport:all-srcs", - "//staging/src/k8s.io/client-go/util/buffer:all-srcs", "//staging/src/k8s.io/client-go/util/cert:all-srcs", "//staging/src/k8s.io/client-go/util/certificate:all-srcs", "//staging/src/k8s.io/client-go/util/connrotation:all-srcs", diff --git a/staging/src/k8s.io/client-go/tools/cache/BUILD b/staging/src/k8s.io/client-go/tools/cache/BUILD index 8b8b912585..8609439e55 100644 --- a/staging/src/k8s.io/client-go/tools/cache/BUILD +++ b/staging/src/k8s.io/client-go/tools/cache/BUILD @@ -81,9 +81,9 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library", "//staging/src/k8s.io/client-go/rest:go_default_library", "//staging/src/k8s.io/client-go/tools/pager:go_default_library", - "//staging/src/k8s.io/client-go/util/buffer:go_default_library", "//staging/src/k8s.io/client-go/util/retry:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/buffer:go_default_library", ], ) diff --git a/staging/src/k8s.io/client-go/tools/cache/shared_informer.go b/staging/src/k8s.io/client-go/tools/cache/shared_informer.go index e91fc9e955..b2f3dba07c 100644 --- a/staging/src/k8s.io/client-go/tools/cache/shared_informer.go +++ b/staging/src/k8s.io/client-go/tools/cache/shared_informer.go @@ -25,8 +25,8 @@ import ( "k8s.io/apimachinery/pkg/util/clock" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/client-go/util/buffer" "k8s.io/client-go/util/retry" + "k8s.io/utils/buffer" "k8s.io/klog" ) diff --git a/staging/src/k8s.io/client-go/util/buffer/BUILD b/staging/src/k8s.io/client-go/util/buffer/BUILD deleted file mode 100644 index d9496272c8..0000000000 --- a/staging/src/k8s.io/client-go/util/buffer/BUILD +++ /dev/null @@ -1,30 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "go_default_library", - srcs = ["ring_growing.go"], - importmap = "k8s.io/kubernetes/vendor/k8s.io/client-go/util/buffer", - importpath = "k8s.io/client-go/util/buffer", - visibility = ["//visibility:public"], -) - -go_test( - name = "go_default_test", - srcs = ["ring_growing_test.go"], - embed = [":go_default_library"], - deps = ["//vendor/github.com/stretchr/testify/assert:go_default_library"], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], - visibility = ["//visibility:public"], -) diff --git a/staging/src/k8s.io/client-go/util/buffer/ring_growing.go b/staging/src/k8s.io/client-go/util/buffer/ring_growing.go deleted file mode 100644 index 86965a5131..0000000000 --- a/staging/src/k8s.io/client-go/util/buffer/ring_growing.go +++ /dev/null @@ -1,72 +0,0 @@ -/* -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 buffer - -// RingGrowing is a growing ring buffer. -// Not thread safe. -type RingGrowing struct { - data []interface{} - n int // Size of Data - beg int // First available element - readable int // Number of data items available -} - -// NewRingGrowing constructs a new RingGrowing instance with provided parameters. -func NewRingGrowing(initialSize int) *RingGrowing { - return &RingGrowing{ - data: make([]interface{}, initialSize), - n: initialSize, - } -} - -// ReadOne reads (consumes) first item from the buffer if it is available, otherwise returns false. -func (r *RingGrowing) ReadOne() (data interface{}, ok bool) { - if r.readable == 0 { - return nil, false - } - r.readable-- - element := r.data[r.beg] - r.data[r.beg] = nil // Remove reference to the object to help GC - if r.beg == r.n-1 { - // Was the last element - r.beg = 0 - } else { - r.beg++ - } - return element, true -} - -// WriteOne adds an item to the end of the buffer, growing it if it is full. -func (r *RingGrowing) WriteOne(data interface{}) { - if r.readable == r.n { - // Time to grow - newN := r.n * 2 - newData := make([]interface{}, newN) - to := r.beg + r.readable - if to <= r.n { - copy(newData, r.data[r.beg:to]) - } else { - copied := copy(newData, r.data[r.beg:]) - copy(newData[copied:], r.data[:(to%r.n)]) - } - r.beg = 0 - r.data = newData - r.n = newN - } - r.data[(r.readable+r.beg)%r.n] = data - r.readable++ -} diff --git a/staging/src/k8s.io/client-go/util/buffer/ring_growing_test.go b/staging/src/k8s.io/client-go/util/buffer/ring_growing_test.go deleted file mode 100644 index 31a4c079d8..0000000000 --- a/staging/src/k8s.io/client-go/util/buffer/ring_growing_test.go +++ /dev/null @@ -1,50 +0,0 @@ -/* -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 buffer - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestGrowth(t *testing.T) { - t.Parallel() - x := 10 - g := NewRingGrowing(1) - for i := 0; i < x; i++ { - assert.Equal(t, i, g.readable) - g.WriteOne(i) - } - read := 0 - for g.readable > 0 { - v, ok := g.ReadOne() - assert.True(t, ok) - assert.Equal(t, read, v) - read++ - } - assert.Equalf(t, x, read, "expected to have read %d items: %d", x, read) - assert.Zerof(t, g.readable, "expected readable to be zero: %d", g.readable) - assert.Equalf(t, 16, g.n, "expected N to be 16: %d", g.n) -} - -func TestEmpty(t *testing.T) { - t.Parallel() - g := NewRingGrowing(1) - _, ok := g.ReadOne() - assert.False(t, ok) -} From 93b086f6eafc1e94214fc1d946a1917482751cf3 Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Thu, 24 Jan 2019 11:50:30 -0500 Subject: [PATCH 6/7] replace k8s.io/apiserver/pkg/util/trace with k8s.io/utils/trace --- hack/.golint_failures | 1 - pkg/scheduler/core/BUILD | 2 +- pkg/scheduler/core/generic_scheduler.go | 2 +- pkg/util/iptables/BUILD | 2 +- pkg/util/iptables/iptables.go | 2 +- staging/src/BUILD | 1 - .../apiserver/pkg/endpoints/handlers/BUILD | 4 +- .../pkg/endpoints/handlers/create.go | 2 +- .../pkg/endpoints/handlers/delete.go | 2 +- .../apiserver/pkg/endpoints/handlers/get.go | 2 +- .../apiserver/pkg/endpoints/handlers/patch.go | 2 +- .../apiserver/pkg/endpoints/handlers/rest.go | 2 +- .../pkg/endpoints/handlers/rest_test.go | 2 +- .../pkg/endpoints/handlers/update.go | 2 +- .../k8s.io/apiserver/pkg/storage/cacher/BUILD | 2 +- .../apiserver/pkg/storage/cacher/cacher.go | 2 +- .../pkg/storage/cacher/watch_cache.go | 2 +- .../k8s.io/apiserver/pkg/storage/etcd3/BUILD | 2 +- .../apiserver/pkg/storage/etcd3/store.go | 2 +- .../src/k8s.io/apiserver/pkg/util/trace/BUILD | 27 ------ .../k8s.io/apiserver/pkg/util/trace/trace.go | 89 ------------------- 21 files changed, 18 insertions(+), 136 deletions(-) delete mode 100644 staging/src/k8s.io/apiserver/pkg/util/trace/BUILD delete mode 100644 staging/src/k8s.io/apiserver/pkg/util/trace/trace.go diff --git a/hack/.golint_failures b/hack/.golint_failures index c7fcee78f1..c206feac73 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -583,7 +583,6 @@ staging/src/k8s.io/apiserver/pkg/storage/value staging/src/k8s.io/apiserver/pkg/util/feature staging/src/k8s.io/apiserver/pkg/util/flag staging/src/k8s.io/apiserver/pkg/util/proxy -staging/src/k8s.io/apiserver/pkg/util/trace staging/src/k8s.io/apiserver/pkg/util/webhook staging/src/k8s.io/apiserver/pkg/util/wsstream staging/src/k8s.io/apiserver/plugin/pkg/audit/log diff --git a/pkg/scheduler/core/BUILD b/pkg/scheduler/core/BUILD index a2ef61a73e..64b582126b 100644 --- a/pkg/scheduler/core/BUILD +++ b/pkg/scheduler/core/BUILD @@ -27,11 +27,11 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/util/trace:go_default_library", "//staging/src/k8s.io/client-go/listers/core/v1:go_default_library", "//staging/src/k8s.io/client-go/rest:go_default_library", "//staging/src/k8s.io/client-go/util/workqueue:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/trace:go_default_library", ], ) diff --git a/pkg/scheduler/core/generic_scheduler.go b/pkg/scheduler/core/generic_scheduler.go index f2086c7fac..59a4d40179 100644 --- a/pkg/scheduler/core/generic_scheduler.go +++ b/pkg/scheduler/core/generic_scheduler.go @@ -33,7 +33,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/errors" - utiltrace "k8s.io/apiserver/pkg/util/trace" corelisters "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/util/workqueue" "k8s.io/kubernetes/pkg/scheduler/algorithm" @@ -47,6 +46,7 @@ import ( pluginsv1alpha1 "k8s.io/kubernetes/pkg/scheduler/plugins/v1alpha1" "k8s.io/kubernetes/pkg/scheduler/util" "k8s.io/kubernetes/pkg/scheduler/volumebinder" + utiltrace "k8s.io/utils/trace" ) const ( diff --git a/pkg/util/iptables/BUILD b/pkg/util/iptables/BUILD index 9b289951f5..6e62709b6d 100644 --- a/pkg/util/iptables/BUILD +++ b/pkg/util/iptables/BUILD @@ -20,10 +20,10 @@ go_library( "//pkg/util/dbus:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/util/trace:go_default_library", "//vendor/github.com/godbus/dbus:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/trace:go_default_library", ] + select({ "@io_bazel_rules_go//go/platform:linux": [ "//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library", diff --git a/pkg/util/iptables/iptables.go b/pkg/util/iptables/iptables.go index c9f3d9860d..976f6d780d 100644 --- a/pkg/util/iptables/iptables.go +++ b/pkg/util/iptables/iptables.go @@ -28,10 +28,10 @@ import ( godbus "github.com/godbus/dbus" "k8s.io/apimachinery/pkg/util/sets" utilversion "k8s.io/apimachinery/pkg/util/version" - utiltrace "k8s.io/apiserver/pkg/util/trace" "k8s.io/klog" utildbus "k8s.io/kubernetes/pkg/util/dbus" utilexec "k8s.io/utils/exec" + utiltrace "k8s.io/utils/trace" ) type RulePosition string diff --git a/staging/src/BUILD b/staging/src/BUILD index 0de07354dd..8aba52e5c3 100644 --- a/staging/src/BUILD +++ b/staging/src/BUILD @@ -104,7 +104,6 @@ filegroup( "//staging/src/k8s.io/apiserver/pkg/util/globalflag:all-srcs", "//staging/src/k8s.io/apiserver/pkg/util/openapi:all-srcs", "//staging/src/k8s.io/apiserver/pkg/util/proxy:all-srcs", - "//staging/src/k8s.io/apiserver/pkg/util/trace:all-srcs", "//staging/src/k8s.io/apiserver/pkg/util/webhook:all-srcs", "//staging/src/k8s.io/apiserver/pkg/util/wsstream:all-srcs", "//staging/src/k8s.io/apiserver/plugin/pkg/audit:all-srcs", diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/BUILD b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/BUILD index 734fc9004b..009a8d4b2e 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/BUILD +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/BUILD @@ -31,8 +31,8 @@ go_test( "//staging/src/k8s.io/apiserver/pkg/apis/example/v1:go_default_library", "//staging/src/k8s.io/apiserver/pkg/endpoints/request:go_default_library", "//staging/src/k8s.io/apiserver/pkg/registry/rest:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/util/trace:go_default_library", "//vendor/github.com/evanphx/json-patch:go_default_library", + "//vendor/k8s.io/utils/trace:go_default_library", ], ) @@ -82,12 +82,12 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/server/httplog:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/dryrun:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/util/trace:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/wsstream:go_default_library", "//vendor/github.com/evanphx/json-patch:go_default_library", "//vendor/golang.org/x/net/websocket:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/kube-openapi/pkg/util/proto:go_default_library", + "//vendor/k8s.io/utils/trace:go_default_library", ], ) diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/create.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/create.go index 7774f849e1..4cb722664d 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/create.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/create.go @@ -37,7 +37,7 @@ import ( "k8s.io/apiserver/pkg/registry/rest" "k8s.io/apiserver/pkg/util/dryrun" utilfeature "k8s.io/apiserver/pkg/util/feature" - utiltrace "k8s.io/apiserver/pkg/util/trace" + utiltrace "k8s.io/utils/trace" ) func createHandler(r rest.NamedCreater, scope RequestScope, admit admission.Interface, includeName bool) http.HandlerFunc { diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go index e38e1c2972..1353ed8250 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go @@ -35,7 +35,7 @@ import ( "k8s.io/apiserver/pkg/registry/rest" "k8s.io/apiserver/pkg/util/dryrun" utilfeature "k8s.io/apiserver/pkg/util/feature" - utiltrace "k8s.io/apiserver/pkg/util/trace" + utiltrace "k8s.io/utils/trace" ) // DeleteResource returns a function that will handle a resource deletion diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/get.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/get.go index 1c0950b8d1..cfa8a6872b 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/get.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/get.go @@ -37,7 +37,7 @@ import ( "k8s.io/apiserver/pkg/endpoints/metrics" "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/registry/rest" - utiltrace "k8s.io/apiserver/pkg/util/trace" + utiltrace "k8s.io/utils/trace" ) // getterFunc performs a get request with the given context and object name. The request diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/patch.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/patch.go index 8ca8b47f85..384c276685 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/patch.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/patch.go @@ -44,7 +44,7 @@ import ( "k8s.io/apiserver/pkg/registry/rest" "k8s.io/apiserver/pkg/util/dryrun" utilfeature "k8s.io/apiserver/pkg/util/feature" - utiltrace "k8s.io/apiserver/pkg/util/trace" + utiltrace "k8s.io/utils/trace" ) // PatchResource returns a function that will handle a resource patch. diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest.go index 5d7abf229c..43b0919452 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest.go @@ -41,8 +41,8 @@ import ( "k8s.io/apiserver/pkg/endpoints/metrics" "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/registry/rest" - utiltrace "k8s.io/apiserver/pkg/util/trace" openapiproto "k8s.io/kube-openapi/pkg/util/proto" + utiltrace "k8s.io/utils/trace" ) // RequestScope encapsulates common fields across all RESTful handler methods. diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest_test.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest_test.go index 4938e94c30..d410bc461f 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest_test.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest_test.go @@ -43,7 +43,7 @@ import ( examplev1 "k8s.io/apiserver/pkg/apis/example/v1" "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/registry/rest" - utiltrace "k8s.io/apiserver/pkg/util/trace" + utiltrace "k8s.io/utils/trace" ) var ( diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/update.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/update.go index ad2fc6ef19..9080b9b42b 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/update.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/update.go @@ -38,7 +38,7 @@ import ( "k8s.io/apiserver/pkg/registry/rest" "k8s.io/apiserver/pkg/util/dryrun" utilfeature "k8s.io/apiserver/pkg/util/feature" - utiltrace "k8s.io/apiserver/pkg/util/trace" + utiltrace "k8s.io/utils/trace" ) // UpdateResource returns a function that will handle a resource update diff --git a/staging/src/k8s.io/apiserver/pkg/storage/cacher/BUILD b/staging/src/k8s.io/apiserver/pkg/storage/cacher/BUILD index af3a14a8fb..cdffbdf0b1 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/cacher/BUILD +++ b/staging/src/k8s.io/apiserver/pkg/storage/cacher/BUILD @@ -26,9 +26,9 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/features:go_default_library", "//staging/src/k8s.io/apiserver/pkg/storage:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/util/trace:go_default_library", "//staging/src/k8s.io/client-go/tools/cache:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/trace:go_default_library", ], ) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go b/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go index e3515148c3..34cf190175 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go @@ -39,8 +39,8 @@ import ( "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/storage" utilfeature "k8s.io/apiserver/pkg/util/feature" - utiltrace "k8s.io/apiserver/pkg/util/trace" "k8s.io/client-go/tools/cache" + utiltrace "k8s.io/utils/trace" ) // Config contains the configuration for a given Cache. diff --git a/staging/src/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go b/staging/src/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go index 527b81dda2..c3ac70a666 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go @@ -29,8 +29,8 @@ import ( "k8s.io/apimachinery/pkg/util/clock" "k8s.io/apimachinery/pkg/watch" "k8s.io/apiserver/pkg/storage" - utiltrace "k8s.io/apiserver/pkg/util/trace" "k8s.io/client-go/tools/cache" + utiltrace "k8s.io/utils/trace" ) const ( diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/BUILD b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/BUILD index 9ca061e8ca..2d064bac40 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/BUILD +++ b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/BUILD @@ -63,11 +63,11 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/storage:go_default_library", "//staging/src/k8s.io/apiserver/pkg/storage/etcd:go_default_library", "//staging/src/k8s.io/apiserver/pkg/storage/value:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/util/trace:go_default_library", "//vendor/github.com/coreos/etcd/clientv3:go_default_library", "//vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes:go_default_library", "//vendor/github.com/coreos/etcd/mvcc/mvccpb:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/trace:go_default_library", ], ) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go index 129b593f53..2413a6674a 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go @@ -39,7 +39,7 @@ import ( "k8s.io/apiserver/pkg/storage" "k8s.io/apiserver/pkg/storage/etcd" "k8s.io/apiserver/pkg/storage/value" - utiltrace "k8s.io/apiserver/pkg/util/trace" + utiltrace "k8s.io/utils/trace" ) // authenticatedDataString satisfies the value.Context interface. It uses the key to diff --git a/staging/src/k8s.io/apiserver/pkg/util/trace/BUILD b/staging/src/k8s.io/apiserver/pkg/util/trace/BUILD deleted file mode 100644 index 4e93ff5b49..0000000000 --- a/staging/src/k8s.io/apiserver/pkg/util/trace/BUILD +++ /dev/null @@ -1,27 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = ["trace.go"], - importmap = "k8s.io/kubernetes/vendor/k8s.io/apiserver/pkg/util/trace", - importpath = "k8s.io/apiserver/pkg/util/trace", - deps = ["//vendor/k8s.io/klog:go_default_library"], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/staging/src/k8s.io/apiserver/pkg/util/trace/trace.go b/staging/src/k8s.io/apiserver/pkg/util/trace/trace.go deleted file mode 100644 index 9049a17d0d..0000000000 --- a/staging/src/k8s.io/apiserver/pkg/util/trace/trace.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2015 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 trace - -import ( - "bytes" - "fmt" - "math/rand" - "time" - - "k8s.io/klog" -) - -type traceStep struct { - stepTime time.Time - msg string -} - -type Trace struct { - name string - startTime time.Time - steps []traceStep -} - -func New(name string) *Trace { - return &Trace{name, time.Now(), nil} -} - -func (t *Trace) Step(msg string) { - if t.steps == nil { - // traces almost always have less than 6 steps, do this to avoid more than a single allocation - t.steps = make([]traceStep, 0, 6) - } - t.steps = append(t.steps, traceStep{time.Now(), msg}) -} - -func (t *Trace) Log() { - // an explicit logging request should dump all the steps out at the higher level - t.logWithStepThreshold(0) -} - -func (t *Trace) logWithStepThreshold(stepThreshold time.Duration) { - var buffer bytes.Buffer - tracenum := rand.Int31() - endTime := time.Now() - - totalTime := endTime.Sub(t.startTime) - buffer.WriteString(fmt.Sprintf("Trace[%d]: %q (started: %v) (total time: %v):\n", tracenum, t.name, t.startTime, totalTime)) - lastStepTime := t.startTime - for _, step := range t.steps { - stepDuration := step.stepTime.Sub(lastStepTime) - if stepThreshold == 0 || stepDuration > stepThreshold || klog.V(4) { - buffer.WriteString(fmt.Sprintf("Trace[%d]: [%v] [%v] %v\n", tracenum, step.stepTime.Sub(t.startTime), stepDuration, step.msg)) - } - lastStepTime = step.stepTime - } - stepDuration := endTime.Sub(lastStepTime) - if stepThreshold == 0 || stepDuration > stepThreshold || klog.V(4) { - buffer.WriteString(fmt.Sprintf("Trace[%d]: [%v] [%v] END\n", tracenum, endTime.Sub(t.startTime), stepDuration)) - } - - klog.Info(buffer.String()) -} - -func (t *Trace) LogIfLong(threshold time.Duration) { - if time.Since(t.startTime) >= threshold { - // if any step took more than it's share of the total allowed time, it deserves a higher log level - stepThreshold := threshold / time.Duration(len(t.steps)+1) - t.logWithStepThreshold(stepThreshold) - } -} - -func (t *Trace) TotalTime() time.Duration { - return time.Since(t.startTime) -} From aab0ea4e4144613c545462dfaa2e2ac76551691d Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Thu, 24 Jan 2019 14:49:59 -0500 Subject: [PATCH 7/7] allow k8s.io/utils in client-go import restrictions --- hack/import-restrictions.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hack/import-restrictions.yaml b/hack/import-restrictions.yaml index 76354c8c6e..bfcd70fefa 100644 --- a/hack/import-restrictions.yaml +++ b/hack/import-restrictions.yaml @@ -62,6 +62,7 @@ - k8s.io/apimachinery - k8s.io/client-go - k8s.io/klog + - k8s.io/utils # prevent core machinery from taking explicit v1 references unless # necessary @@ -84,6 +85,7 @@ - k8s.io/apimachinery - k8s.io/client-go - k8s.io/klog + - k8s.io/utils - baseImportPath: "./vendor/k8s.io/apiserver/" allowedImports: