mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Merge pull request #50920 from DirectXMan12/versions/custom-metrics-v2beta1
Automatic merge from submit-queue (batch tested with PRs 51335, 51364, 51130, 48075, 50920) Graduate custom metrics API to v1beta1 This graduates custom-metrics.metrics.k8s.io/v1alpha1 to custom-metrics.metrics.k8s.io/v1beta1. The move is more-or-less just a straightforward rename. Part of kubernetes/features#117 and kubernetes/features#118 ```release-note the custom metrics API (custom-metrics.metrics.k8s.io) has moved from v1alpha1 to v1beta1 ```
This commit is contained in:
commit
d375e1595f
@ -786,7 +786,7 @@ staging/src/k8s.io/kube-aggregator/pkg/controllers/status
|
||||
staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice
|
||||
staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice/etcd
|
||||
staging/src/k8s.io/metrics/pkg/apis/custom_metrics
|
||||
staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1
|
||||
staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1
|
||||
staging/src/k8s.io/metrics/pkg/apis/metrics
|
||||
staging/src/k8s.io/metrics/pkg/apis/metrics/v1alpha1
|
||||
staging/src/k8s.io/metrics/pkg/client/custom_metrics
|
||||
|
@ -78,7 +78,7 @@ go_test(
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
"//vendor/k8s.io/client-go/testing:go_default_library",
|
||||
"//vendor/k8s.io/heapster/metrics/api/v1/types:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/fake:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/client/custom_metrics/fake:go_default_library",
|
||||
|
@ -44,7 +44,7 @@ import (
|
||||
metricsfake "k8s.io/metrics/pkg/client/clientset_generated/clientset/fake"
|
||||
cmfake "k8s.io/metrics/pkg/client/custom_metrics/fake"
|
||||
|
||||
cmapi "k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
cmapi "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1"
|
||||
metricsapi "k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -24,7 +24,7 @@ go_library(
|
||||
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/heapster/metrics/api/v1/types:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/client/custom_metrics:go_default_library",
|
||||
@ -53,7 +53,7 @@ go_test(
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
"//vendor/k8s.io/client-go/testing:go_default_library",
|
||||
"//vendor/k8s.io/heapster/metrics/api/v1/types:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/fake:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/client/custom_metrics/fake:go_default_library",
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
customapi "k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
customapi "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1"
|
||||
resourceclient "k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1"
|
||||
customclient "k8s.io/metrics/pkg/client/custom_metrics"
|
||||
)
|
||||
|
@ -36,7 +36,7 @@ import (
|
||||
metricsfake "k8s.io/metrics/pkg/client/clientset_generated/clientset/fake"
|
||||
cmfake "k8s.io/metrics/pkg/client/custom_metrics/fake"
|
||||
|
||||
cmapi "k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
cmapi "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1"
|
||||
metricsapi "k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -35,7 +35,7 @@ import (
|
||||
metricsfake "k8s.io/metrics/pkg/client/clientset_generated/clientset/fake"
|
||||
cmfake "k8s.io/metrics/pkg/client/custom_metrics/fake"
|
||||
|
||||
cmapi "k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
cmapi "k8s.io/metrics/pkg/apis/custom_metrics/v1beta1"
|
||||
metricsapi "k8s.io/metrics/pkg/apis/metrics/v1alpha1"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -57,7 +57,7 @@ openapi_library(
|
||||
"k8s.io/client-go/pkg/version",
|
||||
"k8s.io/code-generator/test/apis/testgroup/v1",
|
||||
"k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1",
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1",
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1beta1",
|
||||
"k8s.io/metrics/pkg/apis/metrics/v1alpha1",
|
||||
],
|
||||
)
|
||||
|
@ -98,7 +98,7 @@ func New() *Generator {
|
||||
`k8s.io/api/networking/v1`,
|
||||
`k8s.io/kubernetes/federation/apis/federation/v1beta1`,
|
||||
`k8s.io/metrics/pkg/apis/metrics/v1alpha1`,
|
||||
`k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1`,
|
||||
`k8s.io/metrics/pkg/apis/custom_metrics/v1beta1`,
|
||||
`k8s.io/apiserver/pkg/apis/audit/v1alpha1`,
|
||||
}, ","),
|
||||
DropEmbeddedFields: "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta",
|
||||
|
@ -35,7 +35,7 @@ filegroup(
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//staging/src/k8s.io/metrics/pkg/apis/custom_metrics/install:all-srcs",
|
||||
"//staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1:all-srcs",
|
||||
"//staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
)
|
||||
|
@ -15,5 +15,5 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +groupName=custom-metrics.metrics.k8s.io
|
||||
// +groupName=custom.metrics.k8s.io
|
||||
package custom_metrics
|
||||
|
@ -13,7 +13,7 @@ go_library(
|
||||
"//vendor/k8s.io/apimachinery/pkg/apimachinery/registered:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1beta1"
|
||||
)
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
@ -31,11 +31,11 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
||||
if err := announced.NewGroupMetaFactory(
|
||||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: custom_metrics.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version},
|
||||
AddInternalObjectsToScheme: custom_metrics.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
v1alpha1.SchemeGroupVersion.Version: v1alpha1.AddToScheme,
|
||||
v1beta1.SchemeGroupVersion.Version: v1beta1.AddToScheme,
|
||||
},
|
||||
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
|
||||
panic(err)
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "custom-metrics.metrics.k8s.io"
|
||||
const GroupName = "custom.metrics.k8s.io"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
|
||||
|
@ -1,99 +0,0 @@
|
||||
// +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() {
|
||||
localSchemeBuilder.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
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_MetricValue_To_custom_metrics_MetricValue is an autogenerated conversion function.
|
||||
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
|
||||
}
|
||||
|
||||
// Convert_custom_metrics_MetricValue_To_v1alpha1_MetricValue is an autogenerated conversion function.
|
||||
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
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_MetricValueList_To_custom_metrics_MetricValueList is an autogenerated conversion function.
|
||||
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
|
||||
}
|
||||
|
||||
// Convert_custom_metrics_MetricValueList_To_v1alpha1_MetricValueList is an autogenerated conversion function.
|
||||
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)
|
||||
}
|
@ -18,4 +18,4 @@ limitations under the License.
|
||||
// +k8s:conversion-gen=k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/custom_metrics
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
@ -15,20 +15,20 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by protoc-gen-gogo.
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/generated.proto
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1/generated.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package v1alpha1 is a generated protocol buffer package.
|
||||
Package v1beta1 is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/generated.proto
|
||||
k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
MetricValue
|
||||
MetricValueList
|
||||
*/
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
@ -59,8 +59,8 @@ 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")
|
||||
proto.RegisterType((*MetricValue)(nil), "k8s.io.metrics.pkg.apis.custom_metrics.v1beta1.MetricValue")
|
||||
proto.RegisterType((*MetricValueList)(nil), "k8s.io.metrics.pkg.apis.custom_metrics.v1beta1.MetricValueList")
|
||||
}
|
||||
func (m *MetricValue) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
@ -661,44 +661,44 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1/generated.proto", fileDescriptorGenerated)
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 545 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xc1, 0x6f, 0xd3, 0x30,
|
||||
0x14, 0xc6, 0x9b, 0x95, 0xa2, 0xcd, 0xd5, 0x54, 0x96, 0x0b, 0x51, 0x0f, 0x69, 0x55, 0x2e, 0x05,
|
||||
0x09, 0x5b, 0x2d, 0x08, 0x71, 0xe0, 0x14, 0x71, 0x41, 0xa2, 0x20, 0xb2, 0x09, 0x10, 0x20, 0x21,
|
||||
0xd7, 0x79, 0x4d, 0x4d, 0x9b, 0x38, 0xb2, 0x9d, 0x4e, 0xbb, 0x71, 0xe2, 0xcc, 0x9f, 0xd5, 0xe3,
|
||||
0xc4, 0x69, 0xa7, 0x8a, 0x86, 0x7f, 0x04, 0x25, 0x75, 0xda, 0x6e, 0x65, 0xc0, 0x6e, 0xb1, 0xfd,
|
||||
0xbe, 0x9f, 0xbf, 0xef, 0x3d, 0x07, 0xbd, 0x9f, 0x3c, 0x55, 0x98, 0x0b, 0x32, 0x49, 0x87, 0x20,
|
||||
0x63, 0xd0, 0xa0, 0xc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, 0x53, 0x33, 0x05, 0xfc, 0x7f, 0x79, 0x73, 0xf5, 0x00, 0x34, 0xf5, 0xee, 0x98, 0xbb, 0xf6,
|
||||
0xcb, 0x1d, 0x7f, 0x4d, 0xb4, 0x29, 0xaa, 0x71, 0x0d, 0x91, 0x72, 0xf6, 0xda, 0xd5, 0x6e, 0xbd,
|
||||
0xff, 0x0c, 0xdf, 0xf0, 0xc7, 0xc4, 0x5b, 0x76, 0x37, 0xa1, 0x5e, 0xe4, 0x48, 0x7f, 0x45, 0xf6,
|
||||
0xf0, 0x7c, 0xe9, 0x56, 0xce, 0x97, 0x6e, 0xe5, 0x62, 0xe9, 0x56, 0xbe, 0x66, 0xae, 0x35, 0xcf,
|
||||
0x5c, 0xeb, 0x3c, 0x73, 0xad, 0x8b, 0xcc, 0xb5, 0x7e, 0x66, 0xae, 0xf5, 0xfd, 0x97, 0x5b, 0xf9,
|
||||
0xb0, 0x5f, 0x12, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x80, 0xcc, 0x75, 0x01, 0x76, 0x04, 0x00,
|
||||
0x00,
|
||||
// 546 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x41, 0x6f, 0xd3, 0x3e,
|
||||
0x18, 0xc6, 0x9b, 0xf5, 0xdf, 0x3f, 0x9b, 0xab, 0xa9, 0x2c, 0x17, 0xa2, 0x1e, 0xd2, 0xaa, 0x5c,
|
||||
0x0a, 0xd2, 0x6c, 0xb5, 0x20, 0x84, 0xc4, 0x2d, 0xe2, 0x82, 0x44, 0x41, 0x64, 0x13, 0x93, 0x00,
|
||||
0x09, 0x9c, 0xe4, 0x6d, 0x6a, 0xba, 0xc4, 0x91, 0xed, 0x74, 0xda, 0x8d, 0x13, 0x67, 0x3e, 0x56,
|
||||
0x8f, 0xe3, 0xb6, 0x53, 0x45, 0xc3, 0x17, 0x41, 0x49, 0x9c, 0xb6, 0x5b, 0x19, 0xb0, 0x5b, 0x6c,
|
||||
0xbf, 0xcf, 0xcf, 0xcf, 0xf3, 0xbe, 0x0e, 0x3a, 0x99, 0x3e, 0x95, 0x98, 0x71, 0x32, 0x4d, 0x3d,
|
||||
0x10, 0x31, 0x28, 0x90, 0x64, 0x06, 0x71, 0xc0, 0x05, 0xd1, 0x07, 0x11, 0x28, 0xc1, 0x7c, 0x49,
|
||||
0x92, 0x69, 0x48, 0x68, 0xc2, 0x24, 0xf1, 0x53, 0xa9, 0x78, 0xf4, 0xb1, 0xda, 0x9f, 0x0d, 0x3c,
|
||||
0x50, 0x74, 0x40, 0x42, 0x88, 0x41, 0x50, 0x05, 0x01, 0x4e, 0x04, 0x57, 0xdc, 0xc4, 0xa5, 0x1e,
|
||||
0xeb, 0x3a, 0x9c, 0x4c, 0x43, 0x9c, 0xeb, 0xf1, 0x55, 0x3d, 0xd6, 0xfa, 0xf6, 0x61, 0xc8, 0xd4,
|
||||
0x24, 0xf5, 0xb0, 0xcf, 0x23, 0x12, 0xf2, 0x90, 0x93, 0x02, 0xe3, 0xa5, 0xe3, 0x62, 0x55, 0x2c,
|
||||
0x8a, 0xaf, 0x12, 0xdf, 0xee, 0x69, 0x7b, 0x34, 0x61, 0xc4, 0xe7, 0x02, 0xc8, 0x6c, 0xcb, 0x42,
|
||||
0xfb, 0xf1, 0xba, 0x26, 0xa2, 0xfe, 0x84, 0xc5, 0x20, 0xce, 0xab, 0x1c, 0x44, 0x80, 0xe4, 0xa9,
|
||||
0xf0, 0xe1, 0x56, 0x2a, 0x99, 0xb7, 0x83, 0xfe, 0xee, 0x2e, 0x72, 0x93, 0x4a, 0xa4, 0xb1, 0x62,
|
||||
0xd1, 0xf6, 0x35, 0x4f, 0xfe, 0x26, 0x90, 0xfe, 0x04, 0x22, 0xba, 0xa5, 0x7b, 0x74, 0x93, 0x2e,
|
||||
0x55, 0xec, 0x94, 0xb0, 0x58, 0x49, 0x25, 0xae, 0x8b, 0x7a,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d4, 0xb9, 0xb3, 0xaf, 0x7d, 0x34, 0x8a, 0x8e, 0xbb, 0x25,
|
||||
0xab, 0xf7, 0xdd, 0x40, 0xad, 0x8d, 0x41, 0xbc, 0x64, 0x52, 0x99, 0x1f, 0xd0, 0x6e, 0x9e, 0x20,
|
||||
0xa0, 0x8a, 0xea, 0x29, 0xe0, 0x7f, 0xcb, 0x9b, 0xab, 0x47, 0xa0, 0xa8, 0x73, 0x57, 0xdf, 0xb5,
|
||||
0x5b, 0xed, 0xb8, 0x2b, 0xa2, 0xf9, 0x09, 0x35, 0x98, 0x82, 0x48, 0x5a, 0x3b, 0xdd, 0x7a, 0xbf,
|
||||
0x39, 0x7c, 0x76, 0xcb, 0xff, 0x12, 0x6f, 0xb8, 0x5d, 0x67, 0x7a, 0x91, 0x13, 0xdd, 0x12, 0xec,
|
||||
0x1c, 0xce, 0x97, 0x76, 0xed, 0x62, 0x69, 0xd7, 0x2e, 0x97, 0x76, 0xed, 0x4b, 0x66, 0x1b, 0xf3,
|
||||
0xcc, 0x36, 0x2e, 0x32, 0xdb, 0xb8, 0xcc, 0x6c, 0xe3, 0x47, 0x66, 0x1b, 0xdf, 0x7e, 0xda, 0xb5,
|
||||
0x77, 0x77, 0x34, 0xf0, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x64, 0x6b, 0xb8, 0x76, 0x72, 0x04,
|
||||
0x00, 0x00,
|
||||
}
|
@ -19,7 +19,7 @@ limitations under the License.
|
||||
|
||||
syntax = 'proto2';
|
||||
|
||||
package k8s.io.metrics.pkg.apis.custom_metrics.v1alpha1;
|
||||
package k8s.io.metrics.pkg.apis.custom_metrics.v1beta1;
|
||||
|
||||
import "k8s.io/api/core/v1/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/api/resource/generated.proto";
|
||||
@ -29,7 +29,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
|
||||
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1alpha1";
|
||||
option go_package = "v1beta1";
|
||||
|
||||
// a metric value for some object
|
||||
message MetricValue {
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -23,10 +23,10 @@ import (
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "custom-metrics.metrics.k8s.io"
|
||||
const GroupName = "custom.metrics.k8s.io"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"k8s.io/api/core/v1"
|
@ -0,0 +1,99 @@
|
||||
// +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 v1beta1
|
||||
|
||||
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() {
|
||||
localSchemeBuilder.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_v1beta1_MetricValue_To_custom_metrics_MetricValue,
|
||||
Convert_custom_metrics_MetricValue_To_v1beta1_MetricValue,
|
||||
Convert_v1beta1_MetricValueList_To_custom_metrics_MetricValueList,
|
||||
Convert_custom_metrics_MetricValueList_To_v1beta1_MetricValueList,
|
||||
)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_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
|
||||
}
|
||||
|
||||
// Convert_v1beta1_MetricValue_To_custom_metrics_MetricValue is an autogenerated conversion function.
|
||||
func Convert_v1beta1_MetricValue_To_custom_metrics_MetricValue(in *MetricValue, out *custom_metrics.MetricValue, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_MetricValue_To_custom_metrics_MetricValue(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_custom_metrics_MetricValue_To_v1beta1_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
|
||||
}
|
||||
|
||||
// Convert_custom_metrics_MetricValue_To_v1beta1_MetricValue is an autogenerated conversion function.
|
||||
func Convert_custom_metrics_MetricValue_To_v1beta1_MetricValue(in *custom_metrics.MetricValue, out *MetricValue, s conversion.Scope) error {
|
||||
return autoConvert_custom_metrics_MetricValue_To_v1beta1_MetricValue(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_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
|
||||
}
|
||||
|
||||
// Convert_v1beta1_MetricValueList_To_custom_metrics_MetricValueList is an autogenerated conversion function.
|
||||
func Convert_v1beta1_MetricValueList_To_custom_metrics_MetricValueList(in *MetricValueList, out *custom_metrics.MetricValueList, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_MetricValueList_To_custom_metrics_MetricValueList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_custom_metrics_MetricValueList_To_v1beta1_MetricValueList(in *custom_metrics.MetricValueList, out *MetricValueList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]MetricValue)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_custom_metrics_MetricValueList_To_v1beta1_MetricValueList is an autogenerated conversion function.
|
||||
func Convert_custom_metrics_MetricValueList_To_v1beta1_MetricValueList(in *custom_metrics.MetricValueList, out *MetricValueList, s conversion.Scope) error {
|
||||
return autoConvert_custom_metrics_MetricValueList_To_v1beta1_MetricValueList(in, out, s)
|
||||
}
|
@ -18,7 +18,7 @@ limitations under the License.
|
||||
|
||||
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
@ -20,7 +20,7 @@ go_library(
|
||||
"//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
"//vendor/k8s.io/client-go/util/flowcontrol:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/util/flowcontrol"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1beta1"
|
||||
)
|
||||
|
||||
type customMetricsClient struct {
|
||||
@ -50,7 +50,7 @@ func NewForConfig(c *rest.Config) (CustomMetricsClient, error) {
|
||||
if configShallowCopy.UserAgent == "" {
|
||||
configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
configShallowCopy.GroupVersion = &v1alpha1.SchemeGroupVersion
|
||||
configShallowCopy.GroupVersion = &v1beta1.SchemeGroupVersion
|
||||
configShallowCopy.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
|
||||
|
||||
client, err := rest.RESTClientFor(&configShallowCopy)
|
||||
@ -115,8 +115,8 @@ type rootScopedMetrics struct {
|
||||
client *customMetricsClient
|
||||
}
|
||||
|
||||
func (m *rootScopedMetrics) getForNamespace(namespace string, metricName string) (*v1alpha1.MetricValue, error) {
|
||||
res := &v1alpha1.MetricValueList{}
|
||||
func (m *rootScopedMetrics) getForNamespace(namespace string, metricName string) (*v1beta1.MetricValue, error) {
|
||||
res := &v1beta1.MetricValueList{}
|
||||
err := m.client.client.Get().
|
||||
Resource("metrics").
|
||||
Namespace(namespace).
|
||||
@ -135,7 +135,7 @@ func (m *rootScopedMetrics) getForNamespace(namespace string, metricName string)
|
||||
return &res.Items[0], nil
|
||||
}
|
||||
|
||||
func (m *rootScopedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string) (*v1alpha1.MetricValue, error) {
|
||||
func (m *rootScopedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string) (*v1beta1.MetricValue, error) {
|
||||
// handle namespace separately
|
||||
if groupKind.Kind == "Namespace" && groupKind.Group == "" {
|
||||
return m.getForNamespace(name, metricName)
|
||||
@ -146,7 +146,7 @@ func (m *rootScopedMetrics) GetForObject(groupKind schema.GroupKind, name string
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res := &v1alpha1.MetricValueList{}
|
||||
res := &v1beta1.MetricValueList{}
|
||||
err = m.client.client.Get().
|
||||
Resource(resourceName).
|
||||
Name(name).
|
||||
@ -165,7 +165,7 @@ func (m *rootScopedMetrics) GetForObject(groupKind schema.GroupKind, name string
|
||||
return &res.Items[0], nil
|
||||
}
|
||||
|
||||
func (m *rootScopedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string) (*v1alpha1.MetricValueList, error) {
|
||||
func (m *rootScopedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string) (*v1beta1.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")
|
||||
@ -176,10 +176,10 @@ func (m *rootScopedMetrics) GetForObjects(groupKind schema.GroupKind, selector l
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res := &v1alpha1.MetricValueList{}
|
||||
res := &v1beta1.MetricValueList{}
|
||||
err = m.client.client.Get().
|
||||
Resource(resourceName).
|
||||
Name(v1alpha1.AllObjects).
|
||||
Name(v1beta1.AllObjects).
|
||||
SubResource(metricName).
|
||||
VersionedParams(&metav1.ListOptions{
|
||||
LabelSelector: selector.String(),
|
||||
@ -199,13 +199,13 @@ type namespacedMetrics struct {
|
||||
namespace string
|
||||
}
|
||||
|
||||
func (m *namespacedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string) (*v1alpha1.MetricValue, error) {
|
||||
func (m *namespacedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string) (*v1beta1.MetricValue, error) {
|
||||
resourceName, err := m.client.qualResourceForKind(groupKind)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res := &v1alpha1.MetricValueList{}
|
||||
res := &v1beta1.MetricValueList{}
|
||||
err = m.client.client.Get().
|
||||
Resource(resourceName).
|
||||
Namespace(m.namespace).
|
||||
@ -225,17 +225,17 @@ func (m *namespacedMetrics) GetForObject(groupKind schema.GroupKind, name string
|
||||
return &res.Items[0], nil
|
||||
}
|
||||
|
||||
func (m *namespacedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string) (*v1alpha1.MetricValueList, error) {
|
||||
func (m *namespacedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string) (*v1beta1.MetricValueList, error) {
|
||||
resourceName, err := m.client.qualResourceForKind(groupKind)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res := &v1alpha1.MetricValueList{}
|
||||
res := &v1beta1.MetricValueList{}
|
||||
err = m.client.client.Get().
|
||||
Resource(resourceName).
|
||||
Namespace(m.namespace).
|
||||
Name(v1alpha1.AllObjects).
|
||||
Name(v1beta1.AllObjects).
|
||||
SubResource(metricName).
|
||||
VersionedParams(&metav1.ListOptions{
|
||||
LabelSelector: selector.String(),
|
||||
|
@ -13,7 +13,7 @@ go_library(
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/client-go/testing:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/client/custom_metrics:go_default_library",
|
||||
],
|
||||
)
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/testing"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1beta1"
|
||||
cmclient "k8s.io/metrics/pkg/client/custom_metrics"
|
||||
)
|
||||
|
||||
@ -60,7 +60,7 @@ func NewGetForAction(groupKind schema.GroupKind, namespace, name string, metricN
|
||||
Resource: gvr.Resource,
|
||||
}
|
||||
resource := schema.GroupResource{
|
||||
Group: v1alpha1.SchemeGroupVersion.Group,
|
||||
Group: v1beta1.SchemeGroupVersion.Group,
|
||||
Resource: groupResourceForKind.String(),
|
||||
}
|
||||
return GetForActionImpl{
|
||||
@ -79,7 +79,7 @@ func NewRootGetForAction(groupKind schema.GroupKind, name string, metricName str
|
||||
Resource: gvr.Resource,
|
||||
}
|
||||
resource := schema.GroupResource{
|
||||
Group: v1alpha1.SchemeGroupVersion.Group,
|
||||
Group: v1beta1.SchemeGroupVersion.Group,
|
||||
Resource: groupResourceForKind.String(),
|
||||
}
|
||||
return GetForActionImpl{
|
||||
@ -111,15 +111,15 @@ type fakeNamespacedMetrics struct {
|
||||
ns string
|
||||
}
|
||||
|
||||
func (m *fakeNamespacedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string) (*v1alpha1.MetricValue, error) {
|
||||
func (m *fakeNamespacedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string) (*v1beta1.MetricValue, error) {
|
||||
obj, err := m.Fake.
|
||||
Invokes(NewGetForAction(groupKind, m.ns, name, metricName, nil), &v1alpha1.MetricValueList{})
|
||||
Invokes(NewGetForAction(groupKind, m.ns, name, metricName, nil), &v1beta1.MetricValueList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
objList := obj.(*v1alpha1.MetricValueList)
|
||||
objList := obj.(*v1beta1.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))
|
||||
}
|
||||
@ -127,30 +127,30 @@ func (m *fakeNamespacedMetrics) GetForObject(groupKind schema.GroupKind, name st
|
||||
return &objList.Items[0], err
|
||||
}
|
||||
|
||||
func (m *fakeNamespacedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string) (*v1alpha1.MetricValueList, error) {
|
||||
func (m *fakeNamespacedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string) (*v1beta1.MetricValueList, error) {
|
||||
obj, err := m.Fake.
|
||||
Invokes(NewGetForAction(groupKind, m.ns, "*", metricName, selector), &v1alpha1.MetricValueList{})
|
||||
Invokes(NewGetForAction(groupKind, m.ns, "*", metricName, selector), &v1beta1.MetricValueList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return obj.(*v1alpha1.MetricValueList), err
|
||||
return obj.(*v1beta1.MetricValueList), err
|
||||
}
|
||||
|
||||
type fakeRootScopedMetrics struct {
|
||||
Fake *FakeCustomMetricsClient
|
||||
}
|
||||
|
||||
func (m *fakeRootScopedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string) (*v1alpha1.MetricValue, error) {
|
||||
func (m *fakeRootScopedMetrics) GetForObject(groupKind schema.GroupKind, name string, metricName string) (*v1beta1.MetricValue, error) {
|
||||
obj, err := m.Fake.
|
||||
Invokes(NewRootGetForAction(groupKind, name, metricName, nil), &v1alpha1.MetricValueList{})
|
||||
Invokes(NewRootGetForAction(groupKind, name, metricName, nil), &v1beta1.MetricValueList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
objList := obj.(*v1alpha1.MetricValueList)
|
||||
objList := obj.(*v1beta1.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))
|
||||
}
|
||||
@ -158,13 +158,13 @@ func (m *fakeRootScopedMetrics) GetForObject(groupKind schema.GroupKind, name st
|
||||
return &objList.Items[0], err
|
||||
}
|
||||
|
||||
func (m *fakeRootScopedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string) (*v1alpha1.MetricValueList, error) {
|
||||
func (m *fakeRootScopedMetrics) GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string) (*v1beta1.MetricValueList, error) {
|
||||
obj, err := m.Fake.
|
||||
Invokes(NewRootGetForAction(groupKind, "*", metricName, selector), &v1alpha1.MetricValueList{})
|
||||
Invokes(NewRootGetForAction(groupKind, "*", metricName, selector), &v1beta1.MetricValueList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return obj.(*v1alpha1.MetricValueList), err
|
||||
return obj.(*v1beta1.MetricValueList), err
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ package custom_metrics
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1"
|
||||
"k8s.io/metrics/pkg/apis/custom_metrics/v1beta1"
|
||||
)
|
||||
|
||||
// CustomMetricsClient is a client for fetching metrics
|
||||
@ -45,10 +45,10 @@ type NamespacedMetricsGetter interface {
|
||||
// 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)
|
||||
GetForObject(groupKind schema.GroupKind, name string, metricName string) (*v1beta1.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)
|
||||
GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string) (*v1beta1.MetricValueList, error)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user