pax_global_header00006660000000000000000000000064145363677300014530gustar00rootroot0000000000000052 comment=49f90792cedf4ae99fb83f9ed37401a5a52e39f6 metrics-0.29.0/000077500000000000000000000000001453636773000132665ustar00rootroot00000000000000metrics-0.29.0/.github/000077500000000000000000000000001453636773000146265ustar00rootroot00000000000000metrics-0.29.0/.github/PULL_REQUEST_TEMPLATE.md000066400000000000000000000002251453636773000204260ustar00rootroot00000000000000Sorry, we do not accept changes directly against this repository. Please see CONTRIBUTING.md for information on where and how to contribute instead. metrics-0.29.0/CONTRIBUTING.md000066400000000000000000000013401453636773000155150ustar00rootroot00000000000000# Contributing guidelines Do not open pull requests directly against this repository, they will be ignored. Instead, please open pull requests against [kubernetes/kubernetes](https://git.k8s.io/kubernetes/). Please follow the same [contributing guide](https://git.k8s.io/kubernetes/CONTRIBUTING.md) you would follow for any other pull request made to kubernetes/kubernetes. This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/metrics](https://git.k8s.io/kubernetes/staging/src/k8s.io/metrics) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot). Please see [Staging Directory and Publishing](https://git.k8s.io/community/contributors/devel/sig-architecture/staging.md) for more information metrics-0.29.0/LICENSE000066400000000000000000000261351453636773000143020ustar00rootroot00000000000000 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. metrics-0.29.0/OWNERS000066400000000000000000000002001453636773000142160ustar00rootroot00000000000000# See the OWNERS docs at https://go.k8s.io/owners approvers: - sig-instrumentation-approvers labels: - sig/instrumentation metrics-0.29.0/README.md000066400000000000000000000043171453636773000145520ustar00rootroot00000000000000# metrics Kubernetes metrics API type definitions and clients. ## Purpose This repository contains type definitions and client code for the metrics APIs that Kubernetes makes use of. Depending on the API, the actual implementations live elsewhere. Consumers of the metrics APIs can make use of this repository to access implementations of the APIs, while implementors should make use of this library when implementing their API servers. ## APIs This repository contains types and clients for several APIs. ### Custom Metrics API This API allows consumers to access arbitrary metrics which describe Kubernetes resources. The API is intended to be implemented by monitoring pipeline vendors, on top of their metrics storage solutions. If you want to implement this as an API server for this API, please see the [kubernetes-sigs/custom-metrics-apiserver](https://github.com/kubernetes-sigs/custom-metrics-apiserver) library, which contains the basic infrastructure required to set up such an API server. Import Path: `k8s.io/metrics/pkg/apis/custom_metrics`. ### Resource Metrics API This API allows consumers to access resource metrics (CPU and memory) for pods and nodes. The API is implemented by [metrics-server](https://github.com/kubernetes-sigs/metrics-server) and [prometheus-adapter](https://github.com/kubernetes-sigs/prometheus-adapter). Import Path: `k8s.io/metrics/pkg/apis/metrics`. ## Compatibility The APIs in this repository follow the standard guarantees for Kubernetes APIs, and will follow Kubernetes releases. ## Community, discussion, contribution, and support Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/). You can reach the maintainers of this repository at: - Slack: [#sig-instrumentation channel](https://kubernetes.slack.com/messages/sig-instrumentation), you can get an invite at [slack.kubernetes.io](https://slack.kubernetes.io). - [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-instrumentation) ### Code of Conduct Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md). ### Contibution Guidelines See [CONTRIBUTING.md](CONTRIBUTING.md) for more information. metrics-0.29.0/SECURITY_CONTACTS000066400000000000000000000010631453636773000157560ustar00rootroot00000000000000# Defined below are the security contacts for this repo. # # They are the contact point for the Product Security Committee to reach out # to for triaging and handling of incoming issues. # # The below names agree to abide by the # [Embargo Policy](https://git.k8s.io/security/private-distributors-list.md#embargo-policy) # and will be removed and replaced if they violate that agreement. # # DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE # INSTRUCTIONS AT https://kubernetes.io/security/ cjcullen joelsmith liggitt philips tallclair metrics-0.29.0/code-of-conduct.md000066400000000000000000000002241453636773000165570ustar00rootroot00000000000000# Kubernetes Community Code of Conduct Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md) metrics-0.29.0/doc.go000066400000000000000000000011461453636773000143640ustar00rootroot00000000000000/* Copyright 2021 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 metrics // import "k8s.io/metrics" metrics-0.29.0/go.mod000066400000000000000000000046551453636773000144060ustar00rootroot00000000000000// This is a generated file. Do not edit directly. module k8s.io/metrics go 1.21 require ( github.com/gogo/protobuf v1.3.2 github.com/stretchr/testify v1.8.4 k8s.io/api v0.29.0 k8s.io/apimachinery v0.29.0 k8s.io/client-go v0.29.0 k8s.io/code-generator v0.29.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch v4.12.0+incompatible // indirect github.com/go-logr/logr v1.3.0 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.22.3 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/pflag v1.0.5 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.10.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.12.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect k8s.io/klog/v2 v2.110.1 // indirect k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) replace ( k8s.io/api => k8s.io/api v0.29.0 k8s.io/apimachinery => k8s.io/apimachinery v0.29.0 k8s.io/client-go => k8s.io/client-go v0.29.0 k8s.io/code-generator => k8s.io/code-generator v0.29.0 ) metrics-0.29.0/go.sum000066400000000000000000000362501453636773000144270ustar00rootroot00000000000000github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A= k8s.io/api v0.29.0/go.mod h1:sdVmXoz2Bo/cb77Pxi71IPTSErEW32xa4aXwKH7gfBA= k8s.io/apimachinery v0.29.0 h1:+ACVktwyicPz0oc6MTMLwa2Pw3ouLAfAon1wPLtG48o= k8s.io/apimachinery v0.29.0/go.mod h1:eVBxQ/cwiJxH58eK/jd/vAk4mrxmVlnpBH5J2GbMeis= k8s.io/client-go v0.29.0 h1:KmlDtFcrdUzOYrBhXHgKw5ycWzc3ryPX5mQe0SkG3y8= k8s.io/client-go v0.29.0/go.mod h1:yLkXH4HKMAywcrD82KMSmfYg2DlE8mepPR4JGSo5n38= k8s.io/code-generator v0.29.0 h1:2LQfayGDhaIlaamXjIjEQlCMy4JNCH9lrzas4DNW1GQ= k8s.io/code-generator v0.29.0/go.mod h1:5bqIZoCxs2zTRKMWNYqyQWW/bajc+ah4rh0tMY8zdGA= k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 h1:pWEwq4Asjm4vjW7vcsmijwBhOr1/shsbSYiWXmNGlks= k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= metrics-0.29.0/hack/000077500000000000000000000000001453636773000141745ustar00rootroot00000000000000metrics-0.29.0/hack/boilerplate.go.txt000066400000000000000000000010661453636773000176460ustar00rootroot00000000000000/* Copyright 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. */ metrics-0.29.0/hack/tools.go000066400000000000000000000013651453636773000156700ustar00rootroot00000000000000//go:build tools // +build tools /* Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // This package imports things required by build scripts, to force `go mod` to see them as dependencies package tools import _ "k8s.io/code-generator" metrics-0.29.0/hack/update-codegen.sh000077500000000000000000000034331453636773000174220ustar00rootroot00000000000000#!/usr/bin/env bash # 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. set -o errexit set -o nounset set -o pipefail SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} source "${CODEGEN_PKG}/kube_codegen.sh" # generate the code with: # --output-base because this script should also be able to run inside the vendor dir of # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir # instead of the $GOPATH directly. For normal projects this can be dropped. # # we skip informers and listers for metrics, because we don't quite support the requisite operations yet # we skip generating the internal clientset as it's not really needed kube::codegen::gen_helpers \ --input-pkg-root k8s.io/metrics/pkg/apis \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" kube::codegen::gen_client \ --input-pkg-root k8s.io/metrics/pkg/apis \ --output-pkg-root k8s.io/metrics/pkg/client \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" metrics-0.29.0/hack/verify-codegen.sh000077500000000000000000000023641453636773000174460ustar00rootroot00000000000000#!/usr/bin/env bash # 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. set -o errexit set -o nounset set -o pipefail SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" DIFFROOT="${SCRIPT_ROOT}/pkg" TMP_DIFFROOT="$(mktemp -d -t "$(basename "$0").XXXXXX")/pkg" cleanup() { rm -rf "${TMP_DIFFROOT}" } trap "cleanup" EXIT SIGINT cleanup mkdir -p "${TMP_DIFFROOT}" cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}" "${SCRIPT_ROOT}/hack/update-codegen.sh" echo "diffing ${DIFFROOT} against freshly generated codegen" ret=0 diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$? if [[ $ret -eq 0 ]]; then echo "${DIFFROOT} up to date." else echo "${DIFFROOT} is out of date. Please run hack/update-codegen.sh" exit 1 fi metrics-0.29.0/pkg/000077500000000000000000000000001453636773000140475ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/000077500000000000000000000000001453636773000150035ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/OWNERS000066400000000000000000000003771453636773000157520ustar00rootroot00000000000000# See the OWNERS docs at https://go.k8s.io/owners # Disable inheritance as this is an api owners file options: no_parent_owners: true approvers: - api-approvers reviewers: - api-reviewers - sig-autoscaling-maintainers labels: - kind/api-change metrics-0.29.0/pkg/apis/custom_metrics/000077500000000000000000000000001453636773000200435ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/custom_metrics/conversion.go000066400000000000000000000025221453636773000225600ustar00rootroot00000000000000/* Copyright 2020 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 custom_metrics import ( "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/conversion" ) func Convert_v1_ObjectReference_To_custom_metrics_ObjectReference(in *v1.ObjectReference, out *ObjectReference, s conversion.Scope) error { out.APIVersion = in.APIVersion out.Kind = in.Kind out.Namespace = in.Namespace out.Name = in.Name out.UID = in.UID out.ResourceVersion = in.ResourceVersion out.FieldPath = in.FieldPath return nil } func Convert_custom_metrics_ObjectReference_To_v1_ObjectReference(in *ObjectReference, out *v1.ObjectReference, s conversion.Scope) error { out.APIVersion = in.APIVersion out.Kind = in.Kind out.Namespace = in.Namespace out.Name = in.Name out.UID = in.UID out.ResourceVersion = in.ResourceVersion out.FieldPath = in.FieldPath return nil } metrics-0.29.0/pkg/apis/custom_metrics/doc.go000066400000000000000000000014121453636773000211350ustar00rootroot00000000000000/* 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. */ // +k8s:deepcopy-gen=package // +groupName=custom.metrics.k8s.io // Package custom_metrics defines an API for using custom metrics. package custom_metrics // import "k8s.io/metrics/pkg/apis/custom_metrics" metrics-0.29.0/pkg/apis/custom_metrics/install/000077500000000000000000000000001453636773000215115ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/custom_metrics/install/install.go000066400000000000000000000024501453636773000235070ustar00rootroot00000000000000/* 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 install installs the experimental API group, making it available as // an option to all of the API encoding/decoding machinery. package install import ( "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/metrics/pkg/apis/custom_metrics" "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1" "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2" ) // Install registers the API group and adds types to a scheme func Install(scheme *runtime.Scheme) { utilruntime.Must(custom_metrics.AddToScheme(scheme)) utilruntime.Must(v1beta2.AddToScheme(scheme)) utilruntime.Must(v1beta1.AddToScheme(scheme)) utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion, v1beta2.SchemeGroupVersion)) } metrics-0.29.0/pkg/apis/custom_metrics/register.go000066400000000000000000000031301453636773000222130ustar00rootroot00000000000000/* 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 custom_metrics import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName is the group name use in this package const GroupName = "custom.metrics.k8s.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} // Kind takes an unqualified kind and returns back a Group qualified GroupKind func Kind(kind string) schema.GroupKind { return SchemeGroupVersion.WithKind(kind).GroupKind() } // Resource takes an unqualified resource and returns back a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) AddToScheme = SchemeBuilder.AddToScheme ) func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &MetricValue{}, &MetricValueList{}, &MetricListOptions{}, ) return nil } metrics-0.29.0/pkg/apis/custom_metrics/types.go000066400000000000000000000063661453636773000215510ustar00rootroot00000000000000/* 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 custom_metrics import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ) type MetricIdentifier struct { // name is the name of the given metric Name string // selector represents the label selector that could be used to select // this metric, and will generally just be the selector passed in to // the query used to fetch this metric. // +optional Selector *metav1.LabelSelector } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // a list of values for a given metric for some set of objects type MetricValueList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` // the value of the metric across the described objects Items []MetricValue `json:"items"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // a metric value for some object type MetricValue struct { metav1.TypeMeta // a reference to the described object DescribedObject ObjectReference Metric MetricIdentifier // indicates the time at which the metrics were produced Timestamp metav1.Time // indicates the window ([Timestamp-Window, Timestamp]) from // which these metrics were calculated, when returning rate // metrics calculated from cumulative metrics (or zero for // non-calculated instantaneous metrics). WindowSeconds *int64 // the value of the metric for this Value resource.Quantity } // allObjects is a wildcard used to select metrics // for all objects matching the given label selector const AllObjects = "*" // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // MetricListOptions is used to select metrics by their label selectors type MetricListOptions struct { metav1.TypeMeta // A selector to restrict the list of returned objects by their labels. // Defaults to everything. // +optional LabelSelector string // A selector to restrict the list of returned metrics by their labels // +optional MetricLabelSelector string } // NOTE: ObjectReference is copied from k8s.io/kubernetes/pkg/api/types.go. We // cannot depend on k8s.io/kubernetes/pkg/api because that creates cyclic // dependency between k8s.io/metrics and k8s.io/kubernetes. We cannot depend on // k8s.io/client-go/pkg/api because the package is going to be deprecated soon. // There is no need to keep it an exact copy. Each repo can define its own // internal objects. // ObjectReference contains enough information to let you inspect or modify the referred object. type ObjectReference struct { Kind string Namespace string Name string UID types.UID APIVersion string ResourceVersion string FieldPath string } metrics-0.29.0/pkg/apis/custom_metrics/v1beta1/000077500000000000000000000000001453636773000213065ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/custom_metrics/v1beta1/conversion.go000066400000000000000000000025151453636773000240250ustar00rootroot00000000000000/* 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 v1beta1 import ( "k8s.io/apimachinery/pkg/conversion" "k8s.io/metrics/pkg/apis/custom_metrics" ) func Convert_v1beta1_MetricValue_To_custom_metrics_MetricValue(in *MetricValue, out *custom_metrics.MetricValue, s conversion.Scope) error { if err := autoConvert_v1beta1_MetricValue_To_custom_metrics_MetricValue(in, out, s); err != nil { return err } out.Metric.Name = in.MetricName out.Metric.Selector = in.Selector return nil } func Convert_custom_metrics_MetricValue_To_v1beta1_MetricValue(in *custom_metrics.MetricValue, out *MetricValue, s conversion.Scope) error { if err := autoConvert_custom_metrics_MetricValue_To_v1beta1_MetricValue(in, out, s); err != nil { return err } out.MetricName = in.Metric.Name out.Selector = in.Metric.Selector return nil } metrics-0.29.0/pkg/apis/custom_metrics/v1beta1/doc.go000066400000000000000000000015351453636773000224060ustar00rootroot00000000000000/* 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. */ // +k8s:deepcopy-gen=package // +k8s:protobuf-gen=package // +k8s:conversion-gen=k8s.io/metrics/pkg/apis/custom_metrics // +k8s:openapi-gen=true // Package v1beta1 is the v1beta1 version of the custom_metrics API. package v1beta1 // import "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1" metrics-0.29.0/pkg/apis/custom_metrics/v1beta1/generated.pb.go000066400000000000000000000644561453636773000242120ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1/generated.proto package v1beta1 import ( fmt "fmt" io "io" proto "github.com/gogo/protobuf/proto" v11 "k8s.io/apimachinery/pkg/apis/meta/v1" math "math" math_bits "math/bits" reflect "reflect" strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package func (m *MetricListOptions) Reset() { *m = MetricListOptions{} } func (*MetricListOptions) ProtoMessage() {} func (*MetricListOptions) Descriptor() ([]byte, []int) { return fileDescriptor_eb308345182a1e5e, []int{0} } func (m *MetricListOptions) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *MetricListOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *MetricListOptions) XXX_Merge(src proto.Message) { xxx_messageInfo_MetricListOptions.Merge(m, src) } func (m *MetricListOptions) XXX_Size() int { return m.Size() } func (m *MetricListOptions) XXX_DiscardUnknown() { xxx_messageInfo_MetricListOptions.DiscardUnknown(m) } var xxx_messageInfo_MetricListOptions proto.InternalMessageInfo func (m *MetricValue) Reset() { *m = MetricValue{} } func (*MetricValue) ProtoMessage() {} func (*MetricValue) Descriptor() ([]byte, []int) { return fileDescriptor_eb308345182a1e5e, []int{1} } func (m *MetricValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *MetricValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *MetricValue) XXX_Merge(src proto.Message) { xxx_messageInfo_MetricValue.Merge(m, src) } func (m *MetricValue) XXX_Size() int { return m.Size() } func (m *MetricValue) XXX_DiscardUnknown() { xxx_messageInfo_MetricValue.DiscardUnknown(m) } var xxx_messageInfo_MetricValue proto.InternalMessageInfo func (m *MetricValueList) Reset() { *m = MetricValueList{} } func (*MetricValueList) ProtoMessage() {} func (*MetricValueList) Descriptor() ([]byte, []int) { return fileDescriptor_eb308345182a1e5e, []int{2} } func (m *MetricValueList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *MetricValueList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *MetricValueList) XXX_Merge(src proto.Message) { xxx_messageInfo_MetricValueList.Merge(m, src) } func (m *MetricValueList) XXX_Size() int { return m.Size() } func (m *MetricValueList) XXX_DiscardUnknown() { xxx_messageInfo_MetricValueList.DiscardUnknown(m) } var xxx_messageInfo_MetricValueList proto.InternalMessageInfo func init() { proto.RegisterType((*MetricListOptions)(nil), "k8s.io.metrics.pkg.apis.custom_metrics.v1beta1.MetricListOptions") proto.RegisterType((*MetricValue)(nil), "k8s.io.metrics.pkg.apis.custom_metrics.v1beta1.MetricValue") proto.RegisterType((*MetricValueList)(nil), "k8s.io.metrics.pkg.apis.custom_metrics.v1beta1.MetricValueList") } func init() { proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1/generated.proto", fileDescriptor_eb308345182a1e5e) } var fileDescriptor_eb308345182a1e5e = []byte{ // 617 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xdd, 0x4e, 0xd4, 0x4e, 0x18, 0xc6, 0xb7, 0xec, 0x7f, 0xc9, 0x32, 0xfc, 0x09, 0x52, 0x62, 0xdc, 0x60, 0x52, 0xc8, 0x7a, 0x82, 0x26, 0xce, 0x04, 0x34, 0xc6, 0x84, 0xb3, 0xc6, 0x13, 0x13, 0x56, 0x62, 0x21, 0x92, 0xf8, 0x11, 0x9d, 0x4e, 0x5f, 0xca, 0xb8, 0xdb, 0x4e, 0x33, 0x33, 0x5d, 0xc2, 0x99, 0x97, 0xe0, 0x1d, 0x78, 0x3b, 0x1c, 0xe2, 0x19, 0x47, 0x44, 0x6a, 0xbc, 0x0f, 0xd3, 0xe9, 0x74, 0x3f, 0x00, 0x15, 0xce, 0xda, 0x99, 0xf7, 0xf9, 0xcd, 0x33, 0xef, 0xf3, 0x66, 0xd0, 0x7e, 0xff, 0xb9, 0xc2, 0x5c, 0x90, 0x7e, 0x1e, 0x82, 0x4c, 0x41, 0x83, 0x22, 0x43, 0x48, 0x23, 0x21, 0x89, 0xdd, 0x48, 0x40, 0x4b, 0xce, 0x14, 0xc9, 0xfa, 0x31, 0xa1, 0x19, 0x57, 0x84, 0xe5, 0x4a, 0x8b, 0xe4, 0x63, 0xbd, 0x3e, 0xdc, 0x08, 0x41, 0xd3, 0x0d, 0x12, 0x43, 0x0a, 0x92, 0x6a, 0x88, 0x70, 0x26, 0x85, 0x16, 0x2e, 0xae, 0xf4, 0xd8, 0xd6, 0xe1, 0xac, 0x1f, 0xe3, 0x52, 0x8f, 0xa7, 0xf5, 0xd8, 0xea, 0x57, 0x1e, 0xc7, 0x5c, 0x1f, 0xe6, 0x21, 0x66, 0x22, 0x21, 0xb1, 0x88, 0x05, 0x31, 0x98, 0x30, 0x3f, 0x30, 0x7f, 0xe6, 0xc7, 0x7c, 0x55, 0xf8, 0x95, 0xae, 0xb5, 0x47, 0x33, 0x4e, 0x98, 0x90, 0x40, 0x86, 0x57, 0x2c, 0xac, 0x3c, 0x1d, 0xd7, 0x24, 0x94, 0x1d, 0xf2, 0x14, 0xe4, 0x71, 0x7d, 0x0f, 0x22, 0x41, 0x89, 0x5c, 0x32, 0xb8, 0x95, 0x4a, 0x95, 0xed, 0xa0, 0xd7, 0x9d, 0x45, 0xfe, 0xa4, 0x92, 0x79, 0xaa, 0x79, 0x72, 0xf5, 0x98, 0x67, 0xff, 0x12, 0x28, 0x76, 0x08, 0x09, 0xbd, 0xac, 0xeb, 0x7e, 0x73, 0xd0, 0x52, 0xcf, 0xf4, 0x6e, 0x9b, 0x2b, 0xbd, 0x93, 0x69, 0x2e, 0x52, 0xe5, 0x6e, 0xa1, 0x85, 0x01, 0x0d, 0x61, 0xb0, 0x0b, 0x03, 0x60, 0x5a, 0xc8, 0x8e, 0xb3, 0xe6, 0xac, 0xcf, 0xf9, 0x77, 0x4f, 0xce, 0x57, 0x1b, 0xc5, 0xf9, 0xea, 0xc2, 0xf6, 0xe4, 0x66, 0x30, 0x5d, 0xeb, 0xf6, 0xd0, 0x72, 0x95, 0xc6, 0x54, 0x55, 0x67, 0xc6, 0x20, 0xee, 0x5b, 0xc4, 0x72, 0xef, 0x6a, 0x49, 0x70, 0x9d, 0xae, 0xfb, 0xab, 0x89, 0xe6, 0xab, 0xe2, 0x37, 0x74, 0x90, 0x83, 0x7b, 0x80, 0x16, 0x23, 0x50, 0x4c, 0xf2, 0x10, 0xa2, 0x9d, 0xf0, 0x33, 0x30, 0x6d, 0xdc, 0xcd, 0x6f, 0x3e, 0xa8, 0x67, 0x84, 0x66, 0x1c, 0x97, 0x21, 0xe2, 0xe1, 0x06, 0xae, 0x2a, 0x02, 0x38, 0x00, 0x09, 0x29, 0x03, 0xff, 0x9e, 0x3d, 0x7f, 0xf1, 0xc5, 0x34, 0x23, 0xb8, 0x0c, 0x75, 0x37, 0x11, 0xaa, 0xec, 0xbc, 0xa2, 0x09, 0x58, 0xf7, 0xae, 0x55, 0xa3, 0xde, 0x68, 0x27, 0x98, 0xa8, 0x72, 0xdf, 0xa1, 0xb9, 0xb2, 0xd9, 0x4a, 0xd3, 0x24, 0xeb, 0x34, 0x8d, 0xab, 0x47, 0x13, 0xae, 0x46, 0xc9, 0x8c, 0xc7, 0xb7, 0x1c, 0x80, 0xd2, 0xe7, 0x1e, 0x4f, 0xc0, 0x5f, 0xb2, 0xf8, 0xb9, 0xbd, 0x1a, 0x12, 0x8c, 0x79, 0xee, 0x43, 0x34, 0x7b, 0xc4, 0xd3, 0x48, 0x1c, 0x75, 0xfe, 0x5b, 0x73, 0xd6, 0x9b, 0xfe, 0x52, 0x99, 0xc4, 0xbe, 0x59, 0xd9, 0x05, 0x26, 0xd2, 0x48, 0x05, 0xb6, 0xc0, 0xdd, 0x45, 0xad, 0x61, 0xd9, 0xac, 0x4e, 0xcb, 0x78, 0xc0, 0x7f, 0xf3, 0x80, 0xeb, 0xd1, 0xc5, 0xaf, 0x73, 0x9a, 0x6a, 0xae, 0x8f, 0xfd, 0x05, 0xeb, 0xa3, 0x65, 0x3a, 0x1e, 0x54, 0x2c, 0xf7, 0x03, 0x6a, 0xab, 0x3a, 0xcc, 0x59, 0xc3, 0x7d, 0x72, 0xb3, 0xbb, 0x4d, 0xe5, 0xe9, 0xff, 0x5f, 0x9c, 0xaf, 0xb6, 0x47, 0x91, 0x8f, 0x90, 0xdd, 0xef, 0x0e, 0x5a, 0x9c, 0xc8, 0xb9, 0x1c, 0x47, 0xf7, 0x3d, 0x6a, 0x97, 0x90, 0x88, 0x6a, 0x6a, 0x43, 0xc6, 0x37, 0x3c, 0x92, 0x2b, 0xdd, 0x03, 0x4d, 0xfd, 0x3b, 0xf6, 0x2a, 0xed, 0x7a, 0x25, 0x18, 0x11, 0xdd, 0x4f, 0xa8, 0xc5, 0x35, 0x24, 0xaa, 0x33, 0xb3, 0xd6, 0x5c, 0x9f, 0xdf, 0xdc, 0xba, 0xe5, 0x1b, 0x83, 0x27, 0xdc, 0x8e, 0x5b, 0xf6, 0xb2, 0x24, 0x06, 0x15, 0xd8, 0xdf, 0x3b, 0xb9, 0xf0, 0x1a, 0xa7, 0x17, 0x5e, 0xe3, 0xec, 0xc2, 0x6b, 0x7c, 0x29, 0x3c, 0xe7, 0xa4, 0xf0, 0x9c, 0xd3, 0xc2, 0x73, 0xce, 0x0a, 0xcf, 0xf9, 0x51, 0x78, 0xce, 0xd7, 0x9f, 0x5e, 0xe3, 0x2d, 0xbe, 0xdd, 0xdb, 0xf8, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x7e, 0xac, 0x6e, 0x65, 0x05, 0x00, 0x00, } func (m *MetricListOptions) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *MetricListOptions) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *MetricListOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l i -= len(m.MetricLabelSelector) copy(dAtA[i:], m.MetricLabelSelector) i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricLabelSelector))) i-- dAtA[i] = 0x12 i -= len(m.LabelSelector) copy(dAtA[i:], m.LabelSelector) i = encodeVarintGenerated(dAtA, i, uint64(len(m.LabelSelector))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *MetricValue) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *MetricValue) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *MetricValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.Selector != nil { { size, err := m.Selector.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x32 } { size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a if m.WindowSeconds != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.WindowSeconds)) i-- dAtA[i] = 0x20 } { size, err := m.Timestamp.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a i -= len(m.MetricName) copy(dAtA[i:], m.MetricName) i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricName))) i-- dAtA[i] = 0x12 { size, err := m.DescribedObject.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *MetricValueList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *MetricValueList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *MetricValueList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Items) > 0 { for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } { size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { offset -= sovGenerated(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) return base } func (m *MetricListOptions) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.LabelSelector) n += 1 + l + sovGenerated(uint64(l)) l = len(m.MetricLabelSelector) n += 1 + l + sovGenerated(uint64(l)) return n } func (m *MetricValue) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.DescribedObject.Size() n += 1 + l + sovGenerated(uint64(l)) l = len(m.MetricName) n += 1 + l + sovGenerated(uint64(l)) l = m.Timestamp.Size() n += 1 + l + sovGenerated(uint64(l)) if m.WindowSeconds != nil { n += 1 + sovGenerated(uint64(*m.WindowSeconds)) } l = m.Value.Size() n += 1 + l + sovGenerated(uint64(l)) if m.Selector != nil { l = m.Selector.Size() n += 1 + l + sovGenerated(uint64(l)) } return n } func (m *MetricValueList) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Items) > 0 { for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func sovGenerated(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozGenerated(x uint64) (n int) { return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *MetricListOptions) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&MetricListOptions{`, `LabelSelector:` + fmt.Sprintf("%v", this.LabelSelector) + `,`, `MetricLabelSelector:` + fmt.Sprintf("%v", this.MetricLabelSelector) + `,`, `}`, }, "") return s } func (this *MetricValue) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&MetricValue{`, `DescribedObject:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.DescribedObject), "ObjectReference", "v1.ObjectReference", 1), `&`, ``, 1) + `,`, `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, `Timestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Time", "v11.Time", 1), `&`, ``, 1) + `,`, `WindowSeconds:` + valueToStringGenerated(this.WindowSeconds) + `,`, `Value:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Value), "Quantity", "resource.Quantity", 1), `&`, ``, 1) + `,`, `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "v11.LabelSelector", 1) + `,`, `}`, }, "") return s } func (this *MetricValueList) String() string { if this == nil { return "nil" } repeatedStringForItems := "[]MetricValue{" for _, f := range this.Items { repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "MetricValue", "MetricValue", 1), `&`, ``, 1) + "," } repeatedStringForItems += "}" s := strings.Join([]string{`&MetricValueList{`, `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v11.ListMeta", 1), `&`, ``, 1) + `,`, `Items:` + repeatedStringForItems + `,`, `}`, }, "") return s } func valueToStringGenerated(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } func (m *MetricListOptions) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: MetricListOptions: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: MetricListOptions: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LabelSelector", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.LabelSelector = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MetricLabelSelector", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.MetricLabelSelector = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *MetricValue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: MetricValue: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: MetricValue: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DescribedObject", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.DescribedObject.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MetricName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.MetricName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field WindowSeconds", wireType) } var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int64(b&0x7F) << shift if b < 0x80 { break } } m.WindowSeconds = &v case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if m.Selector == nil { m.Selector = &v11.LabelSelector{} } if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *MetricValueList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: MetricValueList: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: MetricValueList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Items = append(m.Items, MetricValue{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipGenerated(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } case 1: iNdEx += 8 case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if length < 0 { return 0, ErrInvalidLengthGenerated } iNdEx += length case 3: depth++ case 4: if depth == 0 { return 0, ErrUnexpectedEndOfGroupGenerated } depth-- case 5: iNdEx += 4 default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { return 0, ErrInvalidLengthGenerated } if depth == 0 { return iNdEx, nil } } return 0, io.ErrUnexpectedEOF } var ( ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") ) metrics-0.29.0/pkg/apis/custom_metrics/v1beta1/generated.proto000066400000000000000000000055241453636773000243370ustar00rootroot00000000000000/* Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // This file was autogenerated by go-to-protobuf. Do not edit it manually! syntax = "proto2"; package k8s.io.metrics.pkg.apis.custom_metrics.v1beta1; import "k8s.io/api/core/v1/generated.proto"; import "k8s.io/apimachinery/pkg/api/resource/generated.proto"; import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; // Package-wide variables from generator "generated". option go_package = "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1"; // MetricListOptions is used to select metrics by their label selectors message MetricListOptions { // A selector to restrict the list of returned objects by their labels. // Defaults to everything. // +optional optional string labelSelector = 1; // A selector to restrict the list of returned metrics by their labels // +optional optional string metricLabelSelector = 2; } // MetricValue is a metric value for some object message MetricValue { // a reference to the described object optional k8s.io.api.core.v1.ObjectReference describedObject = 1; // the name of the metric optional string metricName = 2; // indicates the time at which the metrics were produced optional k8s.io.apimachinery.pkg.apis.meta.v1.Time timestamp = 3; // indicates the window ([Timestamp-Window, Timestamp]) from // which these metrics were calculated, when returning rate // metrics calculated from cumulative metrics (or zero for // non-calculated instantaneous metrics). optional int64 window = 4; // the value of the metric for this optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 5; // selector represents the label selector that could be used to select // this metric, and will generally just be the selector passed in to // the query used to fetch this metric. // When left blank, only the metric's Name will be used to gather metrics. // +optional optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 6; } // MetricValueList is a list of values for a given metric for some set of objects message MetricValueList { optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // the value of the metric across the described objects repeated MetricValue items = 2; } metrics-0.29.0/pkg/apis/custom_metrics/v1beta1/register.go000066400000000000000000000032341453636773000234630ustar00rootroot00000000000000/* 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 v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName is the group name use in this package const GroupName = "custom.metrics.k8s.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( // SchemeBuilder points to a list of functions added to Scheme. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) localSchemeBuilder = &SchemeBuilder // AddToScheme applies all the stored functions to the scheme. AddToScheme = localSchemeBuilder.AddToScheme ) func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &MetricValue{}, &MetricValueList{}, &MetricListOptions{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil } metrics-0.29.0/pkg/apis/custom_metrics/v1beta1/types.go000066400000000000000000000062451453636773000230100ustar00rootroot00000000000000/* 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 v1beta1 import ( "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // MetricValueList is a list of values for a given metric for some set of objects type MetricValueList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // the value of the metric across the described objects Items []MetricValue `json:"items" protobuf:"bytes,2,rep,name=items"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // MetricValue is a metric value for some object type MetricValue struct { metav1.TypeMeta `json:",inline"` // a reference to the described object DescribedObject v1.ObjectReference `json:"describedObject" protobuf:"bytes,1,name=describedObject"` // the name of the metric MetricName string `json:"metricName" protobuf:"bytes,2,name=metricName"` // indicates the time at which the metrics were produced Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,3,name=timestamp"` // indicates the window ([Timestamp-Window, Timestamp]) from // which these metrics were calculated, when returning rate // metrics calculated from cumulative metrics (or zero for // non-calculated instantaneous metrics). WindowSeconds *int64 `json:"window,omitempty" protobuf:"bytes,4,opt,name=window"` // the value of the metric for this Value resource.Quantity `json:"value" protobuf:"bytes,5,name=value"` // selector represents the label selector that could be used to select // this metric, and will generally just be the selector passed in to // the query used to fetch this metric. // When left blank, only the metric's Name will be used to gather metrics. // +optional Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,6,opt,name=selector"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // MetricListOptions is used to select metrics by their label selectors type MetricListOptions struct { metav1.TypeMeta `json:",inline"` // A selector to restrict the list of returned objects by their labels. // Defaults to everything. // +optional LabelSelector string `json:"labelSelector,omitempty" protobuf:"bytes,1,opt,name=labelSelector"` // A selector to restrict the list of returned metrics by their labels // +optional MetricLabelSelector string `json:"metricLabelSelector,omitempty" protobuf:"bytes,2,opt,name=metricLabelSelector"` } // AllObjects is a wildcard used to select metrics // for all objects matching the given label selector const AllObjects = "*" metrics-0.29.0/pkg/apis/custom_metrics/v1beta1/zz_generated.conversion.go000066400000000000000000000160411453636773000265040ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by conversion-gen. DO NOT EDIT. package v1beta1 import ( unsafe "unsafe" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" custommetrics "k8s.io/metrics/pkg/apis/custom_metrics" ) func init() { localSchemeBuilder.Register(RegisterConversions) } // RegisterConversions adds conversion functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterConversions(s *runtime.Scheme) error { if err := s.AddGeneratedConversionFunc((*MetricListOptions)(nil), (*custommetrics.MetricListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_MetricListOptions_To_custom_metrics_MetricListOptions(a.(*MetricListOptions), b.(*custommetrics.MetricListOptions), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*custommetrics.MetricListOptions)(nil), (*MetricListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_custom_metrics_MetricListOptions_To_v1beta1_MetricListOptions(a.(*custommetrics.MetricListOptions), b.(*MetricListOptions), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*MetricValueList)(nil), (*custommetrics.MetricValueList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_MetricValueList_To_custom_metrics_MetricValueList(a.(*MetricValueList), b.(*custommetrics.MetricValueList), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*custommetrics.MetricValueList)(nil), (*MetricValueList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_custom_metrics_MetricValueList_To_v1beta1_MetricValueList(a.(*custommetrics.MetricValueList), b.(*MetricValueList), scope) }); err != nil { return err } if err := s.AddConversionFunc((*custommetrics.MetricValue)(nil), (*MetricValue)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_custom_metrics_MetricValue_To_v1beta1_MetricValue(a.(*custommetrics.MetricValue), b.(*MetricValue), scope) }); err != nil { return err } if err := s.AddConversionFunc((*MetricValue)(nil), (*custommetrics.MetricValue)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_MetricValue_To_custom_metrics_MetricValue(a.(*MetricValue), b.(*custommetrics.MetricValue), scope) }); err != nil { return err } return nil } func autoConvert_v1beta1_MetricListOptions_To_custom_metrics_MetricListOptions(in *MetricListOptions, out *custommetrics.MetricListOptions, s conversion.Scope) error { out.LabelSelector = in.LabelSelector out.MetricLabelSelector = in.MetricLabelSelector return nil } // Convert_v1beta1_MetricListOptions_To_custom_metrics_MetricListOptions is an autogenerated conversion function. func Convert_v1beta1_MetricListOptions_To_custom_metrics_MetricListOptions(in *MetricListOptions, out *custommetrics.MetricListOptions, s conversion.Scope) error { return autoConvert_v1beta1_MetricListOptions_To_custom_metrics_MetricListOptions(in, out, s) } func autoConvert_custom_metrics_MetricListOptions_To_v1beta1_MetricListOptions(in *custommetrics.MetricListOptions, out *MetricListOptions, s conversion.Scope) error { out.LabelSelector = in.LabelSelector out.MetricLabelSelector = in.MetricLabelSelector return nil } // Convert_custom_metrics_MetricListOptions_To_v1beta1_MetricListOptions is an autogenerated conversion function. func Convert_custom_metrics_MetricListOptions_To_v1beta1_MetricListOptions(in *custommetrics.MetricListOptions, out *MetricListOptions, s conversion.Scope) error { return autoConvert_custom_metrics_MetricListOptions_To_v1beta1_MetricListOptions(in, out, s) } func autoConvert_v1beta1_MetricValue_To_custom_metrics_MetricValue(in *MetricValue, out *custommetrics.MetricValue, s conversion.Scope) error { if err := custommetrics.Convert_v1_ObjectReference_To_custom_metrics_ObjectReference(&in.DescribedObject, &out.DescribedObject, s); err != nil { return err } // WARNING: in.MetricName requires manual conversion: does not exist in peer-type out.Timestamp = in.Timestamp out.WindowSeconds = (*int64)(unsafe.Pointer(in.WindowSeconds)) out.Value = in.Value // WARNING: in.Selector requires manual conversion: does not exist in peer-type return nil } func autoConvert_custom_metrics_MetricValue_To_v1beta1_MetricValue(in *custommetrics.MetricValue, out *MetricValue, s conversion.Scope) error { if err := custommetrics.Convert_custom_metrics_ObjectReference_To_v1_ObjectReference(&in.DescribedObject, &out.DescribedObject, s); err != nil { return err } // WARNING: in.Metric requires manual conversion: does not exist in peer-type out.Timestamp = in.Timestamp out.WindowSeconds = (*int64)(unsafe.Pointer(in.WindowSeconds)) out.Value = in.Value return nil } func autoConvert_v1beta1_MetricValueList_To_custom_metrics_MetricValueList(in *MetricValueList, out *custommetrics.MetricValueList, s conversion.Scope) error { out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]custommetrics.MetricValue, len(*in)) for i := range *in { if err := Convert_v1beta1_MetricValue_To_custom_metrics_MetricValue(&(*in)[i], &(*out)[i], s); err != nil { return err } } } else { out.Items = nil } return nil } // Convert_v1beta1_MetricValueList_To_custom_metrics_MetricValueList is an autogenerated conversion function. func Convert_v1beta1_MetricValueList_To_custom_metrics_MetricValueList(in *MetricValueList, out *custommetrics.MetricValueList, s conversion.Scope) error { return autoConvert_v1beta1_MetricValueList_To_custom_metrics_MetricValueList(in, out, s) } func autoConvert_custom_metrics_MetricValueList_To_v1beta1_MetricValueList(in *custommetrics.MetricValueList, out *MetricValueList, s conversion.Scope) error { out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]MetricValue, len(*in)) for i := range *in { if err := Convert_custom_metrics_MetricValue_To_v1beta1_MetricValue(&(*in)[i], &(*out)[i], s); err != nil { return err } } } else { out.Items = nil } return nil } // Convert_custom_metrics_MetricValueList_To_v1beta1_MetricValueList is an autogenerated conversion function. func Convert_custom_metrics_MetricValueList_To_v1beta1_MetricValueList(in *custommetrics.MetricValueList, out *MetricValueList, s conversion.Scope) error { return autoConvert_custom_metrics_MetricValueList_To_v1beta1_MetricValueList(in, out, s) } metrics-0.29.0/pkg/apis/custom_metrics/v1beta1/zz_generated.deepcopy.go000066400000000000000000000067041453636773000261340ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by deepcopy-gen. DO NOT EDIT. package v1beta1 import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricListOptions) DeepCopyInto(out *MetricListOptions) { *out = *in out.TypeMeta = in.TypeMeta return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricListOptions. func (in *MetricListOptions) DeepCopy() *MetricListOptions { if in == nil { return nil } out := new(MetricListOptions) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MetricListOptions) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricValue) DeepCopyInto(out *MetricValue) { *out = *in out.TypeMeta = in.TypeMeta out.DescribedObject = in.DescribedObject in.Timestamp.DeepCopyInto(&out.Timestamp) if in.WindowSeconds != nil { in, out := &in.WindowSeconds, &out.WindowSeconds *out = new(int64) **out = **in } out.Value = in.Value.DeepCopy() if in.Selector != nil { in, out := &in.Selector, &out.Selector *out = new(v1.LabelSelector) (*in).DeepCopyInto(*out) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricValue. func (in *MetricValue) DeepCopy() *MetricValue { if in == nil { return nil } out := new(MetricValue) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MetricValue) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricValueList) DeepCopyInto(out *MetricValueList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]MetricValue, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricValueList. func (in *MetricValueList) DeepCopy() *MetricValueList { if in == nil { return nil } out := new(MetricValueList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MetricValueList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } metrics-0.29.0/pkg/apis/custom_metrics/v1beta2/000077500000000000000000000000001453636773000213075ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/custom_metrics/v1beta2/doc.go000066400000000000000000000015351453636773000224070ustar00rootroot00000000000000/* 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. */ // +k8s:deepcopy-gen=package // +k8s:protobuf-gen=package // +k8s:conversion-gen=k8s.io/metrics/pkg/apis/custom_metrics // +k8s:openapi-gen=true // Package v1beta2 is the v1beta2 version of the custom_metrics API. package v1beta2 // import "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2" metrics-0.29.0/pkg/apis/custom_metrics/v1beta2/generated.pb.go000066400000000000000000000744211453636773000242040ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta2/generated.proto package v1beta2 import ( fmt "fmt" io "io" proto "github.com/gogo/protobuf/proto" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" math "math" math_bits "math/bits" reflect "reflect" strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package func (m *MetricIdentifier) Reset() { *m = MetricIdentifier{} } func (*MetricIdentifier) ProtoMessage() {} func (*MetricIdentifier) Descriptor() ([]byte, []int) { return fileDescriptor_478ffa937eb23bb9, []int{0} } func (m *MetricIdentifier) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *MetricIdentifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *MetricIdentifier) XXX_Merge(src proto.Message) { xxx_messageInfo_MetricIdentifier.Merge(m, src) } func (m *MetricIdentifier) XXX_Size() int { return m.Size() } func (m *MetricIdentifier) XXX_DiscardUnknown() { xxx_messageInfo_MetricIdentifier.DiscardUnknown(m) } var xxx_messageInfo_MetricIdentifier proto.InternalMessageInfo func (m *MetricListOptions) Reset() { *m = MetricListOptions{} } func (*MetricListOptions) ProtoMessage() {} func (*MetricListOptions) Descriptor() ([]byte, []int) { return fileDescriptor_478ffa937eb23bb9, []int{1} } func (m *MetricListOptions) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *MetricListOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *MetricListOptions) XXX_Merge(src proto.Message) { xxx_messageInfo_MetricListOptions.Merge(m, src) } func (m *MetricListOptions) XXX_Size() int { return m.Size() } func (m *MetricListOptions) XXX_DiscardUnknown() { xxx_messageInfo_MetricListOptions.DiscardUnknown(m) } var xxx_messageInfo_MetricListOptions proto.InternalMessageInfo func (m *MetricValue) Reset() { *m = MetricValue{} } func (*MetricValue) ProtoMessage() {} func (*MetricValue) Descriptor() ([]byte, []int) { return fileDescriptor_478ffa937eb23bb9, []int{2} } func (m *MetricValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *MetricValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *MetricValue) XXX_Merge(src proto.Message) { xxx_messageInfo_MetricValue.Merge(m, src) } func (m *MetricValue) XXX_Size() int { return m.Size() } func (m *MetricValue) XXX_DiscardUnknown() { xxx_messageInfo_MetricValue.DiscardUnknown(m) } var xxx_messageInfo_MetricValue proto.InternalMessageInfo func (m *MetricValueList) Reset() { *m = MetricValueList{} } func (*MetricValueList) ProtoMessage() {} func (*MetricValueList) Descriptor() ([]byte, []int) { return fileDescriptor_478ffa937eb23bb9, []int{3} } func (m *MetricValueList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *MetricValueList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *MetricValueList) XXX_Merge(src proto.Message) { xxx_messageInfo_MetricValueList.Merge(m, src) } func (m *MetricValueList) XXX_Size() int { return m.Size() } func (m *MetricValueList) XXX_DiscardUnknown() { xxx_messageInfo_MetricValueList.DiscardUnknown(m) } var xxx_messageInfo_MetricValueList proto.InternalMessageInfo func init() { proto.RegisterType((*MetricIdentifier)(nil), "k8s.io.metrics.pkg.apis.custom_metrics.v1beta2.MetricIdentifier") proto.RegisterType((*MetricListOptions)(nil), "k8s.io.metrics.pkg.apis.custom_metrics.v1beta2.MetricListOptions") proto.RegisterType((*MetricValue)(nil), "k8s.io.metrics.pkg.apis.custom_metrics.v1beta2.MetricValue") proto.RegisterType((*MetricValueList)(nil), "k8s.io.metrics.pkg.apis.custom_metrics.v1beta2.MetricValueList") } func init() { proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta2/generated.proto", fileDescriptor_478ffa937eb23bb9) } var fileDescriptor_478ffa937eb23bb9 = []byte{ // 657 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, 0x14, 0x8d, 0x9b, 0xa6, 0x4a, 0x26, 0xcd, 0xd7, 0xd6, 0xd5, 0x27, 0xa2, 0x22, 0xb9, 0x51, 0xd8, 0x44, 0x48, 0xcc, 0xa8, 0x01, 0x01, 0x52, 0x37, 0xc8, 0x62, 0x53, 0xa9, 0xa1, 0xc2, 0xad, 0xa8, 0xc4, 0x8f, 0x60, 0x62, 0xdf, 0x24, 0x43, 0x62, 0x8f, 0x35, 0x33, 0x4e, 0xd5, 0x1d, 0x8f, 0x80, 0xc4, 0x03, 0xf0, 0x3a, 0x15, 0xab, 0xb2, 0xeb, 0xaa, 0xa2, 0xe6, 0x45, 0x90, 0xed, 0x71, 0xf3, 0xd3, 0x02, 0x2d, 0xbb, 0x8c, 0xe7, 0x9c, 0x73, 0xcf, 0xbd, 0xe7, 0x4e, 0xd0, 0xe1, 0xf0, 0xa9, 0xc4, 0x8c, 0x93, 0x61, 0xd4, 0x05, 0x11, 0x80, 0x02, 0x49, 0xc6, 0x10, 0x78, 0x5c, 0x10, 0x7d, 0xe1, 0x83, 0x12, 0xcc, 0x95, 0x24, 0x1c, 0xf6, 0x09, 0x0d, 0x99, 0x24, 0x6e, 0x24, 0x15, 0xf7, 0xdf, 0xe7, 0xdf, 0xc7, 0x5b, 0x5d, 0x50, 0xb4, 0x4d, 0xfa, 0x10, 0x80, 0xa0, 0x0a, 0x3c, 0x1c, 0x0a, 0xae, 0xb8, 0x89, 0x33, 0x3e, 0xd6, 0x38, 0x1c, 0x0e, 0xfb, 0x38, 0xe1, 0xe3, 0x59, 0x3e, 0xd6, 0xfc, 0x8d, 0x07, 0x7d, 0xa6, 0x06, 0x51, 0x17, 0xbb, 0xdc, 0x27, 0x7d, 0xde, 0xe7, 0x24, 0x95, 0xe9, 0x46, 0xbd, 0xf4, 0x94, 0x1e, 0xd2, 0x5f, 0x99, 0xfc, 0x46, 0x53, 0xdb, 0xa3, 0x21, 0x23, 0x2e, 0x17, 0x40, 0xc6, 0x5b, 0xf3, 0x16, 0x36, 0x1e, 0x4d, 0x30, 0x3e, 0x75, 0x07, 0x2c, 0x00, 0x71, 0x9c, 0xf7, 0x41, 0x04, 0x48, 0x1e, 0x09, 0x17, 0x6e, 0xc5, 0x92, 0xc9, 0x38, 0xe8, 0x75, 0xb5, 0xc8, 0xef, 0x58, 0x22, 0x0a, 0x14, 0xf3, 0xaf, 0x96, 0x79, 0xfc, 0x37, 0x82, 0x74, 0x07, 0xe0, 0xd3, 0x79, 0x5e, 0xf3, 0x8b, 0x81, 0x56, 0x3b, 0xe9, 0xec, 0x76, 0x3c, 0x08, 0x14, 0xeb, 0x31, 0x10, 0x66, 0x03, 0x2d, 0x06, 0xd4, 0x87, 0xba, 0xd1, 0x30, 0x5a, 0x15, 0x7b, 0xf9, 0xe4, 0x7c, 0xb3, 0x10, 0x9f, 0x6f, 0x2e, 0xbe, 0xa0, 0x3e, 0x38, 0xe9, 0x8d, 0xf9, 0x0e, 0x95, 0x25, 0x8c, 0xc0, 0x55, 0x5c, 0xd4, 0x17, 0x1a, 0x46, 0xab, 0xda, 0x7e, 0x98, 0x27, 0x34, 0xed, 0x60, 0x12, 0x53, 0xd2, 0x28, 0x1e, 0x6f, 0xe1, 0x5d, 0xda, 0x85, 0xd1, 0xbe, 0xa6, 0xda, 0xcb, 0xf1, 0xf9, 0x66, 0x39, 0x3f, 0x39, 0x97, 0x92, 0xcd, 0xaf, 0x06, 0x5a, 0xcb, 0x5c, 0xed, 0x32, 0xa9, 0xf6, 0x42, 0xc5, 0x78, 0x20, 0xcd, 0x6d, 0x54, 0x1b, 0x4d, 0xd3, 0xb5, 0xbf, 0xff, 0xb5, 0xbf, 0xda, 0x8c, 0xb6, 0x33, 0x8b, 0x35, 0x3b, 0x68, 0x3d, 0xdb, 0x91, 0x19, 0x54, 0x6a, 0xbe, 0x62, 0xdf, 0xd5, 0x12, 0xeb, 0x9d, 0xab, 0x10, 0xe7, 0x3a, 0x5e, 0xf3, 0x5b, 0x11, 0x55, 0x33, 0xf0, 0x2b, 0x3a, 0x8a, 0xc0, 0xec, 0xa1, 0x15, 0x0f, 0xa4, 0x2b, 0x58, 0x17, 0xbc, 0xbd, 0xee, 0x47, 0x70, 0x55, 0xea, 0xae, 0xda, 0xbe, 0x37, 0x35, 0x17, 0x9c, 0xac, 0x56, 0x32, 0x85, 0x0c, 0xe1, 0x40, 0x0f, 0x04, 0x04, 0x2e, 0xd8, 0x77, 0x74, 0xfd, 0x95, 0xe7, 0xb3, 0x1a, 0xce, 0xbc, 0xa8, 0x39, 0x40, 0x4b, 0x99, 0x1d, 0x3d, 0xf6, 0x67, 0xb7, 0x7c, 0x18, 0x78, 0x3e, 0x6c, 0xfb, 0x3f, 0x5d, 0x7b, 0x29, 0xbb, 0x71, 0xb4, 0xbe, 0xf9, 0x06, 0x55, 0x92, 0xc5, 0x91, 0x8a, 0xfa, 0x61, 0xbd, 0x98, 0x16, 0xbb, 0x7f, 0xb3, 0x8c, 0x0f, 0x98, 0x0f, 0xf6, 0x9a, 0x96, 0xad, 0x1c, 0xe4, 0x22, 0xce, 0x44, 0xcf, 0x7c, 0x82, 0x6a, 0x47, 0x2c, 0xf0, 0xf8, 0xd1, 0x3e, 0xb8, 0x3c, 0xf0, 0x64, 0x7d, 0xb1, 0x61, 0xb4, 0x8a, 0xf6, 0x5a, 0x12, 0xe3, 0xe1, 0xf4, 0x85, 0x33, 0x8b, 0x33, 0xf7, 0x51, 0x69, 0x9c, 0x0c, 0xbc, 0x5e, 0x4a, 0x1d, 0xe1, 0x3f, 0x39, 0xc2, 0xf9, 0xa3, 0xc4, 0x2f, 0x23, 0x1a, 0x28, 0xa6, 0x8e, 0xed, 0x9a, 0x76, 0x55, 0x4a, 0x53, 0x73, 0x32, 0xad, 0xe6, 0x77, 0x03, 0xad, 0x4c, 0x85, 0x99, 0xec, 0x9c, 0xf9, 0x16, 0x95, 0x93, 0x7e, 0x3c, 0xaa, 0xa8, 0x4e, 0x12, 0xdf, 0x70, 0xc3, 0x99, 0x54, 0x1d, 0x50, 0xd4, 0x5e, 0xd5, 0xb5, 0xca, 0xf9, 0x17, 0xe7, 0x52, 0xd1, 0xfc, 0x80, 0x4a, 0x4c, 0x81, 0x2f, 0xeb, 0x0b, 0x8d, 0x62, 0xab, 0xda, 0xde, 0xfe, 0xb7, 0x14, 0x53, 0xb7, 0x93, 0x9e, 0x76, 0x12, 0x45, 0x27, 0x13, 0xb6, 0x0f, 0x4e, 0x2e, 0xac, 0xc2, 0xe9, 0x85, 0x55, 0x38, 0xbb, 0xb0, 0x0a, 0x9f, 0x62, 0xcb, 0x38, 0x89, 0x2d, 0xe3, 0x34, 0xb6, 0x8c, 0xb3, 0xd8, 0x32, 0x7e, 0xc4, 0x96, 0xf1, 0xf9, 0xa7, 0x55, 0x78, 0x8d, 0x6f, 0xf7, 0xb7, 0xfc, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xf2, 0x24, 0xd3, 0xca, 0xe0, 0x05, 0x00, 0x00, } func (m *MetricIdentifier) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *MetricIdentifier) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *MetricIdentifier) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.Selector != nil { { size, err := m.Selector.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *MetricListOptions) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *MetricListOptions) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *MetricListOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l i -= len(m.MetricLabelSelector) copy(dAtA[i:], m.MetricLabelSelector) i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricLabelSelector))) i-- dAtA[i] = 0x12 i -= len(m.LabelSelector) copy(dAtA[i:], m.LabelSelector) i = encodeVarintGenerated(dAtA, i, uint64(len(m.LabelSelector))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *MetricValue) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *MetricValue) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *MetricValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a if m.WindowSeconds != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.WindowSeconds)) i-- dAtA[i] = 0x20 } { size, err := m.Timestamp.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a { size, err := m.Metric.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 { size, err := m.DescribedObject.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *MetricValueList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *MetricValueList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *MetricValueList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Items) > 0 { for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } { size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { offset -= sovGenerated(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) return base } func (m *MetricIdentifier) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Name) n += 1 + l + sovGenerated(uint64(l)) if m.Selector != nil { l = m.Selector.Size() n += 1 + l + sovGenerated(uint64(l)) } return n } func (m *MetricListOptions) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.LabelSelector) n += 1 + l + sovGenerated(uint64(l)) l = len(m.MetricLabelSelector) n += 1 + l + sovGenerated(uint64(l)) return n } func (m *MetricValue) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.DescribedObject.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Metric.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Timestamp.Size() n += 1 + l + sovGenerated(uint64(l)) if m.WindowSeconds != nil { n += 1 + sovGenerated(uint64(*m.WindowSeconds)) } l = m.Value.Size() n += 1 + l + sovGenerated(uint64(l)) return n } func (m *MetricValueList) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Items) > 0 { for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func sovGenerated(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozGenerated(x uint64) (n int) { return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *MetricIdentifier) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&MetricIdentifier{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "v1.LabelSelector", 1) + `,`, `}`, }, "") return s } func (this *MetricListOptions) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&MetricListOptions{`, `LabelSelector:` + fmt.Sprintf("%v", this.LabelSelector) + `,`, `MetricLabelSelector:` + fmt.Sprintf("%v", this.MetricLabelSelector) + `,`, `}`, }, "") return s } func (this *MetricValue) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&MetricValue{`, `DescribedObject:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.DescribedObject), "ObjectReference", "v11.ObjectReference", 1), `&`, ``, 1) + `,`, `Metric:` + strings.Replace(strings.Replace(this.Metric.String(), "MetricIdentifier", "MetricIdentifier", 1), `&`, ``, 1) + `,`, `Timestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, `WindowSeconds:` + valueToStringGenerated(this.WindowSeconds) + `,`, `Value:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Value), "Quantity", "resource.Quantity", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } func (this *MetricValueList) String() string { if this == nil { return "nil" } repeatedStringForItems := "[]MetricValue{" for _, f := range this.Items { repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "MetricValue", "MetricValue", 1), `&`, ``, 1) + "," } repeatedStringForItems += "}" s := strings.Join([]string{`&MetricValueList{`, `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, `Items:` + repeatedStringForItems + `,`, `}`, }, "") return s } func valueToStringGenerated(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } func (m *MetricIdentifier) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: MetricIdentifier: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: MetricIdentifier: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if m.Selector == nil { m.Selector = &v1.LabelSelector{} } if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *MetricListOptions) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: MetricListOptions: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: MetricListOptions: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LabelSelector", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.LabelSelector = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MetricLabelSelector", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.MetricLabelSelector = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *MetricValue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: MetricValue: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: MetricValue: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DescribedObject", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.DescribedObject.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Metric", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Metric.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field WindowSeconds", wireType) } var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int64(b&0x7F) << shift if b < 0x80 { break } } m.WindowSeconds = &v case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *MetricValueList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: MetricValueList: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: MetricValueList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Items = append(m.Items, MetricValue{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipGenerated(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } case 1: iNdEx += 8 case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if length < 0 { return 0, ErrInvalidLengthGenerated } iNdEx += length case 3: depth++ case 4: if depth == 0 { return 0, ErrUnexpectedEndOfGroupGenerated } depth-- case 5: iNdEx += 4 default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { return 0, ErrInvalidLengthGenerated } if depth == 0 { return iNdEx, nil } } return 0, io.ErrUnexpectedEOF } var ( ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") ) metrics-0.29.0/pkg/apis/custom_metrics/v1beta2/generated.proto000066400000000000000000000057651453636773000243470ustar00rootroot00000000000000/* Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // This file was autogenerated by go-to-protobuf. Do not edit it manually! syntax = "proto2"; package k8s.io.metrics.pkg.apis.custom_metrics.v1beta2; import "k8s.io/api/core/v1/generated.proto"; import "k8s.io/apimachinery/pkg/api/resource/generated.proto"; import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; // Package-wide variables from generator "generated". option go_package = "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2"; // MetricIdentifier identifies a metric by name and, optionally, selector message MetricIdentifier { // name is the name of the given metric optional string name = 1; // selector represents the label selector that could be used to select // this metric, and will generally just be the selector passed in to // the query used to fetch this metric. // When left blank, only the metric's Name will be used to gather metrics. // +optional optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; } // MetricListOptions is used to select metrics by their label selectors message MetricListOptions { // A selector to restrict the list of returned objects by their labels. // Defaults to everything. // +optional optional string labelSelector = 1; // A selector to restrict the list of returned metrics by their labels // +optional optional string metricLabelSelector = 2; } // MetricValue is the metric value for some object message MetricValue { // a reference to the described object optional k8s.io.api.core.v1.ObjectReference describedObject = 1; optional MetricIdentifier metric = 2; // indicates the time at which the metrics were produced optional k8s.io.apimachinery.pkg.apis.meta.v1.Time timestamp = 3; // indicates the window ([Timestamp-Window, Timestamp]) from // which these metrics were calculated, when returning rate // metrics calculated from cumulative metrics (or zero for // non-calculated instantaneous metrics). optional int64 windowSeconds = 4; // the value of the metric for this optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 5; } // MetricValueList is a list of values for a given metric for some set of objects message MetricValueList { optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // the value of the metric across the described objects repeated MetricValue items = 2; } metrics-0.29.0/pkg/apis/custom_metrics/v1beta2/register.go000066400000000000000000000032341453636773000234640ustar00rootroot00000000000000/* 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 v1beta2 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName is the group name use in this package const GroupName = "custom.metrics.k8s.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta2"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( // SchemeBuilder points to a list of functions added to Scheme. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) localSchemeBuilder = &SchemeBuilder // AddToScheme applies all the stored functions to the scheme. AddToScheme = localSchemeBuilder.AddToScheme ) func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &MetricValue{}, &MetricValueList{}, &MetricListOptions{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil } metrics-0.29.0/pkg/apis/custom_metrics/v1beta2/types.go000066400000000000000000000065501453636773000230100ustar00rootroot00000000000000/* 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 v1beta2 import ( "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // MetricIdentifier identifies a metric by name and, optionally, selector type MetricIdentifier struct { // name is the name of the given metric Name string `json:"name" protobuf:"bytes,1,opt,name=name"` // selector represents the label selector that could be used to select // this metric, and will generally just be the selector passed in to // the query used to fetch this metric. // When left blank, only the metric's Name will be used to gather metrics. // +optional Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // MetricValueList is a list of values for a given metric for some set of objects type MetricValueList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // the value of the metric across the described objects Items []MetricValue `json:"items" protobuf:"bytes,2,rep,name=items"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // MetricValue is the metric value for some object type MetricValue struct { metav1.TypeMeta `json:",inline"` // a reference to the described object DescribedObject v1.ObjectReference `json:"describedObject" protobuf:"bytes,1,name=describedObject"` Metric MetricIdentifier `json:"metric" protobuf:"bytes,2,name=metric"` // indicates the time at which the metrics were produced Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,3,name=timestamp"` // indicates the window ([Timestamp-Window, Timestamp]) from // which these metrics were calculated, when returning rate // metrics calculated from cumulative metrics (or zero for // non-calculated instantaneous metrics). WindowSeconds *int64 `json:"windowSeconds,omitempty" protobuf:"bytes,4,opt,name=windowSeconds"` // the value of the metric for this Value resource.Quantity `json:"value" protobuf:"bytes,5,name=value"` } // AllObjects is a wildcard used to select metrics // for all objects matching the given label selector const AllObjects = "*" // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // MetricListOptions is used to select metrics by their label selectors type MetricListOptions struct { metav1.TypeMeta `json:",inline"` // A selector to restrict the list of returned objects by their labels. // Defaults to everything. // +optional LabelSelector string `json:"labelSelector,omitempty" protobuf:"bytes,1,opt,name=labelSelector"` // A selector to restrict the list of returned metrics by their labels // +optional MetricLabelSelector string `json:"metricLabelSelector,omitempty" protobuf:"bytes,2,opt,name=metricLabelSelector"` } metrics-0.29.0/pkg/apis/custom_metrics/v1beta2/zz_generated.conversion.go000066400000000000000000000232371453636773000265120ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by conversion-gen. DO NOT EDIT. package v1beta2 import ( unsafe "unsafe" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" custommetrics "k8s.io/metrics/pkg/apis/custom_metrics" ) func init() { localSchemeBuilder.Register(RegisterConversions) } // RegisterConversions adds conversion functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterConversions(s *runtime.Scheme) error { if err := s.AddGeneratedConversionFunc((*MetricIdentifier)(nil), (*custommetrics.MetricIdentifier)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_MetricIdentifier_To_custom_metrics_MetricIdentifier(a.(*MetricIdentifier), b.(*custommetrics.MetricIdentifier), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*custommetrics.MetricIdentifier)(nil), (*MetricIdentifier)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_custom_metrics_MetricIdentifier_To_v1beta2_MetricIdentifier(a.(*custommetrics.MetricIdentifier), b.(*MetricIdentifier), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*MetricListOptions)(nil), (*custommetrics.MetricListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_MetricListOptions_To_custom_metrics_MetricListOptions(a.(*MetricListOptions), b.(*custommetrics.MetricListOptions), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*custommetrics.MetricListOptions)(nil), (*MetricListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_custom_metrics_MetricListOptions_To_v1beta2_MetricListOptions(a.(*custommetrics.MetricListOptions), b.(*MetricListOptions), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*MetricValue)(nil), (*custommetrics.MetricValue)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_MetricValue_To_custom_metrics_MetricValue(a.(*MetricValue), b.(*custommetrics.MetricValue), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*custommetrics.MetricValue)(nil), (*MetricValue)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_custom_metrics_MetricValue_To_v1beta2_MetricValue(a.(*custommetrics.MetricValue), b.(*MetricValue), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*MetricValueList)(nil), (*custommetrics.MetricValueList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_MetricValueList_To_custom_metrics_MetricValueList(a.(*MetricValueList), b.(*custommetrics.MetricValueList), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*custommetrics.MetricValueList)(nil), (*MetricValueList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_custom_metrics_MetricValueList_To_v1beta2_MetricValueList(a.(*custommetrics.MetricValueList), b.(*MetricValueList), scope) }); err != nil { return err } return nil } func autoConvert_v1beta2_MetricIdentifier_To_custom_metrics_MetricIdentifier(in *MetricIdentifier, out *custommetrics.MetricIdentifier, s conversion.Scope) error { out.Name = in.Name out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) return nil } // Convert_v1beta2_MetricIdentifier_To_custom_metrics_MetricIdentifier is an autogenerated conversion function. func Convert_v1beta2_MetricIdentifier_To_custom_metrics_MetricIdentifier(in *MetricIdentifier, out *custommetrics.MetricIdentifier, s conversion.Scope) error { return autoConvert_v1beta2_MetricIdentifier_To_custom_metrics_MetricIdentifier(in, out, s) } func autoConvert_custom_metrics_MetricIdentifier_To_v1beta2_MetricIdentifier(in *custommetrics.MetricIdentifier, out *MetricIdentifier, s conversion.Scope) error { out.Name = in.Name out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) return nil } // Convert_custom_metrics_MetricIdentifier_To_v1beta2_MetricIdentifier is an autogenerated conversion function. func Convert_custom_metrics_MetricIdentifier_To_v1beta2_MetricIdentifier(in *custommetrics.MetricIdentifier, out *MetricIdentifier, s conversion.Scope) error { return autoConvert_custom_metrics_MetricIdentifier_To_v1beta2_MetricIdentifier(in, out, s) } func autoConvert_v1beta2_MetricListOptions_To_custom_metrics_MetricListOptions(in *MetricListOptions, out *custommetrics.MetricListOptions, s conversion.Scope) error { out.LabelSelector = in.LabelSelector out.MetricLabelSelector = in.MetricLabelSelector return nil } // Convert_v1beta2_MetricListOptions_To_custom_metrics_MetricListOptions is an autogenerated conversion function. func Convert_v1beta2_MetricListOptions_To_custom_metrics_MetricListOptions(in *MetricListOptions, out *custommetrics.MetricListOptions, s conversion.Scope) error { return autoConvert_v1beta2_MetricListOptions_To_custom_metrics_MetricListOptions(in, out, s) } func autoConvert_custom_metrics_MetricListOptions_To_v1beta2_MetricListOptions(in *custommetrics.MetricListOptions, out *MetricListOptions, s conversion.Scope) error { out.LabelSelector = in.LabelSelector out.MetricLabelSelector = in.MetricLabelSelector return nil } // Convert_custom_metrics_MetricListOptions_To_v1beta2_MetricListOptions is an autogenerated conversion function. func Convert_custom_metrics_MetricListOptions_To_v1beta2_MetricListOptions(in *custommetrics.MetricListOptions, out *MetricListOptions, s conversion.Scope) error { return autoConvert_custom_metrics_MetricListOptions_To_v1beta2_MetricListOptions(in, out, s) } func autoConvert_v1beta2_MetricValue_To_custom_metrics_MetricValue(in *MetricValue, out *custommetrics.MetricValue, s conversion.Scope) error { if err := custommetrics.Convert_v1_ObjectReference_To_custom_metrics_ObjectReference(&in.DescribedObject, &out.DescribedObject, s); err != nil { return err } if err := Convert_v1beta2_MetricIdentifier_To_custom_metrics_MetricIdentifier(&in.Metric, &out.Metric, s); err != nil { return err } out.Timestamp = in.Timestamp out.WindowSeconds = (*int64)(unsafe.Pointer(in.WindowSeconds)) out.Value = in.Value return nil } // Convert_v1beta2_MetricValue_To_custom_metrics_MetricValue is an autogenerated conversion function. func Convert_v1beta2_MetricValue_To_custom_metrics_MetricValue(in *MetricValue, out *custommetrics.MetricValue, s conversion.Scope) error { return autoConvert_v1beta2_MetricValue_To_custom_metrics_MetricValue(in, out, s) } func autoConvert_custom_metrics_MetricValue_To_v1beta2_MetricValue(in *custommetrics.MetricValue, out *MetricValue, s conversion.Scope) error { if err := custommetrics.Convert_custom_metrics_ObjectReference_To_v1_ObjectReference(&in.DescribedObject, &out.DescribedObject, s); err != nil { return err } if err := Convert_custom_metrics_MetricIdentifier_To_v1beta2_MetricIdentifier(&in.Metric, &out.Metric, s); err != nil { return err } out.Timestamp = in.Timestamp out.WindowSeconds = (*int64)(unsafe.Pointer(in.WindowSeconds)) out.Value = in.Value return nil } // Convert_custom_metrics_MetricValue_To_v1beta2_MetricValue is an autogenerated conversion function. func Convert_custom_metrics_MetricValue_To_v1beta2_MetricValue(in *custommetrics.MetricValue, out *MetricValue, s conversion.Scope) error { return autoConvert_custom_metrics_MetricValue_To_v1beta2_MetricValue(in, out, s) } func autoConvert_v1beta2_MetricValueList_To_custom_metrics_MetricValueList(in *MetricValueList, out *custommetrics.MetricValueList, s conversion.Scope) error { out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]custommetrics.MetricValue, len(*in)) for i := range *in { if err := Convert_v1beta2_MetricValue_To_custom_metrics_MetricValue(&(*in)[i], &(*out)[i], s); err != nil { return err } } } else { out.Items = nil } return nil } // Convert_v1beta2_MetricValueList_To_custom_metrics_MetricValueList is an autogenerated conversion function. func Convert_v1beta2_MetricValueList_To_custom_metrics_MetricValueList(in *MetricValueList, out *custommetrics.MetricValueList, s conversion.Scope) error { return autoConvert_v1beta2_MetricValueList_To_custom_metrics_MetricValueList(in, out, s) } func autoConvert_custom_metrics_MetricValueList_To_v1beta2_MetricValueList(in *custommetrics.MetricValueList, out *MetricValueList, s conversion.Scope) error { out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]MetricValue, len(*in)) for i := range *in { if err := Convert_custom_metrics_MetricValue_To_v1beta2_MetricValue(&(*in)[i], &(*out)[i], s); err != nil { return err } } } else { out.Items = nil } return nil } // Convert_custom_metrics_MetricValueList_To_v1beta2_MetricValueList is an autogenerated conversion function. func Convert_custom_metrics_MetricValueList_To_v1beta2_MetricValueList(in *custommetrics.MetricValueList, out *MetricValueList, s conversion.Scope) error { return autoConvert_custom_metrics_MetricValueList_To_v1beta2_MetricValueList(in, out, s) } metrics-0.29.0/pkg/apis/custom_metrics/v1beta2/zz_generated.deepcopy.go000066400000000000000000000076751453636773000261450ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by deepcopy-gen. DO NOT EDIT. package v1beta2 import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricIdentifier) DeepCopyInto(out *MetricIdentifier) { *out = *in if in.Selector != nil { in, out := &in.Selector, &out.Selector *out = new(v1.LabelSelector) (*in).DeepCopyInto(*out) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricIdentifier. func (in *MetricIdentifier) DeepCopy() *MetricIdentifier { if in == nil { return nil } out := new(MetricIdentifier) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricListOptions) DeepCopyInto(out *MetricListOptions) { *out = *in out.TypeMeta = in.TypeMeta return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricListOptions. func (in *MetricListOptions) DeepCopy() *MetricListOptions { if in == nil { return nil } out := new(MetricListOptions) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MetricListOptions) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricValue) DeepCopyInto(out *MetricValue) { *out = *in out.TypeMeta = in.TypeMeta out.DescribedObject = in.DescribedObject in.Metric.DeepCopyInto(&out.Metric) in.Timestamp.DeepCopyInto(&out.Timestamp) if in.WindowSeconds != nil { in, out := &in.WindowSeconds, &out.WindowSeconds *out = new(int64) **out = **in } out.Value = in.Value.DeepCopy() return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricValue. func (in *MetricValue) DeepCopy() *MetricValue { if in == nil { return nil } out := new(MetricValue) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MetricValue) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricValueList) DeepCopyInto(out *MetricValueList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]MetricValue, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricValueList. func (in *MetricValueList) DeepCopy() *MetricValueList { if in == nil { return nil } out := new(MetricValueList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MetricValueList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } metrics-0.29.0/pkg/apis/custom_metrics/zz_generated.deepcopy.go000066400000000000000000000106221453636773000246630ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by deepcopy-gen. DO NOT EDIT. package custom_metrics import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricIdentifier) DeepCopyInto(out *MetricIdentifier) { *out = *in if in.Selector != nil { in, out := &in.Selector, &out.Selector *out = new(v1.LabelSelector) (*in).DeepCopyInto(*out) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricIdentifier. func (in *MetricIdentifier) DeepCopy() *MetricIdentifier { if in == nil { return nil } out := new(MetricIdentifier) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricListOptions) DeepCopyInto(out *MetricListOptions) { *out = *in out.TypeMeta = in.TypeMeta return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricListOptions. func (in *MetricListOptions) DeepCopy() *MetricListOptions { if in == nil { return nil } out := new(MetricListOptions) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MetricListOptions) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricValue) DeepCopyInto(out *MetricValue) { *out = *in out.TypeMeta = in.TypeMeta out.DescribedObject = in.DescribedObject in.Metric.DeepCopyInto(&out.Metric) in.Timestamp.DeepCopyInto(&out.Timestamp) if in.WindowSeconds != nil { in, out := &in.WindowSeconds, &out.WindowSeconds *out = new(int64) **out = **in } out.Value = in.Value.DeepCopy() return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricValue. func (in *MetricValue) DeepCopy() *MetricValue { if in == nil { return nil } out := new(MetricValue) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MetricValue) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricValueList) DeepCopyInto(out *MetricValueList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]MetricValue, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricValueList. func (in *MetricValueList) DeepCopy() *MetricValueList { if in == nil { return nil } out := new(MetricValueList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MetricValueList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ObjectReference) DeepCopyInto(out *ObjectReference) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference. func (in *ObjectReference) DeepCopy() *ObjectReference { if in == nil { return nil } out := new(ObjectReference) in.DeepCopyInto(out) return out } metrics-0.29.0/pkg/apis/external_metrics/000077500000000000000000000000001453636773000203535ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/external_metrics/doc.go000066400000000000000000000014251453636773000214510ustar00rootroot00000000000000/* 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. */ // +k8s:deepcopy-gen=package // +groupName=external.metrics.k8s.io // Package external_metrics adds support for defining external metrics. package external_metrics // import "k8s.io/metrics/pkg/apis/external_metrics" metrics-0.29.0/pkg/apis/external_metrics/install/000077500000000000000000000000001453636773000220215ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/external_metrics/install/install.go000066400000000000000000000022611453636773000240170ustar00rootroot00000000000000/* 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 install installs the experimental API group, making it available as // an option to all of the API encoding/decoding machinery. package install import ( "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/metrics/pkg/apis/external_metrics" "k8s.io/metrics/pkg/apis/external_metrics/v1beta1" ) // Install registers the API group and adds types to a scheme func Install(scheme *runtime.Scheme) { utilruntime.Must(external_metrics.AddToScheme(scheme)) utilruntime.Must(v1beta1.AddToScheme(scheme)) utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion)) } metrics-0.29.0/pkg/apis/external_metrics/register.go000066400000000000000000000031241453636773000225260ustar00rootroot00000000000000/* 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 external_metrics import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName is the group name use in this package const GroupName = "external.metrics.k8s.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} // Kind takes an unqualified kind and returns back a Group qualified GroupKind func Kind(kind string) schema.GroupKind { return SchemeGroupVersion.WithKind(kind).GroupKind() } // Resource takes an unqualified resource and returns back a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) AddToScheme = SchemeBuilder.AddToScheme ) func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &ExternalMetricValue{}, &ExternalMetricValueList{}, ) return nil } metrics-0.29.0/pkg/apis/external_metrics/types.go000066400000000000000000000037501453636773000220530ustar00rootroot00000000000000/* 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 external_metrics import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // a list of values for a given metric for some set labels type ExternalMetricValueList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` // value of the metric matching a given set of labels Items []ExternalMetricValue `json:"items"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // a metric value for external metric // A single metric value is identified by metric name and a set of string labels. // For one metric there can be multiple values with different sets of labels. type ExternalMetricValue struct { metav1.TypeMeta `json:",inline"` // the name of the metric MetricName string `json:"metricName"` // a set of labels that identify a single time series for the metric MetricLabels map[string]string `json:"metricLabels"` // indicates the time at which the metrics were produced Timestamp metav1.Time `json:"timestamp"` // indicates the window ([Timestamp-Window, Timestamp]) from // which these metrics were calculated, when returning rate // metrics calculated from cumulative metrics (or zero for // non-calculated instantaneous metrics). WindowSeconds *int64 `json:"window,omitempty"` // the value of the metric Value resource.Quantity `json:"value"` } metrics-0.29.0/pkg/apis/external_metrics/v1beta1/000077500000000000000000000000001453636773000216165ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/external_metrics/v1beta1/doc.go000066400000000000000000000015431453636773000227150ustar00rootroot00000000000000/* 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. */ // +k8s:deepcopy-gen=package // +k8s:protobuf-gen=package // +k8s:conversion-gen=k8s.io/metrics/pkg/apis/external_metrics // +k8s:openapi-gen=true // Package v1beta1 is the v1beta1 version of the external metrics API. package v1beta1 // import "k8s.io/metrics/pkg/apis/external_metrics/v1beta1" metrics-0.29.0/pkg/apis/external_metrics/v1beta1/generated.pb.go000066400000000000000000000576671453636773000245300ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/external_metrics/v1beta1/generated.proto package v1beta1 import ( fmt "fmt" io "io" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" math "math" math_bits "math/bits" reflect "reflect" strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package func (m *ExternalMetricValue) Reset() { *m = ExternalMetricValue{} } func (*ExternalMetricValue) ProtoMessage() {} func (*ExternalMetricValue) Descriptor() ([]byte, []int) { return fileDescriptor_76ac204ccf814641, []int{0} } func (m *ExternalMetricValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ExternalMetricValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *ExternalMetricValue) XXX_Merge(src proto.Message) { xxx_messageInfo_ExternalMetricValue.Merge(m, src) } func (m *ExternalMetricValue) XXX_Size() int { return m.Size() } func (m *ExternalMetricValue) XXX_DiscardUnknown() { xxx_messageInfo_ExternalMetricValue.DiscardUnknown(m) } var xxx_messageInfo_ExternalMetricValue proto.InternalMessageInfo func (m *ExternalMetricValueList) Reset() { *m = ExternalMetricValueList{} } func (*ExternalMetricValueList) ProtoMessage() {} func (*ExternalMetricValueList) Descriptor() ([]byte, []int) { return fileDescriptor_76ac204ccf814641, []int{1} } func (m *ExternalMetricValueList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ExternalMetricValueList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *ExternalMetricValueList) XXX_Merge(src proto.Message) { xxx_messageInfo_ExternalMetricValueList.Merge(m, src) } func (m *ExternalMetricValueList) XXX_Size() int { return m.Size() } func (m *ExternalMetricValueList) XXX_DiscardUnknown() { xxx_messageInfo_ExternalMetricValueList.DiscardUnknown(m) } var xxx_messageInfo_ExternalMetricValueList proto.InternalMessageInfo func init() { proto.RegisterType((*ExternalMetricValue)(nil), "k8s.io.metrics.pkg.apis.external_metrics.v1beta1.ExternalMetricValue") proto.RegisterMapType((map[string]string)(nil), "k8s.io.metrics.pkg.apis.external_metrics.v1beta1.ExternalMetricValue.MetricLabelsEntry") proto.RegisterType((*ExternalMetricValueList)(nil), "k8s.io.metrics.pkg.apis.external_metrics.v1beta1.ExternalMetricValueList") } func init() { proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/external_metrics/v1beta1/generated.proto", fileDescriptor_76ac204ccf814641) } var fileDescriptor_76ac204ccf814641 = []byte{ // 554 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4d, 0x6b, 0x1b, 0x3d, 0x10, 0xc7, 0x2d, 0xfb, 0xf1, 0x43, 0xac, 0x24, 0x10, 0xab, 0x81, 0x1a, 0x1f, 0xd6, 0x26, 0x27, 0xb7, 0x50, 0x29, 0x36, 0xa5, 0x84, 0x5e, 0x0a, 0x0b, 0x3e, 0x14, 0xe2, 0x42, 0x37, 0x21, 0xa1, 0x2f, 0x50, 0xe4, 0xf5, 0x74, 0xad, 0xda, 0xfb, 0x82, 0xa4, 0x75, 0xea, 0x5b, 0x3f, 0x42, 0xfb, 0xad, 0x7c, 0xcc, 0x31, 0x27, 0x53, 0x6f, 0x3e, 0x46, 0x2f, 0x65, 0xdf, 0x62, 0xd7, 0x4e, 0x13, 0x02, 0xbd, 0xed, 0x68, 0x34, 0xff, 0xf9, 0xcd, 0x5f, 0xc3, 0xe2, 0x77, 0xa3, 0x23, 0x45, 0x85, 0xcf, 0x46, 0x61, 0x1f, 0xa4, 0x07, 0x1a, 0x14, 0x9b, 0x80, 0x37, 0xf0, 0x25, 0xcb, 0x12, 0x2e, 0x68, 0x29, 0x6c, 0xc5, 0x82, 0x91, 0xc3, 0x78, 0x20, 0x14, 0x83, 0xaf, 0x1a, 0xa4, 0xc7, 0xc7, 0x9f, 0xf2, 0xcc, 0xa4, 0xdd, 0x07, 0xcd, 0xdb, 0xcc, 0x01, 0x0f, 0x24, 0xd7, 0x30, 0xa0, 0x81, 0xf4, 0xb5, 0x4f, 0x0e, 0x53, 0x05, 0x9a, 0xdd, 0xa3, 0xc1, 0xc8, 0xa1, 0xb1, 0x02, 0x5d, 0x57, 0xa0, 0x99, 0x42, 0xfd, 0x99, 0x23, 0xf4, 0x30, 0xec, 0x53, 0xdb, 0x77, 0x99, 0xe3, 0x3b, 0x3e, 0x4b, 0x84, 0xfa, 0xe1, 0xe7, 0x24, 0x4a, 0x82, 0xe4, 0x2b, 0x6d, 0x50, 0x7f, 0x9e, 0x21, 0xf2, 0x40, 0xb8, 0xdc, 0x1e, 0x0a, 0x0f, 0xe4, 0x34, 0xe7, 0x64, 0x12, 0x94, 0x1f, 0x4a, 0x1b, 0xd6, 0xb1, 0xee, 0xac, 0x52, 0xf1, 0xb8, 0x9c, 0x4d, 0x36, 0x86, 0xa9, 0xb3, 0xbf, 0x55, 0xc9, 0xd0, 0xd3, 0xc2, 0xdd, 0x6c, 0xf3, 0xe2, 0xbe, 0x02, 0x65, 0x0f, 0xc1, 0xe5, 0xeb, 0x75, 0x07, 0xbf, 0x4a, 0xf8, 0x51, 0x37, 0x33, 0xa8, 0x97, 0xf8, 0x73, 0xc6, 0xc7, 0x21, 0x90, 0x0e, 0xc6, 0xa9, 0x5d, 0x6f, 0xb8, 0x0b, 0x35, 0xd4, 0x44, 0xad, 0x8a, 0x49, 0x66, 0xf3, 0x46, 0x21, 0x9a, 0x37, 0x70, 0xef, 0x26, 0x63, 0xad, 0xdc, 0x22, 0x3f, 0x10, 0xde, 0x49, 0xc3, 0x63, 0xde, 0x87, 0xb1, 0xaa, 0x15, 0x9b, 0xa5, 0xd6, 0x76, 0xe7, 0x9c, 0x3e, 0xf4, 0x65, 0xe8, 0x2d, 0x44, 0xb4, 0xb7, 0xa2, 0xdc, 0xf5, 0xb4, 0x9c, 0x9a, 0xfb, 0x19, 0xcf, 0xce, 0x6a, 0xca, 0xfa, 0x03, 0x81, 0x7c, 0xc0, 0x95, 0x78, 0x7c, 0xa5, 0xb9, 0x1b, 0xd4, 0x4a, 0x4d, 0xd4, 0xda, 0xee, 0x3c, 0xcd, 0x79, 0x56, 0xbd, 0x5a, 0x42, 0xc5, 0x4f, 0x42, 0x27, 0x6d, 0x7a, 0x2a, 0x5c, 0x30, 0xab, 0x59, 0x8b, 0xca, 0x69, 0x2e, 0x62, 0x2d, 0xf5, 0xc8, 0x13, 0xfc, 0xff, 0x85, 0xf0, 0x06, 0xfe, 0x45, 0xed, 0xbf, 0x26, 0x6a, 0x95, 0xcc, 0x6a, 0x34, 0x6f, 0xec, 0x9e, 0x27, 0x27, 0x27, 0x60, 0xfb, 0xde, 0x40, 0x59, 0xd9, 0x05, 0x72, 0x82, 0xcb, 0x93, 0x78, 0x8c, 0x5a, 0x39, 0x61, 0xa0, 0x77, 0x31, 0xd0, 0x7c, 0x99, 0xe8, 0xdb, 0x90, 0x7b, 0x5a, 0xe8, 0xa9, 0xb9, 0x9b, 0x71, 0x94, 0x13, 0x2f, 0xac, 0x54, 0xab, 0xfe, 0x0a, 0x57, 0x37, 0x5c, 0x21, 0x7b, 0xb8, 0x34, 0x82, 0x69, 0xfa, 0x64, 0x56, 0xfc, 0x49, 0xf6, 0xf3, 0xde, 0xc5, 0xe4, 0x2c, 0x0d, 0x5e, 0x16, 0x8f, 0xd0, 0xc1, 0x35, 0xc2, 0x8f, 0x6f, 0xf1, 0xfa, 0x58, 0x28, 0x4d, 0x3e, 0xe2, 0xad, 0xd8, 0x8a, 0x01, 0xd7, 0x3c, 0x11, 0xbb, 0x07, 0x7a, 0x69, 0x5c, 0x5c, 0xdd, 0x03, 0xcd, 0xcd, 0xbd, 0x0c, 0x7a, 0x2b, 0x3f, 0xb1, 0x6e, 0x14, 0xc9, 0x17, 0x5c, 0x16, 0x1a, 0xdc, 0x7c, 0x47, 0xba, 0xff, 0x64, 0x47, 0x96, 0x36, 0xbd, 0x8e, 0xb5, 0xad, 0xb4, 0x85, 0x79, 0x36, 0x5b, 0x18, 0x85, 0xcb, 0x85, 0x51, 0xb8, 0x5a, 0x18, 0x85, 0x6f, 0x91, 0x81, 0x66, 0x91, 0x81, 0x2e, 0x23, 0x03, 0x5d, 0x45, 0x06, 0xfa, 0x19, 0x19, 0xe8, 0xfb, 0xb5, 0x51, 0x78, 0x7f, 0xf8, 0xd0, 0x3f, 0xd0, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x49, 0x7d, 0xf4, 0x2a, 0xcd, 0x04, 0x00, 0x00, } func (m *ExternalMetricValue) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ExternalMetricValue) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ExternalMetricValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a if m.WindowSeconds != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.WindowSeconds)) i-- dAtA[i] = 0x20 } { size, err := m.Timestamp.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a if len(m.MetricLabels) > 0 { keysForMetricLabels := make([]string, 0, len(m.MetricLabels)) for k := range m.MetricLabels { keysForMetricLabels = append(keysForMetricLabels, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForMetricLabels) for iNdEx := len(keysForMetricLabels) - 1; iNdEx >= 0; iNdEx-- { v := m.MetricLabels[string(keysForMetricLabels[iNdEx])] baseI := i i -= len(v) copy(dAtA[i:], v) i = encodeVarintGenerated(dAtA, i, uint64(len(v))) i-- dAtA[i] = 0x12 i -= len(keysForMetricLabels[iNdEx]) copy(dAtA[i:], keysForMetricLabels[iNdEx]) i = encodeVarintGenerated(dAtA, i, uint64(len(keysForMetricLabels[iNdEx]))) i-- dAtA[i] = 0xa i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0x12 } } i -= len(m.MetricName) copy(dAtA[i:], m.MetricName) i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricName))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *ExternalMetricValueList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ExternalMetricValueList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ExternalMetricValueList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Items) > 0 { for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } { size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { offset -= sovGenerated(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) return base } func (m *ExternalMetricValue) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.MetricName) n += 1 + l + sovGenerated(uint64(l)) if len(m.MetricLabels) > 0 { for k, v := range m.MetricLabels { _ = k _ = v mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } l = m.Timestamp.Size() n += 1 + l + sovGenerated(uint64(l)) if m.WindowSeconds != nil { n += 1 + sovGenerated(uint64(*m.WindowSeconds)) } l = m.Value.Size() n += 1 + l + sovGenerated(uint64(l)) return n } func (m *ExternalMetricValueList) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Items) > 0 { for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func sovGenerated(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozGenerated(x uint64) (n int) { return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *ExternalMetricValue) String() string { if this == nil { return "nil" } keysForMetricLabels := make([]string, 0, len(this.MetricLabels)) for k := range this.MetricLabels { keysForMetricLabels = append(keysForMetricLabels, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForMetricLabels) mapStringForMetricLabels := "map[string]string{" for _, k := range keysForMetricLabels { mapStringForMetricLabels += fmt.Sprintf("%v: %v,", k, this.MetricLabels[k]) } mapStringForMetricLabels += "}" s := strings.Join([]string{`&ExternalMetricValue{`, `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, `MetricLabels:` + mapStringForMetricLabels + `,`, `Timestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, `WindowSeconds:` + valueToStringGenerated(this.WindowSeconds) + `,`, `Value:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Value), "Quantity", "resource.Quantity", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } func (this *ExternalMetricValueList) String() string { if this == nil { return "nil" } repeatedStringForItems := "[]ExternalMetricValue{" for _, f := range this.Items { repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ExternalMetricValue", "ExternalMetricValue", 1), `&`, ``, 1) + "," } repeatedStringForItems += "}" s := strings.Join([]string{`&ExternalMetricValueList{`, `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, `Items:` + repeatedStringForItems + `,`, `}`, }, "") return s } func valueToStringGenerated(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } func (m *ExternalMetricValue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ExternalMetricValue: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ExternalMetricValue: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MetricName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.MetricName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MetricLabels", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if m.MetricLabels == nil { m.MetricLabels = make(map[string]string) } var mapkey string var mapvalue string for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthGenerated } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthGenerated } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var stringLenmapvalue uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapvalue |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapvalue := int(stringLenmapvalue) if intStringLenmapvalue < 0 { return ErrInvalidLengthGenerated } postStringIndexmapvalue := iNdEx + intStringLenmapvalue if postStringIndexmapvalue < 0 { return ErrInvalidLengthGenerated } if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.MetricLabels[mapkey] = mapvalue iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field WindowSeconds", wireType) } var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int64(b&0x7F) << shift if b < 0x80 { break } } m.WindowSeconds = &v case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *ExternalMetricValueList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ExternalMetricValueList: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ExternalMetricValueList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Items = append(m.Items, ExternalMetricValue{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipGenerated(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } case 1: iNdEx += 8 case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if length < 0 { return 0, ErrInvalidLengthGenerated } iNdEx += length case 3: depth++ case 4: if depth == 0 { return 0, ErrUnexpectedEndOfGroupGenerated } depth-- case 5: iNdEx += 4 default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { return 0, ErrInvalidLengthGenerated } if depth == 0 { return iNdEx, nil } } return 0, io.ErrUnexpectedEOF } var ( ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") ) metrics-0.29.0/pkg/apis/external_metrics/v1beta1/generated.proto000066400000000000000000000044021453636773000246410ustar00rootroot00000000000000/* Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // This file was autogenerated by go-to-protobuf. Do not edit it manually! syntax = "proto2"; package k8s.io.metrics.pkg.apis.external_metrics.v1beta1; import "k8s.io/apimachinery/pkg/api/resource/generated.proto"; import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; // Package-wide variables from generator "generated". option go_package = "k8s.io/metrics/pkg/apis/external_metrics/v1beta1"; // ExternalMetricValue is a metric value for external metric // A single metric value is identified by metric name and a set of string labels. // For one metric there can be multiple values with different sets of labels. message ExternalMetricValue { // the name of the metric optional string metricName = 1; // a set of labels that identify a single time series for the metric map metricLabels = 2; // indicates the time at which the metrics were produced optional k8s.io.apimachinery.pkg.apis.meta.v1.Time timestamp = 3; // indicates the window ([Timestamp-Window, Timestamp]) from // which these metrics were calculated, when returning rate // metrics calculated from cumulative metrics (or zero for // non-calculated instantaneous metrics). optional int64 window = 4; // the value of the metric optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 5; } // ExternalMetricValueList is a list of values for a given metric for some set labels message ExternalMetricValueList { optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // value of the metric matching a given set of labels repeated ExternalMetricValue items = 2; } metrics-0.29.0/pkg/apis/external_metrics/v1beta1/register.go000066400000000000000000000032261453636773000237740ustar00rootroot00000000000000/* 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 v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName is the group name use in this package const GroupName = "external.metrics.k8s.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( // SchemeBuilder points to a list of functions added to Scheme. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) localSchemeBuilder = &SchemeBuilder // AddToScheme applies all the stored functions to the scheme. AddToScheme = localSchemeBuilder.AddToScheme ) func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &ExternalMetricValue{}, &ExternalMetricValueList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil } metrics-0.29.0/pkg/apis/external_metrics/v1beta1/types.go000066400000000000000000000044071453636773000233160ustar00rootroot00000000000000/* 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 v1beta1 import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ExternalMetricValueList is a list of values for a given metric for some set labels type ExternalMetricValueList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // value of the metric matching a given set of labels Items []ExternalMetricValue `json:"items" protobuf:"bytes,2,rep,name=items"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ExternalMetricValue is a metric value for external metric // A single metric value is identified by metric name and a set of string labels. // For one metric there can be multiple values with different sets of labels. type ExternalMetricValue struct { metav1.TypeMeta `json:",inline"` // the name of the metric MetricName string `json:"metricName" protobuf:"bytes,1,name=metricName"` // a set of labels that identify a single time series for the metric MetricLabels map[string]string `json:"metricLabels" protobuf:"bytes,2,rep,name=metricLabels"` // indicates the time at which the metrics were produced Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,3,name=timestamp"` // indicates the window ([Timestamp-Window, Timestamp]) from // which these metrics were calculated, when returning rate // metrics calculated from cumulative metrics (or zero for // non-calculated instantaneous metrics). WindowSeconds *int64 `json:"window,omitempty" protobuf:"bytes,4,opt,name=window"` // the value of the metric Value resource.Quantity `json:"value" protobuf:"bytes,5,name=value"` } metrics-0.29.0/pkg/apis/external_metrics/v1beta1/zz_generated.conversion.go000066400000000000000000000131741453636773000270200ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by conversion-gen. DO NOT EDIT. package v1beta1 import ( unsafe "unsafe" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" externalmetrics "k8s.io/metrics/pkg/apis/external_metrics" ) func init() { localSchemeBuilder.Register(RegisterConversions) } // RegisterConversions adds conversion functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterConversions(s *runtime.Scheme) error { if err := s.AddGeneratedConversionFunc((*ExternalMetricValue)(nil), (*externalmetrics.ExternalMetricValue)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_ExternalMetricValue_To_external_metrics_ExternalMetricValue(a.(*ExternalMetricValue), b.(*externalmetrics.ExternalMetricValue), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*externalmetrics.ExternalMetricValue)(nil), (*ExternalMetricValue)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_external_metrics_ExternalMetricValue_To_v1beta1_ExternalMetricValue(a.(*externalmetrics.ExternalMetricValue), b.(*ExternalMetricValue), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*ExternalMetricValueList)(nil), (*externalmetrics.ExternalMetricValueList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_ExternalMetricValueList_To_external_metrics_ExternalMetricValueList(a.(*ExternalMetricValueList), b.(*externalmetrics.ExternalMetricValueList), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*externalmetrics.ExternalMetricValueList)(nil), (*ExternalMetricValueList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList(a.(*externalmetrics.ExternalMetricValueList), b.(*ExternalMetricValueList), scope) }); err != nil { return err } return nil } func autoConvert_v1beta1_ExternalMetricValue_To_external_metrics_ExternalMetricValue(in *ExternalMetricValue, out *externalmetrics.ExternalMetricValue, s conversion.Scope) error { out.MetricName = in.MetricName out.MetricLabels = *(*map[string]string)(unsafe.Pointer(&in.MetricLabels)) out.Timestamp = in.Timestamp out.WindowSeconds = (*int64)(unsafe.Pointer(in.WindowSeconds)) out.Value = in.Value return nil } // Convert_v1beta1_ExternalMetricValue_To_external_metrics_ExternalMetricValue is an autogenerated conversion function. func Convert_v1beta1_ExternalMetricValue_To_external_metrics_ExternalMetricValue(in *ExternalMetricValue, out *externalmetrics.ExternalMetricValue, s conversion.Scope) error { return autoConvert_v1beta1_ExternalMetricValue_To_external_metrics_ExternalMetricValue(in, out, s) } func autoConvert_external_metrics_ExternalMetricValue_To_v1beta1_ExternalMetricValue(in *externalmetrics.ExternalMetricValue, out *ExternalMetricValue, s conversion.Scope) error { out.MetricName = in.MetricName out.MetricLabels = *(*map[string]string)(unsafe.Pointer(&in.MetricLabels)) out.Timestamp = in.Timestamp out.WindowSeconds = (*int64)(unsafe.Pointer(in.WindowSeconds)) out.Value = in.Value return nil } // Convert_external_metrics_ExternalMetricValue_To_v1beta1_ExternalMetricValue is an autogenerated conversion function. func Convert_external_metrics_ExternalMetricValue_To_v1beta1_ExternalMetricValue(in *externalmetrics.ExternalMetricValue, out *ExternalMetricValue, s conversion.Scope) error { return autoConvert_external_metrics_ExternalMetricValue_To_v1beta1_ExternalMetricValue(in, out, s) } func autoConvert_v1beta1_ExternalMetricValueList_To_external_metrics_ExternalMetricValueList(in *ExternalMetricValueList, out *externalmetrics.ExternalMetricValueList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]externalmetrics.ExternalMetricValue)(unsafe.Pointer(&in.Items)) return nil } // Convert_v1beta1_ExternalMetricValueList_To_external_metrics_ExternalMetricValueList is an autogenerated conversion function. func Convert_v1beta1_ExternalMetricValueList_To_external_metrics_ExternalMetricValueList(in *ExternalMetricValueList, out *externalmetrics.ExternalMetricValueList, s conversion.Scope) error { return autoConvert_v1beta1_ExternalMetricValueList_To_external_metrics_ExternalMetricValueList(in, out, s) } func autoConvert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList(in *externalmetrics.ExternalMetricValueList, out *ExternalMetricValueList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]ExternalMetricValue)(unsafe.Pointer(&in.Items)) return nil } // Convert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList is an autogenerated conversion function. func Convert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList(in *externalmetrics.ExternalMetricValueList, out *ExternalMetricValueList, s conversion.Scope) error { return autoConvert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList(in, out, s) } metrics-0.29.0/pkg/apis/external_metrics/v1beta1/zz_generated.deepcopy.go000066400000000000000000000054701453636773000264430ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by deepcopy-gen. DO NOT EDIT. package v1beta1 import ( runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExternalMetricValue) DeepCopyInto(out *ExternalMetricValue) { *out = *in out.TypeMeta = in.TypeMeta if in.MetricLabels != nil { in, out := &in.MetricLabels, &out.MetricLabels *out = make(map[string]string, len(*in)) for key, val := range *in { (*out)[key] = val } } in.Timestamp.DeepCopyInto(&out.Timestamp) if in.WindowSeconds != nil { in, out := &in.WindowSeconds, &out.WindowSeconds *out = new(int64) **out = **in } out.Value = in.Value.DeepCopy() return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalMetricValue. func (in *ExternalMetricValue) DeepCopy() *ExternalMetricValue { if in == nil { return nil } out := new(ExternalMetricValue) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *ExternalMetricValue) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExternalMetricValueList) DeepCopyInto(out *ExternalMetricValueList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]ExternalMetricValue, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalMetricValueList. func (in *ExternalMetricValueList) DeepCopy() *ExternalMetricValueList { if in == nil { return nil } out := new(ExternalMetricValueList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *ExternalMetricValueList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } metrics-0.29.0/pkg/apis/external_metrics/zz_generated.deepcopy.go000066400000000000000000000055011453636773000251730ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by deepcopy-gen. DO NOT EDIT. package external_metrics import ( runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExternalMetricValue) DeepCopyInto(out *ExternalMetricValue) { *out = *in out.TypeMeta = in.TypeMeta if in.MetricLabels != nil { in, out := &in.MetricLabels, &out.MetricLabels *out = make(map[string]string, len(*in)) for key, val := range *in { (*out)[key] = val } } in.Timestamp.DeepCopyInto(&out.Timestamp) if in.WindowSeconds != nil { in, out := &in.WindowSeconds, &out.WindowSeconds *out = new(int64) **out = **in } out.Value = in.Value.DeepCopy() return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalMetricValue. func (in *ExternalMetricValue) DeepCopy() *ExternalMetricValue { if in == nil { return nil } out := new(ExternalMetricValue) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *ExternalMetricValue) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExternalMetricValueList) DeepCopyInto(out *ExternalMetricValueList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]ExternalMetricValue, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalMetricValueList. func (in *ExternalMetricValueList) DeepCopy() *ExternalMetricValueList { if in == nil { return nil } out := new(ExternalMetricValueList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *ExternalMetricValueList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } metrics-0.29.0/pkg/apis/metrics/000077500000000000000000000000001453636773000164515ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/metrics/doc.go000066400000000000000000000013521453636773000175460ustar00rootroot00000000000000/* 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. */ // +k8s:deepcopy-gen=package // +groupName=metrics.k8s.io // Package metrics defines an API for exposing metrics. package metrics // import "k8s.io/metrics/pkg/apis/metrics" metrics-0.29.0/pkg/apis/metrics/install/000077500000000000000000000000001453636773000201175ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/metrics/install/install.go000066400000000000000000000022261453636773000221160ustar00rootroot00000000000000/* 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 install installs the experimental API group, making it available as // an option to all of the API encoding/decoding machinery. package install import ( "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/metrics/pkg/apis/metrics" "k8s.io/metrics/pkg/apis/metrics/v1beta1" ) // Install registers the API group and adds types to a scheme func Install(scheme *runtime.Scheme) { utilruntime.Must(metrics.AddToScheme(scheme)) utilruntime.Must(v1beta1.AddToScheme(scheme)) utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion)) } metrics-0.29.0/pkg/apis/metrics/register.go000066400000000000000000000034441453636773000206310ustar00rootroot00000000000000/* 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 metrics import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName is the group name use in this package const GroupName = "metrics.k8s.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} // Kind takes an unqualified kind and returns back a Group qualified GroupKind func Kind(kind string) schema.GroupKind { return SchemeGroupVersion.WithKind(kind).GroupKind() } // Resource takes an unqualified resource and returns back a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( // SchemeBuilder is the scheme builder with scheme init functions to run for this API package SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) // AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme AddToScheme = SchemeBuilder.AddToScheme ) func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &NodeMetrics{}, &NodeMetricsList{}, &PodMetrics{}, &PodMetricsList{}, ) return nil } metrics-0.29.0/pkg/apis/metrics/types.go000066400000000000000000000057541453636773000201570ustar00rootroot00000000000000/* 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 metrics import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // +genclient // +resourceName=nodes // +genclient:readonly // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // NodeMetrics sets resource usage metrics of a node. type NodeMetrics struct { metav1.TypeMeta // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta // The following fields define time interval from which metrics were // collected from the interval [Timestamp-Window, Timestamp]. Timestamp metav1.Time Window metav1.Duration // The memory usage is the memory working set. Usage corev1.ResourceList } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // NodeMetricsList is a list of NodeMetrics. type NodeMetricsList struct { metav1.TypeMeta // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds metav1.ListMeta // List of node metrics. Items []NodeMetrics } // +genclient // +resourceName=pods // +genclient:readonly // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodMetrics sets resource usage metrics of a pod. type PodMetrics struct { metav1.TypeMeta // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta // The following fields define time interval from which metrics were // collected from the interval [Timestamp-Window, Timestamp]. Timestamp metav1.Time Window metav1.Duration // Metrics for all containers are collected within the same time window. Containers []ContainerMetrics } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodMetricsList is a list of PodMetrics. type PodMetricsList struct { metav1.TypeMeta // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds metav1.ListMeta // List of pod metrics. Items []PodMetrics } // ContainerMetrics sets resource usage metrics of a container. type ContainerMetrics struct { // Container name corresponding to the one from pod.spec.containers. Name string // The memory usage is the memory working set. Usage corev1.ResourceList } metrics-0.29.0/pkg/apis/metrics/v1alpha1/000077500000000000000000000000001453636773000200665ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/metrics/v1alpha1/doc.go000066400000000000000000000015511453636773000211640ustar00rootroot00000000000000/* 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. */ // +k8s:deepcopy-gen=package // +k8s:protobuf-gen=package // +k8s:conversion-gen=k8s.io/metrics/pkg/apis/metrics // +k8s:openapi-gen=true // +groupName=metrics.k8s.io // Package v1alpha1 is the v1alpha1 version of the metrics API. package v1alpha1 // import "k8s.io/metrics/pkg/apis/metrics/v1alpha1" metrics-0.29.0/pkg/apis/metrics/v1alpha1/generated.pb.go000066400000000000000000001314571453636773000227660ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/generated.proto package v1alpha1 import ( fmt "fmt" io "io" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_api_resource "k8s.io/apimachinery/pkg/api/resource" resource "k8s.io/apimachinery/pkg/api/resource" math "math" math_bits "math/bits" reflect "reflect" strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package func (m *ContainerMetrics) Reset() { *m = ContainerMetrics{} } func (*ContainerMetrics) ProtoMessage() {} func (*ContainerMetrics) Descriptor() ([]byte, []int) { return fileDescriptor_4bcbecebae081ea6, []int{0} } func (m *ContainerMetrics) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ContainerMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *ContainerMetrics) XXX_Merge(src proto.Message) { xxx_messageInfo_ContainerMetrics.Merge(m, src) } func (m *ContainerMetrics) XXX_Size() int { return m.Size() } func (m *ContainerMetrics) XXX_DiscardUnknown() { xxx_messageInfo_ContainerMetrics.DiscardUnknown(m) } var xxx_messageInfo_ContainerMetrics proto.InternalMessageInfo func (m *NodeMetrics) Reset() { *m = NodeMetrics{} } func (*NodeMetrics) ProtoMessage() {} func (*NodeMetrics) Descriptor() ([]byte, []int) { return fileDescriptor_4bcbecebae081ea6, []int{1} } func (m *NodeMetrics) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *NodeMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *NodeMetrics) XXX_Merge(src proto.Message) { xxx_messageInfo_NodeMetrics.Merge(m, src) } func (m *NodeMetrics) XXX_Size() int { return m.Size() } func (m *NodeMetrics) XXX_DiscardUnknown() { xxx_messageInfo_NodeMetrics.DiscardUnknown(m) } var xxx_messageInfo_NodeMetrics proto.InternalMessageInfo func (m *NodeMetricsList) Reset() { *m = NodeMetricsList{} } func (*NodeMetricsList) ProtoMessage() {} func (*NodeMetricsList) Descriptor() ([]byte, []int) { return fileDescriptor_4bcbecebae081ea6, []int{2} } func (m *NodeMetricsList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *NodeMetricsList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *NodeMetricsList) XXX_Merge(src proto.Message) { xxx_messageInfo_NodeMetricsList.Merge(m, src) } func (m *NodeMetricsList) XXX_Size() int { return m.Size() } func (m *NodeMetricsList) XXX_DiscardUnknown() { xxx_messageInfo_NodeMetricsList.DiscardUnknown(m) } var xxx_messageInfo_NodeMetricsList proto.InternalMessageInfo func (m *PodMetrics) Reset() { *m = PodMetrics{} } func (*PodMetrics) ProtoMessage() {} func (*PodMetrics) Descriptor() ([]byte, []int) { return fileDescriptor_4bcbecebae081ea6, []int{3} } func (m *PodMetrics) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *PodMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *PodMetrics) XXX_Merge(src proto.Message) { xxx_messageInfo_PodMetrics.Merge(m, src) } func (m *PodMetrics) XXX_Size() int { return m.Size() } func (m *PodMetrics) XXX_DiscardUnknown() { xxx_messageInfo_PodMetrics.DiscardUnknown(m) } var xxx_messageInfo_PodMetrics proto.InternalMessageInfo func (m *PodMetricsList) Reset() { *m = PodMetricsList{} } func (*PodMetricsList) ProtoMessage() {} func (*PodMetricsList) Descriptor() ([]byte, []int) { return fileDescriptor_4bcbecebae081ea6, []int{4} } func (m *PodMetricsList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *PodMetricsList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *PodMetricsList) XXX_Merge(src proto.Message) { xxx_messageInfo_PodMetricsList.Merge(m, src) } func (m *PodMetricsList) XXX_Size() int { return m.Size() } func (m *PodMetricsList) XXX_DiscardUnknown() { xxx_messageInfo_PodMetricsList.DiscardUnknown(m) } var xxx_messageInfo_PodMetricsList proto.InternalMessageInfo func init() { proto.RegisterType((*ContainerMetrics)(nil), "k8s.io.metrics.pkg.apis.metrics.v1alpha1.ContainerMetrics") proto.RegisterMapType((k8s_io_api_core_v1.ResourceList)(nil), "k8s.io.metrics.pkg.apis.metrics.v1alpha1.ContainerMetrics.UsageEntry") proto.RegisterType((*NodeMetrics)(nil), "k8s.io.metrics.pkg.apis.metrics.v1alpha1.NodeMetrics") proto.RegisterMapType((k8s_io_api_core_v1.ResourceList)(nil), "k8s.io.metrics.pkg.apis.metrics.v1alpha1.NodeMetrics.UsageEntry") proto.RegisterType((*NodeMetricsList)(nil), "k8s.io.metrics.pkg.apis.metrics.v1alpha1.NodeMetricsList") proto.RegisterType((*PodMetrics)(nil), "k8s.io.metrics.pkg.apis.metrics.v1alpha1.PodMetrics") proto.RegisterType((*PodMetricsList)(nil), "k8s.io.metrics.pkg.apis.metrics.v1alpha1.PodMetricsList") } func init() { proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/generated.proto", fileDescriptor_4bcbecebae081ea6) } var fileDescriptor_4bcbecebae081ea6 = []byte{ // 661 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0x41, 0x4f, 0x13, 0x41, 0x18, 0xed, 0xd0, 0x96, 0xc0, 0x54, 0x11, 0xf7, 0x44, 0x7a, 0xd8, 0x92, 0x9e, 0x1a, 0x13, 0x66, 0x85, 0xa0, 0x21, 0x9c, 0xcc, 0x0a, 0x07, 0x13, 0x41, 0xd9, 0xa0, 0x46, 0xf4, 0xe0, 0x74, 0x3b, 0x6e, 0xc7, 0xb2, 0x3b, 0x9b, 0x99, 0xd9, 0x92, 0xde, 0x8c, 0x7a, 0xf2, 0x64, 0xe2, 0x9f, 0xc2, 0x78, 0xe1, 0xc8, 0x45, 0x90, 0xf5, 0xee, 0x0f, 0xf0, 0x64, 0x76, 0x76, 0xb6, 0x5b, 0x29, 0xc2, 0xca, 0xc1, 0x13, 0xb7, 0xee, 0x37, 0xf3, 0xde, 0xfb, 0xe6, 0x7d, 0x6f, 0x26, 0x85, 0x5b, 0xbd, 0x15, 0x81, 0x28, 0xb3, 0x7a, 0x51, 0x9b, 0xf0, 0x80, 0x48, 0x22, 0xac, 0x3e, 0x09, 0x3a, 0x8c, 0x5b, 0x7a, 0xc1, 0x27, 0x92, 0x53, 0x57, 0x58, 0x61, 0xcf, 0xb3, 0x70, 0x48, 0xc5, 0xb0, 0xd0, 0x5f, 0xc4, 0xbb, 0x61, 0x17, 0x2f, 0x5a, 0x1e, 0x09, 0x08, 0xc7, 0x92, 0x74, 0x50, 0xc8, 0x99, 0x64, 0x46, 0x2b, 0x45, 0x22, 0xbd, 0x11, 0x85, 0x3d, 0x0f, 0x25, 0xc8, 0x61, 0x21, 0x43, 0xd6, 0x17, 0x3c, 0x2a, 0xbb, 0x51, 0x1b, 0xb9, 0xcc, 0xb7, 0x3c, 0xe6, 0x31, 0x4b, 0x11, 0xb4, 0xa3, 0xd7, 0xea, 0x4b, 0x7d, 0xa8, 0x5f, 0x29, 0x71, 0xbd, 0xa9, 0x5b, 0xc2, 0x21, 0xb5, 0x5c, 0xc6, 0x89, 0xd5, 0x1f, 0x13, 0xaf, 0x2f, 0xe7, 0x7b, 0x7c, 0xec, 0x76, 0x69, 0x40, 0xf8, 0x20, 0xeb, 0xdd, 0xe2, 0x44, 0xb0, 0x88, 0xbb, 0xe4, 0x9f, 0x50, 0xea, 0xc4, 0xf8, 0x2c, 0x2d, 0xeb, 0x6f, 0x28, 0x1e, 0x05, 0x92, 0xfa, 0xe3, 0x32, 0x77, 0x2f, 0x02, 0x08, 0xb7, 0x4b, 0x7c, 0x7c, 0x1a, 0xd7, 0x7c, 0x5f, 0x86, 0xb3, 0xf7, 0x59, 0x20, 0x71, 0x82, 0xd8, 0x48, 0x5d, 0x34, 0xe6, 0x61, 0x25, 0xc0, 0x3e, 0x99, 0x03, 0xf3, 0xa0, 0x35, 0x6d, 0x5f, 0xdb, 0x3f, 0x6a, 0x94, 0xe2, 0xa3, 0x46, 0x65, 0x13, 0xfb, 0xc4, 0x51, 0x2b, 0x46, 0x0c, 0x60, 0x35, 0x12, 0xd8, 0x23, 0x73, 0x13, 0xf3, 0xe5, 0x56, 0x6d, 0x69, 0x1d, 0x15, 0x9d, 0x0c, 0x3a, 0xad, 0x86, 0x9e, 0x24, 0x3c, 0xeb, 0x81, 0xe4, 0x03, 0xfb, 0x03, 0xd0, 0x5a, 0x55, 0x55, 0xfc, 0x75, 0xd4, 0x68, 0x8c, 0x0f, 0x06, 0x39, 0xda, 0xeb, 0x87, 0x54, 0xc8, 0x77, 0xc7, 0xe7, 0x6e, 0x49, 0x5a, 0xfe, 0x78, 0xdc, 0x58, 0x28, 0x32, 0x3a, 0xb4, 0x15, 0xe1, 0x40, 0x52, 0x39, 0x70, 0xd2, 0xa3, 0xd5, 0xbb, 0x10, 0xe6, 0xbd, 0x19, 0xb3, 0xb0, 0xdc, 0x23, 0x83, 0xd4, 0x13, 0x27, 0xf9, 0x69, 0xac, 0xc1, 0x6a, 0x1f, 0xef, 0x46, 0x89, 0x07, 0xa0, 0x55, 0x5b, 0x42, 0x99, 0x07, 0xa3, 0x2a, 0x99, 0x11, 0xe8, 0x0c, 0x15, 0x05, 0x5e, 0x9d, 0x58, 0x01, 0xcd, 0x9f, 0x15, 0x58, 0xdb, 0x64, 0x1d, 0x92, 0x0d, 0xe0, 0x15, 0x9c, 0x4a, 0x92, 0xd1, 0xc1, 0x12, 0x2b, 0xc1, 0xda, 0xd2, 0xed, 0xf3, 0xc8, 0x95, 0xcb, 0x18, 0xf5, 0x17, 0xd1, 0xa3, 0xf6, 0x1b, 0xe2, 0xca, 0x0d, 0x22, 0xb1, 0x6d, 0x68, 0x2b, 0x61, 0x5e, 0x73, 0x86, 0xac, 0xc6, 0x0b, 0x38, 0x9d, 0xc4, 0x42, 0x48, 0xec, 0x87, 0xba, 0xff, 0x5b, 0xc5, 0x24, 0xb6, 0xa9, 0x4f, 0xec, 0x9b, 0x9a, 0x7c, 0x7a, 0x3b, 0x23, 0x71, 0x72, 0x3e, 0xe3, 0x29, 0x9c, 0xdc, 0xa3, 0x41, 0x87, 0xed, 0xcd, 0x95, 0x2f, 0x76, 0x26, 0x67, 0x5e, 0x8b, 0x38, 0x96, 0x94, 0x05, 0xf6, 0x8c, 0x66, 0x9f, 0x7c, 0xa6, 0x58, 0x1c, 0xcd, 0x66, 0x7c, 0x1b, 0xa6, 0xae, 0xa2, 0x52, 0x77, 0xaf, 0x78, 0xea, 0x46, 0xdc, 0xbd, 0x0a, 0x1c, 0x68, 0x7e, 0x05, 0xf0, 0xc6, 0x88, 0x25, 0xc9, 0xc1, 0x8c, 0x97, 0x63, 0xa1, 0x2b, 0x38, 0xb7, 0x04, 0xad, 0x22, 0x37, 0xab, 0xcd, 0x9c, 0xca, 0x2a, 0x23, 0x81, 0xdb, 0x81, 0x55, 0x2a, 0x89, 0x2f, 0xf4, 0x83, 0x71, 0xe7, 0x52, 0xa3, 0xb3, 0xaf, 0x67, 0xe3, 0x7a, 0x90, 0x70, 0x39, 0x29, 0x65, 0xf3, 0x73, 0x19, 0xc2, 0xc7, 0xac, 0x73, 0x75, 0x7b, 0xce, 0xbd, 0x3d, 0x01, 0x84, 0x6e, 0xf6, 0xf6, 0x0a, 0x7d, 0x83, 0x56, 0x2f, 0xff, 0x6e, 0xe7, 0x16, 0x0d, 0x57, 0x84, 0x33, 0xa2, 0xd0, 0xfc, 0x02, 0xe0, 0x4c, 0x3e, 0x95, 0xff, 0x10, 0xb1, 0xe7, 0x7f, 0x46, 0x6c, 0xb9, 0xf8, 0xd9, 0xf2, 0x36, 0xcf, 0x4e, 0x98, 0xbd, 0xb9, 0x7f, 0x62, 0x96, 0x0e, 0x4e, 0xcc, 0xd2, 0xe1, 0x89, 0x59, 0x7a, 0x1b, 0x9b, 0x60, 0x3f, 0x36, 0xc1, 0x41, 0x6c, 0x82, 0xc3, 0xd8, 0x04, 0xdf, 0x63, 0x13, 0x7c, 0xfa, 0x61, 0x96, 0x76, 0x5a, 0x45, 0xff, 0xd8, 0xfc, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xe2, 0xb1, 0xf3, 0x1c, 0x09, 0x00, 0x00, } func (m *ContainerMetrics) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ContainerMetrics) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ContainerMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Usage) > 0 { keysForUsage := make([]string, 0, len(m.Usage)) for k := range m.Usage { keysForUsage = append(keysForUsage, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForUsage) for iNdEx := len(keysForUsage) - 1; iNdEx >= 0; iNdEx-- { v := m.Usage[k8s_io_api_core_v1.ResourceName(keysForUsage[iNdEx])] baseI := i { size, err := ((*resource.Quantity)(&v)).MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 i -= len(keysForUsage[iNdEx]) copy(dAtA[i:], keysForUsage[iNdEx]) i = encodeVarintGenerated(dAtA, i, uint64(len(keysForUsage[iNdEx]))) i-- dAtA[i] = 0xa i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0x12 } } i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *NodeMetrics) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *NodeMetrics) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *NodeMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Usage) > 0 { keysForUsage := make([]string, 0, len(m.Usage)) for k := range m.Usage { keysForUsage = append(keysForUsage, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForUsage) for iNdEx := len(keysForUsage) - 1; iNdEx >= 0; iNdEx-- { v := m.Usage[k8s_io_api_core_v1.ResourceName(keysForUsage[iNdEx])] baseI := i { size, err := ((*resource.Quantity)(&v)).MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 i -= len(keysForUsage[iNdEx]) copy(dAtA[i:], keysForUsage[iNdEx]) i = encodeVarintGenerated(dAtA, i, uint64(len(keysForUsage[iNdEx]))) i-- dAtA[i] = 0xa i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0x22 } } { size, err := m.Window.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a { size, err := m.Timestamp.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 { size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *NodeMetricsList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *NodeMetricsList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *NodeMetricsList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Items) > 0 { for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } { size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *PodMetrics) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *PodMetrics) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *PodMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Containers) > 0 { for iNdEx := len(m.Containers) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Containers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x22 } } { size, err := m.Window.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a { size, err := m.Timestamp.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 { size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *PodMetricsList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *PodMetricsList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *PodMetricsList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Items) > 0 { for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } { size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { offset -= sovGenerated(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) return base } func (m *ContainerMetrics) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Name) n += 1 + l + sovGenerated(uint64(l)) if len(m.Usage) > 0 { for k, v := range m.Usage { _ = k _ = v l = ((*resource.Quantity)(&v)).Size() mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } return n } func (m *NodeMetrics) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ObjectMeta.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Timestamp.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Window.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Usage) > 0 { for k, v := range m.Usage { _ = k _ = v l = ((*resource.Quantity)(&v)).Size() mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } return n } func (m *NodeMetricsList) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Items) > 0 { for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func (m *PodMetrics) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ObjectMeta.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Timestamp.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Window.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Containers) > 0 { for _, e := range m.Containers { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func (m *PodMetricsList) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Items) > 0 { for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func sovGenerated(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozGenerated(x uint64) (n int) { return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *ContainerMetrics) String() string { if this == nil { return "nil" } keysForUsage := make([]string, 0, len(this.Usage)) for k := range this.Usage { keysForUsage = append(keysForUsage, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForUsage) mapStringForUsage := "k8s_io_api_core_v1.ResourceList{" for _, k := range keysForUsage { mapStringForUsage += fmt.Sprintf("%v: %v,", k, this.Usage[k8s_io_api_core_v1.ResourceName(k)]) } mapStringForUsage += "}" s := strings.Join([]string{`&ContainerMetrics{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Usage:` + mapStringForUsage + `,`, `}`, }, "") return s } func (this *NodeMetrics) String() string { if this == nil { return "nil" } keysForUsage := make([]string, 0, len(this.Usage)) for k := range this.Usage { keysForUsage = append(keysForUsage, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForUsage) mapStringForUsage := "k8s_io_api_core_v1.ResourceList{" for _, k := range keysForUsage { mapStringForUsage += fmt.Sprintf("%v: %v,", k, this.Usage[k8s_io_api_core_v1.ResourceName(k)]) } mapStringForUsage += "}" s := strings.Join([]string{`&NodeMetrics{`, `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, `Timestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, `Window:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Window), "Duration", "v1.Duration", 1), `&`, ``, 1) + `,`, `Usage:` + mapStringForUsage + `,`, `}`, }, "") return s } func (this *NodeMetricsList) String() string { if this == nil { return "nil" } repeatedStringForItems := "[]NodeMetrics{" for _, f := range this.Items { repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "NodeMetrics", "NodeMetrics", 1), `&`, ``, 1) + "," } repeatedStringForItems += "}" s := strings.Join([]string{`&NodeMetricsList{`, `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, `Items:` + repeatedStringForItems + `,`, `}`, }, "") return s } func (this *PodMetrics) String() string { if this == nil { return "nil" } repeatedStringForContainers := "[]ContainerMetrics{" for _, f := range this.Containers { repeatedStringForContainers += strings.Replace(strings.Replace(f.String(), "ContainerMetrics", "ContainerMetrics", 1), `&`, ``, 1) + "," } repeatedStringForContainers += "}" s := strings.Join([]string{`&PodMetrics{`, `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, `Timestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, `Window:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Window), "Duration", "v1.Duration", 1), `&`, ``, 1) + `,`, `Containers:` + repeatedStringForContainers + `,`, `}`, }, "") return s } func (this *PodMetricsList) String() string { if this == nil { return "nil" } repeatedStringForItems := "[]PodMetrics{" for _, f := range this.Items { repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PodMetrics", "PodMetrics", 1), `&`, ``, 1) + "," } repeatedStringForItems += "}" s := strings.Join([]string{`&PodMetricsList{`, `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, `Items:` + repeatedStringForItems + `,`, `}`, }, "") return s } func valueToStringGenerated(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } func (m *ContainerMetrics) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ContainerMetrics: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ContainerMetrics: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if m.Usage == nil { m.Usage = make(k8s_io_api_core_v1.ResourceList) } var mapkey k8s_io_api_core_v1.ResourceName mapvalue := &resource.Quantity{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthGenerated } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthGenerated } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapmsglen |= int(b&0x7F) << shift if b < 0x80 { break } } if mapmsglen < 0 { return ErrInvalidLengthGenerated } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { return ErrInvalidLengthGenerated } if postmsgIndex > l { return io.ErrUnexpectedEOF } mapvalue = &resource.Quantity{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex } else { iNdEx = entryPreIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Usage[k8s_io_api_core_v1.ResourceName(mapkey)] = ((k8s_io_apimachinery_pkg_api_resource.Quantity)(*mapvalue)) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *NodeMetrics) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: NodeMetrics: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: NodeMetrics: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Window", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Window.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if m.Usage == nil { m.Usage = make(k8s_io_api_core_v1.ResourceList) } var mapkey k8s_io_api_core_v1.ResourceName mapvalue := &resource.Quantity{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthGenerated } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthGenerated } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapmsglen |= int(b&0x7F) << shift if b < 0x80 { break } } if mapmsglen < 0 { return ErrInvalidLengthGenerated } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { return ErrInvalidLengthGenerated } if postmsgIndex > l { return io.ErrUnexpectedEOF } mapvalue = &resource.Quantity{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex } else { iNdEx = entryPreIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Usage[k8s_io_api_core_v1.ResourceName(mapkey)] = ((k8s_io_apimachinery_pkg_api_resource.Quantity)(*mapvalue)) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *NodeMetricsList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: NodeMetricsList: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: NodeMetricsList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Items = append(m.Items, NodeMetrics{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *PodMetrics) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PodMetrics: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PodMetrics: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Window", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Window.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Containers", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Containers = append(m.Containers, ContainerMetrics{}) if err := m.Containers[len(m.Containers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *PodMetricsList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PodMetricsList: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PodMetricsList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Items = append(m.Items, PodMetrics{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipGenerated(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } case 1: iNdEx += 8 case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if length < 0 { return 0, ErrInvalidLengthGenerated } iNdEx += length case 3: depth++ case 4: if depth == 0 { return 0, ErrUnexpectedEndOfGroupGenerated } depth-- case 5: iNdEx += 4 default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { return 0, ErrInvalidLengthGenerated } if depth == 0 { return iNdEx, nil } } return 0, io.ErrUnexpectedEOF } var ( ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") ) metrics-0.29.0/pkg/apis/metrics/v1alpha1/generated.proto000066400000000000000000000067231453636773000231210ustar00rootroot00000000000000/* Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // This file was autogenerated by go-to-protobuf. Do not edit it manually! syntax = "proto2"; package k8s.io.metrics.pkg.apis.metrics.v1alpha1; import "k8s.io/api/core/v1/generated.proto"; import "k8s.io/apimachinery/pkg/api/resource/generated.proto"; import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; // Package-wide variables from generator "generated". option go_package = "k8s.io/metrics/pkg/apis/metrics/v1alpha1"; // ContainerMetrics sets resource usage metrics of a container. message ContainerMetrics { // Container name corresponding to the one from pod.spec.containers. optional string name = 1; // The memory usage is the memory working set. map usage = 2; } // NodeMetrics sets resource usage metrics of a node. message NodeMetrics { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The following fields define time interval from which metrics were // collected from the interval [Timestamp-Window, Timestamp]. optional k8s.io.apimachinery.pkg.apis.meta.v1.Time timestamp = 2; optional k8s.io.apimachinery.pkg.apis.meta.v1.Duration window = 3; // The memory usage is the memory working set. map usage = 4; } // NodeMetricsList is a list of NodeMetrics. message NodeMetricsList { // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // List of node metrics. repeated NodeMetrics items = 2; } // PodMetrics sets resource usage metrics of a pod. message PodMetrics { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The following fields define time interval from which metrics were // collected from the interval [Timestamp-Window, Timestamp]. optional k8s.io.apimachinery.pkg.apis.meta.v1.Time timestamp = 2; optional k8s.io.apimachinery.pkg.apis.meta.v1.Duration window = 3; // Metrics for all containers are collected within the same time window. repeated ContainerMetrics containers = 4; } // PodMetricsList is a list of PodMetrics. message PodMetricsList { // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // List of pod metrics. repeated PodMetrics items = 2; } metrics-0.29.0/pkg/apis/metrics/v1alpha1/register.go000066400000000000000000000032401453636773000222400ustar00rootroot00000000000000/* 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 v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName is the group name use in this package const GroupName = "metrics.k8s.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( // SchemeBuilder points to a list of functions added to Scheme. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) localSchemeBuilder = &SchemeBuilder // AddToScheme applies all the stored functions to the scheme. AddToScheme = SchemeBuilder.AddToScheme ) func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &NodeMetrics{}, &NodeMetricsList{}, &PodMetrics{}, &PodMetricsList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil } metrics-0.29.0/pkg/apis/metrics/v1alpha1/types.go000066400000000000000000000101111453636773000215530ustar00rootroot00000000000000/* 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 v1alpha1 import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // +genclient // +resourceName=nodes // +genclient:readonly // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // NodeMetrics sets resource usage metrics of a node. type NodeMetrics struct { metav1.TypeMeta `json:",inline"` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // The following fields define time interval from which metrics were // collected from the interval [Timestamp-Window, Timestamp]. Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,2,opt,name=timestamp"` Window metav1.Duration `json:"window" protobuf:"bytes,3,opt,name=window"` // The memory usage is the memory working set. Usage v1.ResourceList `json:"usage" protobuf:"bytes,4,rep,name=usage,casttype=k8s.io/api/core/v1.ResourceList,castkey=k8s.io/api/core/v1.ResourceName,castvalue=k8s.io/apimachinery/pkg/api/resource.Quantity"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // NodeMetricsList is a list of NodeMetrics. type NodeMetricsList struct { metav1.TypeMeta `json:",inline"` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // List of node metrics. Items []NodeMetrics `json:"items" protobuf:"bytes,2,rep,name=items"` } // +genclient // +resourceName=pods // +genclient:readonly // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodMetrics sets resource usage metrics of a pod. type PodMetrics struct { metav1.TypeMeta `json:",inline"` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // The following fields define time interval from which metrics were // collected from the interval [Timestamp-Window, Timestamp]. Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,2,opt,name=timestamp"` Window metav1.Duration `json:"window" protobuf:"bytes,3,opt,name=window"` // Metrics for all containers are collected within the same time window. Containers []ContainerMetrics `json:"containers" protobuf:"bytes,4,rep,name=containers"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodMetricsList is a list of PodMetrics. type PodMetricsList struct { metav1.TypeMeta `json:",inline"` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // List of pod metrics. Items []PodMetrics `json:"items" protobuf:"bytes,2,rep,name=items"` } // ContainerMetrics sets resource usage metrics of a container. type ContainerMetrics struct { // Container name corresponding to the one from pod.spec.containers. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` // The memory usage is the memory working set. Usage v1.ResourceList `json:"usage" protobuf:"bytes,2,rep,name=usage,casttype=k8s.io/api/core/v1.ResourceList,castkey=k8s.io/api/core/v1.ResourceName,castvalue=k8s.io/apimachinery/pkg/api/resource.Quantity"` } metrics-0.29.0/pkg/apis/metrics/v1alpha1/zz_generated.conversion.go000066400000000000000000000235431453636773000252710ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by conversion-gen. DO NOT EDIT. package v1alpha1 import ( unsafe "unsafe" v1 "k8s.io/api/core/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" metrics "k8s.io/metrics/pkg/apis/metrics" ) func init() { localSchemeBuilder.Register(RegisterConversions) } // RegisterConversions adds conversion functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterConversions(s *runtime.Scheme) error { if err := s.AddGeneratedConversionFunc((*ContainerMetrics)(nil), (*metrics.ContainerMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics(a.(*ContainerMetrics), b.(*metrics.ContainerMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*metrics.ContainerMetrics)(nil), (*ContainerMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_metrics_ContainerMetrics_To_v1alpha1_ContainerMetrics(a.(*metrics.ContainerMetrics), b.(*ContainerMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*NodeMetrics)(nil), (*metrics.NodeMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_NodeMetrics_To_metrics_NodeMetrics(a.(*NodeMetrics), b.(*metrics.NodeMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*metrics.NodeMetrics)(nil), (*NodeMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_metrics_NodeMetrics_To_v1alpha1_NodeMetrics(a.(*metrics.NodeMetrics), b.(*NodeMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*NodeMetricsList)(nil), (*metrics.NodeMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_NodeMetricsList_To_metrics_NodeMetricsList(a.(*NodeMetricsList), b.(*metrics.NodeMetricsList), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*metrics.NodeMetricsList)(nil), (*NodeMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_metrics_NodeMetricsList_To_v1alpha1_NodeMetricsList(a.(*metrics.NodeMetricsList), b.(*NodeMetricsList), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*PodMetrics)(nil), (*metrics.PodMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_PodMetrics_To_metrics_PodMetrics(a.(*PodMetrics), b.(*metrics.PodMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*metrics.PodMetrics)(nil), (*PodMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_metrics_PodMetrics_To_v1alpha1_PodMetrics(a.(*metrics.PodMetrics), b.(*PodMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*PodMetricsList)(nil), (*metrics.PodMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_PodMetricsList_To_metrics_PodMetricsList(a.(*PodMetricsList), b.(*metrics.PodMetricsList), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*metrics.PodMetricsList)(nil), (*PodMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_metrics_PodMetricsList_To_v1alpha1_PodMetricsList(a.(*metrics.PodMetricsList), b.(*PodMetricsList), scope) }); err != nil { return err } return nil } func autoConvert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics(in *ContainerMetrics, out *metrics.ContainerMetrics, s conversion.Scope) error { out.Name = in.Name out.Usage = *(*v1.ResourceList)(unsafe.Pointer(&in.Usage)) return nil } // Convert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics is an autogenerated conversion function. func Convert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics(in *ContainerMetrics, out *metrics.ContainerMetrics, s conversion.Scope) error { return autoConvert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics(in, out, s) } func autoConvert_metrics_ContainerMetrics_To_v1alpha1_ContainerMetrics(in *metrics.ContainerMetrics, out *ContainerMetrics, s conversion.Scope) error { out.Name = in.Name out.Usage = *(*v1.ResourceList)(unsafe.Pointer(&in.Usage)) return nil } // Convert_metrics_ContainerMetrics_To_v1alpha1_ContainerMetrics is an autogenerated conversion function. func Convert_metrics_ContainerMetrics_To_v1alpha1_ContainerMetrics(in *metrics.ContainerMetrics, out *ContainerMetrics, s conversion.Scope) error { return autoConvert_metrics_ContainerMetrics_To_v1alpha1_ContainerMetrics(in, out, s) } func autoConvert_v1alpha1_NodeMetrics_To_metrics_NodeMetrics(in *NodeMetrics, out *metrics.NodeMetrics, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta out.Timestamp = in.Timestamp out.Window = in.Window out.Usage = *(*v1.ResourceList)(unsafe.Pointer(&in.Usage)) return nil } // Convert_v1alpha1_NodeMetrics_To_metrics_NodeMetrics is an autogenerated conversion function. func Convert_v1alpha1_NodeMetrics_To_metrics_NodeMetrics(in *NodeMetrics, out *metrics.NodeMetrics, s conversion.Scope) error { return autoConvert_v1alpha1_NodeMetrics_To_metrics_NodeMetrics(in, out, s) } func autoConvert_metrics_NodeMetrics_To_v1alpha1_NodeMetrics(in *metrics.NodeMetrics, out *NodeMetrics, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta out.Timestamp = in.Timestamp out.Window = in.Window out.Usage = *(*v1.ResourceList)(unsafe.Pointer(&in.Usage)) return nil } // Convert_metrics_NodeMetrics_To_v1alpha1_NodeMetrics is an autogenerated conversion function. func Convert_metrics_NodeMetrics_To_v1alpha1_NodeMetrics(in *metrics.NodeMetrics, out *NodeMetrics, s conversion.Scope) error { return autoConvert_metrics_NodeMetrics_To_v1alpha1_NodeMetrics(in, out, s) } func autoConvert_v1alpha1_NodeMetricsList_To_metrics_NodeMetricsList(in *NodeMetricsList, out *metrics.NodeMetricsList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]metrics.NodeMetrics)(unsafe.Pointer(&in.Items)) return nil } // Convert_v1alpha1_NodeMetricsList_To_metrics_NodeMetricsList is an autogenerated conversion function. func Convert_v1alpha1_NodeMetricsList_To_metrics_NodeMetricsList(in *NodeMetricsList, out *metrics.NodeMetricsList, s conversion.Scope) error { return autoConvert_v1alpha1_NodeMetricsList_To_metrics_NodeMetricsList(in, out, s) } func autoConvert_metrics_NodeMetricsList_To_v1alpha1_NodeMetricsList(in *metrics.NodeMetricsList, out *NodeMetricsList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]NodeMetrics)(unsafe.Pointer(&in.Items)) return nil } // Convert_metrics_NodeMetricsList_To_v1alpha1_NodeMetricsList is an autogenerated conversion function. func Convert_metrics_NodeMetricsList_To_v1alpha1_NodeMetricsList(in *metrics.NodeMetricsList, out *NodeMetricsList, s conversion.Scope) error { return autoConvert_metrics_NodeMetricsList_To_v1alpha1_NodeMetricsList(in, out, s) } func autoConvert_v1alpha1_PodMetrics_To_metrics_PodMetrics(in *PodMetrics, out *metrics.PodMetrics, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta out.Timestamp = in.Timestamp out.Window = in.Window out.Containers = *(*[]metrics.ContainerMetrics)(unsafe.Pointer(&in.Containers)) return nil } // Convert_v1alpha1_PodMetrics_To_metrics_PodMetrics is an autogenerated conversion function. func Convert_v1alpha1_PodMetrics_To_metrics_PodMetrics(in *PodMetrics, out *metrics.PodMetrics, s conversion.Scope) error { return autoConvert_v1alpha1_PodMetrics_To_metrics_PodMetrics(in, out, s) } func autoConvert_metrics_PodMetrics_To_v1alpha1_PodMetrics(in *metrics.PodMetrics, out *PodMetrics, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta out.Timestamp = in.Timestamp out.Window = in.Window out.Containers = *(*[]ContainerMetrics)(unsafe.Pointer(&in.Containers)) return nil } // Convert_metrics_PodMetrics_To_v1alpha1_PodMetrics is an autogenerated conversion function. func Convert_metrics_PodMetrics_To_v1alpha1_PodMetrics(in *metrics.PodMetrics, out *PodMetrics, s conversion.Scope) error { return autoConvert_metrics_PodMetrics_To_v1alpha1_PodMetrics(in, out, s) } func autoConvert_v1alpha1_PodMetricsList_To_metrics_PodMetricsList(in *PodMetricsList, out *metrics.PodMetricsList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]metrics.PodMetrics)(unsafe.Pointer(&in.Items)) return nil } // Convert_v1alpha1_PodMetricsList_To_metrics_PodMetricsList is an autogenerated conversion function. func Convert_v1alpha1_PodMetricsList_To_metrics_PodMetricsList(in *PodMetricsList, out *metrics.PodMetricsList, s conversion.Scope) error { return autoConvert_v1alpha1_PodMetricsList_To_metrics_PodMetricsList(in, out, s) } func autoConvert_metrics_PodMetricsList_To_v1alpha1_PodMetricsList(in *metrics.PodMetricsList, out *PodMetricsList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]PodMetrics)(unsafe.Pointer(&in.Items)) return nil } // Convert_metrics_PodMetricsList_To_v1alpha1_PodMetricsList is an autogenerated conversion function. func Convert_metrics_PodMetricsList_To_v1alpha1_PodMetricsList(in *metrics.PodMetricsList, out *PodMetricsList, s conversion.Scope) error { return autoConvert_metrics_PodMetricsList_To_v1alpha1_PodMetricsList(in, out, s) } metrics-0.29.0/pkg/apis/metrics/v1alpha1/zz_generated.deepcopy.go000066400000000000000000000121501453636773000247040ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by deepcopy-gen. DO NOT EDIT. package v1alpha1 import ( v1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ContainerMetrics) DeepCopyInto(out *ContainerMetrics) { *out = *in if in.Usage != nil { in, out := &in.Usage, &out.Usage *out = make(v1.ResourceList, len(*in)) for key, val := range *in { (*out)[key] = val.DeepCopy() } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerMetrics. func (in *ContainerMetrics) DeepCopy() *ContainerMetrics { if in == nil { return nil } out := new(ContainerMetrics) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeMetrics) DeepCopyInto(out *NodeMetrics) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Timestamp.DeepCopyInto(&out.Timestamp) out.Window = in.Window if in.Usage != nil { in, out := &in.Usage, &out.Usage *out = make(v1.ResourceList, len(*in)) for key, val := range *in { (*out)[key] = val.DeepCopy() } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeMetrics. func (in *NodeMetrics) DeepCopy() *NodeMetrics { if in == nil { return nil } out := new(NodeMetrics) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *NodeMetrics) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeMetricsList) DeepCopyInto(out *NodeMetricsList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]NodeMetrics, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeMetricsList. func (in *NodeMetricsList) DeepCopy() *NodeMetricsList { if in == nil { return nil } out := new(NodeMetricsList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *NodeMetricsList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodMetrics) DeepCopyInto(out *PodMetrics) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Timestamp.DeepCopyInto(&out.Timestamp) out.Window = in.Window if in.Containers != nil { in, out := &in.Containers, &out.Containers *out = make([]ContainerMetrics, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodMetrics. func (in *PodMetrics) DeepCopy() *PodMetrics { if in == nil { return nil } out := new(PodMetrics) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *PodMetrics) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodMetricsList) DeepCopyInto(out *PodMetricsList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]PodMetrics, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodMetricsList. func (in *PodMetricsList) DeepCopy() *PodMetricsList { if in == nil { return nil } out := new(PodMetricsList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *PodMetricsList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } metrics-0.29.0/pkg/apis/metrics/v1beta1/000077500000000000000000000000001453636773000177145ustar00rootroot00000000000000metrics-0.29.0/pkg/apis/metrics/v1beta1/doc.go000066400000000000000000000015451453636773000210150ustar00rootroot00000000000000/* 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. */ // +k8s:deepcopy-gen=package // +k8s:protobuf-gen=package // +k8s:conversion-gen=k8s.io/metrics/pkg/apis/metrics // +k8s:openapi-gen=true // +groupName=metrics.k8s.io // Package v1beta1 is the v1beta1 version of the metrics API. package v1beta1 // import "k8s.io/metrics/pkg/apis/metrics/v1beta1" metrics-0.29.0/pkg/apis/metrics/v1beta1/generated.pb.go000066400000000000000000001314451453636773000226110ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/metrics/v1beta1/generated.proto package v1beta1 import ( fmt "fmt" io "io" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_api_resource "k8s.io/apimachinery/pkg/api/resource" resource "k8s.io/apimachinery/pkg/api/resource" math "math" math_bits "math/bits" reflect "reflect" strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package func (m *ContainerMetrics) Reset() { *m = ContainerMetrics{} } func (*ContainerMetrics) ProtoMessage() {} func (*ContainerMetrics) Descriptor() ([]byte, []int) { return fileDescriptor_3e7a045767f4b09f, []int{0} } func (m *ContainerMetrics) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ContainerMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *ContainerMetrics) XXX_Merge(src proto.Message) { xxx_messageInfo_ContainerMetrics.Merge(m, src) } func (m *ContainerMetrics) XXX_Size() int { return m.Size() } func (m *ContainerMetrics) XXX_DiscardUnknown() { xxx_messageInfo_ContainerMetrics.DiscardUnknown(m) } var xxx_messageInfo_ContainerMetrics proto.InternalMessageInfo func (m *NodeMetrics) Reset() { *m = NodeMetrics{} } func (*NodeMetrics) ProtoMessage() {} func (*NodeMetrics) Descriptor() ([]byte, []int) { return fileDescriptor_3e7a045767f4b09f, []int{1} } func (m *NodeMetrics) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *NodeMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *NodeMetrics) XXX_Merge(src proto.Message) { xxx_messageInfo_NodeMetrics.Merge(m, src) } func (m *NodeMetrics) XXX_Size() int { return m.Size() } func (m *NodeMetrics) XXX_DiscardUnknown() { xxx_messageInfo_NodeMetrics.DiscardUnknown(m) } var xxx_messageInfo_NodeMetrics proto.InternalMessageInfo func (m *NodeMetricsList) Reset() { *m = NodeMetricsList{} } func (*NodeMetricsList) ProtoMessage() {} func (*NodeMetricsList) Descriptor() ([]byte, []int) { return fileDescriptor_3e7a045767f4b09f, []int{2} } func (m *NodeMetricsList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *NodeMetricsList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *NodeMetricsList) XXX_Merge(src proto.Message) { xxx_messageInfo_NodeMetricsList.Merge(m, src) } func (m *NodeMetricsList) XXX_Size() int { return m.Size() } func (m *NodeMetricsList) XXX_DiscardUnknown() { xxx_messageInfo_NodeMetricsList.DiscardUnknown(m) } var xxx_messageInfo_NodeMetricsList proto.InternalMessageInfo func (m *PodMetrics) Reset() { *m = PodMetrics{} } func (*PodMetrics) ProtoMessage() {} func (*PodMetrics) Descriptor() ([]byte, []int) { return fileDescriptor_3e7a045767f4b09f, []int{3} } func (m *PodMetrics) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *PodMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *PodMetrics) XXX_Merge(src proto.Message) { xxx_messageInfo_PodMetrics.Merge(m, src) } func (m *PodMetrics) XXX_Size() int { return m.Size() } func (m *PodMetrics) XXX_DiscardUnknown() { xxx_messageInfo_PodMetrics.DiscardUnknown(m) } var xxx_messageInfo_PodMetrics proto.InternalMessageInfo func (m *PodMetricsList) Reset() { *m = PodMetricsList{} } func (*PodMetricsList) ProtoMessage() {} func (*PodMetricsList) Descriptor() ([]byte, []int) { return fileDescriptor_3e7a045767f4b09f, []int{4} } func (m *PodMetricsList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *PodMetricsList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *PodMetricsList) XXX_Merge(src proto.Message) { xxx_messageInfo_PodMetricsList.Merge(m, src) } func (m *PodMetricsList) XXX_Size() int { return m.Size() } func (m *PodMetricsList) XXX_DiscardUnknown() { xxx_messageInfo_PodMetricsList.DiscardUnknown(m) } var xxx_messageInfo_PodMetricsList proto.InternalMessageInfo func init() { proto.RegisterType((*ContainerMetrics)(nil), "k8s.io.metrics.pkg.apis.metrics.v1beta1.ContainerMetrics") proto.RegisterMapType((k8s_io_api_core_v1.ResourceList)(nil), "k8s.io.metrics.pkg.apis.metrics.v1beta1.ContainerMetrics.UsageEntry") proto.RegisterType((*NodeMetrics)(nil), "k8s.io.metrics.pkg.apis.metrics.v1beta1.NodeMetrics") proto.RegisterMapType((k8s_io_api_core_v1.ResourceList)(nil), "k8s.io.metrics.pkg.apis.metrics.v1beta1.NodeMetrics.UsageEntry") proto.RegisterType((*NodeMetricsList)(nil), "k8s.io.metrics.pkg.apis.metrics.v1beta1.NodeMetricsList") proto.RegisterType((*PodMetrics)(nil), "k8s.io.metrics.pkg.apis.metrics.v1beta1.PodMetrics") proto.RegisterType((*PodMetricsList)(nil), "k8s.io.metrics.pkg.apis.metrics.v1beta1.PodMetricsList") } func init() { proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/metrics/v1beta1/generated.proto", fileDescriptor_3e7a045767f4b09f) } var fileDescriptor_3e7a045767f4b09f = []byte{ // 661 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0xbf, 0x6f, 0x13, 0x3f, 0x1c, 0x8d, 0x9b, 0xa4, 0x6a, 0x9d, 0xef, 0xb7, 0x94, 0x9b, 0xaa, 0x0c, 0x97, 0x2a, 0x4b, 0x2b, 0xa4, 0xda, 0xb4, 0x54, 0xa8, 0xb0, 0x20, 0x1d, 0x65, 0x40, 0xa2, 0xa5, 0x9c, 0xca, 0x6f, 0x06, 0x9c, 0x8b, 0xb9, 0x98, 0x70, 0xe7, 0xc8, 0xf6, 0xa5, 0xca, 0x86, 0x2a, 0x26, 0x26, 0xc4, 0x5f, 0x15, 0x31, 0x75, 0xec, 0x80, 0x5a, 0x12, 0x66, 0xfe, 0x01, 0x26, 0x74, 0x3e, 0x5f, 0x2e, 0x34, 0xa5, 0x3d, 0x3a, 0x30, 0x75, 0xcb, 0x7d, 0xec, 0xf7, 0xde, 0xc7, 0xef, 0xf3, 0x6c, 0x05, 0xee, 0xb4, 0x37, 0x24, 0x62, 0x1c, 0xb7, 0xa3, 0x06, 0x15, 0x21, 0x55, 0x54, 0xe2, 0x2e, 0x0d, 0x9b, 0x5c, 0x60, 0xb3, 0x10, 0x50, 0x25, 0x98, 0x27, 0x71, 0xa7, 0xed, 0x63, 0xd2, 0x61, 0x72, 0x54, 0xe8, 0xae, 0x36, 0xa8, 0x22, 0xab, 0xd8, 0xa7, 0x21, 0x15, 0x44, 0xd1, 0x26, 0xea, 0x08, 0xae, 0xb8, 0xb5, 0x94, 0x00, 0x91, 0xd9, 0x87, 0x3a, 0x6d, 0x1f, 0xc5, 0xc0, 0x51, 0xc1, 0x00, 0xab, 0x2b, 0x3e, 0x53, 0xad, 0xa8, 0x81, 0x3c, 0x1e, 0x60, 0x9f, 0xfb, 0x1c, 0x6b, 0x7c, 0x23, 0x7a, 0xa3, 0xbf, 0xf4, 0x87, 0xfe, 0x95, 0xf0, 0x56, 0xeb, 0xa6, 0x21, 0xd2, 0x61, 0xd8, 0xe3, 0x82, 0xe2, 0xee, 0x84, 0x76, 0x75, 0x3d, 0xdb, 0x13, 0x10, 0xaf, 0xc5, 0x42, 0x2a, 0x7a, 0x69, 0xe7, 0x58, 0x50, 0xc9, 0x23, 0xe1, 0xd1, 0xbf, 0x42, 0xe9, 0xf3, 0x92, 0xd3, 0xb4, 0xf0, 0x9f, 0x50, 0x22, 0x0a, 0x15, 0x0b, 0x26, 0x65, 0x6e, 0x9e, 0x07, 0x90, 0x5e, 0x8b, 0x06, 0xe4, 0x24, 0xae, 0xbe, 0x5f, 0x84, 0xf3, 0x77, 0x79, 0xa8, 0x48, 0x8c, 0xd8, 0x4a, 0x4c, 0xb4, 0x16, 0x61, 0x29, 0x24, 0x01, 0x5d, 0x00, 0x8b, 0x60, 0x79, 0xd6, 0xf9, 0xaf, 0x7f, 0x54, 0x2b, 0x0c, 0x8f, 0x6a, 0xa5, 0x6d, 0x12, 0x50, 0x57, 0xaf, 0x58, 0x03, 0x00, 0xcb, 0x91, 0x24, 0x3e, 0x5d, 0x98, 0x5a, 0x2c, 0x2e, 0x57, 0xd6, 0x36, 0x51, 0xce, 0xc1, 0xa0, 0x93, 0x62, 0xe8, 0x71, 0x4c, 0x73, 0x2f, 0x54, 0xa2, 0xe7, 0x7c, 0x00, 0x46, 0xaa, 0xac, 0x8b, 0x3f, 0x8f, 0x6a, 0xb5, 0xc9, 0xb9, 0x20, 0xd7, 0x58, 0xfd, 0x80, 0x49, 0xb5, 0x7f, 0x7c, 0xe6, 0x96, 0xb8, 0xe3, 0x8f, 0xc7, 0xb5, 0x95, 0x3c, 0x93, 0x43, 0x8f, 0x22, 0x12, 0x2a, 0xa6, 0x7a, 0x6e, 0x72, 0xb2, 0x6a, 0x0b, 0xc2, 0xac, 0x37, 0x6b, 0x1e, 0x16, 0xdb, 0xb4, 0x97, 0x58, 0xe2, 0xc6, 0x3f, 0xad, 0x4d, 0x58, 0xee, 0x92, 0x77, 0x51, 0x6c, 0x01, 0x58, 0xae, 0xac, 0xa1, 0xd4, 0x82, 0x71, 0x95, 0xd4, 0x07, 0x74, 0x8a, 0x8a, 0x06, 0xdf, 0x9e, 0xda, 0x00, 0xf5, 0x1f, 0x25, 0x58, 0xd9, 0xe6, 0x4d, 0x9a, 0xfa, 0xff, 0x1a, 0xce, 0xc4, 0xc1, 0x68, 0x12, 0x45, 0xb4, 0x60, 0x65, 0xed, 0xfa, 0x59, 0xe4, 0xda, 0x64, 0x82, 0xba, 0xab, 0xe8, 0x61, 0xe3, 0x2d, 0xf5, 0xd4, 0x16, 0x55, 0xc4, 0xb1, 0x8c, 0x95, 0x30, 0xab, 0xb9, 0x23, 0x56, 0xeb, 0x25, 0x9c, 0x8d, 0x53, 0x21, 0x15, 0x09, 0x3a, 0xa6, 0xff, 0x6b, 0xf9, 0x24, 0x76, 0x59, 0x40, 0x9d, 0xab, 0x86, 0x7c, 0x76, 0x37, 0x25, 0x71, 0x33, 0x3e, 0xeb, 0x09, 0x9c, 0xde, 0x63, 0x61, 0x93, 0xef, 0x2d, 0x14, 0xcf, 0x77, 0x26, 0x63, 0xde, 0x8c, 0x04, 0x51, 0x8c, 0x87, 0xce, 0x9c, 0x61, 0x9f, 0x7e, 0xaa, 0x59, 0x5c, 0xc3, 0x66, 0x7d, 0x1d, 0x85, 0xae, 0xa4, 0x43, 0x77, 0x27, 0x77, 0xe8, 0xc6, 0xcc, 0xbd, 0xcc, 0x1b, 0xa8, 0x7f, 0x01, 0xf0, 0xca, 0x98, 0x25, 0xf1, 0xc1, 0xac, 0x57, 0x13, 0x99, 0xcb, 0x39, 0xb6, 0x18, 0xad, 0x13, 0x37, 0x6f, 0xcc, 0x9c, 0x49, 0x2b, 0x63, 0x79, 0x7b, 0x0e, 0xcb, 0x4c, 0xd1, 0x40, 0x9a, 0xe7, 0x62, 0xfd, 0x22, 0x93, 0x73, 0xfe, 0x4f, 0xa7, 0x75, 0x3f, 0xa6, 0x72, 0x13, 0xc6, 0xfa, 0xe7, 0x22, 0x84, 0x3b, 0xbc, 0x79, 0x79, 0x77, 0xce, 0xbc, 0x3b, 0x01, 0x84, 0x5e, 0xfa, 0xf2, 0x4a, 0x73, 0x7f, 0x6e, 0x5d, 0xf8, 0xd1, 0xce, 0x1c, 0x1a, 0xad, 0x48, 0x77, 0x4c, 0xa0, 0xde, 0x07, 0x70, 0x2e, 0x1b, 0xca, 0x3f, 0x08, 0xd8, 0xb3, 0xdf, 0x03, 0x76, 0x23, 0xf7, 0xd1, 0xb2, 0x2e, 0x4f, 0xcf, 0x97, 0xb3, 0xd5, 0x1f, 0xd8, 0x85, 0x83, 0x81, 0x5d, 0x38, 0x1c, 0xd8, 0x85, 0xf7, 0x43, 0x1b, 0xf4, 0x87, 0x36, 0x38, 0x18, 0xda, 0xe0, 0x70, 0x68, 0x83, 0x6f, 0x43, 0x1b, 0x7c, 0xfa, 0x6e, 0x17, 0x5e, 0x2c, 0xe5, 0xfc, 0x47, 0xf3, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x26, 0x83, 0xd3, 0x6d, 0x14, 0x09, 0x00, 0x00, } func (m *ContainerMetrics) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ContainerMetrics) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ContainerMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Usage) > 0 { keysForUsage := make([]string, 0, len(m.Usage)) for k := range m.Usage { keysForUsage = append(keysForUsage, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForUsage) for iNdEx := len(keysForUsage) - 1; iNdEx >= 0; iNdEx-- { v := m.Usage[k8s_io_api_core_v1.ResourceName(keysForUsage[iNdEx])] baseI := i { size, err := ((*resource.Quantity)(&v)).MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 i -= len(keysForUsage[iNdEx]) copy(dAtA[i:], keysForUsage[iNdEx]) i = encodeVarintGenerated(dAtA, i, uint64(len(keysForUsage[iNdEx]))) i-- dAtA[i] = 0xa i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0x12 } } i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *NodeMetrics) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *NodeMetrics) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *NodeMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Usage) > 0 { keysForUsage := make([]string, 0, len(m.Usage)) for k := range m.Usage { keysForUsage = append(keysForUsage, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForUsage) for iNdEx := len(keysForUsage) - 1; iNdEx >= 0; iNdEx-- { v := m.Usage[k8s_io_api_core_v1.ResourceName(keysForUsage[iNdEx])] baseI := i { size, err := ((*resource.Quantity)(&v)).MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 i -= len(keysForUsage[iNdEx]) copy(dAtA[i:], keysForUsage[iNdEx]) i = encodeVarintGenerated(dAtA, i, uint64(len(keysForUsage[iNdEx]))) i-- dAtA[i] = 0xa i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0x22 } } { size, err := m.Window.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a { size, err := m.Timestamp.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 { size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *NodeMetricsList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *NodeMetricsList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *NodeMetricsList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Items) > 0 { for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } { size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *PodMetrics) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *PodMetrics) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *PodMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Containers) > 0 { for iNdEx := len(m.Containers) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Containers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x22 } } { size, err := m.Window.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a { size, err := m.Timestamp.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 { size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *PodMetricsList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *PodMetricsList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *PodMetricsList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Items) > 0 { for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } { size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { offset -= sovGenerated(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) return base } func (m *ContainerMetrics) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Name) n += 1 + l + sovGenerated(uint64(l)) if len(m.Usage) > 0 { for k, v := range m.Usage { _ = k _ = v l = ((*resource.Quantity)(&v)).Size() mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } return n } func (m *NodeMetrics) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ObjectMeta.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Timestamp.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Window.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Usage) > 0 { for k, v := range m.Usage { _ = k _ = v l = ((*resource.Quantity)(&v)).Size() mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } return n } func (m *NodeMetricsList) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Items) > 0 { for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func (m *PodMetrics) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ObjectMeta.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Timestamp.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Window.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Containers) > 0 { for _, e := range m.Containers { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func (m *PodMetricsList) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Items) > 0 { for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func sovGenerated(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozGenerated(x uint64) (n int) { return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *ContainerMetrics) String() string { if this == nil { return "nil" } keysForUsage := make([]string, 0, len(this.Usage)) for k := range this.Usage { keysForUsage = append(keysForUsage, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForUsage) mapStringForUsage := "k8s_io_api_core_v1.ResourceList{" for _, k := range keysForUsage { mapStringForUsage += fmt.Sprintf("%v: %v,", k, this.Usage[k8s_io_api_core_v1.ResourceName(k)]) } mapStringForUsage += "}" s := strings.Join([]string{`&ContainerMetrics{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Usage:` + mapStringForUsage + `,`, `}`, }, "") return s } func (this *NodeMetrics) String() string { if this == nil { return "nil" } keysForUsage := make([]string, 0, len(this.Usage)) for k := range this.Usage { keysForUsage = append(keysForUsage, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForUsage) mapStringForUsage := "k8s_io_api_core_v1.ResourceList{" for _, k := range keysForUsage { mapStringForUsage += fmt.Sprintf("%v: %v,", k, this.Usage[k8s_io_api_core_v1.ResourceName(k)]) } mapStringForUsage += "}" s := strings.Join([]string{`&NodeMetrics{`, `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, `Timestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, `Window:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Window), "Duration", "v1.Duration", 1), `&`, ``, 1) + `,`, `Usage:` + mapStringForUsage + `,`, `}`, }, "") return s } func (this *NodeMetricsList) String() string { if this == nil { return "nil" } repeatedStringForItems := "[]NodeMetrics{" for _, f := range this.Items { repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "NodeMetrics", "NodeMetrics", 1), `&`, ``, 1) + "," } repeatedStringForItems += "}" s := strings.Join([]string{`&NodeMetricsList{`, `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, `Items:` + repeatedStringForItems + `,`, `}`, }, "") return s } func (this *PodMetrics) String() string { if this == nil { return "nil" } repeatedStringForContainers := "[]ContainerMetrics{" for _, f := range this.Containers { repeatedStringForContainers += strings.Replace(strings.Replace(f.String(), "ContainerMetrics", "ContainerMetrics", 1), `&`, ``, 1) + "," } repeatedStringForContainers += "}" s := strings.Join([]string{`&PodMetrics{`, `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, `Timestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, `Window:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Window), "Duration", "v1.Duration", 1), `&`, ``, 1) + `,`, `Containers:` + repeatedStringForContainers + `,`, `}`, }, "") return s } func (this *PodMetricsList) String() string { if this == nil { return "nil" } repeatedStringForItems := "[]PodMetrics{" for _, f := range this.Items { repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PodMetrics", "PodMetrics", 1), `&`, ``, 1) + "," } repeatedStringForItems += "}" s := strings.Join([]string{`&PodMetricsList{`, `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, `Items:` + repeatedStringForItems + `,`, `}`, }, "") return s } func valueToStringGenerated(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } func (m *ContainerMetrics) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ContainerMetrics: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ContainerMetrics: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if m.Usage == nil { m.Usage = make(k8s_io_api_core_v1.ResourceList) } var mapkey k8s_io_api_core_v1.ResourceName mapvalue := &resource.Quantity{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthGenerated } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthGenerated } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapmsglen |= int(b&0x7F) << shift if b < 0x80 { break } } if mapmsglen < 0 { return ErrInvalidLengthGenerated } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { return ErrInvalidLengthGenerated } if postmsgIndex > l { return io.ErrUnexpectedEOF } mapvalue = &resource.Quantity{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex } else { iNdEx = entryPreIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Usage[k8s_io_api_core_v1.ResourceName(mapkey)] = ((k8s_io_apimachinery_pkg_api_resource.Quantity)(*mapvalue)) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *NodeMetrics) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: NodeMetrics: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: NodeMetrics: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Window", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Window.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if m.Usage == nil { m.Usage = make(k8s_io_api_core_v1.ResourceList) } var mapkey k8s_io_api_core_v1.ResourceName mapvalue := &resource.Quantity{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthGenerated } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthGenerated } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapmsglen |= int(b&0x7F) << shift if b < 0x80 { break } } if mapmsglen < 0 { return ErrInvalidLengthGenerated } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { return ErrInvalidLengthGenerated } if postmsgIndex > l { return io.ErrUnexpectedEOF } mapvalue = &resource.Quantity{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex } else { iNdEx = entryPreIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Usage[k8s_io_api_core_v1.ResourceName(mapkey)] = ((k8s_io_apimachinery_pkg_api_resource.Quantity)(*mapvalue)) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *NodeMetricsList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: NodeMetricsList: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: NodeMetricsList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Items = append(m.Items, NodeMetrics{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *PodMetrics) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PodMetrics: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PodMetrics: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Window", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Window.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Containers", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Containers = append(m.Containers, ContainerMetrics{}) if err := m.Containers[len(m.Containers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *PodMetricsList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PodMetricsList: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PodMetricsList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Items = append(m.Items, PodMetrics{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipGenerated(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } case 1: iNdEx += 8 case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if length < 0 { return 0, ErrInvalidLengthGenerated } iNdEx += length case 3: depth++ case 4: if depth == 0 { return 0, ErrUnexpectedEndOfGroupGenerated } depth-- case 5: iNdEx += 4 default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { return 0, ErrInvalidLengthGenerated } if depth == 0 { return iNdEx, nil } } return 0, io.ErrUnexpectedEOF } var ( ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") ) metrics-0.29.0/pkg/apis/metrics/v1beta1/generated.proto000066400000000000000000000067211453636773000227450ustar00rootroot00000000000000/* Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // This file was autogenerated by go-to-protobuf. Do not edit it manually! syntax = "proto2"; package k8s.io.metrics.pkg.apis.metrics.v1beta1; import "k8s.io/api/core/v1/generated.proto"; import "k8s.io/apimachinery/pkg/api/resource/generated.proto"; import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; // Package-wide variables from generator "generated". option go_package = "k8s.io/metrics/pkg/apis/metrics/v1beta1"; // ContainerMetrics sets resource usage metrics of a container. message ContainerMetrics { // Container name corresponding to the one from pod.spec.containers. optional string name = 1; // The memory usage is the memory working set. map usage = 2; } // NodeMetrics sets resource usage metrics of a node. message NodeMetrics { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The following fields define time interval from which metrics were // collected from the interval [Timestamp-Window, Timestamp]. optional k8s.io.apimachinery.pkg.apis.meta.v1.Time timestamp = 2; optional k8s.io.apimachinery.pkg.apis.meta.v1.Duration window = 3; // The memory usage is the memory working set. map usage = 4; } // NodeMetricsList is a list of NodeMetrics. message NodeMetricsList { // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // List of node metrics. repeated NodeMetrics items = 2; } // PodMetrics sets resource usage metrics of a pod. message PodMetrics { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The following fields define time interval from which metrics were // collected from the interval [Timestamp-Window, Timestamp]. optional k8s.io.apimachinery.pkg.apis.meta.v1.Time timestamp = 2; optional k8s.io.apimachinery.pkg.apis.meta.v1.Duration window = 3; // Metrics for all containers are collected within the same time window. repeated ContainerMetrics containers = 4; } // PodMetricsList is a list of PodMetrics. message PodMetricsList { // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // List of pod metrics. repeated PodMetrics items = 2; } metrics-0.29.0/pkg/apis/metrics/v1beta1/register.go000066400000000000000000000032361453636773000220730ustar00rootroot00000000000000/* 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 v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName is the group name use in this package const GroupName = "metrics.k8s.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( // SchemeBuilder points to a list of functions added to Scheme. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) localSchemeBuilder = &SchemeBuilder // AddToScheme applies all the stored functions to the scheme. AddToScheme = SchemeBuilder.AddToScheme ) func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &NodeMetrics{}, &NodeMetricsList{}, &PodMetrics{}, &PodMetricsList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil } metrics-0.29.0/pkg/apis/metrics/v1beta1/types.go000066400000000000000000000101101453636773000214000ustar00rootroot00000000000000/* 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 v1beta1 import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // +genclient // +resourceName=nodes // +genclient:readonly // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // NodeMetrics sets resource usage metrics of a node. type NodeMetrics struct { metav1.TypeMeta `json:",inline"` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // The following fields define time interval from which metrics were // collected from the interval [Timestamp-Window, Timestamp]. Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,2,opt,name=timestamp"` Window metav1.Duration `json:"window" protobuf:"bytes,3,opt,name=window"` // The memory usage is the memory working set. Usage v1.ResourceList `json:"usage" protobuf:"bytes,4,rep,name=usage,casttype=k8s.io/api/core/v1.ResourceList,castkey=k8s.io/api/core/v1.ResourceName,castvalue=k8s.io/apimachinery/pkg/api/resource.Quantity"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // NodeMetricsList is a list of NodeMetrics. type NodeMetricsList struct { metav1.TypeMeta `json:",inline"` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // List of node metrics. Items []NodeMetrics `json:"items" protobuf:"bytes,2,rep,name=items"` } // +genclient // +resourceName=pods // +genclient:readonly // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodMetrics sets resource usage metrics of a pod. type PodMetrics struct { metav1.TypeMeta `json:",inline"` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // The following fields define time interval from which metrics were // collected from the interval [Timestamp-Window, Timestamp]. Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,2,opt,name=timestamp"` Window metav1.Duration `json:"window" protobuf:"bytes,3,opt,name=window"` // Metrics for all containers are collected within the same time window. Containers []ContainerMetrics `json:"containers" protobuf:"bytes,4,rep,name=containers"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodMetricsList is a list of PodMetrics. type PodMetricsList struct { metav1.TypeMeta `json:",inline"` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // List of pod metrics. Items []PodMetrics `json:"items" protobuf:"bytes,2,rep,name=items"` } // ContainerMetrics sets resource usage metrics of a container. type ContainerMetrics struct { // Container name corresponding to the one from pod.spec.containers. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` // The memory usage is the memory working set. Usage v1.ResourceList `json:"usage" protobuf:"bytes,2,rep,name=usage,casttype=k8s.io/api/core/v1.ResourceList,castkey=k8s.io/api/core/v1.ResourceName,castvalue=k8s.io/apimachinery/pkg/api/resource.Quantity"` } metrics-0.29.0/pkg/apis/metrics/v1beta1/zz_generated.conversion.go000066400000000000000000000234601453636773000251150ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by conversion-gen. DO NOT EDIT. package v1beta1 import ( unsafe "unsafe" v1 "k8s.io/api/core/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" metrics "k8s.io/metrics/pkg/apis/metrics" ) func init() { localSchemeBuilder.Register(RegisterConversions) } // RegisterConversions adds conversion functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterConversions(s *runtime.Scheme) error { if err := s.AddGeneratedConversionFunc((*ContainerMetrics)(nil), (*metrics.ContainerMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_ContainerMetrics_To_metrics_ContainerMetrics(a.(*ContainerMetrics), b.(*metrics.ContainerMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*metrics.ContainerMetrics)(nil), (*ContainerMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_metrics_ContainerMetrics_To_v1beta1_ContainerMetrics(a.(*metrics.ContainerMetrics), b.(*ContainerMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*NodeMetrics)(nil), (*metrics.NodeMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_NodeMetrics_To_metrics_NodeMetrics(a.(*NodeMetrics), b.(*metrics.NodeMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*metrics.NodeMetrics)(nil), (*NodeMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_metrics_NodeMetrics_To_v1beta1_NodeMetrics(a.(*metrics.NodeMetrics), b.(*NodeMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*NodeMetricsList)(nil), (*metrics.NodeMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_NodeMetricsList_To_metrics_NodeMetricsList(a.(*NodeMetricsList), b.(*metrics.NodeMetricsList), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*metrics.NodeMetricsList)(nil), (*NodeMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_metrics_NodeMetricsList_To_v1beta1_NodeMetricsList(a.(*metrics.NodeMetricsList), b.(*NodeMetricsList), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*PodMetrics)(nil), (*metrics.PodMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_PodMetrics_To_metrics_PodMetrics(a.(*PodMetrics), b.(*metrics.PodMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*metrics.PodMetrics)(nil), (*PodMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_metrics_PodMetrics_To_v1beta1_PodMetrics(a.(*metrics.PodMetrics), b.(*PodMetrics), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*PodMetricsList)(nil), (*metrics.PodMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_PodMetricsList_To_metrics_PodMetricsList(a.(*PodMetricsList), b.(*metrics.PodMetricsList), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*metrics.PodMetricsList)(nil), (*PodMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_metrics_PodMetricsList_To_v1beta1_PodMetricsList(a.(*metrics.PodMetricsList), b.(*PodMetricsList), scope) }); err != nil { return err } return nil } func autoConvert_v1beta1_ContainerMetrics_To_metrics_ContainerMetrics(in *ContainerMetrics, out *metrics.ContainerMetrics, s conversion.Scope) error { out.Name = in.Name out.Usage = *(*v1.ResourceList)(unsafe.Pointer(&in.Usage)) return nil } // Convert_v1beta1_ContainerMetrics_To_metrics_ContainerMetrics is an autogenerated conversion function. func Convert_v1beta1_ContainerMetrics_To_metrics_ContainerMetrics(in *ContainerMetrics, out *metrics.ContainerMetrics, s conversion.Scope) error { return autoConvert_v1beta1_ContainerMetrics_To_metrics_ContainerMetrics(in, out, s) } func autoConvert_metrics_ContainerMetrics_To_v1beta1_ContainerMetrics(in *metrics.ContainerMetrics, out *ContainerMetrics, s conversion.Scope) error { out.Name = in.Name out.Usage = *(*v1.ResourceList)(unsafe.Pointer(&in.Usage)) return nil } // Convert_metrics_ContainerMetrics_To_v1beta1_ContainerMetrics is an autogenerated conversion function. func Convert_metrics_ContainerMetrics_To_v1beta1_ContainerMetrics(in *metrics.ContainerMetrics, out *ContainerMetrics, s conversion.Scope) error { return autoConvert_metrics_ContainerMetrics_To_v1beta1_ContainerMetrics(in, out, s) } func autoConvert_v1beta1_NodeMetrics_To_metrics_NodeMetrics(in *NodeMetrics, out *metrics.NodeMetrics, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta out.Timestamp = in.Timestamp out.Window = in.Window out.Usage = *(*v1.ResourceList)(unsafe.Pointer(&in.Usage)) return nil } // Convert_v1beta1_NodeMetrics_To_metrics_NodeMetrics is an autogenerated conversion function. func Convert_v1beta1_NodeMetrics_To_metrics_NodeMetrics(in *NodeMetrics, out *metrics.NodeMetrics, s conversion.Scope) error { return autoConvert_v1beta1_NodeMetrics_To_metrics_NodeMetrics(in, out, s) } func autoConvert_metrics_NodeMetrics_To_v1beta1_NodeMetrics(in *metrics.NodeMetrics, out *NodeMetrics, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta out.Timestamp = in.Timestamp out.Window = in.Window out.Usage = *(*v1.ResourceList)(unsafe.Pointer(&in.Usage)) return nil } // Convert_metrics_NodeMetrics_To_v1beta1_NodeMetrics is an autogenerated conversion function. func Convert_metrics_NodeMetrics_To_v1beta1_NodeMetrics(in *metrics.NodeMetrics, out *NodeMetrics, s conversion.Scope) error { return autoConvert_metrics_NodeMetrics_To_v1beta1_NodeMetrics(in, out, s) } func autoConvert_v1beta1_NodeMetricsList_To_metrics_NodeMetricsList(in *NodeMetricsList, out *metrics.NodeMetricsList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]metrics.NodeMetrics)(unsafe.Pointer(&in.Items)) return nil } // Convert_v1beta1_NodeMetricsList_To_metrics_NodeMetricsList is an autogenerated conversion function. func Convert_v1beta1_NodeMetricsList_To_metrics_NodeMetricsList(in *NodeMetricsList, out *metrics.NodeMetricsList, s conversion.Scope) error { return autoConvert_v1beta1_NodeMetricsList_To_metrics_NodeMetricsList(in, out, s) } func autoConvert_metrics_NodeMetricsList_To_v1beta1_NodeMetricsList(in *metrics.NodeMetricsList, out *NodeMetricsList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]NodeMetrics)(unsafe.Pointer(&in.Items)) return nil } // Convert_metrics_NodeMetricsList_To_v1beta1_NodeMetricsList is an autogenerated conversion function. func Convert_metrics_NodeMetricsList_To_v1beta1_NodeMetricsList(in *metrics.NodeMetricsList, out *NodeMetricsList, s conversion.Scope) error { return autoConvert_metrics_NodeMetricsList_To_v1beta1_NodeMetricsList(in, out, s) } func autoConvert_v1beta1_PodMetrics_To_metrics_PodMetrics(in *PodMetrics, out *metrics.PodMetrics, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta out.Timestamp = in.Timestamp out.Window = in.Window out.Containers = *(*[]metrics.ContainerMetrics)(unsafe.Pointer(&in.Containers)) return nil } // Convert_v1beta1_PodMetrics_To_metrics_PodMetrics is an autogenerated conversion function. func Convert_v1beta1_PodMetrics_To_metrics_PodMetrics(in *PodMetrics, out *metrics.PodMetrics, s conversion.Scope) error { return autoConvert_v1beta1_PodMetrics_To_metrics_PodMetrics(in, out, s) } func autoConvert_metrics_PodMetrics_To_v1beta1_PodMetrics(in *metrics.PodMetrics, out *PodMetrics, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta out.Timestamp = in.Timestamp out.Window = in.Window out.Containers = *(*[]ContainerMetrics)(unsafe.Pointer(&in.Containers)) return nil } // Convert_metrics_PodMetrics_To_v1beta1_PodMetrics is an autogenerated conversion function. func Convert_metrics_PodMetrics_To_v1beta1_PodMetrics(in *metrics.PodMetrics, out *PodMetrics, s conversion.Scope) error { return autoConvert_metrics_PodMetrics_To_v1beta1_PodMetrics(in, out, s) } func autoConvert_v1beta1_PodMetricsList_To_metrics_PodMetricsList(in *PodMetricsList, out *metrics.PodMetricsList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]metrics.PodMetrics)(unsafe.Pointer(&in.Items)) return nil } // Convert_v1beta1_PodMetricsList_To_metrics_PodMetricsList is an autogenerated conversion function. func Convert_v1beta1_PodMetricsList_To_metrics_PodMetricsList(in *PodMetricsList, out *metrics.PodMetricsList, s conversion.Scope) error { return autoConvert_v1beta1_PodMetricsList_To_metrics_PodMetricsList(in, out, s) } func autoConvert_metrics_PodMetricsList_To_v1beta1_PodMetricsList(in *metrics.PodMetricsList, out *PodMetricsList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]PodMetrics)(unsafe.Pointer(&in.Items)) return nil } // Convert_metrics_PodMetricsList_To_v1beta1_PodMetricsList is an autogenerated conversion function. func Convert_metrics_PodMetricsList_To_v1beta1_PodMetricsList(in *metrics.PodMetricsList, out *PodMetricsList, s conversion.Scope) error { return autoConvert_metrics_PodMetricsList_To_v1beta1_PodMetricsList(in, out, s) } metrics-0.29.0/pkg/apis/metrics/v1beta1/zz_generated.deepcopy.go000066400000000000000000000121471453636773000245400ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by deepcopy-gen. DO NOT EDIT. package v1beta1 import ( v1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ContainerMetrics) DeepCopyInto(out *ContainerMetrics) { *out = *in if in.Usage != nil { in, out := &in.Usage, &out.Usage *out = make(v1.ResourceList, len(*in)) for key, val := range *in { (*out)[key] = val.DeepCopy() } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerMetrics. func (in *ContainerMetrics) DeepCopy() *ContainerMetrics { if in == nil { return nil } out := new(ContainerMetrics) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeMetrics) DeepCopyInto(out *NodeMetrics) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Timestamp.DeepCopyInto(&out.Timestamp) out.Window = in.Window if in.Usage != nil { in, out := &in.Usage, &out.Usage *out = make(v1.ResourceList, len(*in)) for key, val := range *in { (*out)[key] = val.DeepCopy() } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeMetrics. func (in *NodeMetrics) DeepCopy() *NodeMetrics { if in == nil { return nil } out := new(NodeMetrics) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *NodeMetrics) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeMetricsList) DeepCopyInto(out *NodeMetricsList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]NodeMetrics, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeMetricsList. func (in *NodeMetricsList) DeepCopy() *NodeMetricsList { if in == nil { return nil } out := new(NodeMetricsList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *NodeMetricsList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodMetrics) DeepCopyInto(out *PodMetrics) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Timestamp.DeepCopyInto(&out.Timestamp) out.Window = in.Window if in.Containers != nil { in, out := &in.Containers, &out.Containers *out = make([]ContainerMetrics, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodMetrics. func (in *PodMetrics) DeepCopy() *PodMetrics { if in == nil { return nil } out := new(PodMetrics) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *PodMetrics) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodMetricsList) DeepCopyInto(out *PodMetricsList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]PodMetrics, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodMetricsList. func (in *PodMetricsList) DeepCopy() *PodMetricsList { if in == nil { return nil } out := new(PodMetricsList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *PodMetricsList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } metrics-0.29.0/pkg/apis/metrics/zz_generated.deepcopy.go000066400000000000000000000121471453636773000232750ustar00rootroot00000000000000//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 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. */ // Code generated by deepcopy-gen. DO NOT EDIT. package metrics import ( v1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ContainerMetrics) DeepCopyInto(out *ContainerMetrics) { *out = *in if in.Usage != nil { in, out := &in.Usage, &out.Usage *out = make(v1.ResourceList, len(*in)) for key, val := range *in { (*out)[key] = val.DeepCopy() } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerMetrics. func (in *ContainerMetrics) DeepCopy() *ContainerMetrics { if in == nil { return nil } out := new(ContainerMetrics) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeMetrics) DeepCopyInto(out *NodeMetrics) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Timestamp.DeepCopyInto(&out.Timestamp) out.Window = in.Window if in.Usage != nil { in, out := &in.Usage, &out.Usage *out = make(v1.ResourceList, len(*in)) for key, val := range *in { (*out)[key] = val.DeepCopy() } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeMetrics. func (in *NodeMetrics) DeepCopy() *NodeMetrics { if in == nil { return nil } out := new(NodeMetrics) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *NodeMetrics) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeMetricsList) DeepCopyInto(out *NodeMetricsList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]NodeMetrics, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeMetricsList. func (in *NodeMetricsList) DeepCopy() *NodeMetricsList { if in == nil { return nil } out := new(NodeMetricsList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *NodeMetricsList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodMetrics) DeepCopyInto(out *PodMetrics) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Timestamp.DeepCopyInto(&out.Timestamp) out.Window = in.Window if in.Containers != nil { in, out := &in.Containers, &out.Containers *out = make([]ContainerMetrics, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodMetrics. func (in *PodMetrics) DeepCopy() *PodMetrics { if in == nil { return nil } out := new(PodMetrics) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *PodMetrics) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodMetricsList) DeepCopyInto(out *PodMetricsList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]PodMetrics, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodMetricsList. func (in *PodMetricsList) DeepCopy() *PodMetricsList { if in == nil { return nil } out := new(PodMetricsList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *PodMetricsList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } metrics-0.29.0/pkg/apis/roundtrip_test.go000066400000000000000000000044021453636773000204170ustar00rootroot00000000000000/* Copyright 2020 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 testing import ( "math/rand" "testing" custommetrics "k8s.io/metrics/pkg/apis/custom_metrics" custommetricsv1beta1 "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1" custommetricsv1beta2 "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2" externalmetrics "k8s.io/metrics/pkg/apis/external_metrics" externalmetricsv1beta1 "k8s.io/metrics/pkg/apis/external_metrics/v1beta1" metrics "k8s.io/metrics/pkg/apis/metrics" metricsv1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1" metricsv1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1" "github.com/stretchr/testify/require" "k8s.io/apimachinery/pkg/api/apitesting/fuzzer" "k8s.io/apimachinery/pkg/api/apitesting/roundtrip" genericfuzzer "k8s.io/apimachinery/pkg/apis/meta/fuzzer" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" ) var groups = []runtime.SchemeBuilder{ custommetrics.SchemeBuilder, custommetricsv1beta1.SchemeBuilder, custommetricsv1beta2.SchemeBuilder, externalmetrics.SchemeBuilder, externalmetricsv1beta1.SchemeBuilder, metrics.SchemeBuilder, metricsv1alpha1.SchemeBuilder, metricsv1beta1.SchemeBuilder, } func TestRoundTripTypes(t *testing.T) { scheme := runtime.NewScheme() codecs := serializer.NewCodecFactory(scheme) for _, builder := range groups { require.NoError(t, builder.AddToScheme(scheme)) } seed := rand.Int63() // I'm only using the generic fuzzer funcs, but at some point in time we might need to // switch to specialized. For now we're happy with the current serialization test. fuzzer := fuzzer.FuzzerFor(genericfuzzer.Funcs, rand.NewSource(seed), codecs) roundtrip.RoundTripExternalTypes(t, scheme, codecs, fuzzer, nil) roundtrip.RoundTripTypes(t, scheme, codecs, fuzzer, nil) } metrics-0.29.0/pkg/client/000077500000000000000000000000001453636773000153255ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset/000077500000000000000000000000001453636773000173175ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset/versioned/000077500000000000000000000000001453636773000213155ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset/versioned/clientset.go000066400000000000000000000104141453636773000236360ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package versioned import ( "fmt" "net/http" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" metricsv1alpha1 "k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1alpha1" metricsv1beta1 "k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1beta1" ) type Interface interface { Discovery() discovery.DiscoveryInterface MetricsV1alpha1() metricsv1alpha1.MetricsV1alpha1Interface MetricsV1beta1() metricsv1beta1.MetricsV1beta1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient metricsV1alpha1 *metricsv1alpha1.MetricsV1alpha1Client metricsV1beta1 *metricsv1beta1.MetricsV1beta1Client } // MetricsV1alpha1 retrieves the MetricsV1alpha1Client func (c *Clientset) MetricsV1alpha1() metricsv1alpha1.MetricsV1alpha1Interface { return c.metricsV1alpha1 } // MetricsV1beta1 retrieves the MetricsV1beta1Client func (c *Clientset) MetricsV1beta1() metricsv1beta1.MetricsV1beta1Interface { return c.metricsV1beta1 } // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { return nil } return c.DiscoveryClient } // NewForConfig creates a new Clientset for the given config. // If config's RateLimiter is not set and QPS and Burst are acceptable, // NewForConfig will generate a rate-limiter in configShallowCopy. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*Clientset, error) { configShallowCopy := *c if configShallowCopy.UserAgent == "" { configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() } // share the transport between all clients httpClient, err := rest.HTTPClientFor(&configShallowCopy) if err != nil { return nil, err } return NewForConfigAndClient(&configShallowCopy, httpClient) } // NewForConfigAndClient creates a new Clientset for the given config and http client. // Note the http client provided takes precedence over the configured transport values. // If config's RateLimiter is not set and QPS and Burst are acceptable, // NewForConfigAndClient will generate a rate-limiter in configShallowCopy. func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { configShallowCopy := *c if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.Burst <= 0 { return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") } configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) } var cs Clientset var err error cs.metricsV1alpha1, err = metricsv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.metricsV1beta1, err = metricsv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } return &cs, nil } // NewForConfigOrDie creates a new Clientset for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { cs, err := NewForConfig(c) if err != nil { panic(err) } return cs } // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset cs.metricsV1alpha1 = metricsv1alpha1.New(c) cs.metricsV1beta1 = metricsv1beta1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs } metrics-0.29.0/pkg/client/clientset/versioned/fake/000077500000000000000000000000001453636773000222235ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset/versioned/fake/clientset_generated.go000066400000000000000000000061521453636773000265660ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" fakediscovery "k8s.io/client-go/discovery/fake" "k8s.io/client-go/testing" clientset "k8s.io/metrics/pkg/client/clientset/versioned" metricsv1alpha1 "k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1alpha1" fakemetricsv1alpha1 "k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake" metricsv1beta1 "k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1beta1" fakemetricsv1beta1 "k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1beta1/fake" ) // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, // without applying any validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { if err := o.Add(obj); err != nil { panic(err) } } cs := &Clientset{tracker: o} cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} cs.AddReactor("*", "*", testing.ObjectReaction(o)) cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { gvr := action.GetResource() ns := action.GetNamespace() watch, err := o.Watch(gvr, ns) if err != nil { return false, nil, err } return true, watch, nil }) return cs } // Clientset implements clientset.Interface. Meant to be embedded into a // struct to get a default implementation. This makes faking out just the method // you want to test easier. type Clientset struct { testing.Fake discovery *fakediscovery.FakeDiscovery tracker testing.ObjectTracker } func (c *Clientset) Discovery() discovery.DiscoveryInterface { return c.discovery } func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } var ( _ clientset.Interface = &Clientset{} _ testing.FakeClient = &Clientset{} ) // MetricsV1alpha1 retrieves the MetricsV1alpha1Client func (c *Clientset) MetricsV1alpha1() metricsv1alpha1.MetricsV1alpha1Interface { return &fakemetricsv1alpha1.FakeMetricsV1alpha1{Fake: &c.Fake} } // MetricsV1beta1 retrieves the MetricsV1beta1Client func (c *Clientset) MetricsV1beta1() metricsv1beta1.MetricsV1beta1Interface { return &fakemetricsv1beta1.FakeMetricsV1beta1{Fake: &c.Fake} } metrics-0.29.0/pkg/client/clientset/versioned/fake/doc.go000066400000000000000000000012621453636773000233200ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated fake clientset. package fake metrics-0.29.0/pkg/client/clientset/versioned/fake/register.go000066400000000000000000000036051453636773000244020ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" metricsv1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1" metricsv1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1" ) var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ metricsv1alpha1.AddToScheme, metricsv1beta1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // // import ( // "k8s.io/client-go/kubernetes" // clientsetscheme "k8s.io/client-go/kubernetes/scheme" // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" // ) // // kclientset, _ := kubernetes.NewForConfig(c) // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. var AddToScheme = localSchemeBuilder.AddToScheme func init() { v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) utilruntime.Must(AddToScheme(scheme)) } metrics-0.29.0/pkg/client/clientset/versioned/scheme/000077500000000000000000000000001453636773000225615ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset/versioned/scheme/doc.go000066400000000000000000000013021453636773000236510ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. // This package contains the scheme of the automatically generated clientset. package scheme metrics-0.29.0/pkg/client/clientset/versioned/scheme/register.go000066400000000000000000000036751453636773000247470ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package scheme import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" metricsv1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1" metricsv1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1" ) var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ metricsv1alpha1.AddToScheme, metricsv1beta1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // // import ( // "k8s.io/client-go/kubernetes" // clientsetscheme "k8s.io/client-go/kubernetes/scheme" // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" // ) // // kclientset, _ := kubernetes.NewForConfig(c) // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. var AddToScheme = localSchemeBuilder.AddToScheme func init() { v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) utilruntime.Must(AddToScheme(Scheme)) } metrics-0.29.0/pkg/client/clientset/versioned/typed/000077500000000000000000000000001453636773000224425ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/000077500000000000000000000000001453636773000241105ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1alpha1/000077500000000000000000000000001453636773000255255ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1alpha1/doc.go000066400000000000000000000012651453636773000266250ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. package v1alpha1 metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/000077500000000000000000000000001453636773000264335ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/doc.go000066400000000000000000000012531453636773000275300ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. // Package fake has the automatically generated clients. package fake metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_metrics_client.go000066400000000000000000000024211453636773000327530ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" v1alpha1 "k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1alpha1" ) type FakeMetricsV1alpha1 struct { *testing.Fake } func (c *FakeMetricsV1alpha1) NodeMetricses() v1alpha1.NodeMetricsInterface { return &FakeNodeMetricses{c} } func (c *FakeMetricsV1alpha1) PodMetricses(namespace string) v1alpha1.PodMetricsInterface { return &FakePodMetricses{c, namespace} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeMetricsV1alpha1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_nodemetrics.go000066400000000000000000000050751453636773000322730ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( "context" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" v1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1" ) // FakeNodeMetricses implements NodeMetricsInterface type FakeNodeMetricses struct { Fake *FakeMetricsV1alpha1 } var nodemetricsesResource = v1alpha1.SchemeGroupVersion.WithResource("nodes") var nodemetricsesKind = v1alpha1.SchemeGroupVersion.WithKind("NodeMetrics") // Get takes name of the nodeMetrics, and returns the corresponding nodeMetrics object, and an error if there is any. func (c *FakeNodeMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeMetrics, err error) { obj, err := c.Fake. Invokes(testing.NewRootGetAction(nodemetricsesResource, name), &v1alpha1.NodeMetrics{}) if obj == nil { return nil, err } return obj.(*v1alpha1.NodeMetrics), err } // List takes label and field selectors, and returns the list of NodeMetricses that match those selectors. func (c *FakeNodeMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeMetricsList, err error) { obj, err := c.Fake. Invokes(testing.NewRootListAction(nodemetricsesResource, nodemetricsesKind, opts), &v1alpha1.NodeMetricsList{}) if obj == nil { return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &v1alpha1.NodeMetricsList{ListMeta: obj.(*v1alpha1.NodeMetricsList).ListMeta} for _, item := range obj.(*v1alpha1.NodeMetricsList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } } return list, err } // Watch returns a watch.Interface that watches the requested nodeMetricses. func (c *FakeNodeMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewRootWatchAction(nodemetricsesResource, opts)) } metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_podmetrics.go000066400000000000000000000050711453636773000321240ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( "context" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" v1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1" ) // FakePodMetricses implements PodMetricsInterface type FakePodMetricses struct { Fake *FakeMetricsV1alpha1 ns string } var podmetricsesResource = v1alpha1.SchemeGroupVersion.WithResource("pods") var podmetricsesKind = v1alpha1.SchemeGroupVersion.WithKind("PodMetrics") // Get takes name of the podMetrics, and returns the corresponding podMetrics object, and an error if there is any. func (c *FakePodMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PodMetrics, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(podmetricsesResource, c.ns, name), &v1alpha1.PodMetrics{}) if obj == nil { return nil, err } return obj.(*v1alpha1.PodMetrics), err } // List takes label and field selectors, and returns the list of PodMetricses that match those selectors. func (c *FakePodMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PodMetricsList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(podmetricsesResource, podmetricsesKind, c.ns, opts), &v1alpha1.PodMetricsList{}) if obj == nil { return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &v1alpha1.PodMetricsList{ListMeta: obj.(*v1alpha1.PodMetricsList).ListMeta} for _, item := range obj.(*v1alpha1.PodMetricsList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } } return list, err } // Watch returns a watch.Interface that watches the requested podMetricses. func (c *FakePodMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(podmetricsesResource, c.ns, opts)) } metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1alpha1/generated_expansion.go000066400000000000000000000013031453636773000320730ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package v1alpha1 type NodeMetricsExpansion interface{} type PodMetricsExpansion interface{} metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1alpha1/metrics_client.go000066400000000000000000000063301453636773000310620ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package v1alpha1 import ( "net/http" rest "k8s.io/client-go/rest" v1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1" "k8s.io/metrics/pkg/client/clientset/versioned/scheme" ) type MetricsV1alpha1Interface interface { RESTClient() rest.Interface NodeMetricsesGetter PodMetricsesGetter } // MetricsV1alpha1Client is used to interact with features provided by the metrics.k8s.io group. type MetricsV1alpha1Client struct { restClient rest.Interface } func (c *MetricsV1alpha1Client) NodeMetricses() NodeMetricsInterface { return newNodeMetricses(c) } func (c *MetricsV1alpha1Client) PodMetricses(namespace string) PodMetricsInterface { return newPodMetricses(c, namespace) } // NewForConfig creates a new MetricsV1alpha1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*MetricsV1alpha1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } httpClient, err := rest.HTTPClientFor(&config) if err != nil { return nil, err } return NewForConfigAndClient(&config, httpClient) } // NewForConfigAndClient creates a new MetricsV1alpha1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. func NewForConfigAndClient(c *rest.Config, h *http.Client) (*MetricsV1alpha1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } return &MetricsV1alpha1Client{client}, nil } // NewForConfigOrDie creates a new MetricsV1alpha1Client for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *MetricsV1alpha1Client { client, err := NewForConfig(c) if err != nil { panic(err) } return client } // New creates a new MetricsV1alpha1Client for the given RESTClient. func New(c rest.Interface) *MetricsV1alpha1Client { return &MetricsV1alpha1Client{c} } func setConfigDefaults(config *rest.Config) error { gv := v1alpha1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() } return nil } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *MetricsV1alpha1Client) RESTClient() rest.Interface { if c == nil { return nil } return c.restClient } metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1alpha1/nodemetrics.go000066400000000000000000000061261453636773000303750ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package v1alpha1 import ( "context" "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" v1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1" scheme "k8s.io/metrics/pkg/client/clientset/versioned/scheme" ) // NodeMetricsesGetter has a method to return a NodeMetricsInterface. // A group's client should implement this interface. type NodeMetricsesGetter interface { NodeMetricses() NodeMetricsInterface } // NodeMetricsInterface has methods to work with NodeMetrics resources. type NodeMetricsInterface interface { Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NodeMetrics, error) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeMetricsList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) NodeMetricsExpansion } // nodeMetricses implements NodeMetricsInterface type nodeMetricses struct { client rest.Interface } // newNodeMetricses returns a NodeMetricses func newNodeMetricses(c *MetricsV1alpha1Client) *nodeMetricses { return &nodeMetricses{ client: c.RESTClient(), } } // Get takes name of the nodeMetrics, and returns the corresponding nodeMetrics object, and an error if there is any. func (c *nodeMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeMetrics, err error) { result = &v1alpha1.NodeMetrics{} err = c.client.Get(). Resource("nodes"). Name(name). VersionedParams(&options, scheme.ParameterCodec). Do(ctx). Into(result) return } // List takes label and field selectors, and returns the list of NodeMetricses that match those selectors. func (c *nodeMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeMetricsList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } result = &v1alpha1.NodeMetricsList{} err = c.client.Get(). Resource("nodes"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested nodeMetricses. func (c *nodeMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } opts.Watch = true return c.client.Get(). Resource("nodes"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Watch(ctx) } metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1alpha1/podmetrics.go000066400000000000000000000062641453636773000302350ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package v1alpha1 import ( "context" "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" v1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1" scheme "k8s.io/metrics/pkg/client/clientset/versioned/scheme" ) // PodMetricsesGetter has a method to return a PodMetricsInterface. // A group's client should implement this interface. type PodMetricsesGetter interface { PodMetricses(namespace string) PodMetricsInterface } // PodMetricsInterface has methods to work with PodMetrics resources. type PodMetricsInterface interface { Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.PodMetrics, error) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PodMetricsList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) PodMetricsExpansion } // podMetricses implements PodMetricsInterface type podMetricses struct { client rest.Interface ns string } // newPodMetricses returns a PodMetricses func newPodMetricses(c *MetricsV1alpha1Client, namespace string) *podMetricses { return &podMetricses{ client: c.RESTClient(), ns: namespace, } } // Get takes name of the podMetrics, and returns the corresponding podMetrics object, and an error if there is any. func (c *podMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PodMetrics, err error) { result = &v1alpha1.PodMetrics{} err = c.client.Get(). Namespace(c.ns). Resource("pods"). Name(name). VersionedParams(&options, scheme.ParameterCodec). Do(ctx). Into(result) return } // List takes label and field selectors, and returns the list of PodMetricses that match those selectors. func (c *podMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PodMetricsList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } result = &v1alpha1.PodMetricsList{} err = c.client.Get(). Namespace(c.ns). Resource("pods"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested podMetricses. func (c *podMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } opts.Watch = true return c.client.Get(). Namespace(c.ns). Resource("pods"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Watch(ctx) } metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1beta1/000077500000000000000000000000001453636773000253535ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1beta1/doc.go000066400000000000000000000012641453636773000264520ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. package v1beta1 metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1beta1/fake/000077500000000000000000000000001453636773000262615ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1beta1/fake/doc.go000066400000000000000000000012531453636773000273560ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. // Package fake has the automatically generated clients. package fake metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1beta1/fake/fake_metrics_client.go000066400000000000000000000024111453636773000326000ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" v1beta1 "k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1beta1" ) type FakeMetricsV1beta1 struct { *testing.Fake } func (c *FakeMetricsV1beta1) NodeMetricses() v1beta1.NodeMetricsInterface { return &FakeNodeMetricses{c} } func (c *FakeMetricsV1beta1) PodMetricses(namespace string) v1beta1.PodMetricsInterface { return &FakePodMetricses{c, namespace} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeMetricsV1beta1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1beta1/fake/fake_nodemetrics.go000066400000000000000000000050601453636773000321130ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( "context" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" v1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1" ) // FakeNodeMetricses implements NodeMetricsInterface type FakeNodeMetricses struct { Fake *FakeMetricsV1beta1 } var nodemetricsesResource = v1beta1.SchemeGroupVersion.WithResource("nodes") var nodemetricsesKind = v1beta1.SchemeGroupVersion.WithKind("NodeMetrics") // Get takes name of the nodeMetrics, and returns the corresponding nodeMetrics object, and an error if there is any. func (c *FakeNodeMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.NodeMetrics, err error) { obj, err := c.Fake. Invokes(testing.NewRootGetAction(nodemetricsesResource, name), &v1beta1.NodeMetrics{}) if obj == nil { return nil, err } return obj.(*v1beta1.NodeMetrics), err } // List takes label and field selectors, and returns the list of NodeMetricses that match those selectors. func (c *FakeNodeMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.NodeMetricsList, err error) { obj, err := c.Fake. Invokes(testing.NewRootListAction(nodemetricsesResource, nodemetricsesKind, opts), &v1beta1.NodeMetricsList{}) if obj == nil { return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &v1beta1.NodeMetricsList{ListMeta: obj.(*v1beta1.NodeMetricsList).ListMeta} for _, item := range obj.(*v1beta1.NodeMetricsList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } } return list, err } // Watch returns a watch.Interface that watches the requested nodeMetricses. func (c *FakeNodeMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewRootWatchAction(nodemetricsesResource, opts)) } metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1beta1/fake/fake_podmetrics.go000066400000000000000000000050541453636773000317530ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( "context" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" v1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1" ) // FakePodMetricses implements PodMetricsInterface type FakePodMetricses struct { Fake *FakeMetricsV1beta1 ns string } var podmetricsesResource = v1beta1.SchemeGroupVersion.WithResource("pods") var podmetricsesKind = v1beta1.SchemeGroupVersion.WithKind("PodMetrics") // Get takes name of the podMetrics, and returns the corresponding podMetrics object, and an error if there is any. func (c *FakePodMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.PodMetrics, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(podmetricsesResource, c.ns, name), &v1beta1.PodMetrics{}) if obj == nil { return nil, err } return obj.(*v1beta1.PodMetrics), err } // List takes label and field selectors, and returns the list of PodMetricses that match those selectors. func (c *FakePodMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.PodMetricsList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(podmetricsesResource, podmetricsesKind, c.ns, opts), &v1beta1.PodMetricsList{}) if obj == nil { return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &v1beta1.PodMetricsList{ListMeta: obj.(*v1beta1.PodMetricsList).ListMeta} for _, item := range obj.(*v1beta1.PodMetricsList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } } return list, err } // Watch returns a watch.Interface that watches the requested podMetricses. func (c *FakePodMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(podmetricsesResource, c.ns, opts)) } metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1beta1/generated_expansion.go000066400000000000000000000013021453636773000317200ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 type NodeMetricsExpansion interface{} type PodMetricsExpansion interface{} metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1beta1/metrics_client.go000066400000000000000000000063041453636773000307110ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 import ( "net/http" rest "k8s.io/client-go/rest" v1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1" "k8s.io/metrics/pkg/client/clientset/versioned/scheme" ) type MetricsV1beta1Interface interface { RESTClient() rest.Interface NodeMetricsesGetter PodMetricsesGetter } // MetricsV1beta1Client is used to interact with features provided by the metrics.k8s.io group. type MetricsV1beta1Client struct { restClient rest.Interface } func (c *MetricsV1beta1Client) NodeMetricses() NodeMetricsInterface { return newNodeMetricses(c) } func (c *MetricsV1beta1Client) PodMetricses(namespace string) PodMetricsInterface { return newPodMetricses(c, namespace) } // NewForConfig creates a new MetricsV1beta1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*MetricsV1beta1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } httpClient, err := rest.HTTPClientFor(&config) if err != nil { return nil, err } return NewForConfigAndClient(&config, httpClient) } // NewForConfigAndClient creates a new MetricsV1beta1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. func NewForConfigAndClient(c *rest.Config, h *http.Client) (*MetricsV1beta1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } return &MetricsV1beta1Client{client}, nil } // NewForConfigOrDie creates a new MetricsV1beta1Client for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *MetricsV1beta1Client { client, err := NewForConfig(c) if err != nil { panic(err) } return client } // New creates a new MetricsV1beta1Client for the given RESTClient. func New(c rest.Interface) *MetricsV1beta1Client { return &MetricsV1beta1Client{c} } func setConfigDefaults(config *rest.Config) error { gv := v1beta1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() } return nil } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *MetricsV1beta1Client) RESTClient() rest.Interface { if c == nil { return nil } return c.restClient } metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1beta1/nodemetrics.go000066400000000000000000000061141453636773000302200ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 import ( "context" "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" v1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1" scheme "k8s.io/metrics/pkg/client/clientset/versioned/scheme" ) // NodeMetricsesGetter has a method to return a NodeMetricsInterface. // A group's client should implement this interface. type NodeMetricsesGetter interface { NodeMetricses() NodeMetricsInterface } // NodeMetricsInterface has methods to work with NodeMetrics resources. type NodeMetricsInterface interface { Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.NodeMetrics, error) List(ctx context.Context, opts v1.ListOptions) (*v1beta1.NodeMetricsList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) NodeMetricsExpansion } // nodeMetricses implements NodeMetricsInterface type nodeMetricses struct { client rest.Interface } // newNodeMetricses returns a NodeMetricses func newNodeMetricses(c *MetricsV1beta1Client) *nodeMetricses { return &nodeMetricses{ client: c.RESTClient(), } } // Get takes name of the nodeMetrics, and returns the corresponding nodeMetrics object, and an error if there is any. func (c *nodeMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.NodeMetrics, err error) { result = &v1beta1.NodeMetrics{} err = c.client.Get(). Resource("nodes"). Name(name). VersionedParams(&options, scheme.ParameterCodec). Do(ctx). Into(result) return } // List takes label and field selectors, and returns the list of NodeMetricses that match those selectors. func (c *nodeMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.NodeMetricsList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } result = &v1beta1.NodeMetricsList{} err = c.client.Get(). Resource("nodes"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested nodeMetricses. func (c *nodeMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } opts.Watch = true return c.client.Get(). Resource("nodes"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Watch(ctx) } metrics-0.29.0/pkg/client/clientset/versioned/typed/metrics/v1beta1/podmetrics.go000066400000000000000000000062521453636773000300600ustar00rootroot00000000000000/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 import ( "context" "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" v1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1" scheme "k8s.io/metrics/pkg/client/clientset/versioned/scheme" ) // PodMetricsesGetter has a method to return a PodMetricsInterface. // A group's client should implement this interface. type PodMetricsesGetter interface { PodMetricses(namespace string) PodMetricsInterface } // PodMetricsInterface has methods to work with PodMetrics resources. type PodMetricsInterface interface { Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.PodMetrics, error) List(ctx context.Context, opts v1.ListOptions) (*v1beta1.PodMetricsList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) PodMetricsExpansion } // podMetricses implements PodMetricsInterface type podMetricses struct { client rest.Interface ns string } // newPodMetricses returns a PodMetricses func newPodMetricses(c *MetricsV1beta1Client, namespace string) *podMetricses { return &podMetricses{ client: c.RESTClient(), ns: namespace, } } // Get takes name of the podMetrics, and returns the corresponding podMetrics object, and an error if there is any. func (c *podMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.PodMetrics, err error) { result = &v1beta1.PodMetrics{} err = c.client.Get(). Namespace(c.ns). Resource("pods"). Name(name). VersionedParams(&options, scheme.ParameterCodec). Do(ctx). Into(result) return } // List takes label and field selectors, and returns the list of PodMetricses that match those selectors. func (c *podMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.PodMetricsList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } result = &v1beta1.PodMetricsList{} err = c.client.Get(). Namespace(c.ns). Resource("pods"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested podMetricses. func (c *podMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } opts.Watch = true return c.client.Get(). Namespace(c.ns). Resource("pods"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Watch(ctx) } metrics-0.29.0/pkg/client/clientset_test/000077500000000000000000000000001453636773000203565ustar00rootroot00000000000000metrics-0.29.0/pkg/client/clientset_test/clientset_test.go000066400000000000000000000027601453636773000237430ustar00rootroot00000000000000/* Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package clientset_test import ( "context" "testing" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/metrics/pkg/client/clientset/versioned/fake" ) // TestFakeList is a basic sanity check that makes sure the fake Clientset is working properly. func TestFakeList(t *testing.T) { client := fake.NewSimpleClientset() if _, err := client.MetricsV1alpha1().PodMetricses("").List(context.TODO(), metav1.ListOptions{}); err != nil { t.Errorf("Unexpected error: %v", err) } if _, err := client.MetricsV1alpha1().NodeMetricses().List(context.TODO(), metav1.ListOptions{}); err != nil { t.Errorf("Unexpected error: %v", err) } if _, err := client.MetricsV1beta1().PodMetricses("").List(context.TODO(), metav1.ListOptions{}); err != nil { t.Errorf("Unexpected error: %v", err) } if _, err := client.MetricsV1beta1().NodeMetricses().List(context.TODO(), metav1.ListOptions{}); err != nil { t.Errorf("Unexpected error: %v", err) } } metrics-0.29.0/pkg/client/custom_metrics/000077500000000000000000000000001453636773000203655ustar00rootroot00000000000000metrics-0.29.0/pkg/client/custom_metrics/converter.go000066400000000000000000000100101453636773000227130ustar00rootroot00000000000000/* 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 custom_metrics import ( "fmt" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/client-go/rest" cmint "k8s.io/metrics/pkg/apis/custom_metrics" cmv1beta1 "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1" cmv1beta2 "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2" "k8s.io/metrics/pkg/client/custom_metrics/scheme" ) var ( // MetricVersions is the set of metric versions accepted by the converter. MetricVersions = []schema.GroupVersion{ cmv1beta2.SchemeGroupVersion, cmv1beta1.SchemeGroupVersion, cmint.SchemeGroupVersion, } ) // MetricConverter knows how to convert between external MetricValue versions. type MetricConverter struct { scheme *runtime.Scheme codecs serializer.CodecFactory internalVersioner runtime.GroupVersioner } // NewMetricConverter creates a MetricConverter which knows how to convert objects // between different versions of the custom metrics api. func NewMetricConverter() *MetricConverter { return &MetricConverter{ scheme: scheme.Scheme, codecs: serializer.NewCodecFactory(scheme.Scheme), internalVersioner: runtime.NewMultiGroupVersioner( scheme.SchemeGroupVersion, schema.GroupKind{Group: cmint.GroupName, Kind: ""}, schema.GroupKind{Group: cmv1beta1.GroupName, Kind: ""}, schema.GroupKind{Group: cmv1beta2.GroupName, Kind: ""}, ), } } // Scheme returns the scheme used by this metric converter. func (c *MetricConverter) Scheme() *runtime.Scheme { return c.scheme } // Codecs returns the codecs used by this metric converter func (c *MetricConverter) Codecs() serializer.CodecFactory { return c.codecs } // ConvertListOptionsToVersion converts converts a set of MetricListOptions // to the provided GroupVersion. func (c *MetricConverter) ConvertListOptionsToVersion(opts *cmint.MetricListOptions, version schema.GroupVersion) (runtime.Object, error) { paramObj, err := c.UnsafeConvertToVersionVia(opts, version) if err != nil { return nil, err } return paramObj, nil } // ConvertResultToVersion converts a Result to the provided GroupVersion func (c *MetricConverter) ConvertResultToVersion(res rest.Result, gv schema.GroupVersion) (runtime.Object, error) { if err := res.Error(); err != nil { return nil, err } metricBytes, err := res.Raw() if err != nil { return nil, err } decoder := c.codecs.UniversalDecoder(MetricVersions...) rawMetricObj, err := runtime.Decode(decoder, metricBytes) if err != nil { return nil, err } metricObj, err := c.UnsafeConvertToVersionVia(rawMetricObj, gv) if err != nil { return nil, err } return metricObj, nil } // UnsafeConvertToVersionVia is like Scheme.UnsafeConvertToVersion, but it does so via an internal version first. // We use it here to work with the v1beta2 client internally, while preserving backwards compatibility for existing custom metrics adapters func (c *MetricConverter) UnsafeConvertToVersionVia(obj runtime.Object, externalVersion schema.GroupVersion) (runtime.Object, error) { objInt, err := c.scheme.UnsafeConvertToVersion(obj, schema.GroupVersion{Group: externalVersion.Group, Version: runtime.APIVersionInternal}) if err != nil { return nil, fmt.Errorf("failed to convert the given object to the internal version: %v", err) } objExt, err := c.scheme.UnsafeConvertToVersion(objInt, externalVersion) if err != nil { return nil, fmt.Errorf("failed to convert the given object back to the external version: %v", err) } return objExt, err } metrics-0.29.0/pkg/client/custom_metrics/discovery.go000066400000000000000000000102161453636773000227230ustar00rootroot00000000000000/* 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 custom_metrics import ( "fmt" "sync" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/discovery" cmint "k8s.io/metrics/pkg/apis/custom_metrics" ) var ( // metricVersionsToGV is the map of string group-versions // accepted by the converter to group-version objects (so // we don't have to re-parse) metricVersionsToGV map[string]schema.GroupVersion ) func init() { metricVersionsToGV = make(map[string]schema.GroupVersion) for _, ver := range MetricVersions { metricVersionsToGV[ver.String()] = ver } } // NewAvailableAPIsGetter creates an AvailableAPIsGetter that checks discovery // to find the available versions of the custom metrics api. func NewAvailableAPIsGetter(client discovery.DiscoveryInterface) AvailableAPIsGetter { return &apiVersionsFromDiscovery{ client: client, } } // apiVersionsFromDiscovery caches a preferred version of the custom metrics api. type apiVersionsFromDiscovery struct { client discovery.DiscoveryInterface // just cache the group directly since the discovery interface doesn't yet allow // asking for a single API group's versions. prefVersion *schema.GroupVersion mu sync.RWMutex } // fetchVersions fetches the versions, but doesn't try to invalidate on cache misses. func (d *apiVersionsFromDiscovery) fetchVersions() (*metav1.APIGroup, error) { // TODO(directxman12): amend the discovery interface to ask for a particular group (/apis/foo) groups, err := d.client.ServerGroups() if err != nil { return nil, err } // Determine the preferred version on the server by first finding the custom metrics group var apiGroup *metav1.APIGroup for _, group := range groups.Groups { if group.Name == cmint.GroupName { apiGroup = &group break } } if apiGroup == nil { return nil, fmt.Errorf("no custom metrics API (%s) registered", cmint.GroupName) } return apiGroup, nil } // chooseVersion sets a preferred version of the custom metrics api based on available versions. func (d *apiVersionsFromDiscovery) chooseVersion(apiGroup *metav1.APIGroup) (schema.GroupVersion, error) { var preferredVersion *schema.GroupVersion if gv, present := metricVersionsToGV[apiGroup.PreferredVersion.GroupVersion]; present && len(apiGroup.PreferredVersion.GroupVersion) != 0 { preferredVersion = &gv } else { for _, version := range apiGroup.Versions { if gv, present := metricVersionsToGV[version.GroupVersion]; present { preferredVersion = &gv break } } } if preferredVersion == nil { return schema.GroupVersion{}, fmt.Errorf("no known available metric versions found") } return *preferredVersion, nil } // PreferredVersion returns the current preferred version of the custom metrics api. // If none is specified, it will use the first known one. func (d *apiVersionsFromDiscovery) PreferredVersion() (schema.GroupVersion, error) { d.mu.RLock() if d.prefVersion != nil { // if we've already got one, proceed with that defer d.mu.RUnlock() return *d.prefVersion, nil } d.mu.RUnlock() d.mu.Lock() defer d.mu.Unlock() // double check, someone might have beaten us to it if d.prefVersion != nil { return *d.prefVersion, nil } // populate our cache groupInfo, err := d.fetchVersions() if err != nil { return schema.GroupVersion{}, err } prefVersion, err := d.chooseVersion(groupInfo) if err != nil { return schema.GroupVersion{}, err } d.prefVersion = &prefVersion return *d.prefVersion, nil } // Invalidate refreshes the preferred version information. func (d *apiVersionsFromDiscovery) Invalidate() { d.mu.Lock() defer d.mu.Unlock() d.prefVersion = nil } metrics-0.29.0/pkg/client/custom_metrics/fake/000077500000000000000000000000001453636773000212735ustar00rootroot00000000000000metrics-0.29.0/pkg/client/custom_metrics/fake/fake_client.go000066400000000000000000000123451453636773000240730ustar00rootroot00000000000000/* 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 fake import ( "fmt" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/testing" "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2" cmclient "k8s.io/metrics/pkg/client/custom_metrics" ) type GetForActionImpl struct { testing.GetAction MetricName string LabelSelector labels.Selector } type GetForAction interface { testing.GetAction GetMetricName() string GetLabelSelector() labels.Selector } func (i GetForActionImpl) GetMetricName() string { return i.MetricName } func (i GetForActionImpl) GetLabelSelector() labels.Selector { return i.LabelSelector } func (i GetForActionImpl) GetSubresource() string { return i.MetricName } func (i GetForActionImpl) DeepCopy() testing.Action { var labelSelector labels.Selector if i.LabelSelector != nil { labelSelector = i.LabelSelector.DeepCopySelector() } return GetForActionImpl{ GetAction: i.GetAction.DeepCopy().(testing.GetAction), MetricName: i.MetricName, LabelSelector: labelSelector, } } func NewGetForAction(groupKind schema.GroupKind, namespace, name string, metricName string, labelSelector labels.Selector) GetForActionImpl { // the version doesn't matter gvk := groupKind.WithVersion("") gvr, _ := meta.UnsafeGuessKindToResource(gvk) groupResourceForKind := schema.GroupResource{ Group: gvr.Group, Resource: gvr.Resource, } resource := schema.GroupResource{ Group: v1beta2.SchemeGroupVersion.Group, Resource: groupResourceForKind.String(), } return GetForActionImpl{ GetAction: testing.NewGetAction(resource.WithVersion(""), namespace, name), MetricName: metricName, LabelSelector: labelSelector, } } func NewRootGetForAction(groupKind schema.GroupKind, name string, metricName string, labelSelector labels.Selector) GetForActionImpl { // the version doesn't matter gvk := groupKind.WithVersion("") gvr, _ := meta.UnsafeGuessKindToResource(gvk) groupResourceForKind := schema.GroupResource{ Group: gvr.Group, Resource: gvr.Resource, } resource := schema.GroupResource{ Group: v1beta2.SchemeGroupVersion.Group, Resource: groupResourceForKind.String(), } return GetForActionImpl{ GetAction: testing.NewRootGetAction(resource.WithVersion(""), name), MetricName: metricName, LabelSelector: labelSelector, } } type FakeCustomMetricsClient struct { testing.Fake } func (c *FakeCustomMetricsClient) RootScopedMetrics() cmclient.MetricsInterface { return &fakeRootScopedMetrics{ Fake: c, } } func (c *FakeCustomMetricsClient) NamespacedMetrics(namespace string) cmclient.MetricsInterface { return &fakeNamespacedMetrics{ Fake: c, ns: namespace, } } type fakeNamespacedMetrics struct { Fake *FakeCustomMetricsClient ns string } func (m *fakeNamespacedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValue, error) { obj, err := m.Fake. Invokes(NewGetForAction(groupKind, m.ns, name, metricName, nil), &v1beta2.MetricValueList{}) if obj == nil { return nil, err } objList := obj.(*v1beta2.MetricValueList) if len(objList.Items) != 1 { return nil, fmt.Errorf("the custom metrics API server returned %v results when we asked for exactly one", len(objList.Items)) } return &objList.Items[0], err } func (m *fakeNamespacedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValueList, error) { obj, err := m.Fake. Invokes(NewGetForAction(groupKind, m.ns, "*", metricName, selector), &v1beta2.MetricValueList{}) if obj == nil { return nil, err } return obj.(*v1beta2.MetricValueList), err } type fakeRootScopedMetrics struct { Fake *FakeCustomMetricsClient } func (m *fakeRootScopedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValue, error) { obj, err := m.Fake. Invokes(NewRootGetForAction(groupKind, name, metricName, nil), &v1beta2.MetricValueList{}) if obj == nil { return nil, err } objList := obj.(*v1beta2.MetricValueList) if len(objList.Items) != 1 { return nil, fmt.Errorf("the custom metrics API server returned %v results when we asked for exactly one", len(objList.Items)) } return &objList.Items[0], err } func (m *fakeRootScopedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValueList, error) { obj, err := m.Fake. Invokes(NewRootGetForAction(groupKind, "*", metricName, selector), &v1beta2.MetricValueList{}) if obj == nil { return nil, err } return obj.(*v1beta2.MetricValueList), err } metrics-0.29.0/pkg/client/custom_metrics/interfaces.go000066400000000000000000000041271453636773000230430ustar00rootroot00000000000000/* 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 custom_metrics import ( "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2" ) // CustomMetricsClient is a client for fetching metrics // describing both root-scoped and namespaced resources. type CustomMetricsClient interface { RootScopedMetricsGetter NamespacedMetricsGetter } // RootScopedMetricsGetter provides access to an interface for fetching // metrics describing root-scoped objects. Note that metrics describing // a namespace are simply considered a special case of root-scoped metrics. type RootScopedMetricsGetter interface { RootScopedMetrics() MetricsInterface } // NamespacedMetricsGetter provides access to an interface for fetching // metrics describing resources in a particular namespace. type NamespacedMetricsGetter interface { NamespacedMetrics(namespace string) MetricsInterface } // MetricsInterface provides access to metrics describing Kubernetes objects. type MetricsInterface interface { // GetForObject fetchs the given metric describing the given object. GetForObject(groupKind schema.GroupKind, name string, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValue, error) // GetForObjects fetches the given metric describing all objects of the given // type matching the given label selector (or simply all objects of the given type // if the selector is nil). GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValueList, error) } metrics-0.29.0/pkg/client/custom_metrics/multi_client.go000066400000000000000000000100151453636773000234010ustar00rootroot00000000000000/* 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 custom_metrics import ( "sync" "time" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/rest" "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2" ) // AvailableAPIsGetter knows how to fetch and cache the preferred custom metrics API version, // and invalidate that cache when asked. type AvailableAPIsGetter interface { PreferredVersion() (schema.GroupVersion, error) Invalidate() } // PeriodicallyInvalidate periodically invalidates the preferred version cache until // told to stop. func PeriodicallyInvalidate(cache AvailableAPIsGetter, interval time.Duration, stopCh <-chan struct{}) { ticker := time.NewTicker(interval) defer ticker.Stop() for { select { case <-ticker.C: cache.Invalidate() case <-stopCh: return } } } // NewForConfig creates a new custom metrics client which delegates to a client which // uses the preferred api version. func NewForConfig(baseConfig *rest.Config, mapper meta.RESTMapper, availableAPIs AvailableAPIsGetter) CustomMetricsClient { return &multiClient{ clients: make(map[schema.GroupVersion]CustomMetricsClient), availableAPIs: availableAPIs, newClient: func(ver schema.GroupVersion) (CustomMetricsClient, error) { return NewForVersionForConfig(rest.CopyConfig(baseConfig), mapper, ver) }, } } // multiClient is a CustomMetricsClient that can work with *any* metrics API version. type multiClient struct { newClient func(schema.GroupVersion) (CustomMetricsClient, error) clients map[schema.GroupVersion]CustomMetricsClient availableAPIs AvailableAPIsGetter mu sync.RWMutex } // getPreferredClient returns a custom metrics client of the preferred api version. func (c *multiClient) getPreferredClient() (CustomMetricsClient, error) { pref, err := c.availableAPIs.PreferredVersion() if err != nil { return nil, err } c.mu.RLock() client, present := c.clients[pref] c.mu.RUnlock() if present { return client, nil } c.mu.Lock() defer c.mu.Unlock() client, err = c.newClient(pref) if err != nil { return nil, err } c.clients[pref] = client return client, nil } func (c *multiClient) RootScopedMetrics() MetricsInterface { return &multiClientInterface{clients: c} } func (c *multiClient) NamespacedMetrics(namespace string) MetricsInterface { return &multiClientInterface{ clients: c, namespace: &namespace, } } type multiClientInterface struct { clients *multiClient namespace *string } func (m *multiClientInterface) GetForObject(groupKind schema.GroupKind, name string, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValue, error) { client, err := m.clients.getPreferredClient() if err != nil { return nil, err } if m.namespace == nil { return client.RootScopedMetrics().GetForObject(groupKind, name, metricName, metricSelector) } else { return client.NamespacedMetrics(*m.namespace).GetForObject(groupKind, name, metricName, metricSelector) } } func (m *multiClientInterface) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValueList, error) { client, err := m.clients.getPreferredClient() if err != nil { return nil, err } if m.namespace == nil { return client.RootScopedMetrics().GetForObjects(groupKind, selector, metricName, metricSelector) } else { return client.NamespacedMetrics(*m.namespace).GetForObjects(groupKind, selector, metricName, metricSelector) } } metrics-0.29.0/pkg/client/custom_metrics/scheme/000077500000000000000000000000001453636773000216315ustar00rootroot00000000000000metrics-0.29.0/pkg/client/custom_metrics/scheme/register.go000066400000000000000000000045451453636773000240140ustar00rootroot00000000000000/* 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 scheme import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" cmint "k8s.io/metrics/pkg/apis/custom_metrics" cmv1beta1 "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1" cmv1beta2 "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2" ) // GroupName is the group name use in this package. const GroupName = cmv1beta1.GroupName // SchemeGroupVersion is group version used to register these objects. var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} // Scheme is the runtime.Scheme to which all custom metrics api types are registered. var Scheme = runtime.NewScheme() // Codecs provides access to encoding and decoding for the scheme. var Codecs = serializer.NewCodecFactory(Scheme) // ParameterCodec handles versioning of objects that are converted to query parameters. var ParameterCodec = runtime.NewParameterCodec(Scheme) func init() { metav1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) AddToScheme(Scheme) } // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // // import ( // "k8s.io/client-go/kubernetes" // clientsetscheme "k8s.io/client-go/kubernetes/scheme" // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" // ) // // kclientset, _ := kubernetes.NewForConfig(c) // aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { cmint.AddToScheme(scheme) cmv1beta1.AddToScheme(scheme) cmv1beta2.AddToScheme(scheme) } metrics-0.29.0/pkg/client/custom_metrics/util_test.go000066400000000000000000000037371453636773000227420ustar00rootroot00000000000000/* 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 custom_metrics import ( "testing" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" cmint "k8s.io/metrics/pkg/apis/custom_metrics" cmv1beta1 "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1" cmv1beta2 "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2" ) func TestMetricConverter(t *testing.T) { testCases := []struct { name string group schema.GroupVersion expected runtime.Object }{ { name: "Use custom metrics v1beta2", group: cmv1beta2.SchemeGroupVersion, expected: &cmv1beta2.MetricListOptions{ TypeMeta: metav1.TypeMeta{Kind: "MetricListOptions", APIVersion: cmv1beta2.SchemeGroupVersion.String()}, MetricLabelSelector: "foo", }, }, { name: "Use custom metrics v1beta1", group: cmv1beta1.SchemeGroupVersion, expected: &cmv1beta1.MetricListOptions{ TypeMeta: metav1.TypeMeta{Kind: "MetricListOptions", APIVersion: cmv1beta1.SchemeGroupVersion.String()}, MetricLabelSelector: "foo", }, }, } for _, test := range testCases { t.Run(test.name, func(t *testing.T) { metricConverter := NewMetricConverter() opts := &cmint.MetricListOptions{MetricLabelSelector: "foo"} res, err := metricConverter.ConvertListOptionsToVersion(opts, test.group) require.NoError(t, err) require.Equal(t, test.expected, res) }) } } metrics-0.29.0/pkg/client/custom_metrics/versioned_client.go000066400000000000000000000222761453636773000242610ustar00rootroot00000000000000/* 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 custom_metrics import ( "context" "fmt" "reflect" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/rest" "k8s.io/client-go/util/flowcontrol" cmint "k8s.io/metrics/pkg/apis/custom_metrics" "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1" "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2" "k8s.io/metrics/pkg/client/custom_metrics/scheme" ) var versionConverter = NewMetricConverter() type customMetricsClient struct { client rest.Interface version schema.GroupVersion mapper meta.RESTMapper } // NewForVersion returns a new CustomMetricsClient for a particular api version. func NewForVersion(client rest.Interface, mapper meta.RESTMapper, version schema.GroupVersion) CustomMetricsClient { return &customMetricsClient{ client: client, version: version, mapper: mapper, } } // NewForVersionForConfig returns a new CustomMetricsClient for a particular api version and base configuration. func NewForVersionForConfig(c *rest.Config, mapper meta.RESTMapper, version schema.GroupVersion) (CustomMetricsClient, error) { configShallowCopy := *c if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.Burst <= 0 { return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") } configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) } configShallowCopy.APIPath = "/apis" if configShallowCopy.UserAgent == "" { configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() } configShallowCopy.GroupVersion = &version configShallowCopy.NegotiatedSerializer = scheme.Codecs.WithoutConversion() client, err := rest.RESTClientFor(&configShallowCopy) if err != nil { return nil, err } return NewForVersion(client, mapper, version), nil } func (c *customMetricsClient) RootScopedMetrics() MetricsInterface { return &rootScopedMetrics{c} } func (c *customMetricsClient) NamespacedMetrics(namespace string) MetricsInterface { return &namespacedMetrics{ client: c, namespace: namespace, } } // qualResourceForKind returns the string format of a qualified group resource for the specified GroupKind func (c *customMetricsClient) qualResourceForKind(groupKind schema.GroupKind) (string, error) { mapping, err := c.mapper.RESTMapping(groupKind) if err != nil { return "", fmt.Errorf("unable to map kind %s to resource: %v", groupKind.String(), err) } gr := mapping.Resource.GroupResource() return gr.String(), nil } type rootScopedMetrics struct { client *customMetricsClient } func (m *rootScopedMetrics) getForNamespace(namespace string, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValue, error) { params, err := versionConverter.ConvertListOptionsToVersion(&cmint.MetricListOptions{ MetricLabelSelector: metricSelector.String(), }, m.client.version) if err != nil { return nil, err } result := m.client.client.Get(). Resource("metrics"). Namespace(namespace). Name(metricName). VersionedParams(params, scheme.ParameterCodec). Do(context.TODO()) metricObj, err := versionConverter.ConvertResultToVersion(result, v1beta2.SchemeGroupVersion) if err != nil { return nil, err } var res *v1beta2.MetricValueList var ok bool if res, ok = metricObj.(*v1beta2.MetricValueList); !ok { return nil, fmt.Errorf("the custom metrics API server didn't return MetricValueList, the type is %v", reflect.TypeOf(metricObj)) } if len(res.Items) != 1 { return nil, fmt.Errorf("the custom metrics API server returned %v results when we asked for exactly one", len(res.Items)) } return &res.Items[0], nil } func (m *rootScopedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValue, error) { // handle namespace separately if groupKind.Kind == "Namespace" && groupKind.Group == "" { return m.getForNamespace(name, metricName, metricSelector) } resourceName, err := m.client.qualResourceForKind(groupKind) if err != nil { return nil, err } params, err := versionConverter.ConvertListOptionsToVersion(&cmint.MetricListOptions{ MetricLabelSelector: metricSelector.String(), }, m.client.version) if err != nil { return nil, err } result := m.client.client.Get(). Resource(resourceName). Name(name). SubResource(metricName). VersionedParams(params, scheme.ParameterCodec). Do(context.TODO()) metricObj, err := versionConverter.ConvertResultToVersion(result, v1beta2.SchemeGroupVersion) if err != nil { return nil, err } var res *v1beta2.MetricValueList var ok bool if res, ok = metricObj.(*v1beta2.MetricValueList); !ok { return nil, fmt.Errorf("the custom metrics API server didn't return MetricValueList, the type is %v", reflect.TypeOf(metricObj)) } if len(res.Items) != 1 { return nil, fmt.Errorf("the custom metrics API server returned %v results when we asked for exactly one", len(res.Items)) } return &res.Items[0], nil } func (m *rootScopedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValueList, error) { // we can't wildcard-fetch for namespaces if groupKind.Kind == "Namespace" && groupKind.Group == "" { return nil, fmt.Errorf("cannot fetch metrics for multiple namespaces at once") } resourceName, err := m.client.qualResourceForKind(groupKind) if err != nil { return nil, err } params, err := versionConverter.ConvertListOptionsToVersion(&cmint.MetricListOptions{ LabelSelector: selector.String(), MetricLabelSelector: metricSelector.String(), }, m.client.version) if err != nil { return nil, err } result := m.client.client.Get(). Resource(resourceName). Name(v1beta1.AllObjects). SubResource(metricName). VersionedParams(params, scheme.ParameterCodec). Do(context.TODO()) metricObj, err := versionConverter.ConvertResultToVersion(result, v1beta2.SchemeGroupVersion) if err != nil { return nil, err } var res *v1beta2.MetricValueList var ok bool if res, ok = metricObj.(*v1beta2.MetricValueList); !ok { return nil, fmt.Errorf("the custom metrics API server didn't return MetricValueList, the type is %v", reflect.TypeOf(metricObj)) } return res, nil } type namespacedMetrics struct { client *customMetricsClient namespace string } func (m *namespacedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValue, error) { resourceName, err := m.client.qualResourceForKind(groupKind) if err != nil { return nil, err } params, err := versionConverter.ConvertListOptionsToVersion(&cmint.MetricListOptions{ MetricLabelSelector: metricSelector.String(), }, m.client.version) if err != nil { return nil, err } result := m.client.client.Get(). Resource(resourceName). Namespace(m.namespace). Name(name). SubResource(metricName). VersionedParams(params, scheme.ParameterCodec). Do(context.TODO()) metricObj, err := versionConverter.ConvertResultToVersion(result, v1beta2.SchemeGroupVersion) if err != nil { return nil, err } var res *v1beta2.MetricValueList var ok bool if res, ok = metricObj.(*v1beta2.MetricValueList); !ok { return nil, fmt.Errorf("the custom metrics API server didn't return MetricValueList, the type is %v", reflect.TypeOf(metricObj)) } if len(res.Items) != 1 { return nil, fmt.Errorf("the custom metrics API server returned %v results when we asked for exactly one", len(res.Items)) } return &res.Items[0], nil } func (m *namespacedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValueList, error) { resourceName, err := m.client.qualResourceForKind(groupKind) if err != nil { return nil, err } params, err := versionConverter.ConvertListOptionsToVersion(&cmint.MetricListOptions{ LabelSelector: selector.String(), MetricLabelSelector: metricSelector.String(), }, m.client.version) if err != nil { return nil, err } result := m.client.client.Get(). Resource(resourceName). Namespace(m.namespace). Name(v1beta1.AllObjects). SubResource(metricName). VersionedParams(params, scheme.ParameterCodec). Do(context.TODO()) metricObj, err := versionConverter.ConvertResultToVersion(result, v1beta2.SchemeGroupVersion) if err != nil { return nil, err } var res *v1beta2.MetricValueList var ok bool if res, ok = metricObj.(*v1beta2.MetricValueList); !ok { return nil, fmt.Errorf("the custom metrics API server didn't return MetricValueList, the type is %v", reflect.TypeOf(metricObj)) } return res, nil } metrics-0.29.0/pkg/client/external_metrics/000077500000000000000000000000001453636773000206755ustar00rootroot00000000000000metrics-0.29.0/pkg/client/external_metrics/client.go000066400000000000000000000052741453636773000225120ustar00rootroot00000000000000/* 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 external_metrics import ( "context" "fmt" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" "k8s.io/client-go/util/flowcontrol" "k8s.io/metrics/pkg/apis/external_metrics/v1beta1" ) type externalMetricsClient struct { client rest.Interface } func New(client rest.Interface) ExternalMetricsClient { return &externalMetricsClient{ client: client, } } func NewForConfig(c *rest.Config) (ExternalMetricsClient, error) { configShallowCopy := *c if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.Burst <= 0 { return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") } configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) } configShallowCopy.APIPath = "/apis" if configShallowCopy.UserAgent == "" { configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() } configShallowCopy.GroupVersion = &v1beta1.SchemeGroupVersion configShallowCopy.NegotiatedSerializer = scheme.Codecs.WithoutConversion() client, err := rest.RESTClientFor(&configShallowCopy) if err != nil { return nil, err } return New(client), nil } func NewForConfigOrDie(c *rest.Config) ExternalMetricsClient { client, err := NewForConfig(c) if err != nil { panic(err) } return client } func (c *externalMetricsClient) NamespacedMetrics(namespace string) MetricsInterface { return &namespacedMetrics{ client: c, namespace: namespace, } } type namespacedMetrics struct { client *externalMetricsClient namespace string } func (m *namespacedMetrics) List(metricName string, metricSelector labels.Selector) (*v1beta1.ExternalMetricValueList, error) { res := &v1beta1.ExternalMetricValueList{} err := m.client.client.Get(). Namespace(m.namespace). Resource(metricName). VersionedParams(&metav1.ListOptions{ LabelSelector: metricSelector.String(), }, metav1.ParameterCodec). Do(context.TODO()). Into(res) if err != nil { return nil, err } return res, nil } metrics-0.29.0/pkg/client/external_metrics/fake/000077500000000000000000000000001453636773000216035ustar00rootroot00000000000000metrics-0.29.0/pkg/client/external_metrics/fake/fake_client.go000066400000000000000000000034401453636773000243770ustar00rootroot00000000000000/* 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 fake import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/testing" "k8s.io/metrics/pkg/apis/external_metrics/v1beta1" eclient "k8s.io/metrics/pkg/client/external_metrics" ) type FakeExternalMetricsClient struct { testing.Fake } func (c *FakeExternalMetricsClient) NamespacedMetrics(namespace string) eclient.MetricsInterface { return &fakeNamespacedMetrics{ Fake: c, ns: namespace, } } type fakeNamespacedMetrics struct { Fake *FakeExternalMetricsClient ns string } func (m *fakeNamespacedMetrics) List(metricName string, metricSelector labels.Selector) (*v1beta1.ExternalMetricValueList, error) { resource := schema.GroupResource{ Group: v1beta1.SchemeGroupVersion.Group, Resource: metricName, } kind := schema.GroupKind{ Group: v1beta1.SchemeGroupVersion.Group, Kind: "ExternalMetricValue", } action := testing.NewListAction(resource.WithVersion(""), kind.WithVersion(""), m.ns, metav1.ListOptions{LabelSelector: metricSelector.String()}) obj, err := m.Fake. Invokes(action, &v1beta1.ExternalMetricValueList{}) if obj == nil { return nil, err } return obj.(*v1beta1.ExternalMetricValueList), err } metrics-0.29.0/pkg/client/external_metrics/interfaces.go000066400000000000000000000024541453636773000233540ustar00rootroot00000000000000/* 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 external_metrics import ( "k8s.io/apimachinery/pkg/labels" "k8s.io/metrics/pkg/apis/external_metrics/v1beta1" ) // ExternalMetricsClient is a client for fetching external metrics. type ExternalMetricsClient interface { NamespacedMetricsGetter } // NamespacedMetricsGetter provides access to an interface for fetching // metrics in a particular namespace. type NamespacedMetricsGetter interface { NamespacedMetrics(namespace string) MetricsInterface } // MetricsInterface provides access to external metrics. type MetricsInterface interface { // List fetches the metric for the given namespace that maches the given // metricSelector. List(metricName string, metricSelector labels.Selector) (*v1beta1.ExternalMetricValueList, error) }