Commit f371b3d8 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #16621 from timstclair/metrics-lite

Auto commit by PR queue bot
parents 25b7c798 5cd5b80f
......@@ -31,6 +31,8 @@ import (
_ "k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1"
_ "k8s.io/kubernetes/pkg/apis/extensions"
_ "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
_ "k8s.io/kubernetes/pkg/apis/metrics"
_ "k8s.io/kubernetes/pkg/apis/metrics/v1alpha1"
kruntime "k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/sets"
......
......@@ -31,6 +31,8 @@ import (
_ "k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1"
_ "k8s.io/kubernetes/pkg/apis/extensions"
_ "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
_ "k8s.io/kubernetes/pkg/apis/metrics"
_ "k8s.io/kubernetes/pkg/apis/metrics/v1alpha1"
kruntime "k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/sets"
......
......@@ -21,4 +21,5 @@ import (
_ "k8s.io/kubernetes/pkg/api/install"
_ "k8s.io/kubernetes/pkg/apis/componentconfig/install"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
_ "k8s.io/kubernetes/pkg/apis/metrics/install"
)
......@@ -43,7 +43,7 @@ EOF
}
# TODO(lavalamp): get this list by listing the pkg/apis/ directory?
DEFAULT_GROUP_VERSIONS="v1 extensions/v1beta1 componentconfig/v1alpha1"
DEFAULT_GROUP_VERSIONS="v1 extensions/v1beta1 componentconfig/v1alpha1 metrics/v1alpha1"
VERSIONS=${VERSIONS:-$DEFAULT_GROUP_VERSIONS}
for ver in $VERSIONS; do
# Ensure that the version being processed is registered by setting
......
......@@ -49,7 +49,7 @@ function generate_deep_copies() {
for ver in ${group_versions}; do
# Ensure that the version being processed is registered by setting
# KUBE_API_VERSIONS.
if [ -z ${ver##*/} ]; then
if [ -z ${ver##*/} ]; then
apiVersions=""
fi
KUBE_API_VERSIONS="${apiVersions}" generate_version "${ver}"
......@@ -57,6 +57,6 @@ function generate_deep_copies() {
}
# v1 is in the group ""
DEFAULT_VERSIONS="/ v1 extensions/ extensions/v1beta1 componentconfig/ componentconfig/v1alpha1"
DEFAULT_VERSIONS="/ v1 extensions/ extensions/v1beta1 componentconfig/ componentconfig/v1alpha1 metrics/ metrics/v1alpha1"
VERSIONS=${VERSIONS:-$DEFAULT_VERSIONS}
generate_deep_copies "$VERSIONS"
......@@ -23,7 +23,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
APIROOTS=${APIROOTS:-pkg/api pkg/apis/extensions}
APIROOTS=${APIROOTS:-pkg/api pkg/apis/extensions pkg/apis/metrics}
_tmp="${KUBE_ROOT}/_tmp"
cleanup() {
......
......@@ -25,7 +25,7 @@ kube::golang::setup_env
gendeepcopy=$(kube::util::find-binary "gendeepcopy")
APIROOTS=${APIROOTS:-pkg/api pkg/apis/extensions}
APIROOTS=${APIROOTS:-pkg/api pkg/apis/extensions pkg/apis/metrics}
_tmp="${KUBE_ROOT}/_tmp"
cleanup() {
......
......@@ -56,9 +56,7 @@ KUBE_GOVERALLS_BIN=${KUBE_GOVERALLS_BIN:-}
# Lists of API Versions of each groups that should be tested, groups are
# separated by comma, lists are separated by semicolon. e.g.,
# "v1,compute/v1alpha1,experimental/v1alpha2;v1,compute/v2,experimental/v1alpha3"
# TODO: It's going to be:
# KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,extensions/v1beta1"}
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,extensions/v1beta1"}
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,extensions/v1beta1,metrics/v1alpha1"}
# once we have multiple group supports
# Run tests with the standard (registry) and a custom etcd prefix
# (kubernetes.io/registry).
......@@ -315,7 +313,7 @@ for (( i=0, j=0; ; )); do
# KUBE_TEST_API sets the version of each group to be tested. KUBE_API_VERSIONS
# register the groups/versions as supported by k8s. So KUBE_API_VERSIONS
# needs to be the superset of KUBE_TEST_API.
KUBE_TEST_API="${apiVersion}" KUBE_API_VERSIONS="v1,extensions/v1beta1,componentconfig/v1alpha1" ETCD_PREFIX=${etcdPrefix} runTests "$@"
KUBE_TEST_API="${apiVersion}" KUBE_API_VERSIONS="v1,extensions/v1beta1,componentconfig/v1alpha1,metrics/v1alpha1" ETCD_PREFIX=${etcdPrefix} runTests "$@"
i=${i}+1
j=${j}+1
if [[ i -eq ${apiVersionsCount} ]] && [[ j -eq ${etcdPrefixesCount} ]]; then
......
......@@ -35,6 +35,7 @@ func init() {
"v1": true,
"extensions/v1beta1": true,
"componentconfig/v1alpha1": true,
"metrics/v1alpha1": true,
}
// The default list of supported api versions, in order of most preferred to the least.
......
......@@ -25,6 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api"
_ "k8s.io/kubernetes/pkg/api/install"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
_ "k8s.io/kubernetes/pkg/apis/metrics/install"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/meta"
......@@ -90,21 +91,11 @@ func (g TestGroup) GroupAndVersion() string {
// KUBE_TEST_API env var.
func (g TestGroup) Codec() runtime.Codec {
// TODO: caesarxuchao: Restructure the body once we have a central `latest`.
if g.Group == "" {
interfaces, err := latest.GroupOrDie("").InterfacesFor(g.GroupVersionUnderTest)
if err != nil {
panic(err)
}
return interfaces.Codec
}
if g.Group == "extensions" {
interfaces, err := latest.GroupOrDie("extensions").InterfacesFor(g.GroupVersionUnderTest)
if err != nil {
panic(err)
}
return interfaces.Codec
interfaces, err := latest.GroupOrDie(g.Group).InterfacesFor(g.GroupVersionUnderTest)
if err != nil {
panic(err)
}
panic(fmt.Errorf("cannot test group %s", g.Group))
return interfaces.Codec
}
// Converter returns the api.Scheme for the API version to test against, as set by the
......
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
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.
*/
// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-deep-copies.sh.
package metrics
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func deepCopy_unversioned_TypeMeta(in unversioned.TypeMeta, out *unversioned.TypeMeta, c *conversion.Cloner) error {
out.Kind = in.Kind
out.APIVersion = in.APIVersion
return nil
}
func deepCopy_metrics_RawNode(in RawNode, out *RawNode, c *conversion.Cloner) error {
if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
return nil
}
func deepCopy_metrics_RawPod(in RawPod, out *RawPod, c *conversion.Cloner) error {
if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
return nil
}
func init() {
err := api.Scheme.AddGeneratedDeepCopyFuncs(
deepCopy_unversioned_TypeMeta,
deepCopy_metrics_RawNode,
deepCopy_metrics_RawPod,
)
if err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
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 metrics API group, making it available as
// an option to all of the API encoding/decoding machinery.
package install
import (
"fmt"
"strings"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/registered"
apiutil "k8s.io/kubernetes/pkg/api/util"
_ "k8s.io/kubernetes/pkg/apis/metrics"
"k8s.io/kubernetes/pkg/apis/metrics/v1alpha1"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/sets"
)
const importPrefix = "k8s.io/kubernetes/pkg/apis/metrics"
var accessor = meta.NewAccessor()
func init() {
groupMeta, err := latest.RegisterGroup("metrics")
if err != nil {
glog.V(4).Infof("%v", err)
return
}
registeredGroupVersions := registered.GroupVersionsForGroup("metrics")
groupVersion := registeredGroupVersions[0]
*groupMeta = latest.GroupMeta{
GroupVersion: groupVersion,
Group: apiutil.GetGroup(groupVersion),
Version: apiutil.GetVersion(groupVersion),
Codec: runtime.CodecFor(api.Scheme, groupVersion),
}
var versions []string
var groupVersions []string
for i := len(registeredGroupVersions) - 1; i >= 0; i-- {
versions = append(versions, apiutil.GetVersion(registeredGroupVersions[i]))
groupVersions = append(groupVersions, registeredGroupVersions[i])
}
groupMeta.Versions = versions
groupMeta.GroupVersions = groupVersions
groupMeta.SelfLinker = runtime.SelfLinker(accessor)
// the list of kinds that are scoped at the root of the api hierarchy
// if a kind is not enumerated here, it is assumed to have a namespace scope
rootScoped := sets.NewString()
ignoredKinds := sets.NewString()
groupMeta.RESTMapper = api.NewDefaultRESTMapper("metrics", groupVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped)
api.RegisterRESTMapper(groupMeta.RESTMapper)
groupMeta.InterfacesFor = interfacesFor
}
// InterfacesFor returns the default Codec and ResourceVersioner for a given version
// string, or an error if the version is not known.
func interfacesFor(version string) (*meta.VersionInterfaces, error) {
switch version {
case "metrics/v1alpha1":
return &meta.VersionInterfaces{
Codec: v1alpha1.Codec,
ObjectConvertor: api.Scheme,
MetadataAccessor: accessor,
}, nil
default:
g, _ := latest.Group("metrics")
return nil, fmt.Errorf("unsupported storage version: %s (valid: %s)", version, strings.Join(g.Versions, ", "))
}
}
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
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/kubernetes/pkg/api"
)
func init() {
// Register the API.
addKnownTypes()
}
// Adds the list of known types to api.Scheme.
func addKnownTypes() {
api.Scheme.AddKnownTypes("",
&RawNode{},
&RawPod{},
)
}
func (*RawNode) IsAnAPIObject() {}
func (*RawPod) IsAnAPIObject() {}
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
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/kubernetes/pkg/api/unversioned"
// Placeholder top-level node resource metrics.
type RawNode struct {
unversioned.TypeMeta `json:",inline"`
}
// Placeholder top-level pod resource metrics.
type RawPod struct {
unversioned.TypeMeta `json:",inline"`
}
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
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.
*/
// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-conversions.sh
package v1alpha1
import (
reflect "reflect"
api "k8s.io/kubernetes/pkg/api"
metrics "k8s.io/kubernetes/pkg/apis/metrics"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func autoconvert_metrics_RawNode_To_v1alpha1_RawNode(in *metrics.RawNode, out *RawNode, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*metrics.RawNode))(in)
}
if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil {
return err
}
return nil
}
func convert_metrics_RawNode_To_v1alpha1_RawNode(in *metrics.RawNode, out *RawNode, s conversion.Scope) error {
return autoconvert_metrics_RawNode_To_v1alpha1_RawNode(in, out, s)
}
func autoconvert_metrics_RawPod_To_v1alpha1_RawPod(in *metrics.RawPod, out *RawPod, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*metrics.RawPod))(in)
}
if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil {
return err
}
return nil
}
func convert_metrics_RawPod_To_v1alpha1_RawPod(in *metrics.RawPod, out *RawPod, s conversion.Scope) error {
return autoconvert_metrics_RawPod_To_v1alpha1_RawPod(in, out, s)
}
func autoconvert_v1alpha1_RawNode_To_metrics_RawNode(in *RawNode, out *metrics.RawNode, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*RawNode))(in)
}
if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil {
return err
}
return nil
}
func convert_v1alpha1_RawNode_To_metrics_RawNode(in *RawNode, out *metrics.RawNode, s conversion.Scope) error {
return autoconvert_v1alpha1_RawNode_To_metrics_RawNode(in, out, s)
}
func autoconvert_v1alpha1_RawPod_To_metrics_RawPod(in *RawPod, out *metrics.RawPod, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*RawPod))(in)
}
if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil {
return err
}
return nil
}
func convert_v1alpha1_RawPod_To_metrics_RawPod(in *RawPod, out *metrics.RawPod, s conversion.Scope) error {
return autoconvert_v1alpha1_RawPod_To_metrics_RawPod(in, out, s)
}
func init() {
err := api.Scheme.AddGeneratedConversionFuncs(
autoconvert_metrics_RawNode_To_v1alpha1_RawNode,
autoconvert_metrics_RawPod_To_v1alpha1_RawPod,
autoconvert_v1alpha1_RawNode_To_metrics_RawNode,
autoconvert_v1alpha1_RawPod_To_metrics_RawPod,
)
if err != nil {
// If one of the conversion functions is malformed, detect it immediately.
panic(err)
}
}
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
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.
*/
// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-deep-copies.sh.
package v1alpha1
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func deepCopy_unversioned_TypeMeta(in unversioned.TypeMeta, out *unversioned.TypeMeta, c *conversion.Cloner) error {
out.Kind = in.Kind
out.APIVersion = in.APIVersion
return nil
}
func deepCopy_v1alpha1_RawNode(in RawNode, out *RawNode, c *conversion.Cloner) error {
if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
return nil
}
func deepCopy_v1alpha1_RawPod(in RawPod, out *RawPod, c *conversion.Cloner) error {
if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
return nil
}
func init() {
err := api.Scheme.AddGeneratedDeepCopyFuncs(
deepCopy_unversioned_TypeMeta,
deepCopy_v1alpha1_RawNode,
deepCopy_v1alpha1_RawPod,
)
if err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
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/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/runtime"
)
var Codec = runtime.CodecFor(api.Scheme, "metrics/v1alpha1")
func init() {
// Register the API.
addKnownTypes()
}
// Adds the list of known types to api.Scheme.
func addKnownTypes() {
api.Scheme.AddKnownTypes("metrics/v1alpha1",
&RawNode{},
&RawPod{},
)
}
func (*RawNode) IsAnAPIObject() {}
func (*RawPod) IsAnAPIObject() {}
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
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/kubernetes/pkg/api/unversioned"
// Placeholder top-level node resource metrics.
type RawNode struct {
unversioned.TypeMeta `json:",inline"`
}
// Placeholder top-level pod resource metrics.
type RawPod struct {
unversioned.TypeMeta `json:",inline"`
}
......@@ -21,4 +21,5 @@ import (
_ "k8s.io/kubernetes/pkg/api/install"
_ "k8s.io/kubernetes/pkg/apis/componentconfig/install"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
_ "k8s.io/kubernetes/pkg/apis/metrics/install"
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment