mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 10:17:51 +00:00
Add vendor folder to git
This commit is contained in:
parent
66cf5eaafb
commit
183585f56f
6916 changed files with 2629581 additions and 1 deletions
19
vendor/k8s.io/metrics/pkg/apis/custom_metrics/doc.go
generated
vendored
Normal file
19
vendor/k8s.io/metrics/pkg/apis/custom_metrics/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
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,register
|
||||
// +groupName=custom-metrics.metrics.k8s.io
|
||||
package custom_metrics // import "k8s.io/metrics/pkg/apis/custom_metrics"
|
||||
49
vendor/k8s.io/metrics/pkg/apis/custom_metrics/install/install.go
generated
vendored
Normal file
49
vendor/k8s.io/metrics/pkg/apis/custom_metrics/install/install.go
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
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/apimachinery/announced"
|
||||
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Install(api.GroupFactoryRegistry, api.Registry, api.Scheme)
|
||||
}
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
|
||||
if err := announced.NewGroupMetaFactory(
|
||||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: custom_metrics.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/metrics/pkg/apis/custom_metrics",
|
||||
AddInternalObjectsToScheme: custom_metrics.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
v1alpha1.SchemeGroupVersion.Version: v1alpha1.AddToScheme,
|
||||
},
|
||||
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
27
vendor/k8s.io/metrics/pkg/apis/custom_metrics/install/install_test.go
generated
vendored
Normal file
27
vendor/k8s.io/metrics/pkg/apis/custom_metrics/install/install_test.go
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
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
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
apitesting "k8s.io/apimachinery/pkg/api/testing"
|
||||
)
|
||||
|
||||
func TestRoundTripTypes(t *testing.T) {
|
||||
apitesting.RoundTripTestForAPIGroup(t, Install, nil)
|
||||
}
|
||||
51
vendor/k8s.io/metrics/pkg/apis/custom_metrics/register.go
generated
vendored
Normal file
51
vendor/k8s.io/metrics/pkg/apis/custom_metrics/register.go
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
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.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{},
|
||||
)
|
||||
return nil
|
||||
}
|
||||
1134
vendor/k8s.io/metrics/pkg/apis/custom_metrics/types.generated.go
generated
vendored
Normal file
1134
vendor/k8s.io/metrics/pkg/apis/custom_metrics/types.generated.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
59
vendor/k8s.io/metrics/pkg/apis/custom_metrics/types.go
generated
vendored
Normal file
59
vendor/k8s.io/metrics/pkg/apis/custom_metrics/types.go
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
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/client-go/pkg/api"
|
||||
)
|
||||
|
||||
// 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"`
|
||||
}
|
||||
|
||||
// a metric value for some object
|
||||
type MetricValue struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
// a reference to the described object
|
||||
DescribedObject api.ObjectReference `json:"describedObject"`
|
||||
|
||||
// the name of the metric
|
||||
MetricName string `json:"metricName"`
|
||||
|
||||
// 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 for this
|
||||
Value resource.Quantity `json:"value"`
|
||||
}
|
||||
|
||||
// allObjects is a wildcard used to select metrics
|
||||
// for all objects matching the given label selector
|
||||
const AllObjects = "*"
|
||||
21
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/doc.go
generated
vendored
Normal file
21
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
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,register
|
||||
// +k8s:conversion-gen=k8s.io/metrics/pkg/apis/custom_metrics
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
package v1alpha1 // import "k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
697
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/generated.pb.go
generated
vendored
Normal file
697
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/generated.pb.go
generated
vendored
Normal file
|
|
@ -0,0 +1,697 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by protoc-gen-gogo.
|
||||
// source: k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/generated.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package v1alpha1 is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
MetricValue
|
||||
MetricValueList
|
||||
*/
|
||||
package v1alpha1
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
import strings "strings"
|
||||
import reflect "reflect"
|
||||
|
||||
import io "io"
|
||||
|
||||
// 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.
|
||||
const _ = proto.GoGoProtoPackageIsVersion1
|
||||
|
||||
func (m *MetricValue) Reset() { *m = MetricValue{} }
|
||||
func (*MetricValue) ProtoMessage() {}
|
||||
func (*MetricValue) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
|
||||
func (m *MetricValueList) Reset() { *m = MetricValueList{} }
|
||||
func (*MetricValueList) ProtoMessage() {}
|
||||
func (*MetricValueList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MetricValue)(nil), "k8s.io.metrics.pkg.apis.custom_metrics.v1alpha1.MetricValue")
|
||||
proto.RegisterType((*MetricValueList)(nil), "k8s.io.metrics.pkg.apis.custom_metrics.v1alpha1.MetricValueList")
|
||||
}
|
||||
func (m *MetricValue) Marshal() (data []byte, err error) {
|
||||
size := m.Size()
|
||||
data = make([]byte, size)
|
||||
n, err := m.MarshalTo(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return data[:n], nil
|
||||
}
|
||||
|
||||
func (m *MetricValue) MarshalTo(data []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
data[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(m.DescribedObject.Size()))
|
||||
n1, err := m.DescribedObject.MarshalTo(data[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
data[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(len(m.MetricName)))
|
||||
i += copy(data[i:], m.MetricName)
|
||||
data[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(m.Timestamp.Size()))
|
||||
n2, err := m.Timestamp.MarshalTo(data[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n2
|
||||
if m.WindowSeconds != nil {
|
||||
data[i] = 0x20
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(*m.WindowSeconds))
|
||||
}
|
||||
data[i] = 0x2a
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(m.Value.Size()))
|
||||
n3, err := m.Value.MarshalTo(data[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n3
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *MetricValueList) Marshal() (data []byte, err error) {
|
||||
size := m.Size()
|
||||
data = make([]byte, size)
|
||||
n, err := m.MarshalTo(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return data[:n], nil
|
||||
}
|
||||
|
||||
func (m *MetricValueList) MarshalTo(data []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
data[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size()))
|
||||
n4, err := m.ListMeta.MarshalTo(data[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n4
|
||||
if len(m.Items) > 0 {
|
||||
for _, msg := range m.Items {
|
||||
data[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(msg.Size()))
|
||||
n, err := msg.MarshalTo(data[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n
|
||||
}
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Generated(data []byte, offset int, v uint64) int {
|
||||
data[offset] = uint8(v)
|
||||
data[offset+1] = uint8(v >> 8)
|
||||
data[offset+2] = uint8(v >> 16)
|
||||
data[offset+3] = uint8(v >> 24)
|
||||
data[offset+4] = uint8(v >> 32)
|
||||
data[offset+5] = uint8(v >> 40)
|
||||
data[offset+6] = uint8(v >> 48)
|
||||
data[offset+7] = uint8(v >> 56)
|
||||
return offset + 8
|
||||
}
|
||||
func encodeFixed32Generated(data []byte, offset int, v uint32) int {
|
||||
data[offset] = uint8(v)
|
||||
data[offset+1] = uint8(v >> 8)
|
||||
data[offset+2] = uint8(v >> 16)
|
||||
data[offset+3] = uint8(v >> 24)
|
||||
return offset + 4
|
||||
}
|
||||
func encodeVarintGenerated(data []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
data[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
data[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func (m *MetricValue) Size() (n int) {
|
||||
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))
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MetricValueList) Size() (n int) {
|
||||
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) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (this *MetricValue) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&MetricValue{`,
|
||||
`DescribedObject:` + strings.Replace(strings.Replace(this.DescribedObject.String(), "ObjectReference", "k8s_io_client_go_pkg_api_v1.ObjectReference", 1), `&`, ``, 1) + `,`,
|
||||
`MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`,
|
||||
`Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Time", "k8s_io_apimachinery_pkg_apis_meta_v1.Time", 1), `&`, ``, 1) + `,`,
|
||||
`WindowSeconds:` + valueToStringGenerated(this.WindowSeconds) + `,`,
|
||||
`Value:` + strings.Replace(strings.Replace(this.Value.String(), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1), `&`, ``, 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *MetricValueList) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&MetricValueList{`,
|
||||
`ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`,
|
||||
`Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "MetricValue", "MetricValue", 1), `&`, ``, 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
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 *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 > 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 > 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 > 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 > 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 {
|
||||
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 > 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 > 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 {
|
||||
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
|
||||
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
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
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
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := data[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipGenerated(data[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 542 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x93, 0x4f, 0x6f, 0xd3, 0x30,
|
||||
0x18, 0xc6, 0x9b, 0x95, 0x4a, 0xad, 0xab, 0xaa, 0x2c, 0x17, 0xa2, 0x1e, 0xd2, 0x6a, 0xa7, 0x6a,
|
||||
0x30, 0x5b, 0x2d, 0x08, 0x38, 0x20, 0x21, 0x45, 0x5c, 0x90, 0x28, 0x88, 0x6c, 0x02, 0x09, 0x90,
|
||||
0x26, 0xd7, 0x79, 0x97, 0x9a, 0x36, 0x71, 0x14, 0x3b, 0x9d, 0x76, 0xe3, 0x23, 0xf0, 0x05, 0xf8,
|
||||
0x3e, 0x3d, 0x4e, 0x9c, 0x38, 0x55, 0x34, 0x7c, 0x11, 0xe4, 0xfc, 0x59, 0xdb, 0x55, 0x1b, 0xec,
|
||||
0x16, 0xdb, 0xef, 0xf3, 0xf3, 0xf3, 0xbe, 0x8f, 0x83, 0x5e, 0x4e, 0x9f, 0x4b, 0xcc, 0x05, 0x09,
|
||||
0x40, 0xc5, 0x9c, 0x49, 0x12, 0x4d, 0x7d, 0x42, 0x23, 0x2e, 0x09, 0x4b, 0xa4, 0x12, 0xc1, 0x69,
|
||||
0xb9, 0x3f, 0x1f, 0xd0, 0x59, 0x34, 0xa1, 0x03, 0xe2, 0x43, 0x08, 0x31, 0x55, 0xe0, 0xe1, 0x28,
|
||||
0x16, 0x4a, 0x98, 0x24, 0x07, 0xe0, 0xa2, 0x10, 0x47, 0x53, 0x1f, 0x6b, 0x00, 0xde, 0x06, 0xe0,
|
||||
0x12, 0xd0, 0x39, 0xf2, 0xb9, 0x9a, 0x24, 0x63, 0xcc, 0x44, 0x40, 0x7c, 0xe1, 0x0b, 0x92, 0x71,
|
||||
0xc6, 0xc9, 0x59, 0xb6, 0xca, 0x16, 0xd9, 0x57, 0xce, 0xef, 0x3c, 0x29, 0x0c, 0xd2, 0x88, 0x07,
|
||||
0x94, 0x4d, 0x78, 0x08, 0xf1, 0x45, 0xe9, 0x92, 0xc4, 0x20, 0x45, 0x12, 0x33, 0xb8, 0xee, 0xea,
|
||||
0x56, 0x95, 0xd4, 0xcd, 0x52, 0x32, 0xdf, 0xe9, 0xa5, 0x43, 0x6e, 0x52, 0xc5, 0x49, 0xa8, 0x78,
|
||||
0xb0, 0x7b, 0xcd, 0xd3, 0x7f, 0x09, 0x24, 0x9b, 0x40, 0x40, 0x77, 0x74, 0x8f, 0x6f, 0xd2, 0x25,
|
||||
0x8a, 0xcf, 0x08, 0x0f, 0x95, 0x54, 0xf1, 0x8e, 0xe8, 0x61, 0x21, 0x62, 0x33, 0x0e, 0xa1, 0x3a,
|
||||
0xd2, 0x93, 0x2b, 0xc6, 0xb0, 0xdb, 0xca, 0xc1, 0x8f, 0x2a, 0x6a, 0x8e, 0xb2, 0xd1, 0x7f, 0xa0,
|
||||
0xb3, 0x04, 0x4c, 0x81, 0xda, 0x1e, 0x48, 0x16, 0xf3, 0x31, 0x78, 0xef, 0xc6, 0x5f, 0x81, 0x29,
|
||||
0xcb, 0xe8, 0x19, 0xfd, 0xe6, 0xf0, 0x11, 0x2e, 0x02, 0xcc, 0xb1, 0xa7, 0x7a, 0xf0, 0x79, 0x84,
|
||||
0x78, 0x3e, 0xc0, 0x79, 0xa9, 0x0b, 0x67, 0x10, 0x43, 0xc8, 0xc0, 0x79, 0xb0, 0x58, 0x76, 0x2b,
|
||||
0xe9, 0xb2, 0xdb, 0x7e, 0xb5, 0x0d, 0x73, 0xaf, 0xd3, 0xcd, 0x21, 0x42, 0x79, 0xf4, 0x6f, 0x69,
|
||||
0x00, 0xd6, 0x5e, 0xcf, 0xe8, 0x37, 0x1c, 0xb3, 0x50, 0xa3, 0xd1, 0xd5, 0x89, 0xbb, 0x51, 0x65,
|
||||
0x7e, 0x46, 0x0d, 0x3d, 0x35, 0xa9, 0x68, 0x10, 0x59, 0xd5, 0xcc, 0xde, 0x61, 0x69, 0x6f, 0x73,
|
||||
0x54, 0xeb, 0x47, 0xa6, 0x93, 0xd4, 0x3e, 0x4f, 0x78, 0x00, 0xce, 0x7e, 0x81, 0x6f, 0x9c, 0x94,
|
||||
0x10, 0x77, 0xcd, 0x33, 0x9f, 0xa1, 0xd6, 0x39, 0x0f, 0x3d, 0x71, 0x7e, 0x0c, 0x4c, 0x84, 0x9e,
|
||||
0xb4, 0xee, 0xf5, 0x8c, 0x7e, 0xd5, 0xd9, 0x4f, 0x97, 0xdd, 0xd6, 0xc7, 0xcd, 0x03, 0x77, 0xbb,
|
||||
0xce, 0x3c, 0x46, 0xb5, 0xb9, 0x9e, 0xa1, 0x55, 0xcb, 0x1c, 0xe1, 0xdb, 0x1c, 0xe1, 0xf2, 0x45,
|
||||
0xe2, 0xf7, 0x09, 0x0d, 0x15, 0x57, 0x17, 0x4e, 0xab, 0x70, 0x55, 0xcb, 0x82, 0x70, 0x73, 0xd6,
|
||||
0xc1, 0x4f, 0x03, 0xb5, 0x37, 0xf2, 0x79, 0xc3, 0xa5, 0x32, 0xbf, 0xa0, 0xba, 0xee, 0xc7, 0xa3,
|
||||
0x8a, 0x16, 0xe1, 0xe0, 0xff, 0xeb, 0x5e, 0xab, 0x47, 0xa0, 0xa8, 0x73, 0xbf, 0xb8, 0xab, 0x5e,
|
||||
0xee, 0xb8, 0x57, 0x44, 0x93, 0xa2, 0x1a, 0x57, 0x10, 0x48, 0x6b, 0xaf, 0x57, 0xed, 0x37, 0x87,
|
||||
0x2f, 0xf0, 0x1d, 0x7f, 0x5c, 0xbc, 0x61, 0x77, 0xdd, 0xd4, 0x6b, 0x8d, 0x74, 0x73, 0xb2, 0x73,
|
||||
0xb8, 0x58, 0xd9, 0x95, 0xcb, 0x95, 0x5d, 0xf9, 0xb5, 0xb2, 0x2b, 0xdf, 0x52, 0xdb, 0x58, 0xa4,
|
||||
0xb6, 0x71, 0x99, 0xda, 0xc6, 0xef, 0xd4, 0x36, 0xbe, 0xff, 0xb1, 0x2b, 0x9f, 0xea, 0x25, 0xed,
|
||||
0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xde, 0x29, 0xfe, 0x9a, 0x79, 0x04, 0x00, 0x00,
|
||||
}
|
||||
62
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/generated.proto
generated
vendored
Normal file
62
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/generated.proto
generated
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
|
||||
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
|
||||
|
||||
syntax = 'proto2';
|
||||
|
||||
package k8s.io.metrics.pkg.apis.custom_metrics.v1alpha1;
|
||||
|
||||
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";
|
||||
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
|
||||
import "k8s.io/client-go/pkg/api/v1/generated.proto";
|
||||
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1alpha1";
|
||||
|
||||
// a metric value for some object
|
||||
message MetricValue {
|
||||
// a reference to the described object
|
||||
optional k8s.io.client_go.pkg.api.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 windowSeconds = 4;
|
||||
|
||||
// the value of the metric for this
|
||||
optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 5;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
48
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/register.go
generated
vendored
Normal file
48
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/register.go
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
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 = "custom-metrics.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 = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&MetricValue{},
|
||||
&MetricValueList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
||||
1110
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/types.generated.go
generated
vendored
Normal file
1110
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/types.generated.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
59
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/types.go
generated
vendored
Normal file
59
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/types.go
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
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 (
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
)
|
||||
|
||||
// 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"`
|
||||
}
|
||||
|
||||
// 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=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 = "*"
|
||||
95
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
95
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by conversion-gen. Do not edit it manually!
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
custom_metrics "k8s.io/metrics/pkg/apis/custom_metrics"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(RegisterConversions)
|
||||
}
|
||||
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedConversionFuncs(
|
||||
Convert_v1alpha1_MetricValue_To_custom_metrics_MetricValue,
|
||||
Convert_custom_metrics_MetricValue_To_v1alpha1_MetricValue,
|
||||
Convert_v1alpha1_MetricValueList_To_custom_metrics_MetricValueList,
|
||||
Convert_custom_metrics_MetricValueList_To_v1alpha1_MetricValueList,
|
||||
)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_MetricValue_To_custom_metrics_MetricValue(in *MetricValue, out *custom_metrics.MetricValue, s conversion.Scope) error {
|
||||
// TODO: Inefficient conversion - can we improve it?
|
||||
if err := s.Convert(&in.DescribedObject, &out.DescribedObject, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
out.MetricName = in.MetricName
|
||||
out.Timestamp = in.Timestamp
|
||||
out.WindowSeconds = (*int64)(unsafe.Pointer(in.WindowSeconds))
|
||||
out.Value = in.Value
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1alpha1_MetricValue_To_custom_metrics_MetricValue(in *MetricValue, out *custom_metrics.MetricValue, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_MetricValue_To_custom_metrics_MetricValue(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_custom_metrics_MetricValue_To_v1alpha1_MetricValue(in *custom_metrics.MetricValue, out *MetricValue, s conversion.Scope) error {
|
||||
// TODO: Inefficient conversion - can we improve it?
|
||||
if err := s.Convert(&in.DescribedObject, &out.DescribedObject, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
out.MetricName = in.MetricName
|
||||
out.Timestamp = in.Timestamp
|
||||
out.WindowSeconds = (*int64)(unsafe.Pointer(in.WindowSeconds))
|
||||
out.Value = in.Value
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_custom_metrics_MetricValue_To_v1alpha1_MetricValue(in *custom_metrics.MetricValue, out *MetricValue, s conversion.Scope) error {
|
||||
return autoConvert_custom_metrics_MetricValue_To_v1alpha1_MetricValue(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_MetricValueList_To_custom_metrics_MetricValueList(in *MetricValueList, out *custom_metrics.MetricValueList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]custom_metrics.MetricValue)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1alpha1_MetricValueList_To_custom_metrics_MetricValueList(in *MetricValueList, out *custom_metrics.MetricValueList, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_MetricValueList_To_custom_metrics_MetricValueList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_custom_metrics_MetricValueList_To_v1alpha1_MetricValueList(in *custom_metrics.MetricValueList, out *MetricValueList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]MetricValue)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_custom_metrics_MetricValueList_To_v1alpha1_MetricValueList(in *custom_metrics.MetricValueList, out *MetricValueList, s conversion.Scope) error {
|
||||
return autoConvert_custom_metrics_MetricValueList_To_v1alpha1_MetricValueList(in, out, s)
|
||||
}
|
||||
74
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
74
vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(RegisterDeepCopies)
|
||||
}
|
||||
|
||||
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_MetricValue, InType: reflect.TypeOf(&MetricValue{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_MetricValueList, InType: reflect.TypeOf(&MetricValueList{})},
|
||||
)
|
||||
}
|
||||
|
||||
func DeepCopy_v1alpha1_MetricValue(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*MetricValue)
|
||||
out := out.(*MetricValue)
|
||||
*out = *in
|
||||
out.Timestamp = in.Timestamp.DeepCopy()
|
||||
if in.WindowSeconds != nil {
|
||||
in, out := &in.WindowSeconds, &out.WindowSeconds
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
out.Value = in.Value.DeepCopy()
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1alpha1_MetricValueList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*MetricValueList)
|
||||
out := out.(*MetricValueList)
|
||||
*out = *in
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]MetricValue, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_v1alpha1_MetricValue(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
74
vendor/k8s.io/metrics/pkg/apis/custom_metrics/zz_generated.deepcopy.go
generated
vendored
Normal file
74
vendor/k8s.io/metrics/pkg/apis/custom_metrics/zz_generated.deepcopy.go
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||
|
||||
package custom_metrics
|
||||
|
||||
import (
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(RegisterDeepCopies)
|
||||
}
|
||||
|
||||
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_custom_metrics_MetricValue, InType: reflect.TypeOf(&MetricValue{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_custom_metrics_MetricValueList, InType: reflect.TypeOf(&MetricValueList{})},
|
||||
)
|
||||
}
|
||||
|
||||
func DeepCopy_custom_metrics_MetricValue(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*MetricValue)
|
||||
out := out.(*MetricValue)
|
||||
*out = *in
|
||||
out.Timestamp = in.Timestamp.DeepCopy()
|
||||
if in.WindowSeconds != nil {
|
||||
in, out := &in.WindowSeconds, &out.WindowSeconds
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
out.Value = in.Value.DeepCopy()
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_custom_metrics_MetricValueList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*MetricValueList)
|
||||
out := out.(*MetricValueList)
|
||||
*out = *in
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]MetricValue, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_custom_metrics_MetricValue(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
21
vendor/k8s.io/metrics/pkg/apis/metrics/doc.go
generated
vendored
Normal file
21
vendor/k8s.io/metrics/pkg/apis/metrics/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// TODO: this needs to be cross-registered as metrics.metrics.k8s.io
|
||||
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
|
||||
package metrics // import "k8s.io/metrics/pkg/apis/metrics"
|
||||
51
vendor/k8s.io/metrics/pkg/apis/metrics/install/install.go
generated
vendored
Normal file
51
vendor/k8s.io/metrics/pkg/apis/metrics/install/install.go
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
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/apimachinery/announced"
|
||||
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/metrics/pkg/apis/metrics"
|
||||
"k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Install(api.GroupFactoryRegistry, api.Registry, api.Scheme)
|
||||
}
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
|
||||
if err := announced.NewGroupMetaFactory(
|
||||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: metrics.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/metrics/pkg/apis/metrics",
|
||||
RootScopedKinds: sets.NewString("NodeMetrics"),
|
||||
AddInternalObjectsToScheme: metrics.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
v1alpha1.SchemeGroupVersion.Version: v1alpha1.AddToScheme,
|
||||
},
|
||||
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
28
vendor/k8s.io/metrics/pkg/apis/metrics/install/install_test.go
generated
vendored
Normal file
28
vendor/k8s.io/metrics/pkg/apis/metrics/install/install_test.go
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
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
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
apitesting "k8s.io/apimachinery/pkg/api/testing"
|
||||
)
|
||||
|
||||
func TestRoundTripTypes(t *testing.T) {
|
||||
apitesting.RoundTripTestForAPIGroup(t, Install, nil)
|
||||
}
|
||||
|
||||
53
vendor/k8s.io/metrics/pkg/apis/metrics/register.go
generated
vendored
Normal file
53
vendor/k8s.io/metrics/pkg/apis/metrics/register.go
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
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"
|
||||
|
||||
// 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,
|
||||
&NodeMetrics{},
|
||||
&NodeMetricsList{},
|
||||
&PodMetrics{},
|
||||
&PodMetricsList{},
|
||||
)
|
||||
return nil
|
||||
}
|
||||
89
vendor/k8s.io/metrics/pkg/apis/metrics/types.go
generated
vendored
Normal file
89
vendor/k8s.io/metrics/pkg/apis/metrics/types.go
generated
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
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 (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
)
|
||||
|
||||
// +genclient=true
|
||||
// +resourceName=nodes
|
||||
// +readonly=true
|
||||
// +nonNamespaced=true
|
||||
|
||||
// resource usage metrics of a node.
|
||||
type NodeMetrics struct {
|
||||
metav1.TypeMeta
|
||||
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 api.ResourceList
|
||||
}
|
||||
|
||||
// NodeMetricsList is a list of NodeMetrics.
|
||||
type NodeMetricsList struct {
|
||||
metav1.TypeMeta
|
||||
// Standard list metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
||||
metav1.ListMeta
|
||||
|
||||
// List of node metrics.
|
||||
Items []NodeMetrics
|
||||
}
|
||||
|
||||
// +genclient=true
|
||||
// +resourceName=pods
|
||||
// +readonly=true
|
||||
|
||||
// resource usage metrics of a pod.
|
||||
type PodMetrics struct {
|
||||
metav1.TypeMeta
|
||||
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
|
||||
}
|
||||
|
||||
// PodMetricsList is a list of PodMetrics.
|
||||
type PodMetricsList struct {
|
||||
metav1.TypeMeta
|
||||
// Standard list metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
||||
metav1.ListMeta
|
||||
|
||||
// List of pod metrics.
|
||||
Items []PodMetrics
|
||||
}
|
||||
|
||||
// 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 api.ResourceList
|
||||
}
|
||||
21
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/doc.go
generated
vendored
Normal file
21
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
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,register
|
||||
// +k8s:conversion-gen=k8s.io/metrics/pkg/apis/metrics
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
package v1alpha1 // import "k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
1527
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/generated.pb.go
generated
vendored
Normal file
1527
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
90
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/generated.proto
generated
vendored
Normal file
90
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/generated.proto
generated
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
|
||||
// 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/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";
|
||||
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
|
||||
import "k8s.io/client-go/pkg/api/v1/generated.proto";
|
||||
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1alpha1";
|
||||
|
||||
// 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<string, k8s.io.apimachinery.pkg.api.resource.Quantity> usage = 2;
|
||||
}
|
||||
|
||||
// resource usage metrics of a node.
|
||||
message NodeMetrics {
|
||||
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<string, k8s.io.apimachinery.pkg.api.resource.Quantity> usage = 4;
|
||||
}
|
||||
|
||||
// NodeMetricsList is a list of NodeMetrics.
|
||||
message NodeMetricsList {
|
||||
// Standard list metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
// List of node metrics.
|
||||
repeated NodeMetrics items = 2;
|
||||
}
|
||||
|
||||
// resource usage metrics of a pod.
|
||||
message PodMetrics {
|
||||
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: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
// List of pod metrics.
|
||||
repeated PodMetrics items = 2;
|
||||
}
|
||||
|
||||
50
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/register.go
generated
vendored
Normal file
50
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/register.go
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
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"
|
||||
|
||||
// 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 = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&NodeMetrics{},
|
||||
&NodeMetricsList{},
|
||||
&PodMetrics{},
|
||||
&PodMetricsList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
||||
89
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/types.go
generated
vendored
Normal file
89
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/types.go
generated
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
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/client-go/pkg/api/v1"
|
||||
)
|
||||
|
||||
// +genclient=true
|
||||
// +resourceName=nodes
|
||||
// +readonly=true
|
||||
// +nonNamespaced=true
|
||||
|
||||
// resource usage metrics of a node.
|
||||
type NodeMetrics struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// The following fields define time interval from which metrics were
|
||||
// collected from the interval [Timestamp-Window, Timestamp].
|
||||
Timestamp metav1.Time `json:"timestamp"`
|
||||
Window metav1.Duration `json:"window"`
|
||||
|
||||
// The memory usage is the memory working set.
|
||||
Usage v1.ResourceList `json:"usage"`
|
||||
}
|
||||
|
||||
// NodeMetricsList is a list of NodeMetrics.
|
||||
type NodeMetricsList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
// List of node metrics.
|
||||
Items []NodeMetrics `json:"items"`
|
||||
}
|
||||
|
||||
// +genclient=true
|
||||
// +resourceName=pods
|
||||
// +readonly=true
|
||||
|
||||
// resource usage metrics of a pod.
|
||||
type PodMetrics struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// The following fields define time interval from which metrics were
|
||||
// collected from the interval [Timestamp-Window, Timestamp].
|
||||
Timestamp metav1.Time `json:"timestamp"`
|
||||
Window metav1.Duration `json:"window"`
|
||||
|
||||
// Metrics for all containers are collected within the same time window.
|
||||
Containers []ContainerMetrics `json:"containers"`
|
||||
}
|
||||
|
||||
// PodMetricsList is a list of PodMetrics.
|
||||
type PodMetricsList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
// List of pod metrics.
|
||||
Items []PodMetrics `json:"items"`
|
||||
}
|
||||
|
||||
// resource usage metrics of a container.
|
||||
type ContainerMetrics struct {
|
||||
// Container name corresponding to the one from pod.spec.containers.
|
||||
Name string `json:"name"`
|
||||
// The memory usage is the memory working set.
|
||||
Usage v1.ResourceList `json:"usage"`
|
||||
}
|
||||
159
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
159
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by conversion-gen. Do not edit it manually!
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
v1 "k8s.io/client-go/pkg/api/v1"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(RegisterConversions)
|
||||
}
|
||||
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedConversionFuncs(
|
||||
Convert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics,
|
||||
Convert_metrics_ContainerMetrics_To_v1alpha1_ContainerMetrics,
|
||||
Convert_v1alpha1_NodeMetrics_To_metrics_NodeMetrics,
|
||||
Convert_metrics_NodeMetrics_To_v1alpha1_NodeMetrics,
|
||||
Convert_v1alpha1_NodeMetricsList_To_metrics_NodeMetricsList,
|
||||
Convert_metrics_NodeMetricsList_To_v1alpha1_NodeMetricsList,
|
||||
Convert_v1alpha1_PodMetrics_To_metrics_PodMetrics,
|
||||
Convert_metrics_PodMetrics_To_v1alpha1_PodMetrics,
|
||||
Convert_v1alpha1_PodMetricsList_To_metrics_PodMetricsList,
|
||||
Convert_metrics_PodMetricsList_To_v1alpha1_PodMetricsList,
|
||||
)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics(in *ContainerMetrics, out *metrics.ContainerMetrics, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
out.Usage = *(*api.ResourceList)(unsafe.Pointer(&in.Usage))
|
||||
return nil
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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 = *(*api.ResourceList)(unsafe.Pointer(&in.Usage))
|
||||
return nil
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
143
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
143
vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
v1 "k8s.io/client-go/pkg/api/v1"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(RegisterDeepCopies)
|
||||
}
|
||||
|
||||
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ContainerMetrics, InType: reflect.TypeOf(&ContainerMetrics{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_NodeMetrics, InType: reflect.TypeOf(&NodeMetrics{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_NodeMetricsList, InType: reflect.TypeOf(&NodeMetricsList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_PodMetrics, InType: reflect.TypeOf(&PodMetrics{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_PodMetricsList, InType: reflect.TypeOf(&PodMetricsList{})},
|
||||
)
|
||||
}
|
||||
|
||||
func DeepCopy_v1alpha1_ContainerMetrics(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ContainerMetrics)
|
||||
out := out.(*ContainerMetrics)
|
||||
*out = *in
|
||||
if in.Usage != nil {
|
||||
in, out := &in.Usage, &out.Usage
|
||||
*out = make(v1.ResourceList)
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val.DeepCopy()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1alpha1_NodeMetrics(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NodeMetrics)
|
||||
out := out.(*NodeMetrics)
|
||||
*out = *in
|
||||
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
|
||||
return err
|
||||
} else {
|
||||
out.ObjectMeta = *newVal.(*meta_v1.ObjectMeta)
|
||||
}
|
||||
out.Timestamp = in.Timestamp.DeepCopy()
|
||||
if in.Usage != nil {
|
||||
in, out := &in.Usage, &out.Usage
|
||||
*out = make(v1.ResourceList)
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val.DeepCopy()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1alpha1_NodeMetricsList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NodeMetricsList)
|
||||
out := out.(*NodeMetricsList)
|
||||
*out = *in
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]NodeMetrics, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_v1alpha1_NodeMetrics(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1alpha1_PodMetrics(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PodMetrics)
|
||||
out := out.(*PodMetrics)
|
||||
*out = *in
|
||||
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
|
||||
return err
|
||||
} else {
|
||||
out.ObjectMeta = *newVal.(*meta_v1.ObjectMeta)
|
||||
}
|
||||
out.Timestamp = in.Timestamp.DeepCopy()
|
||||
if in.Containers != nil {
|
||||
in, out := &in.Containers, &out.Containers
|
||||
*out = make([]ContainerMetrics, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_v1alpha1_ContainerMetrics(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1alpha1_PodMetricsList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PodMetricsList)
|
||||
out := out.(*PodMetricsList)
|
||||
*out = *in
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]PodMetrics, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_v1alpha1_PodMetrics(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
143
vendor/k8s.io/metrics/pkg/apis/metrics/zz_generated.deepcopy.go
generated
vendored
Normal file
143
vendor/k8s.io/metrics/pkg/apis/metrics/zz_generated.deepcopy.go
generated
vendored
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||
|
||||
package metrics
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(RegisterDeepCopies)
|
||||
}
|
||||
|
||||
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_metrics_ContainerMetrics, InType: reflect.TypeOf(&ContainerMetrics{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_metrics_NodeMetrics, InType: reflect.TypeOf(&NodeMetrics{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_metrics_NodeMetricsList, InType: reflect.TypeOf(&NodeMetricsList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_metrics_PodMetrics, InType: reflect.TypeOf(&PodMetrics{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_metrics_PodMetricsList, InType: reflect.TypeOf(&PodMetricsList{})},
|
||||
)
|
||||
}
|
||||
|
||||
func DeepCopy_metrics_ContainerMetrics(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ContainerMetrics)
|
||||
out := out.(*ContainerMetrics)
|
||||
*out = *in
|
||||
if in.Usage != nil {
|
||||
in, out := &in.Usage, &out.Usage
|
||||
*out = make(api.ResourceList)
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val.DeepCopy()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_metrics_NodeMetrics(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NodeMetrics)
|
||||
out := out.(*NodeMetrics)
|
||||
*out = *in
|
||||
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
|
||||
return err
|
||||
} else {
|
||||
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
|
||||
}
|
||||
out.Timestamp = in.Timestamp.DeepCopy()
|
||||
if in.Usage != nil {
|
||||
in, out := &in.Usage, &out.Usage
|
||||
*out = make(api.ResourceList)
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val.DeepCopy()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_metrics_NodeMetricsList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NodeMetricsList)
|
||||
out := out.(*NodeMetricsList)
|
||||
*out = *in
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]NodeMetrics, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_metrics_NodeMetrics(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_metrics_PodMetrics(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PodMetrics)
|
||||
out := out.(*PodMetrics)
|
||||
*out = *in
|
||||
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
|
||||
return err
|
||||
} else {
|
||||
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
|
||||
}
|
||||
out.Timestamp = in.Timestamp.DeepCopy()
|
||||
if in.Containers != nil {
|
||||
in, out := &in.Containers, &out.Containers
|
||||
*out = make([]ContainerMetrics, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_metrics_ContainerMetrics(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_metrics_PodMetricsList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PodMetricsList)
|
||||
out := out.(*PodMetricsList)
|
||||
*out = *in
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]PodMetrics, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_metrics_PodMetrics(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
105
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/clientset.go
generated
vendored
Normal file
105
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/clientset.go
generated
vendored
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
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 clientset
|
||||
|
||||
import (
|
||||
glog "github.com/golang/glog"
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
rest "k8s.io/client-go/rest"
|
||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||
metricsv1alpha1 "k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
MetricsV1alpha1() metricsv1alpha1.MetricsV1alpha1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Metrics() metricsv1alpha1.MetricsV1alpha1Interface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups. Each group has exactly one
|
||||
// version included in a Clientset.
|
||||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
*metricsv1alpha1.MetricsV1alpha1Client
|
||||
}
|
||||
|
||||
// MetricsV1alpha1 retrieves the MetricsV1alpha1Client
|
||||
func (c *Clientset) MetricsV1alpha1() metricsv1alpha1.MetricsV1alpha1Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.MetricsV1alpha1Client
|
||||
}
|
||||
|
||||
// Deprecated: Metrics retrieves the default version of MetricsClient.
|
||||
// Please explicitly pick a version.
|
||||
func (c *Clientset) Metrics() metricsv1alpha1.MetricsV1alpha1Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.MetricsV1alpha1Client
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
configShallowCopy := *c
|
||||
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||
}
|
||||
var cs Clientset
|
||||
var err error
|
||||
cs.MetricsV1alpha1Client, err = metricsv1alpha1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to create the DiscoveryClient: %v", err)
|
||||
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 {
|
||||
var cs Clientset
|
||||
cs.MetricsV1alpha1Client = metricsv1alpha1.NewForConfigOrDie(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
return &cs
|
||||
}
|
||||
|
||||
// New creates a new Clientset for the given RESTClient.
|
||||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.MetricsV1alpha1Client = metricsv1alpha1.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
}
|
||||
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// This package has the automatically generated clientset.
|
||||
package clientset
|
||||
72
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/fake/clientset_generated.go
generated
vendored
Normal file
72
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/fake/clientset_generated.go
generated
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package 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/pkg/api"
|
||||
"k8s.io/client-go/testing"
|
||||
clientset "k8s.io/metrics/pkg/client/clientset_generated/clientset"
|
||||
metricsv1alpha1 "k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1"
|
||||
fakemetricsv1alpha1 "k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/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(api.Registry, api.Scheme, api.Codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
fakePtr := testing.Fake{}
|
||||
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o, api.Registry.RESTMapper()))
|
||||
|
||||
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil))
|
||||
|
||||
return &Clientset{fakePtr}
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
return &fakediscovery.FakeDiscovery{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
var _ clientset.Interface = &Clientset{}
|
||||
|
||||
// MetricsV1alpha1 retrieves the MetricsV1alpha1Client
|
||||
func (c *Clientset) MetricsV1alpha1() metricsv1alpha1.MetricsV1alpha1Interface {
|
||||
return &fakemetricsv1alpha1.FakeMetricsV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// Metrics retrieves the MetricsV1alpha1Client
|
||||
func (c *Clientset) Metrics() metricsv1alpha1.MetricsV1alpha1Interface {
|
||||
return &fakemetricsv1alpha1.FakeMetricsV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/fake/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/fake/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// This package has the automatically generated fake clientset.
|
||||
package fake
|
||||
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/scheme/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/scheme/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// This package contains the scheme of the automatically generated clientset.
|
||||
package scheme
|
||||
53
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/scheme/register.go
generated
vendored
Normal file
53
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/scheme/register.go
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
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 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"
|
||||
metricsv1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
)
|
||||
|
||||
var Scheme = runtime.NewScheme()
|
||||
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
|
||||
func init() {
|
||||
v1.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/kuberentes/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) {
|
||||
metricsv1alpha1.AddToScheme(scheme)
|
||||
|
||||
}
|
||||
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1alpha1
|
||||
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/fake/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/fake/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
||||
42
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/fake/fake_metrics_client.go
generated
vendored
Normal file
42
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/fake/fake_metrics_client.go
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
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 (
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
v1alpha1 "k8s.io/metrics/pkg/client/clientset_generated/clientset/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
|
||||
}
|
||||
68
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/fake/fake_nodemetrics.go
generated
vendored
Normal file
68
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/fake/fake_nodemetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
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 (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
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 = schema.GroupVersionResource{Group: "metrics", Version: "v1alpha1", Resource: "nodemetricses"}
|
||||
|
||||
func (c *FakeNodeMetricses) Get(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
|
||||
}
|
||||
|
||||
func (c *FakeNodeMetricses) List(opts v1.ListOptions) (result *v1alpha1.NodeMetricsList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(nodemetricsesResource, opts), &v1alpha1.NodeMetricsList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.NodeMetricsList{}
|
||||
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(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(nodemetricsesResource, opts))
|
||||
}
|
||||
72
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/fake/fake_podmetrics.go
generated
vendored
Normal file
72
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/fake/fake_podmetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
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 = schema.GroupVersionResource{Group: "metrics", Version: "v1alpha1", Resource: "podmetricses"}
|
||||
|
||||
func (c *FakePodMetricses) Get(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
|
||||
}
|
||||
|
||||
func (c *FakePodMetricses) List(opts v1.ListOptions) (result *v1alpha1.PodMetricsList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(podmetricsesResource, c.ns, opts), &v1alpha1.PodMetricsList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.PodMetricsList{}
|
||||
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(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(podmetricsesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
21
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/generated_expansion.go
generated
vendored
Normal file
21
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/generated_expansion.go
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
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
|
||||
|
||||
type NodeMetricsExpansion interface{}
|
||||
|
||||
type PodMetricsExpansion interface{}
|
||||
93
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/metrics_client.go
generated
vendored
Normal file
93
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/metrics_client.go
generated
vendored
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
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 (
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
v1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
"k8s.io/metrics/pkg/client/clientset_generated/clientset/scheme"
|
||||
)
|
||||
|
||||
type MetricsV1alpha1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
NodeMetricsesGetter
|
||||
PodMetricsesGetter
|
||||
}
|
||||
|
||||
// MetricsV1alpha1Client is used to interact with features provided by the metrics 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.
|
||||
func NewForConfig(c *rest.Config) (*MetricsV1alpha1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
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 = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
|
||||
|
||||
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
|
||||
}
|
||||
84
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/nodemetrics.go
generated
vendored
Normal file
84
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/nodemetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
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/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_generated/clientset/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(name string, options v1.GetOptions) (*v1alpha1.NodeMetrics, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.NodeMetricsList, error)
|
||||
Watch(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(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().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of NodeMetricses that match those selectors.
|
||||
func (c *nodeMetricses) List(opts v1.ListOptions) (result *v1alpha1.NodeMetricsList, err error) {
|
||||
result = &v1alpha1.NodeMetricsList{}
|
||||
err = c.client.Get().
|
||||
Resource("nodes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested nodeMetricses.
|
||||
func (c *nodeMetricses) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Resource("nodes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
89
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/podmetrics.go
generated
vendored
Normal file
89
vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1/podmetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
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/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_generated/clientset/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(name string, options v1.GetOptions) (*v1alpha1.PodMetrics, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.PodMetricsList, error)
|
||||
Watch(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(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().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of PodMetricses that match those selectors.
|
||||
func (c *podMetricses) List(opts v1.ListOptions) (result *v1alpha1.PodMetricsList, err error) {
|
||||
result = &v1alpha1.PodMetricsList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("pods").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested podMetricses.
|
||||
func (c *podMetricses) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
Resource("pods").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
94
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/clientset.go
generated
vendored
Normal file
94
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/clientset.go
generated
vendored
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
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 internalclientset
|
||||
|
||||
import (
|
||||
glog "github.com/golang/glog"
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
rest "k8s.io/client-go/rest"
|
||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||
metricsinternalversion "k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
Metrics() metricsinternalversion.MetricsInterface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups. Each group has exactly one
|
||||
// version included in a Clientset.
|
||||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
*metricsinternalversion.MetricsClient
|
||||
}
|
||||
|
||||
// Metrics retrieves the MetricsClient
|
||||
func (c *Clientset) Metrics() metricsinternalversion.MetricsInterface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.MetricsClient
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
configShallowCopy := *c
|
||||
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||
}
|
||||
var cs Clientset
|
||||
var err error
|
||||
cs.MetricsClient, err = metricsinternalversion.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to create the DiscoveryClient: %v", err)
|
||||
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 {
|
||||
var cs Clientset
|
||||
cs.MetricsClient = metricsinternalversion.NewForConfigOrDie(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
return &cs
|
||||
}
|
||||
|
||||
// New creates a new Clientset for the given RESTClient.
|
||||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.MetricsClient = metricsinternalversion.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
}
|
||||
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// This package has the automatically generated clientset.
|
||||
package internalclientset
|
||||
67
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/fake/clientset_generated.go
generated
vendored
Normal file
67
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/fake/clientset_generated.go
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
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 (
|
||||
"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/pkg/api"
|
||||
"k8s.io/client-go/testing"
|
||||
clientset "k8s.io/metrics/pkg/client/clientset_generated/internalclientset"
|
||||
metricsinternalversion "k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion"
|
||||
fakemetricsinternalversion "k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/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(api.Registry, api.Scheme, api.Codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
fakePtr := testing.Fake{}
|
||||
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o, api.Registry.RESTMapper()))
|
||||
|
||||
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil))
|
||||
|
||||
return &Clientset{fakePtr}
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
return &fakediscovery.FakeDiscovery{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
var _ clientset.Interface = &Clientset{}
|
||||
|
||||
// Metrics retrieves the MetricsClient
|
||||
func (c *Clientset) Metrics() metricsinternalversion.MetricsInterface {
|
||||
return &fakemetricsinternalversion.FakeMetrics{Fake: &c.Fake}
|
||||
}
|
||||
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/fake/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/fake/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// This package has the automatically generated fake clientset.
|
||||
package fake
|
||||
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/scheme/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/scheme/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// This package contains the scheme of the automatically generated clientset.
|
||||
package scheme
|
||||
46
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/scheme/register.go
generated
vendored
Normal file
46
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/scheme/register.go
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
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 scheme
|
||||
|
||||
import (
|
||||
announced "k8s.io/apimachinery/pkg/apimachinery/announced"
|
||||
registered "k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
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"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics/install"
|
||||
os "os"
|
||||
)
|
||||
|
||||
var Scheme = runtime.NewScheme()
|
||||
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
|
||||
var Registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
|
||||
var GroupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
|
||||
|
||||
func init() {
|
||||
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
|
||||
Install(GroupFactoryRegistry, Registry, Scheme)
|
||||
}
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
|
||||
metrics.Install(groupFactoryRegistry, registry, scheme)
|
||||
|
||||
}
|
||||
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package internalversion
|
||||
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/fake/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/fake/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
||||
42
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/fake/fake_metrics_client.go
generated
vendored
Normal file
42
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/fake/fake_metrics_client.go
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
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 (
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
internalversion "k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion"
|
||||
)
|
||||
|
||||
type FakeMetrics struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeMetrics) NodeMetricses() internalversion.NodeMetricsInterface {
|
||||
return &FakeNodeMetricses{c}
|
||||
}
|
||||
|
||||
func (c *FakeMetrics) PodMetricses(namespace string) internalversion.PodMetricsInterface {
|
||||
return &FakePodMetricses{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeMetrics) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
||||
68
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/fake/fake_nodemetrics.go
generated
vendored
Normal file
68
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/fake/fake_nodemetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
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 (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
)
|
||||
|
||||
// FakeNodeMetricses implements NodeMetricsInterface
|
||||
type FakeNodeMetricses struct {
|
||||
Fake *FakeMetrics
|
||||
}
|
||||
|
||||
var nodemetricsesResource = schema.GroupVersionResource{Group: "metrics", Version: "", Resource: "nodemetricses"}
|
||||
|
||||
func (c *FakeNodeMetricses) Get(name string, options v1.GetOptions) (result *metrics.NodeMetrics, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(nodemetricsesResource, name), &metrics.NodeMetrics{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*metrics.NodeMetrics), err
|
||||
}
|
||||
|
||||
func (c *FakeNodeMetricses) List(opts v1.ListOptions) (result *metrics.NodeMetricsList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(nodemetricsesResource, opts), &metrics.NodeMetricsList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &metrics.NodeMetricsList{}
|
||||
for _, item := range obj.(*metrics.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(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(nodemetricsesResource, opts))
|
||||
}
|
||||
72
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/fake/fake_podmetrics.go
generated
vendored
Normal file
72
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/fake/fake_podmetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
)
|
||||
|
||||
// FakePodMetricses implements PodMetricsInterface
|
||||
type FakePodMetricses struct {
|
||||
Fake *FakeMetrics
|
||||
ns string
|
||||
}
|
||||
|
||||
var podmetricsesResource = schema.GroupVersionResource{Group: "metrics", Version: "", Resource: "podmetricses"}
|
||||
|
||||
func (c *FakePodMetricses) Get(name string, options v1.GetOptions) (result *metrics.PodMetrics, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(podmetricsesResource, c.ns, name), &metrics.PodMetrics{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*metrics.PodMetrics), err
|
||||
}
|
||||
|
||||
func (c *FakePodMetricses) List(opts v1.ListOptions) (result *metrics.PodMetricsList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(podmetricsesResource, c.ns, opts), &metrics.PodMetricsList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &metrics.PodMetricsList{}
|
||||
for _, item := range obj.(*metrics.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(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(podmetricsesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
21
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/generated_expansion.go
generated
vendored
Normal file
21
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/generated_expansion.go
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
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 internalversion
|
||||
|
||||
type NodeMetricsExpansion interface{}
|
||||
|
||||
type PodMetricsExpansion interface{}
|
||||
104
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/metrics_client.go
generated
vendored
Normal file
104
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/metrics_client.go
generated
vendored
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
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 internalversion
|
||||
|
||||
import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
"k8s.io/metrics/pkg/client/clientset_generated/internalclientset/scheme"
|
||||
)
|
||||
|
||||
type MetricsInterface interface {
|
||||
RESTClient() rest.Interface
|
||||
NodeMetricsesGetter
|
||||
PodMetricsesGetter
|
||||
}
|
||||
|
||||
// MetricsClient is used to interact with features provided by the metrics group.
|
||||
type MetricsClient struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *MetricsClient) NodeMetricses() NodeMetricsInterface {
|
||||
return newNodeMetricses(c)
|
||||
}
|
||||
|
||||
func (c *MetricsClient) PodMetricses(namespace string) PodMetricsInterface {
|
||||
return newPodMetricses(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new MetricsClient for the given config.
|
||||
func NewForConfig(c *rest.Config) (*MetricsClient, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &MetricsClient{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new MetricsClient for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *MetricsClient {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new MetricsClient for the given RESTClient.
|
||||
func New(c rest.Interface) *MetricsClient {
|
||||
return &MetricsClient{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
g, err := scheme.Registry.Group("metrics")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config.APIPath = "/apis"
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group {
|
||||
gv := g.GroupVersion
|
||||
config.GroupVersion = &gv
|
||||
}
|
||||
config.NegotiatedSerializer = scheme.Codecs
|
||||
|
||||
if config.QPS == 0 {
|
||||
config.QPS = 5
|
||||
}
|
||||
if config.Burst == 0 {
|
||||
config.Burst = 10
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *MetricsClient) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
||||
84
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/nodemetrics.go
generated
vendored
Normal file
84
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/nodemetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
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 internalversion
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
scheme "k8s.io/metrics/pkg/client/clientset_generated/internalclientset/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(name string, options v1.GetOptions) (*metrics.NodeMetrics, error)
|
||||
List(opts v1.ListOptions) (*metrics.NodeMetricsList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
|
||||
NodeMetricsExpansion
|
||||
}
|
||||
|
||||
// nodeMetricses implements NodeMetricsInterface
|
||||
type nodeMetricses struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newNodeMetricses returns a NodeMetricses
|
||||
func newNodeMetricses(c *MetricsClient) *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(name string, options v1.GetOptions) (result *metrics.NodeMetrics, err error) {
|
||||
result = &metrics.NodeMetrics{}
|
||||
err = c.client.Get().
|
||||
Resource("nodes").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of NodeMetricses that match those selectors.
|
||||
func (c *nodeMetricses) List(opts v1.ListOptions) (result *metrics.NodeMetricsList, err error) {
|
||||
result = &metrics.NodeMetricsList{}
|
||||
err = c.client.Get().
|
||||
Resource("nodes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested nodeMetricses.
|
||||
func (c *nodeMetricses) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Resource("nodes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
89
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/podmetrics.go
generated
vendored
Normal file
89
vendor/k8s.io/metrics/pkg/client/clientset_generated/internalclientset/typed/metrics/internalversion/podmetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
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 internalversion
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
scheme "k8s.io/metrics/pkg/client/clientset_generated/internalclientset/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(name string, options v1.GetOptions) (*metrics.PodMetrics, error)
|
||||
List(opts v1.ListOptions) (*metrics.PodMetricsList, error)
|
||||
Watch(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 *MetricsClient, 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(name string, options v1.GetOptions) (result *metrics.PodMetrics, err error) {
|
||||
result = &metrics.PodMetrics{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("pods").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of PodMetricses that match those selectors.
|
||||
func (c *podMetricses) List(opts v1.ListOptions) (result *metrics.PodMetricsList, err error) {
|
||||
result = &metrics.PodMetricsList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("pods").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested podMetricses.
|
||||
func (c *podMetricses) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
Resource("pods").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
234
vendor/k8s.io/metrics/pkg/client/custom_metrics/client.go
generated
vendored
Normal file
234
vendor/k8s.io/metrics/pkg/client/custom_metrics/client.go
generated
vendored
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
/*
|
||||
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 (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/util/flowcontrol"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
)
|
||||
|
||||
type customMetricsClient struct {
|
||||
client rest.Interface
|
||||
mapper meta.RESTMapper
|
||||
}
|
||||
|
||||
func New(client rest.Interface) CustomMetricsClient {
|
||||
return NewForMapper(client, api.Registry.RESTMapper())
|
||||
}
|
||||
|
||||
func NewForConfig(c *rest.Config) (CustomMetricsClient, error) {
|
||||
configShallowCopy := *c
|
||||
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||
}
|
||||
configShallowCopy.APIPath = "/apis"
|
||||
if configShallowCopy.UserAgent == "" {
|
||||
configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
configShallowCopy.GroupVersion = &v1alpha1.SchemeGroupVersion
|
||||
configShallowCopy.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs}
|
||||
|
||||
client, err := rest.RESTClientFor(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return New(client), nil
|
||||
}
|
||||
|
||||
func NewForConfigOrDie(c *rest.Config) CustomMetricsClient {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
func NewForMapper(client rest.Interface, mapper meta.RESTMapper) CustomMetricsClient {
|
||||
return &customMetricsClient{
|
||||
client: client,
|
||||
mapper: mapper,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *customMetricsClient) RootScopedMetrics() MetricsInterface {
|
||||
return &rootScopedMetrics{c}
|
||||
}
|
||||
|
||||
func (c *customMetricsClient) NamespacedMetrics(namespace string) MetricsInterface {
|
||||
return &namespacedMetrics{
|
||||
client: c,
|
||||
namespace: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
groupResource := schema.GroupResource{
|
||||
Group: mapping.GroupVersionKind.Group,
|
||||
Resource: mapping.Resource,
|
||||
}
|
||||
|
||||
return groupResource.String(), nil
|
||||
}
|
||||
|
||||
type rootScopedMetrics struct {
|
||||
client *customMetricsClient
|
||||
}
|
||||
|
||||
func (m *rootScopedMetrics) getForNamespace(namespace string, metricName string) (*v1alpha1.MetricValue, error) {
|
||||
res := &v1alpha1.MetricValueList{}
|
||||
err := m.client.client.Get().
|
||||
Resource("metrics").
|
||||
Namespace(namespace).
|
||||
Name(metricName).
|
||||
Do().
|
||||
Into(res)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
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) (*v1alpha1.MetricValue, error) {
|
||||
// handle namespace separately
|
||||
if groupKind.Kind == "Namespace" && groupKind.Group == "" {
|
||||
return m.getForNamespace(name, metricName)
|
||||
}
|
||||
|
||||
resourceName, err := m.client.qualResourceForKind(groupKind)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res := &v1alpha1.MetricValueList{}
|
||||
err = m.client.client.Get().
|
||||
Resource(resourceName).
|
||||
Name(name).
|
||||
SubResource(metricName).
|
||||
Do().
|
||||
Into(res)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
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) (*v1alpha1.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
|
||||
}
|
||||
|
||||
res := &v1alpha1.MetricValueList{}
|
||||
err = m.client.client.Get().
|
||||
Resource(resourceName).
|
||||
Name(v1alpha1.AllObjects).
|
||||
SubResource(metricName).
|
||||
LabelsSelectorParam(selector).
|
||||
Do().
|
||||
Into(res)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
type namespacedMetrics struct {
|
||||
client *customMetricsClient
|
||||
namespace string
|
||||
}
|
||||
|
||||
func (m *namespacedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string) (*v1alpha1.MetricValue, error) {
|
||||
resourceName, err := m.client.qualResourceForKind(groupKind)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res := &v1alpha1.MetricValueList{}
|
||||
err = m.client.client.Get().
|
||||
Resource(resourceName).
|
||||
Namespace(m.namespace).
|
||||
Name(name).
|
||||
SubResource(metricName).
|
||||
Do().
|
||||
Into(res)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(res.Items) != 1 {
|
||||
return nil, fmt.Errorf("the custom metrics API server returned %v results when we asked for exactly one")
|
||||
}
|
||||
|
||||
return &res.Items[0], nil
|
||||
}
|
||||
|
||||
func (m *namespacedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string) (*v1alpha1.MetricValueList, error) {
|
||||
resourceName, err := m.client.qualResourceForKind(groupKind)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res := &v1alpha1.MetricValueList{}
|
||||
err = m.client.client.Get().
|
||||
Resource(resourceName).
|
||||
Namespace(m.namespace).
|
||||
Name(v1alpha1.AllObjects).
|
||||
SubResource(metricName).
|
||||
LabelsSelectorParam(selector).
|
||||
Do().
|
||||
Into(res)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
172
vendor/k8s.io/metrics/pkg/client/custom_metrics/fake/fake_client.go
generated
vendored
Normal file
172
vendor/k8s.io/metrics/pkg/client/custom_metrics/fake/fake_client.go
generated
vendored
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
/*
|
||||
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/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/testing"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
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 NewGetForAction(groupKind schema.GroupKind, namespace, name string, metricName string, labelSelector labels.Selector) GetForActionImpl {
|
||||
mapping, err := api.Registry.RESTMapper().RESTMapping(groupKind)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("unable to get REST mapping for groupKind %s while building GetFor action: %v", groupKind.String, err))
|
||||
}
|
||||
groupResourceForKind := schema.GroupResource{
|
||||
Group: mapping.GroupVersionKind.Group,
|
||||
Resource: mapping.Resource,
|
||||
}
|
||||
resource := schema.GroupResource{
|
||||
Group: v1alpha1.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 {
|
||||
mapping, err := api.Registry.RESTMapper().RESTMapping(groupKind)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("unable to get REST mapping for groupKind %s while building GetFor action: %v", groupKind.String, err))
|
||||
}
|
||||
groupResourceForKind := schema.GroupResource{
|
||||
Group: mapping.GroupVersionKind.Group,
|
||||
Resource: mapping.Resource,
|
||||
}
|
||||
resource := schema.GroupResource{
|
||||
Group: v1alpha1.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) (*v1alpha1.MetricValue, error) {
|
||||
obj, err := m.Fake.
|
||||
Invokes(NewGetForAction(groupKind, m.ns, name, metricName, nil), &v1alpha1.MetricValueList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
objList := obj.(*v1alpha1.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) (*v1alpha1.MetricValueList, error) {
|
||||
obj, err := m.Fake.
|
||||
Invokes(NewGetForAction(groupKind, m.ns, "*", metricName, selector), &v1alpha1.MetricValueList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return obj.(*v1alpha1.MetricValueList), err
|
||||
}
|
||||
|
||||
type fakeRootScopedMetrics struct {
|
||||
Fake *FakeCustomMetricsClient
|
||||
}
|
||||
|
||||
func (m *fakeRootScopedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string) (*v1alpha1.MetricValue, error) {
|
||||
obj, err := m.Fake.
|
||||
Invokes(NewRootGetForAction(groupKind, name, metricName, nil), &v1alpha1.MetricValueList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
objList := obj.(*v1alpha1.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) (*v1alpha1.MetricValueList, error) {
|
||||
obj, err := m.Fake.
|
||||
Invokes(NewRootGetForAction(groupKind, "*", metricName, selector), &v1alpha1.MetricValueList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return obj.(*v1alpha1.MetricValueList), err
|
||||
}
|
||||
54
vendor/k8s.io/metrics/pkg/client/custom_metrics/interfaces.go
generated
vendored
Normal file
54
vendor/k8s.io/metrics/pkg/client/custom_metrics/interfaces.go
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
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/v1alpha1"
|
||||
)
|
||||
|
||||
// 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) (*v1alpha1.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) (*v1alpha1.MetricValueList, error)
|
||||
}
|
||||
95
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/factory.go
generated
vendored
Normal file
95
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/factory.go
generated
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package externalversions
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
clientset "k8s.io/metrics/pkg/client/clientset_generated/clientset"
|
||||
internalinterfaces "k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/internalinterfaces"
|
||||
metrics "k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/metrics"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
time "time"
|
||||
)
|
||||
|
||||
type sharedInformerFactory struct {
|
||||
client clientset.Interface
|
||||
lock sync.Mutex
|
||||
defaultResync time.Duration
|
||||
|
||||
informers map[reflect.Type]cache.SharedIndexInformer
|
||||
// startedInformers is used for tracking which informers have been started.
|
||||
// This allows Start() to be called multiple times safely.
|
||||
startedInformers map[reflect.Type]bool
|
||||
}
|
||||
|
||||
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory
|
||||
func NewSharedInformerFactory(client clientset.Interface, defaultResync time.Duration) SharedInformerFactory {
|
||||
return &sharedInformerFactory{
|
||||
client: client,
|
||||
defaultResync: defaultResync,
|
||||
informers: make(map[reflect.Type]cache.SharedIndexInformer),
|
||||
startedInformers: make(map[reflect.Type]bool),
|
||||
}
|
||||
}
|
||||
|
||||
// Start initializes all requested informers.
|
||||
func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
for informerType, informer := range f.informers {
|
||||
if !f.startedInformers[informerType] {
|
||||
go informer.Run(stopCh)
|
||||
f.startedInformers[informerType] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// InternalInformerFor returns the SharedIndexInformer for obj using an internal
|
||||
// client.
|
||||
func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
informerType := reflect.TypeOf(obj)
|
||||
informer, exists := f.informers[informerType]
|
||||
if exists {
|
||||
return informer
|
||||
}
|
||||
informer = newFunc(f.client, f.defaultResync)
|
||||
f.informers[informerType] = informer
|
||||
|
||||
return informer
|
||||
}
|
||||
|
||||
// SharedInformerFactory provides shared informers for resources in all known
|
||||
// API group versions.
|
||||
type SharedInformerFactory interface {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
|
||||
|
||||
Metrics() metrics.Interface
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Metrics() metrics.Interface {
|
||||
return metrics.New(f)
|
||||
}
|
||||
63
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/generic.go
generated
vendored
Normal file
63
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/generic.go
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package externalversions
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
v1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
)
|
||||
|
||||
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
|
||||
// sharedInformers based on type
|
||||
type GenericInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() cache.GenericLister
|
||||
}
|
||||
|
||||
type genericInformer struct {
|
||||
informer cache.SharedIndexInformer
|
||||
resource schema.GroupResource
|
||||
}
|
||||
|
||||
// Informer returns the SharedIndexInformer.
|
||||
func (f *genericInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.informer
|
||||
}
|
||||
|
||||
// Lister returns the GenericLister.
|
||||
func (f *genericInformer) Lister() cache.GenericLister {
|
||||
return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource)
|
||||
}
|
||||
|
||||
// ForResource gives generic access to a shared informer of the matching type
|
||||
// TODO extend this to unknown resources with a client pool
|
||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||
switch resource {
|
||||
// Group=Metrics, Version=V1alpha1
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("nodemetricses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Metrics().V1alpha1().NodeMetricses().Informer()}, nil
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("podmetricses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Metrics().V1alpha1().PodMetricses().Informer()}, nil
|
||||
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("no informer found for %v", resource)
|
||||
}
|
||||
34
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/internalinterfaces/factory_interfaces.go
generated
vendored
Normal file
34
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/internalinterfaces/factory_interfaces.go
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package internalinterfaces
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
clientset "k8s.io/metrics/pkg/client/clientset_generated/clientset"
|
||||
time "time"
|
||||
)
|
||||
|
||||
type NewInformerFunc func(clientset.Interface, time.Duration) cache.SharedIndexInformer
|
||||
|
||||
// SharedInformerFactory a small interface to allow for adding an informer without an import cycle
|
||||
type SharedInformerFactory interface {
|
||||
Start(stopCh <-chan struct{})
|
||||
InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
|
||||
}
|
||||
44
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/metrics/interface.go
generated
vendored
Normal file
44
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/metrics/interface.go
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package metrics
|
||||
|
||||
import (
|
||||
internalinterfaces "k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/internalinterfaces"
|
||||
v1alpha1 "k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/metrics/v1alpha1"
|
||||
)
|
||||
|
||||
// Interface provides access to each of this group's versions.
|
||||
type Interface interface {
|
||||
// V1alpha1 provides access to shared informers for resources in V1alpha1.
|
||||
V1alpha1() v1alpha1.Interface
|
||||
}
|
||||
|
||||
type group struct {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory) Interface {
|
||||
return &group{f}
|
||||
}
|
||||
|
||||
// V1alpha1 returns a new v1alpha1.Interface.
|
||||
func (g *group) V1alpha1() v1alpha1.Interface {
|
||||
return v1alpha1.New(g.SharedInformerFactory)
|
||||
}
|
||||
50
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/metrics/v1alpha1/interface.go
generated
vendored
Normal file
50
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/metrics/v1alpha1/interface.go
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
internalinterfaces "k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// NodeMetricses returns a NodeMetricsInformer.
|
||||
NodeMetricses() NodeMetricsInformer
|
||||
// PodMetricses returns a PodMetricsInformer.
|
||||
PodMetricses() PodMetricsInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory) Interface {
|
||||
return &version{f}
|
||||
}
|
||||
|
||||
// NodeMetricses returns a NodeMetricsInformer.
|
||||
func (v *version) NodeMetricses() NodeMetricsInformer {
|
||||
return &nodeMetricsInformer{factory: v.SharedInformerFactory}
|
||||
}
|
||||
|
||||
// PodMetricses returns a PodMetricsInformer.
|
||||
func (v *version) PodMetricses() PodMetricsInformer {
|
||||
return &podMetricsInformer{factory: v.SharedInformerFactory}
|
||||
}
|
||||
68
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/metrics/v1alpha1/nodemetrics.go
generated
vendored
Normal file
68
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/metrics/v1alpha1/nodemetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
metrics_v1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
clientset "k8s.io/metrics/pkg/client/clientset_generated/clientset"
|
||||
internalinterfaces "k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/internalinterfaces"
|
||||
v1alpha1 "k8s.io/metrics/pkg/client/listers/metrics/v1alpha1"
|
||||
time "time"
|
||||
)
|
||||
|
||||
// NodeMetricsInformer provides access to a shared informer and lister for
|
||||
// NodeMetricses.
|
||||
type NodeMetricsInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.NodeMetricsLister
|
||||
}
|
||||
|
||||
type nodeMetricsInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
func newNodeMetricsInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
sharedIndexInformer := cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
return client.MetricsV1alpha1().NodeMetricses().List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
return client.MetricsV1alpha1().NodeMetricses().Watch(options)
|
||||
},
|
||||
},
|
||||
&metrics_v1alpha1.NodeMetrics{},
|
||||
resyncPeriod,
|
||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
|
||||
)
|
||||
|
||||
return sharedIndexInformer
|
||||
}
|
||||
|
||||
func (f *nodeMetricsInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&metrics_v1alpha1.NodeMetrics{}, newNodeMetricsInformer)
|
||||
}
|
||||
|
||||
func (f *nodeMetricsInformer) Lister() v1alpha1.NodeMetricsLister {
|
||||
return v1alpha1.NewNodeMetricsLister(f.Informer().GetIndexer())
|
||||
}
|
||||
68
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/metrics/v1alpha1/podmetrics.go
generated
vendored
Normal file
68
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/metrics/v1alpha1/podmetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
metrics_v1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
clientset "k8s.io/metrics/pkg/client/clientset_generated/clientset"
|
||||
internalinterfaces "k8s.io/metrics/pkg/client/informers/informers_generated/externalversions/internalinterfaces"
|
||||
v1alpha1 "k8s.io/metrics/pkg/client/listers/metrics/v1alpha1"
|
||||
time "time"
|
||||
)
|
||||
|
||||
// PodMetricsInformer provides access to a shared informer and lister for
|
||||
// PodMetricses.
|
||||
type PodMetricsInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.PodMetricsLister
|
||||
}
|
||||
|
||||
type podMetricsInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
func newPodMetricsInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
sharedIndexInformer := cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
return client.MetricsV1alpha1().PodMetricses(v1.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
return client.MetricsV1alpha1().PodMetricses(v1.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&metrics_v1alpha1.PodMetrics{},
|
||||
resyncPeriod,
|
||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
|
||||
)
|
||||
|
||||
return sharedIndexInformer
|
||||
}
|
||||
|
||||
func (f *podMetricsInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&metrics_v1alpha1.PodMetrics{}, newPodMetricsInformer)
|
||||
}
|
||||
|
||||
func (f *podMetricsInformer) Lister() v1alpha1.PodMetricsLister {
|
||||
return v1alpha1.NewPodMetricsLister(f.Informer().GetIndexer())
|
||||
}
|
||||
95
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/factory.go
generated
vendored
Normal file
95
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/factory.go
generated
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
internalclientset "k8s.io/metrics/pkg/client/clientset_generated/internalclientset"
|
||||
internalinterfaces "k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
|
||||
metrics "k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/metrics"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
time "time"
|
||||
)
|
||||
|
||||
type sharedInformerFactory struct {
|
||||
client internalclientset.Interface
|
||||
lock sync.Mutex
|
||||
defaultResync time.Duration
|
||||
|
||||
informers map[reflect.Type]cache.SharedIndexInformer
|
||||
// startedInformers is used for tracking which informers have been started.
|
||||
// This allows Start() to be called multiple times safely.
|
||||
startedInformers map[reflect.Type]bool
|
||||
}
|
||||
|
||||
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory
|
||||
func NewSharedInformerFactory(client internalclientset.Interface, defaultResync time.Duration) SharedInformerFactory {
|
||||
return &sharedInformerFactory{
|
||||
client: client,
|
||||
defaultResync: defaultResync,
|
||||
informers: make(map[reflect.Type]cache.SharedIndexInformer),
|
||||
startedInformers: make(map[reflect.Type]bool),
|
||||
}
|
||||
}
|
||||
|
||||
// Start initializes all requested informers.
|
||||
func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
for informerType, informer := range f.informers {
|
||||
if !f.startedInformers[informerType] {
|
||||
go informer.Run(stopCh)
|
||||
f.startedInformers[informerType] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// InternalInformerFor returns the SharedIndexInformer for obj using an internal
|
||||
// client.
|
||||
func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
informerType := reflect.TypeOf(obj)
|
||||
informer, exists := f.informers[informerType]
|
||||
if exists {
|
||||
return informer
|
||||
}
|
||||
informer = newFunc(f.client, f.defaultResync)
|
||||
f.informers[informerType] = informer
|
||||
|
||||
return informer
|
||||
}
|
||||
|
||||
// SharedInformerFactory provides shared informers for resources in all known
|
||||
// API group versions.
|
||||
type SharedInformerFactory interface {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
|
||||
|
||||
Metrics() metrics.Interface
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Metrics() metrics.Interface {
|
||||
return metrics.New(f)
|
||||
}
|
||||
63
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/generic.go
generated
vendored
Normal file
63
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/generic.go
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
)
|
||||
|
||||
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
|
||||
// sharedInformers based on type
|
||||
type GenericInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() cache.GenericLister
|
||||
}
|
||||
|
||||
type genericInformer struct {
|
||||
informer cache.SharedIndexInformer
|
||||
resource schema.GroupResource
|
||||
}
|
||||
|
||||
// Informer returns the SharedIndexInformer.
|
||||
func (f *genericInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.informer
|
||||
}
|
||||
|
||||
// Lister returns the GenericLister.
|
||||
func (f *genericInformer) Lister() cache.GenericLister {
|
||||
return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource)
|
||||
}
|
||||
|
||||
// ForResource gives generic access to a shared informer of the matching type
|
||||
// TODO extend this to unknown resources with a client pool
|
||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||
switch resource {
|
||||
// Group=Metrics, Version=InternalVersion
|
||||
case metrics.SchemeGroupVersion.WithResource("nodemetricses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Metrics().InternalVersion().NodeMetricses().Informer()}, nil
|
||||
case metrics.SchemeGroupVersion.WithResource("podmetricses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Metrics().InternalVersion().PodMetricses().Informer()}, nil
|
||||
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("no informer found for %v", resource)
|
||||
}
|
||||
34
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/internalinterfaces/factory_interfaces.go
generated
vendored
Normal file
34
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/internalinterfaces/factory_interfaces.go
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package internalinterfaces
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
internalclientset "k8s.io/metrics/pkg/client/clientset_generated/internalclientset"
|
||||
time "time"
|
||||
)
|
||||
|
||||
type NewInformerFunc func(internalclientset.Interface, time.Duration) cache.SharedIndexInformer
|
||||
|
||||
// SharedInformerFactory a small interface to allow for adding an informer without an import cycle
|
||||
type SharedInformerFactory interface {
|
||||
Start(stopCh <-chan struct{})
|
||||
InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
|
||||
}
|
||||
44
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/metrics/interface.go
generated
vendored
Normal file
44
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/metrics/interface.go
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package metrics
|
||||
|
||||
import (
|
||||
internalinterfaces "k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
|
||||
internalversion "k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/metrics/internalversion"
|
||||
)
|
||||
|
||||
// Interface provides access to each of this group's versions.
|
||||
type Interface interface {
|
||||
// InternalVersion provides access to shared informers for resources in InternalVersion.
|
||||
InternalVersion() internalversion.Interface
|
||||
}
|
||||
|
||||
type group struct {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory) Interface {
|
||||
return &group{f}
|
||||
}
|
||||
|
||||
// InternalVersion returns a new internalversion.Interface.
|
||||
func (g *group) InternalVersion() internalversion.Interface {
|
||||
return internalversion.New(g.SharedInformerFactory)
|
||||
}
|
||||
50
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/metrics/internalversion/interface.go
generated
vendored
Normal file
50
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/metrics/internalversion/interface.go
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
internalinterfaces "k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// NodeMetricses returns a NodeMetricsInformer.
|
||||
NodeMetricses() NodeMetricsInformer
|
||||
// PodMetricses returns a PodMetricsInformer.
|
||||
PodMetricses() PodMetricsInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory) Interface {
|
||||
return &version{f}
|
||||
}
|
||||
|
||||
// NodeMetricses returns a NodeMetricsInformer.
|
||||
func (v *version) NodeMetricses() NodeMetricsInformer {
|
||||
return &nodeMetricsInformer{factory: v.SharedInformerFactory}
|
||||
}
|
||||
|
||||
// PodMetricses returns a PodMetricsInformer.
|
||||
func (v *version) PodMetricses() PodMetricsInformer {
|
||||
return &podMetricsInformer{factory: v.SharedInformerFactory}
|
||||
}
|
||||
68
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/metrics/internalversion/nodemetrics.go
generated
vendored
Normal file
68
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/metrics/internalversion/nodemetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
internalclientset "k8s.io/metrics/pkg/client/clientset_generated/internalclientset"
|
||||
internalinterfaces "k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
|
||||
internalversion "k8s.io/metrics/pkg/client/listers/metrics/internalversion"
|
||||
time "time"
|
||||
)
|
||||
|
||||
// NodeMetricsInformer provides access to a shared informer and lister for
|
||||
// NodeMetricses.
|
||||
type NodeMetricsInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() internalversion.NodeMetricsLister
|
||||
}
|
||||
|
||||
type nodeMetricsInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
func newNodeMetricsInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
sharedIndexInformer := cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
return client.Metrics().NodeMetricses().List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
return client.Metrics().NodeMetricses().Watch(options)
|
||||
},
|
||||
},
|
||||
&metrics.NodeMetrics{},
|
||||
resyncPeriod,
|
||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
|
||||
)
|
||||
|
||||
return sharedIndexInformer
|
||||
}
|
||||
|
||||
func (f *nodeMetricsInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&metrics.NodeMetrics{}, newNodeMetricsInformer)
|
||||
}
|
||||
|
||||
func (f *nodeMetricsInformer) Lister() internalversion.NodeMetricsLister {
|
||||
return internalversion.NewNodeMetricsLister(f.Informer().GetIndexer())
|
||||
}
|
||||
68
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/metrics/internalversion/podmetrics.go
generated
vendored
Normal file
68
vendor/k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/metrics/internalversion/podmetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
internalclientset "k8s.io/metrics/pkg/client/clientset_generated/internalclientset"
|
||||
internalinterfaces "k8s.io/metrics/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
|
||||
internalversion "k8s.io/metrics/pkg/client/listers/metrics/internalversion"
|
||||
time "time"
|
||||
)
|
||||
|
||||
// PodMetricsInformer provides access to a shared informer and lister for
|
||||
// PodMetricses.
|
||||
type PodMetricsInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() internalversion.PodMetricsLister
|
||||
}
|
||||
|
||||
type podMetricsInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
func newPodMetricsInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
sharedIndexInformer := cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
return client.Metrics().PodMetricses(v1.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
return client.Metrics().PodMetricses(v1.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&metrics.PodMetrics{},
|
||||
resyncPeriod,
|
||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
|
||||
)
|
||||
|
||||
return sharedIndexInformer
|
||||
}
|
||||
|
||||
func (f *podMetricsInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&metrics.PodMetrics{}, newPodMetricsInformer)
|
||||
}
|
||||
|
||||
func (f *podMetricsInformer) Lister() internalversion.PodMetricsLister {
|
||||
return internalversion.NewPodMetricsLister(f.Informer().GetIndexer())
|
||||
}
|
||||
31
vendor/k8s.io/metrics/pkg/client/listers/metrics/internalversion/expansion_generated.go
generated
vendored
Normal file
31
vendor/k8s.io/metrics/pkg/client/listers/metrics/internalversion/expansion_generated.go
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by lister-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
// NodeMetricsListerExpansion allows custom methods to be added to
|
||||
// NodeMetricsLister.
|
||||
type NodeMetricsListerExpansion interface{}
|
||||
|
||||
// PodMetricsListerExpansion allows custom methods to be added to
|
||||
// PodMetricsLister.
|
||||
type PodMetricsListerExpansion interface{}
|
||||
|
||||
// PodMetricsNamespaceListerExpansion allows custom methods to be added to
|
||||
// PodMetricsNamespaeLister.
|
||||
type PodMetricsNamespaceListerExpansion interface{}
|
||||
67
vendor/k8s.io/metrics/pkg/client/listers/metrics/internalversion/nodemetrics.go
generated
vendored
Normal file
67
vendor/k8s.io/metrics/pkg/client/listers/metrics/internalversion/nodemetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by lister-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
)
|
||||
|
||||
// NodeMetricsLister helps list NodeMetricses.
|
||||
type NodeMetricsLister interface {
|
||||
// List lists all NodeMetricses in the indexer.
|
||||
List(selector labels.Selector) (ret []*metrics.NodeMetrics, err error)
|
||||
// Get retrieves the NodeMetrics from the index for a given name.
|
||||
Get(name string) (*metrics.NodeMetrics, error)
|
||||
NodeMetricsListerExpansion
|
||||
}
|
||||
|
||||
// nodeMetricsLister implements the NodeMetricsLister interface.
|
||||
type nodeMetricsLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewNodeMetricsLister returns a new NodeMetricsLister.
|
||||
func NewNodeMetricsLister(indexer cache.Indexer) NodeMetricsLister {
|
||||
return &nodeMetricsLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all NodeMetricses in the indexer.
|
||||
func (s *nodeMetricsLister) List(selector labels.Selector) (ret []*metrics.NodeMetrics, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*metrics.NodeMetrics))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the NodeMetrics from the index for a given name.
|
||||
func (s *nodeMetricsLister) Get(name string) (*metrics.NodeMetrics, error) {
|
||||
key := &metrics.NodeMetrics{ObjectMeta: v1.ObjectMeta{Name: name}}
|
||||
obj, exists, err := s.indexer.Get(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(metrics.Resource("nodemetrics"), name)
|
||||
}
|
||||
return obj.(*metrics.NodeMetrics), nil
|
||||
}
|
||||
94
vendor/k8s.io/metrics/pkg/client/listers/metrics/internalversion/podmetrics.go
generated
vendored
Normal file
94
vendor/k8s.io/metrics/pkg/client/listers/metrics/internalversion/podmetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by lister-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
)
|
||||
|
||||
// PodMetricsLister helps list PodMetricses.
|
||||
type PodMetricsLister interface {
|
||||
// List lists all PodMetricses in the indexer.
|
||||
List(selector labels.Selector) (ret []*metrics.PodMetrics, err error)
|
||||
// PodMetricses returns an object that can list and get PodMetricses.
|
||||
PodMetricses(namespace string) PodMetricsNamespaceLister
|
||||
PodMetricsListerExpansion
|
||||
}
|
||||
|
||||
// podMetricsLister implements the PodMetricsLister interface.
|
||||
type podMetricsLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewPodMetricsLister returns a new PodMetricsLister.
|
||||
func NewPodMetricsLister(indexer cache.Indexer) PodMetricsLister {
|
||||
return &podMetricsLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all PodMetricses in the indexer.
|
||||
func (s *podMetricsLister) List(selector labels.Selector) (ret []*metrics.PodMetrics, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*metrics.PodMetrics))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// PodMetricses returns an object that can list and get PodMetricses.
|
||||
func (s *podMetricsLister) PodMetricses(namespace string) PodMetricsNamespaceLister {
|
||||
return podMetricsNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// PodMetricsNamespaceLister helps list and get PodMetricses.
|
||||
type PodMetricsNamespaceLister interface {
|
||||
// List lists all PodMetricses in the indexer for a given namespace.
|
||||
List(selector labels.Selector) (ret []*metrics.PodMetrics, err error)
|
||||
// Get retrieves the PodMetrics from the indexer for a given namespace and name.
|
||||
Get(name string) (*metrics.PodMetrics, error)
|
||||
PodMetricsNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// podMetricsNamespaceLister implements the PodMetricsNamespaceLister
|
||||
// interface.
|
||||
type podMetricsNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all PodMetricses in the indexer for a given namespace.
|
||||
func (s podMetricsNamespaceLister) List(selector labels.Selector) (ret []*metrics.PodMetrics, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*metrics.PodMetrics))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the PodMetrics from the indexer for a given namespace and name.
|
||||
func (s podMetricsNamespaceLister) Get(name string) (*metrics.PodMetrics, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(metrics.Resource("podmetrics"), name)
|
||||
}
|
||||
return obj.(*metrics.PodMetrics), nil
|
||||
}
|
||||
31
vendor/k8s.io/metrics/pkg/client/listers/metrics/v1alpha1/expansion_generated.go
generated
vendored
Normal file
31
vendor/k8s.io/metrics/pkg/client/listers/metrics/v1alpha1/expansion_generated.go
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by lister-gen
|
||||
|
||||
package v1alpha1
|
||||
|
||||
// NodeMetricsListerExpansion allows custom methods to be added to
|
||||
// NodeMetricsLister.
|
||||
type NodeMetricsListerExpansion interface{}
|
||||
|
||||
// PodMetricsListerExpansion allows custom methods to be added to
|
||||
// PodMetricsLister.
|
||||
type PodMetricsListerExpansion interface{}
|
||||
|
||||
// PodMetricsNamespaceListerExpansion allows custom methods to be added to
|
||||
// PodMetricsNamespaeLister.
|
||||
type PodMetricsNamespaceListerExpansion interface{}
|
||||
68
vendor/k8s.io/metrics/pkg/client/listers/metrics/v1alpha1/nodemetrics.go
generated
vendored
Normal file
68
vendor/k8s.io/metrics/pkg/client/listers/metrics/v1alpha1/nodemetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by lister-gen
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
v1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
)
|
||||
|
||||
// NodeMetricsLister helps list NodeMetricses.
|
||||
type NodeMetricsLister interface {
|
||||
// List lists all NodeMetricses in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.NodeMetrics, err error)
|
||||
// Get retrieves the NodeMetrics from the index for a given name.
|
||||
Get(name string) (*v1alpha1.NodeMetrics, error)
|
||||
NodeMetricsListerExpansion
|
||||
}
|
||||
|
||||
// nodeMetricsLister implements the NodeMetricsLister interface.
|
||||
type nodeMetricsLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewNodeMetricsLister returns a new NodeMetricsLister.
|
||||
func NewNodeMetricsLister(indexer cache.Indexer) NodeMetricsLister {
|
||||
return &nodeMetricsLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all NodeMetricses in the indexer.
|
||||
func (s *nodeMetricsLister) List(selector labels.Selector) (ret []*v1alpha1.NodeMetrics, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.NodeMetrics))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the NodeMetrics from the index for a given name.
|
||||
func (s *nodeMetricsLister) Get(name string) (*v1alpha1.NodeMetrics, error) {
|
||||
key := &v1alpha1.NodeMetrics{ObjectMeta: v1.ObjectMeta{Name: name}}
|
||||
obj, exists, err := s.indexer.Get(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(metrics.Resource("nodemetrics"), name)
|
||||
}
|
||||
return obj.(*v1alpha1.NodeMetrics), nil
|
||||
}
|
||||
95
vendor/k8s.io/metrics/pkg/client/listers/metrics/v1alpha1/podmetrics.go
generated
vendored
Normal file
95
vendor/k8s.io/metrics/pkg/client/listers/metrics/v1alpha1/podmetrics.go
generated
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by lister-gen
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
metrics "k8s.io/metrics/pkg/apis/metrics"
|
||||
v1alpha1 "k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
)
|
||||
|
||||
// PodMetricsLister helps list PodMetricses.
|
||||
type PodMetricsLister interface {
|
||||
// List lists all PodMetricses in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.PodMetrics, err error)
|
||||
// PodMetricses returns an object that can list and get PodMetricses.
|
||||
PodMetricses(namespace string) PodMetricsNamespaceLister
|
||||
PodMetricsListerExpansion
|
||||
}
|
||||
|
||||
// podMetricsLister implements the PodMetricsLister interface.
|
||||
type podMetricsLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewPodMetricsLister returns a new PodMetricsLister.
|
||||
func NewPodMetricsLister(indexer cache.Indexer) PodMetricsLister {
|
||||
return &podMetricsLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all PodMetricses in the indexer.
|
||||
func (s *podMetricsLister) List(selector labels.Selector) (ret []*v1alpha1.PodMetrics, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.PodMetrics))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// PodMetricses returns an object that can list and get PodMetricses.
|
||||
func (s *podMetricsLister) PodMetricses(namespace string) PodMetricsNamespaceLister {
|
||||
return podMetricsNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// PodMetricsNamespaceLister helps list and get PodMetricses.
|
||||
type PodMetricsNamespaceLister interface {
|
||||
// List lists all PodMetricses in the indexer for a given namespace.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.PodMetrics, err error)
|
||||
// Get retrieves the PodMetrics from the indexer for a given namespace and name.
|
||||
Get(name string) (*v1alpha1.PodMetrics, error)
|
||||
PodMetricsNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// podMetricsNamespaceLister implements the PodMetricsNamespaceLister
|
||||
// interface.
|
||||
type podMetricsNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all PodMetricses in the indexer for a given namespace.
|
||||
func (s podMetricsNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.PodMetrics, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.PodMetrics))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the PodMetrics from the indexer for a given namespace and name.
|
||||
func (s podMetricsNamespaceLister) Get(name string) (*v1alpha1.PodMetrics, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(metrics.Resource("podmetrics"), name)
|
||||
}
|
||||
return obj.(*v1alpha1.PodMetrics), nil
|
||||
}
|
||||
18
vendor/k8s.io/metrics/pkg/generated/openapi/doc.go
generated
vendored
Normal file
18
vendor/k8s.io/metrics/pkg/generated/openapi/doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// openapi generated definitions.
|
||||
package openapi
|
||||
1758
vendor/k8s.io/metrics/pkg/generated/openapi/zz_generated.openapi.go
generated
vendored
Normal file
1758
vendor/k8s.io/metrics/pkg/generated/openapi/zz_generated.openapi.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue