Set up new "metrics" API group.
This commit only adds 2 placeholder structs to the API, for the purposes of separating the API group setup from the API discussion.
This commit is contained in:
@@ -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
|
||||
|
@@ -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,22 +91,12 @@ 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)
|
||||
interfaces, err := latest.GroupOrDie(g.Group).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
|
||||
}
|
||||
panic(fmt.Errorf("cannot test group %s", g.Group))
|
||||
}
|
||||
|
||||
// Converter returns the api.Scheme for the API version to test against, as set by the
|
||||
// KUBE_TEST_API env var.
|
||||
|
57
pkg/apis/metrics/deep_copy_generated.go
Normal file
57
pkg/apis/metrics/deep_copy_generated.go
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
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)
|
||||
}
|
||||
}
|
92
pkg/apis/metrics/install/install.go
Normal file
92
pkg/apis/metrics/install/install.go
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
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, ", "))
|
||||
}
|
||||
}
|
37
pkg/apis/metrics/register.go
Normal file
37
pkg/apis/metrics/register.go
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
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() {}
|
464
pkg/apis/metrics/types.generated.go
Normal file
464
pkg/apis/metrics/types.generated.go
Normal file
@@ -0,0 +1,464 @@
|
||||
/*
|
||||
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 codecgen.
|
||||
// ************************************************************
|
||||
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
codec1978 "github.com/ugorji/go/codec"
|
||||
pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"reflect"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
const (
|
||||
codecSelferC_UTF81234 = 1
|
||||
codecSelferC_RAW1234 = 0
|
||||
codecSelferValueTypeArray1234 = 10
|
||||
codecSelferValueTypeMap1234 = 9
|
||||
)
|
||||
|
||||
var (
|
||||
codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits())
|
||||
codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`)
|
||||
)
|
||||
|
||||
type codecSelfer1234 struct{}
|
||||
|
||||
func init() {
|
||||
if codec1978.GenVersion != 4 {
|
||||
_, file, _, _ := runtime.Caller(0)
|
||||
err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v",
|
||||
4, codec1978.GenVersion, file)
|
||||
panic(err)
|
||||
}
|
||||
if false { // reference the types, but skip this branch at build/run time
|
||||
var v0 pkg1_unversioned.TypeMeta
|
||||
_ = v0
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawNode) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
if x == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yym1 := z.EncBinary()
|
||||
_ = yym1
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(x) {
|
||||
} else {
|
||||
yysep2 := !z.EncBinary()
|
||||
yy2arr2 := z.EncBasicHandle().StructToArray
|
||||
var yyq2 [2]bool
|
||||
_, _, _ = yysep2, yyq2, yy2arr2
|
||||
const yyr2 bool = false
|
||||
yyq2[0] = x.Kind != ""
|
||||
yyq2[1] = x.APIVersion != ""
|
||||
if yyr2 || yy2arr2 {
|
||||
r.EncodeArrayStart(2)
|
||||
} else {
|
||||
var yynn2 int = 0
|
||||
for _, b := range yyq2 {
|
||||
if b {
|
||||
yynn2++
|
||||
}
|
||||
}
|
||||
r.EncodeMapStart(yynn2)
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
if yyq2[0] {
|
||||
yym4 := z.EncBinary()
|
||||
_ = yym4
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
}
|
||||
} else {
|
||||
if yyq2[0] {
|
||||
r.EncodeString(codecSelferC_UTF81234, string("kind"))
|
||||
yym5 := z.EncBinary()
|
||||
_ = yym5
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
if yyq2[1] {
|
||||
yym7 := z.EncBinary()
|
||||
_ = yym7
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
}
|
||||
} else {
|
||||
if yyq2[1] {
|
||||
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
|
||||
yym8 := z.EncBinary()
|
||||
_ = yym8
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
}
|
||||
}
|
||||
if yysep2 {
|
||||
r.EncodeEnd()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawNode) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
yym9 := z.DecBinary()
|
||||
_ = yym9
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(x) {
|
||||
} else {
|
||||
if r.IsContainerType(codecSelferValueTypeMap1234) {
|
||||
yyl10 := r.ReadMapStart()
|
||||
if yyl10 == 0 {
|
||||
r.ReadEnd()
|
||||
} else {
|
||||
x.codecDecodeSelfFromMap(yyl10, d)
|
||||
}
|
||||
} else if r.IsContainerType(codecSelferValueTypeArray1234) {
|
||||
yyl10 := r.ReadArrayStart()
|
||||
if yyl10 == 0 {
|
||||
r.ReadEnd()
|
||||
} else {
|
||||
x.codecDecodeSelfFromArray(yyl10, d)
|
||||
}
|
||||
} else {
|
||||
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawNode) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yys11Slc = z.DecScratchBuffer() // default slice to decode into
|
||||
_ = yys11Slc
|
||||
var yyhl11 bool = l >= 0
|
||||
for yyj11 := 0; ; yyj11++ {
|
||||
if yyhl11 {
|
||||
if yyj11 >= l {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
if r.CheckBreak() {
|
||||
break
|
||||
}
|
||||
}
|
||||
yys11Slc = r.DecodeBytes(yys11Slc, true, true)
|
||||
yys11 := string(yys11Slc)
|
||||
switch yys11 {
|
||||
case "kind":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
} else {
|
||||
x.Kind = string(r.DecodeString())
|
||||
}
|
||||
case "apiVersion":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.APIVersion = ""
|
||||
} else {
|
||||
x.APIVersion = string(r.DecodeString())
|
||||
}
|
||||
default:
|
||||
z.DecStructFieldNotFound(-1, yys11)
|
||||
} // end switch yys11
|
||||
} // end for yyj11
|
||||
if !yyhl11 {
|
||||
r.ReadEnd()
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawNode) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj14 int
|
||||
var yyb14 bool
|
||||
var yyhl14 bool = l >= 0
|
||||
yyj14++
|
||||
if yyhl14 {
|
||||
yyb14 = yyj14 > l
|
||||
} else {
|
||||
yyb14 = r.CheckBreak()
|
||||
}
|
||||
if yyb14 {
|
||||
r.ReadEnd()
|
||||
return
|
||||
}
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
} else {
|
||||
x.Kind = string(r.DecodeString())
|
||||
}
|
||||
yyj14++
|
||||
if yyhl14 {
|
||||
yyb14 = yyj14 > l
|
||||
} else {
|
||||
yyb14 = r.CheckBreak()
|
||||
}
|
||||
if yyb14 {
|
||||
r.ReadEnd()
|
||||
return
|
||||
}
|
||||
if r.TryDecodeAsNil() {
|
||||
x.APIVersion = ""
|
||||
} else {
|
||||
x.APIVersion = string(r.DecodeString())
|
||||
}
|
||||
for {
|
||||
yyj14++
|
||||
if yyhl14 {
|
||||
yyb14 = yyj14 > l
|
||||
} else {
|
||||
yyb14 = r.CheckBreak()
|
||||
}
|
||||
if yyb14 {
|
||||
break
|
||||
}
|
||||
z.DecStructFieldNotFound(yyj14-1, "")
|
||||
}
|
||||
r.ReadEnd()
|
||||
}
|
||||
|
||||
func (x *RawPod) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
if x == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yym17 := z.EncBinary()
|
||||
_ = yym17
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(x) {
|
||||
} else {
|
||||
yysep18 := !z.EncBinary()
|
||||
yy2arr18 := z.EncBasicHandle().StructToArray
|
||||
var yyq18 [2]bool
|
||||
_, _, _ = yysep18, yyq18, yy2arr18
|
||||
const yyr18 bool = false
|
||||
yyq18[0] = x.Kind != ""
|
||||
yyq18[1] = x.APIVersion != ""
|
||||
if yyr18 || yy2arr18 {
|
||||
r.EncodeArrayStart(2)
|
||||
} else {
|
||||
var yynn18 int = 0
|
||||
for _, b := range yyq18 {
|
||||
if b {
|
||||
yynn18++
|
||||
}
|
||||
}
|
||||
r.EncodeMapStart(yynn18)
|
||||
}
|
||||
if yyr18 || yy2arr18 {
|
||||
if yyq18[0] {
|
||||
yym20 := z.EncBinary()
|
||||
_ = yym20
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
}
|
||||
} else {
|
||||
if yyq18[0] {
|
||||
r.EncodeString(codecSelferC_UTF81234, string("kind"))
|
||||
yym21 := z.EncBinary()
|
||||
_ = yym21
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr18 || yy2arr18 {
|
||||
if yyq18[1] {
|
||||
yym23 := z.EncBinary()
|
||||
_ = yym23
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
}
|
||||
} else {
|
||||
if yyq18[1] {
|
||||
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
|
||||
yym24 := z.EncBinary()
|
||||
_ = yym24
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
}
|
||||
}
|
||||
if yysep18 {
|
||||
r.EncodeEnd()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawPod) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
yym25 := z.DecBinary()
|
||||
_ = yym25
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(x) {
|
||||
} else {
|
||||
if r.IsContainerType(codecSelferValueTypeMap1234) {
|
||||
yyl26 := r.ReadMapStart()
|
||||
if yyl26 == 0 {
|
||||
r.ReadEnd()
|
||||
} else {
|
||||
x.codecDecodeSelfFromMap(yyl26, d)
|
||||
}
|
||||
} else if r.IsContainerType(codecSelferValueTypeArray1234) {
|
||||
yyl26 := r.ReadArrayStart()
|
||||
if yyl26 == 0 {
|
||||
r.ReadEnd()
|
||||
} else {
|
||||
x.codecDecodeSelfFromArray(yyl26, d)
|
||||
}
|
||||
} else {
|
||||
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawPod) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yys27Slc = z.DecScratchBuffer() // default slice to decode into
|
||||
_ = yys27Slc
|
||||
var yyhl27 bool = l >= 0
|
||||
for yyj27 := 0; ; yyj27++ {
|
||||
if yyhl27 {
|
||||
if yyj27 >= l {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
if r.CheckBreak() {
|
||||
break
|
||||
}
|
||||
}
|
||||
yys27Slc = r.DecodeBytes(yys27Slc, true, true)
|
||||
yys27 := string(yys27Slc)
|
||||
switch yys27 {
|
||||
case "kind":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
} else {
|
||||
x.Kind = string(r.DecodeString())
|
||||
}
|
||||
case "apiVersion":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.APIVersion = ""
|
||||
} else {
|
||||
x.APIVersion = string(r.DecodeString())
|
||||
}
|
||||
default:
|
||||
z.DecStructFieldNotFound(-1, yys27)
|
||||
} // end switch yys27
|
||||
} // end for yyj27
|
||||
if !yyhl27 {
|
||||
r.ReadEnd()
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawPod) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj30 int
|
||||
var yyb30 bool
|
||||
var yyhl30 bool = l >= 0
|
||||
yyj30++
|
||||
if yyhl30 {
|
||||
yyb30 = yyj30 > l
|
||||
} else {
|
||||
yyb30 = r.CheckBreak()
|
||||
}
|
||||
if yyb30 {
|
||||
r.ReadEnd()
|
||||
return
|
||||
}
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
} else {
|
||||
x.Kind = string(r.DecodeString())
|
||||
}
|
||||
yyj30++
|
||||
if yyhl30 {
|
||||
yyb30 = yyj30 > l
|
||||
} else {
|
||||
yyb30 = r.CheckBreak()
|
||||
}
|
||||
if yyb30 {
|
||||
r.ReadEnd()
|
||||
return
|
||||
}
|
||||
if r.TryDecodeAsNil() {
|
||||
x.APIVersion = ""
|
||||
} else {
|
||||
x.APIVersion = string(r.DecodeString())
|
||||
}
|
||||
for {
|
||||
yyj30++
|
||||
if yyhl30 {
|
||||
yyb30 = yyj30 > l
|
||||
} else {
|
||||
yyb30 = r.CheckBreak()
|
||||
}
|
||||
if yyb30 {
|
||||
break
|
||||
}
|
||||
z.DecStructFieldNotFound(yyj30-1, "")
|
||||
}
|
||||
r.ReadEnd()
|
||||
}
|
29
pkg/apis/metrics/types.go
Normal file
29
pkg/apis/metrics/types.go
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
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"`
|
||||
}
|
96
pkg/apis/metrics/v1alpha1/conversion_generated.go
Normal file
96
pkg/apis/metrics/v1alpha1/conversion_generated.go
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
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)
|
||||
}
|
||||
}
|
57
pkg/apis/metrics/v1alpha1/deep_copy_generated.go
Normal file
57
pkg/apis/metrics/v1alpha1/deep_copy_generated.go
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
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)
|
||||
}
|
||||
}
|
40
pkg/apis/metrics/v1alpha1/register.go
Normal file
40
pkg/apis/metrics/v1alpha1/register.go
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
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() {}
|
464
pkg/apis/metrics/v1alpha1/types.generated.go
Normal file
464
pkg/apis/metrics/v1alpha1/types.generated.go
Normal file
@@ -0,0 +1,464 @@
|
||||
/*
|
||||
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 codecgen.
|
||||
// ************************************************************
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
codec1978 "github.com/ugorji/go/codec"
|
||||
pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"reflect"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
const (
|
||||
codecSelferC_UTF81234 = 1
|
||||
codecSelferC_RAW1234 = 0
|
||||
codecSelferValueTypeArray1234 = 10
|
||||
codecSelferValueTypeMap1234 = 9
|
||||
)
|
||||
|
||||
var (
|
||||
codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits())
|
||||
codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`)
|
||||
)
|
||||
|
||||
type codecSelfer1234 struct{}
|
||||
|
||||
func init() {
|
||||
if codec1978.GenVersion != 4 {
|
||||
_, file, _, _ := runtime.Caller(0)
|
||||
err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v",
|
||||
4, codec1978.GenVersion, file)
|
||||
panic(err)
|
||||
}
|
||||
if false { // reference the types, but skip this branch at build/run time
|
||||
var v0 pkg1_unversioned.TypeMeta
|
||||
_ = v0
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawNode) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
if x == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yym1 := z.EncBinary()
|
||||
_ = yym1
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(x) {
|
||||
} else {
|
||||
yysep2 := !z.EncBinary()
|
||||
yy2arr2 := z.EncBasicHandle().StructToArray
|
||||
var yyq2 [2]bool
|
||||
_, _, _ = yysep2, yyq2, yy2arr2
|
||||
const yyr2 bool = false
|
||||
yyq2[0] = x.Kind != ""
|
||||
yyq2[1] = x.APIVersion != ""
|
||||
if yyr2 || yy2arr2 {
|
||||
r.EncodeArrayStart(2)
|
||||
} else {
|
||||
var yynn2 int = 0
|
||||
for _, b := range yyq2 {
|
||||
if b {
|
||||
yynn2++
|
||||
}
|
||||
}
|
||||
r.EncodeMapStart(yynn2)
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
if yyq2[0] {
|
||||
yym4 := z.EncBinary()
|
||||
_ = yym4
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
}
|
||||
} else {
|
||||
if yyq2[0] {
|
||||
r.EncodeString(codecSelferC_UTF81234, string("kind"))
|
||||
yym5 := z.EncBinary()
|
||||
_ = yym5
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
if yyq2[1] {
|
||||
yym7 := z.EncBinary()
|
||||
_ = yym7
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
}
|
||||
} else {
|
||||
if yyq2[1] {
|
||||
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
|
||||
yym8 := z.EncBinary()
|
||||
_ = yym8
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
}
|
||||
}
|
||||
if yysep2 {
|
||||
r.EncodeEnd()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawNode) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
yym9 := z.DecBinary()
|
||||
_ = yym9
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(x) {
|
||||
} else {
|
||||
if r.IsContainerType(codecSelferValueTypeMap1234) {
|
||||
yyl10 := r.ReadMapStart()
|
||||
if yyl10 == 0 {
|
||||
r.ReadEnd()
|
||||
} else {
|
||||
x.codecDecodeSelfFromMap(yyl10, d)
|
||||
}
|
||||
} else if r.IsContainerType(codecSelferValueTypeArray1234) {
|
||||
yyl10 := r.ReadArrayStart()
|
||||
if yyl10 == 0 {
|
||||
r.ReadEnd()
|
||||
} else {
|
||||
x.codecDecodeSelfFromArray(yyl10, d)
|
||||
}
|
||||
} else {
|
||||
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawNode) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yys11Slc = z.DecScratchBuffer() // default slice to decode into
|
||||
_ = yys11Slc
|
||||
var yyhl11 bool = l >= 0
|
||||
for yyj11 := 0; ; yyj11++ {
|
||||
if yyhl11 {
|
||||
if yyj11 >= l {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
if r.CheckBreak() {
|
||||
break
|
||||
}
|
||||
}
|
||||
yys11Slc = r.DecodeBytes(yys11Slc, true, true)
|
||||
yys11 := string(yys11Slc)
|
||||
switch yys11 {
|
||||
case "kind":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
} else {
|
||||
x.Kind = string(r.DecodeString())
|
||||
}
|
||||
case "apiVersion":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.APIVersion = ""
|
||||
} else {
|
||||
x.APIVersion = string(r.DecodeString())
|
||||
}
|
||||
default:
|
||||
z.DecStructFieldNotFound(-1, yys11)
|
||||
} // end switch yys11
|
||||
} // end for yyj11
|
||||
if !yyhl11 {
|
||||
r.ReadEnd()
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawNode) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj14 int
|
||||
var yyb14 bool
|
||||
var yyhl14 bool = l >= 0
|
||||
yyj14++
|
||||
if yyhl14 {
|
||||
yyb14 = yyj14 > l
|
||||
} else {
|
||||
yyb14 = r.CheckBreak()
|
||||
}
|
||||
if yyb14 {
|
||||
r.ReadEnd()
|
||||
return
|
||||
}
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
} else {
|
||||
x.Kind = string(r.DecodeString())
|
||||
}
|
||||
yyj14++
|
||||
if yyhl14 {
|
||||
yyb14 = yyj14 > l
|
||||
} else {
|
||||
yyb14 = r.CheckBreak()
|
||||
}
|
||||
if yyb14 {
|
||||
r.ReadEnd()
|
||||
return
|
||||
}
|
||||
if r.TryDecodeAsNil() {
|
||||
x.APIVersion = ""
|
||||
} else {
|
||||
x.APIVersion = string(r.DecodeString())
|
||||
}
|
||||
for {
|
||||
yyj14++
|
||||
if yyhl14 {
|
||||
yyb14 = yyj14 > l
|
||||
} else {
|
||||
yyb14 = r.CheckBreak()
|
||||
}
|
||||
if yyb14 {
|
||||
break
|
||||
}
|
||||
z.DecStructFieldNotFound(yyj14-1, "")
|
||||
}
|
||||
r.ReadEnd()
|
||||
}
|
||||
|
||||
func (x *RawPod) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
if x == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yym17 := z.EncBinary()
|
||||
_ = yym17
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(x) {
|
||||
} else {
|
||||
yysep18 := !z.EncBinary()
|
||||
yy2arr18 := z.EncBasicHandle().StructToArray
|
||||
var yyq18 [2]bool
|
||||
_, _, _ = yysep18, yyq18, yy2arr18
|
||||
const yyr18 bool = false
|
||||
yyq18[0] = x.Kind != ""
|
||||
yyq18[1] = x.APIVersion != ""
|
||||
if yyr18 || yy2arr18 {
|
||||
r.EncodeArrayStart(2)
|
||||
} else {
|
||||
var yynn18 int = 0
|
||||
for _, b := range yyq18 {
|
||||
if b {
|
||||
yynn18++
|
||||
}
|
||||
}
|
||||
r.EncodeMapStart(yynn18)
|
||||
}
|
||||
if yyr18 || yy2arr18 {
|
||||
if yyq18[0] {
|
||||
yym20 := z.EncBinary()
|
||||
_ = yym20
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
}
|
||||
} else {
|
||||
if yyq18[0] {
|
||||
r.EncodeString(codecSelferC_UTF81234, string("kind"))
|
||||
yym21 := z.EncBinary()
|
||||
_ = yym21
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr18 || yy2arr18 {
|
||||
if yyq18[1] {
|
||||
yym23 := z.EncBinary()
|
||||
_ = yym23
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
}
|
||||
} else {
|
||||
if yyq18[1] {
|
||||
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
|
||||
yym24 := z.EncBinary()
|
||||
_ = yym24
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
}
|
||||
}
|
||||
if yysep18 {
|
||||
r.EncodeEnd()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawPod) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
yym25 := z.DecBinary()
|
||||
_ = yym25
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(x) {
|
||||
} else {
|
||||
if r.IsContainerType(codecSelferValueTypeMap1234) {
|
||||
yyl26 := r.ReadMapStart()
|
||||
if yyl26 == 0 {
|
||||
r.ReadEnd()
|
||||
} else {
|
||||
x.codecDecodeSelfFromMap(yyl26, d)
|
||||
}
|
||||
} else if r.IsContainerType(codecSelferValueTypeArray1234) {
|
||||
yyl26 := r.ReadArrayStart()
|
||||
if yyl26 == 0 {
|
||||
r.ReadEnd()
|
||||
} else {
|
||||
x.codecDecodeSelfFromArray(yyl26, d)
|
||||
}
|
||||
} else {
|
||||
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawPod) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yys27Slc = z.DecScratchBuffer() // default slice to decode into
|
||||
_ = yys27Slc
|
||||
var yyhl27 bool = l >= 0
|
||||
for yyj27 := 0; ; yyj27++ {
|
||||
if yyhl27 {
|
||||
if yyj27 >= l {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
if r.CheckBreak() {
|
||||
break
|
||||
}
|
||||
}
|
||||
yys27Slc = r.DecodeBytes(yys27Slc, true, true)
|
||||
yys27 := string(yys27Slc)
|
||||
switch yys27 {
|
||||
case "kind":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
} else {
|
||||
x.Kind = string(r.DecodeString())
|
||||
}
|
||||
case "apiVersion":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.APIVersion = ""
|
||||
} else {
|
||||
x.APIVersion = string(r.DecodeString())
|
||||
}
|
||||
default:
|
||||
z.DecStructFieldNotFound(-1, yys27)
|
||||
} // end switch yys27
|
||||
} // end for yyj27
|
||||
if !yyhl27 {
|
||||
r.ReadEnd()
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RawPod) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj30 int
|
||||
var yyb30 bool
|
||||
var yyhl30 bool = l >= 0
|
||||
yyj30++
|
||||
if yyhl30 {
|
||||
yyb30 = yyj30 > l
|
||||
} else {
|
||||
yyb30 = r.CheckBreak()
|
||||
}
|
||||
if yyb30 {
|
||||
r.ReadEnd()
|
||||
return
|
||||
}
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
} else {
|
||||
x.Kind = string(r.DecodeString())
|
||||
}
|
||||
yyj30++
|
||||
if yyhl30 {
|
||||
yyb30 = yyj30 > l
|
||||
} else {
|
||||
yyb30 = r.CheckBreak()
|
||||
}
|
||||
if yyb30 {
|
||||
r.ReadEnd()
|
||||
return
|
||||
}
|
||||
if r.TryDecodeAsNil() {
|
||||
x.APIVersion = ""
|
||||
} else {
|
||||
x.APIVersion = string(r.DecodeString())
|
||||
}
|
||||
for {
|
||||
yyj30++
|
||||
if yyhl30 {
|
||||
yyb30 = yyj30 > l
|
||||
} else {
|
||||
yyb30 = r.CheckBreak()
|
||||
}
|
||||
if yyb30 {
|
||||
break
|
||||
}
|
||||
z.DecStructFieldNotFound(yyj30-1, "")
|
||||
}
|
||||
r.ReadEnd()
|
||||
}
|
29
pkg/apis/metrics/v1alpha1/types.go
Normal file
29
pkg/apis/metrics/v1alpha1/types.go
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
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"
|
||||
)
|
||||
|
Reference in New Issue
Block a user