Removing unneeded fields from Cluster API object

pull/6/head
nikhiljindal 2016-06-28 13:37:03 -07:00
parent 1f62850007
commit 88b10b1dc0
12 changed files with 125 additions and 1399 deletions

View File

@ -22,7 +22,6 @@ package federation
import (
api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
@ -32,7 +31,6 @@ func init() {
DeepCopy_federation_Cluster,
DeepCopy_federation_ClusterCondition,
DeepCopy_federation_ClusterList,
DeepCopy_federation_ClusterMeta,
DeepCopy_federation_ClusterSpec,
DeepCopy_federation_ClusterStatus,
DeepCopy_federation_ServerAddressByClientCIDR,
@ -93,11 +91,6 @@ func DeepCopy_federation_ClusterList(in ClusterList, out *ClusterList, c *conver
return nil
}
func DeepCopy_federation_ClusterMeta(in ClusterMeta, out *ClusterMeta, c *conversion.Cloner) error {
out.Version = in.Version
return nil
}
func DeepCopy_federation_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conversion.Cloner) error {
if in.ServerAddressByClientCIDRs != nil {
in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
@ -134,35 +127,6 @@ func DeepCopy_federation_ClusterStatus(in ClusterStatus, out *ClusterStatus, c *
} else {
out.Conditions = nil
}
if in.Capacity != nil {
in, out := in.Capacity, &out.Capacity
*out = make(api.ResourceList)
for key, val := range in {
newVal := new(resource.Quantity)
if err := resource.DeepCopy_resource_Quantity(val, newVal, c); err != nil {
return err
}
(*out)[key] = *newVal
}
} else {
out.Capacity = nil
}
if in.Allocatable != nil {
in, out := in.Allocatable, &out.Allocatable
*out = make(api.ResourceList)
for key, val := range in {
newVal := new(resource.Quantity)
if err := resource.DeepCopy_resource_Quantity(val, newVal, c); err != nil {
return err
}
(*out)[key] = *newVal
}
} else {
out.Allocatable = nil
}
if err := DeepCopy_federation_ClusterMeta(in.ClusterMeta, &out.ClusterMeta, c); err != nil {
return err
}
if in.Zones != nil {
in, out := in.Zones, &out.Zones
*out = make([]string, len(in))

View File

@ -26,9 +26,8 @@ import (
"fmt"
codec1978 "github.com/ugorji/go/codec"
pkg1_api "k8s.io/kubernetes/pkg/api"
pkg3_resource "k8s.io/kubernetes/pkg/api/resource"
pkg2_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
pkg4_types "k8s.io/kubernetes/pkg/types"
pkg3_types "k8s.io/kubernetes/pkg/types"
"reflect"
"runtime"
time "time"
@ -65,11 +64,10 @@ func init() {
}
if false { // reference the types, but skip this branch at build/run time
var v0 pkg1_api.LocalObjectReference
var v1 pkg3_resource.Quantity
var v2 pkg2_unversioned.Time
var v3 pkg4_types.UID
var v4 time.Time
_, _, _, _, _ = v0, v1, v2, v3, v4
var v1 pkg2_unversioned.Time
var v2 pkg3_types.UID
var v3 time.Time
_, _, _, _ = v0, v1, v2, v3
}
}
@ -985,175 +983,6 @@ func (x *ClusterCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ClusterMeta) 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 [1]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[0] = x.Version != ""
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(1)
} else {
yynn2 = 0
for _, b := range yyq2 {
if b {
yynn2++
}
}
r.EncodeMapStart(yynn2)
yynn2 = 0
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[0] {
yym4 := z.EncBinary()
_ = yym4
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Version))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("version"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym5 := z.EncBinary()
_ = yym5
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Version))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
}
}
}
}
func (x *ClusterMeta) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yym1 := z.DecBinary()
_ = yym1
if false {
} else if z.HasExtensions() && z.DecExt(x) {
} else {
yyct2 := r.ContainerType()
if yyct2 == codecSelferValueTypeMap1234 {
yyl2 := r.ReadMapStart()
if yyl2 == 0 {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
} else {
x.codecDecodeSelfFromMap(yyl2, d)
}
} else if yyct2 == codecSelferValueTypeArray1234 {
yyl2 := r.ReadArrayStart()
if yyl2 == 0 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
x.codecDecodeSelfFromArray(yyl2, d)
}
} else {
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
}
}
}
func (x *ClusterMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yys3Slc = z.DecScratchBuffer() // default slice to decode into
_ = yys3Slc
var yyhl3 bool = l >= 0
for yyj3 := 0; ; yyj3++ {
if yyhl3 {
if yyj3 >= l {
break
}
} else {
if r.CheckBreak() {
break
}
}
z.DecSendContainerState(codecSelfer_containerMapKey1234)
yys3Slc = r.DecodeBytes(yys3Slc, true, true)
yys3 := string(yys3Slc)
z.DecSendContainerState(codecSelfer_containerMapValue1234)
switch yys3 {
case "version":
if r.TryDecodeAsNil() {
x.Version = ""
} else {
x.Version = string(r.DecodeString())
}
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
} // end for yyj3
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ClusterMeta) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj5 int
var yyb5 bool
var yyhl5 bool = l >= 0
yyj5++
if yyhl5 {
yyb5 = yyj5 > l
} else {
yyb5 = r.CheckBreak()
}
if yyb5 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Version = ""
} else {
x.Version = string(r.DecodeString())
}
for {
yyj5++
if yyhl5 {
yyb5 = yyj5 > l
} else {
yyb5 = r.CheckBreak()
}
if yyb5 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj5-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
@ -1168,18 +997,15 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [6]bool
var yyq2 [3]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[0] = len(x.Conditions) != 0
yyq2[1] = len(x.Capacity) != 0
yyq2[2] = len(x.Allocatable) != 0
yyq2[3] = len(x.Zones) != 0
yyq2[4] = x.Region != ""
yyq2[5] = x.Version != ""
yyq2[1] = len(x.Zones) != 0
yyq2[2] = x.Region != ""
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(6)
r.EncodeArrayStart(3)
} else {
yynn2 = 0
for _, b := range yyq2 {
@ -1226,79 +1052,29 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[1] {
if x.Capacity == nil {
if x.Zones == nil {
r.EncodeNil()
} else {
yysf7 := &x.Capacity
yysf7.CodecEncodeSelf(e)
yym7 := z.EncBinary()
_ = yym7
if false {
} else {
z.F.EncSliceStringV(x.Zones, false, e)
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("capacity"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Capacity == nil {
r.EncodeNil()
} else {
yysf8 := &x.Capacity
yysf8.CodecEncodeSelf(e)
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] {
if x.Allocatable == nil {
r.EncodeNil()
} else {
yysf10 := &x.Allocatable
yysf10.CodecEncodeSelf(e)
}
} else {
r.EncodeNil()
}
} else {
if yyq2[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("allocatable"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Allocatable == nil {
r.EncodeNil()
} else {
yysf11 := &x.Allocatable
yysf11.CodecEncodeSelf(e)
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[3] {
if x.Zones == nil {
r.EncodeNil()
} else {
yym13 := z.EncBinary()
_ = yym13
if false {
} else {
z.F.EncSliceStringV(x.Zones, false, e)
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[3] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("zones"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Zones == nil {
r.EncodeNil()
} else {
yym14 := z.EncBinary()
_ = yym14
yym8 := z.EncBinary()
_ = yym8
if false {
} else {
z.F.EncSliceStringV(x.Zones, false, e)
@ -1308,9 +1084,9 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[4] {
yym16 := z.EncBinary()
_ = yym16
if yyq2[2] {
yym10 := z.EncBinary()
_ = yym10
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Region))
@ -1319,43 +1095,18 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[4] {
if yyq2[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("region"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym17 := z.EncBinary()
_ = yym17
yym11 := z.EncBinary()
_ = yym11
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Region))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[5] {
yym19 := z.EncBinary()
_ = yym19
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Version))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[5] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("version"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym20 := z.EncBinary()
_ = yym20
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Version))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
@ -1429,30 +1180,16 @@ func (x *ClusterStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
h.decSliceClusterCondition((*[]ClusterCondition)(yyv4), d)
}
}
case "capacity":
if r.TryDecodeAsNil() {
x.Capacity = nil
} else {
yyv6 := &x.Capacity
yyv6.CodecDecodeSelf(d)
}
case "allocatable":
if r.TryDecodeAsNil() {
x.Allocatable = nil
} else {
yyv7 := &x.Allocatable
yyv7.CodecDecodeSelf(d)
}
case "zones":
if r.TryDecodeAsNil() {
x.Zones = nil
} else {
yyv8 := &x.Zones
yym9 := z.DecBinary()
_ = yym9
yyv6 := &x.Zones
yym7 := z.DecBinary()
_ = yym7
if false {
} else {
z.F.DecSliceStringX(yyv8, false, d)
z.F.DecSliceStringX(yyv6, false, d)
}
}
case "region":
@ -1461,12 +1198,6 @@ func (x *ClusterStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
} else {
x.Region = string(r.DecodeString())
}
case "version":
if r.TryDecodeAsNil() {
x.Version = ""
} else {
x.Version = string(r.DecodeString())
}
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
@ -1478,16 +1209,16 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj12 int
var yyb12 bool
var yyhl12 bool = l >= 0
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
var yyj9 int
var yyb9 bool
var yyhl9 bool = l >= 0
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb12 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb12 {
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1495,55 +1226,21 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Conditions = nil
} else {
yyv13 := &x.Conditions
yym14 := z.DecBinary()
_ = yym14
yyv10 := &x.Conditions
yym11 := z.DecBinary()
_ = yym11
if false {
} else {
h.decSliceClusterCondition((*[]ClusterCondition)(yyv13), d)
h.decSliceClusterCondition((*[]ClusterCondition)(yyv10), d)
}
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb12 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Capacity = nil
} else {
yyv15 := &x.Capacity
yyv15.CodecDecodeSelf(d)
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb12 = r.CheckBreak()
}
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Allocatable = nil
} else {
yyv16 := &x.Allocatable
yyv16.CodecDecodeSelf(d)
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb12 = r.CheckBreak()
}
if yyb12 {
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1551,21 +1248,21 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Zones = nil
} else {
yyv17 := &x.Zones
yym18 := z.DecBinary()
_ = yym18
yyv12 := &x.Zones
yym13 := z.DecBinary()
_ = yym13
if false {
} else {
z.F.DecSliceStringX(yyv17, false, d)
z.F.DecSliceStringX(yyv12, false, d)
}
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb12 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb12 {
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1575,34 +1272,18 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} else {
x.Region = string(r.DecodeString())
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb12 = r.CheckBreak()
}
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Version = ""
} else {
x.Version = string(r.DecodeString())
}
for {
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb12 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb12 {
if yyb9 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj12-1, "")
z.DecStructFieldNotFound(yyj9-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
@ -2571,7 +2252,7 @@ func (x codecSelfer1234) decSliceCluster(v *[]Cluster, d *codec1978.Decoder) {
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 368)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 336)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]

View File

@ -71,21 +71,10 @@ type ClusterCondition struct {
Message string `json:"message,omitempty"`
}
// Cluster metadata
type ClusterMeta struct {
// Release version of the cluster.
Version string `json:"version,omitempty"`
}
// ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally.
type ClusterStatus struct {
// Conditions is an array of current cluster conditions.
Conditions []ClusterCondition `json:"conditions,omitempty"`
// Capacity represents the total resources of the cluster
Capacity api.ResourceList `json:"capacity,omitempty"`
// Allocatable represents the total resources of a cluster that are available for scheduling.
Allocatable api.ResourceList `json:"allocatable,omitempty"`
ClusterMeta `json:",inline"`
// Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
// These will always be in the same region.
Zones []string `json:"zones,omitempty"`

View File

@ -23,7 +23,6 @@ package v1alpha1
import (
federation "k8s.io/kubernetes/federation/apis/federation"
api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion"
)
@ -36,8 +35,6 @@ func init() {
Convert_federation_ClusterCondition_To_v1alpha1_ClusterCondition,
Convert_v1alpha1_ClusterList_To_federation_ClusterList,
Convert_federation_ClusterList_To_v1alpha1_ClusterList,
Convert_v1alpha1_ClusterMeta_To_federation_ClusterMeta,
Convert_federation_ClusterMeta_To_v1alpha1_ClusterMeta,
Convert_v1alpha1_ClusterSpec_To_federation_ClusterSpec,
Convert_federation_ClusterSpec_To_v1alpha1_ClusterSpec,
Convert_v1alpha1_ClusterStatus_To_federation_ClusterStatus,
@ -178,24 +175,6 @@ func Convert_federation_ClusterList_To_v1alpha1_ClusterList(in *federation.Clust
return autoConvert_federation_ClusterList_To_v1alpha1_ClusterList(in, out, s)
}
func autoConvert_v1alpha1_ClusterMeta_To_federation_ClusterMeta(in *ClusterMeta, out *federation.ClusterMeta, s conversion.Scope) error {
out.Version = in.Version
return nil
}
func Convert_v1alpha1_ClusterMeta_To_federation_ClusterMeta(in *ClusterMeta, out *federation.ClusterMeta, s conversion.Scope) error {
return autoConvert_v1alpha1_ClusterMeta_To_federation_ClusterMeta(in, out, s)
}
func autoConvert_federation_ClusterMeta_To_v1alpha1_ClusterMeta(in *federation.ClusterMeta, out *ClusterMeta, s conversion.Scope) error {
out.Version = in.Version
return nil
}
func Convert_federation_ClusterMeta_To_v1alpha1_ClusterMeta(in *federation.ClusterMeta, out *ClusterMeta, s conversion.Scope) error {
return autoConvert_federation_ClusterMeta_To_v1alpha1_ClusterMeta(in, out, s)
}
func autoConvert_v1alpha1_ClusterSpec_To_federation_ClusterSpec(in *ClusterSpec, out *federation.ClusterSpec, s conversion.Scope) error {
if in.ServerAddressByClientCIDRs != nil {
in, out := &in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
@ -266,15 +245,6 @@ func autoConvert_v1alpha1_ClusterStatus_To_federation_ClusterStatus(in *ClusterS
} else {
out.Conditions = nil
}
if err := v1.Convert_v1_ResourceList_To_api_ResourceList(&in.Capacity, &out.Capacity, s); err != nil {
return err
}
if err := v1.Convert_v1_ResourceList_To_api_ResourceList(&in.Allocatable, &out.Allocatable, s); err != nil {
return err
}
if err := Convert_v1alpha1_ClusterMeta_To_federation_ClusterMeta(&in.ClusterMeta, &out.ClusterMeta, s); err != nil {
return err
}
out.Zones = in.Zones
out.Region = in.Region
return nil
@ -296,35 +266,6 @@ func autoConvert_federation_ClusterStatus_To_v1alpha1_ClusterStatus(in *federati
} else {
out.Conditions = nil
}
if in.Capacity != nil {
in, out := &in.Capacity, &out.Capacity
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
newVal := new(resource.Quantity)
if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, newVal, s); err != nil {
return err
}
(*out)[v1.ResourceName(key)] = *newVal
}
} else {
out.Capacity = nil
}
if in.Allocatable != nil {
in, out := &in.Allocatable, &out.Allocatable
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
newVal := new(resource.Quantity)
if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, newVal, s); err != nil {
return err
}
(*out)[v1.ResourceName(key)] = *newVal
}
} else {
out.Allocatable = nil
}
if err := Convert_federation_ClusterMeta_To_v1alpha1_ClusterMeta(&in.ClusterMeta, &out.ClusterMeta, s); err != nil {
return err
}
out.Zones = in.Zones
out.Region = in.Region
return nil

View File

@ -22,7 +22,6 @@ package v1alpha1
import (
api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion"
@ -33,7 +32,6 @@ func init() {
DeepCopy_v1alpha1_Cluster,
DeepCopy_v1alpha1_ClusterCondition,
DeepCopy_v1alpha1_ClusterList,
DeepCopy_v1alpha1_ClusterMeta,
DeepCopy_v1alpha1_ClusterSpec,
DeepCopy_v1alpha1_ClusterStatus,
DeepCopy_v1alpha1_ServerAddressByClientCIDR,
@ -94,11 +92,6 @@ func DeepCopy_v1alpha1_ClusterList(in ClusterList, out *ClusterList, c *conversi
return nil
}
func DeepCopy_v1alpha1_ClusterMeta(in ClusterMeta, out *ClusterMeta, c *conversion.Cloner) error {
out.Version = in.Version
return nil
}
func DeepCopy_v1alpha1_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conversion.Cloner) error {
if in.ServerAddressByClientCIDRs != nil {
in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
@ -135,35 +128,6 @@ func DeepCopy_v1alpha1_ClusterStatus(in ClusterStatus, out *ClusterStatus, c *co
} else {
out.Conditions = nil
}
if in.Capacity != nil {
in, out := in.Capacity, &out.Capacity
*out = make(v1.ResourceList)
for key, val := range in {
newVal := new(resource.Quantity)
if err := resource.DeepCopy_resource_Quantity(val, newVal, c); err != nil {
return err
}
(*out)[key] = *newVal
}
} else {
out.Capacity = nil
}
if in.Allocatable != nil {
in, out := in.Allocatable, &out.Allocatable
*out = make(v1.ResourceList)
for key, val := range in {
newVal := new(resource.Quantity)
if err := resource.DeepCopy_resource_Quantity(val, newVal, c); err != nil {
return err
}
(*out)[key] = *newVal
}
} else {
out.Allocatable = nil
}
if err := DeepCopy_v1alpha1_ClusterMeta(in.ClusterMeta, &out.ClusterMeta, c); err != nil {
return err
}
if in.Zones != nil {
in, out := in.Zones, &out.Zones
*out = make([]string, len(in))

View File

@ -28,7 +28,6 @@ limitations under the License.
Cluster
ClusterCondition
ClusterList
ClusterMeta
ClusterSpec
ClusterStatus
ServerAddressByClientCIDR
@ -39,8 +38,6 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import k8s_io_kubernetes_pkg_api_resource "k8s.io/kubernetes/pkg/api/resource"
import k8s_io_kubernetes_pkg_api_v1 "k8s.io/kubernetes/pkg/api/v1"
import io "io"
@ -62,10 +59,6 @@ func (m *ClusterList) Reset() { *m = ClusterList{} }
func (m *ClusterList) String() string { return proto.CompactTextString(m) }
func (*ClusterList) ProtoMessage() {}
func (m *ClusterMeta) Reset() { *m = ClusterMeta{} }
func (m *ClusterMeta) String() string { return proto.CompactTextString(m) }
func (*ClusterMeta) ProtoMessage() {}
func (m *ClusterSpec) Reset() { *m = ClusterSpec{} }
func (m *ClusterSpec) String() string { return proto.CompactTextString(m) }
func (*ClusterSpec) ProtoMessage() {}
@ -82,7 +75,6 @@ func init() {
proto.RegisterType((*Cluster)(nil), "k8s.io.kubernetes.federation.apis.federation.v1alpha1.Cluster")
proto.RegisterType((*ClusterCondition)(nil), "k8s.io.kubernetes.federation.apis.federation.v1alpha1.ClusterCondition")
proto.RegisterType((*ClusterList)(nil), "k8s.io.kubernetes.federation.apis.federation.v1alpha1.ClusterList")
proto.RegisterType((*ClusterMeta)(nil), "k8s.io.kubernetes.federation.apis.federation.v1alpha1.ClusterMeta")
proto.RegisterType((*ClusterSpec)(nil), "k8s.io.kubernetes.federation.apis.federation.v1alpha1.ClusterSpec")
proto.RegisterType((*ClusterStatus)(nil), "k8s.io.kubernetes.federation.apis.federation.v1alpha1.ClusterStatus")
proto.RegisterType((*ServerAddressByClientCIDR)(nil), "k8s.io.kubernetes.federation.apis.federation.v1alpha1.ServerAddressByClientCIDR")
@ -217,28 +209,6 @@ func (m *ClusterList) MarshalTo(data []byte) (int, error) {
return i, nil
}
func (m *ClusterMeta) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
if err != nil {
return nil, err
}
return data[:n], nil
}
func (m *ClusterMeta) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
_ = l
data[i] = 0xa
i++
i = encodeVarintGenerated(data, i, uint64(len(m.Version)))
i += copy(data[i:], m.Version)
return i, nil
}
func (m *ClusterSpec) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
@ -306,58 +276,6 @@ func (m *ClusterStatus) MarshalTo(data []byte) (int, error) {
i += n
}
}
if len(m.Capacity) > 0 {
for k := range m.Capacity {
data[i] = 0x12
i++
v := m.Capacity[k]
msgSize := (&v).Size()
mapSize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + msgSize + sovGenerated(uint64(msgSize))
i = encodeVarintGenerated(data, i, uint64(mapSize))
data[i] = 0xa
i++
i = encodeVarintGenerated(data, i, uint64(len(k)))
i += copy(data[i:], k)
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64((&v).Size()))
n8, err := (&v).MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n8
}
}
if len(m.Allocatable) > 0 {
for k := range m.Allocatable {
data[i] = 0x1a
i++
v := m.Allocatable[k]
msgSize := (&v).Size()
mapSize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + msgSize + sovGenerated(uint64(msgSize))
i = encodeVarintGenerated(data, i, uint64(mapSize))
data[i] = 0xa
i++
i = encodeVarintGenerated(data, i, uint64(len(k)))
i += copy(data[i:], k)
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64((&v).Size()))
n9, err := (&v).MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n9
}
}
data[i] = 0x22
i++
i = encodeVarintGenerated(data, i, uint64(m.ClusterMeta.Size()))
n10, err := m.ClusterMeta.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n10
if len(m.Zones) > 0 {
for _, s := range m.Zones {
data[i] = 0x2a
@ -477,14 +395,6 @@ func (m *ClusterList) Size() (n int) {
return n
}
func (m *ClusterMeta) Size() (n int) {
var l int
_ = l
l = len(m.Version)
n += 1 + l + sovGenerated(uint64(l))
return n
}
func (m *ClusterSpec) Size() (n int) {
var l int
_ = l
@ -510,26 +420,6 @@ func (m *ClusterStatus) Size() (n int) {
n += 1 + l + sovGenerated(uint64(l))
}
}
if len(m.Capacity) > 0 {
for k, v := range m.Capacity {
_ = k
_ = v
l = v.Size()
mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l))
n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
}
}
if len(m.Allocatable) > 0 {
for k, v := range m.Allocatable {
_ = k
_ = v
l = v.Size()
mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l))
n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
}
}
l = m.ClusterMeta.Size()
n += 1 + l + sovGenerated(uint64(l))
if len(m.Zones) > 0 {
for _, s := range m.Zones {
l = len(s)
@ -1041,85 +931,6 @@ func (m *ClusterList) Unmarshal(data []byte) error {
}
return nil
}
func (m *ClusterMeta) Unmarshal(data []byte) error {
l := len(data)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ClusterMeta: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ClusterMeta: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Version = string(data[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(data[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenerated
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *ClusterSpec) Unmarshal(data []byte) error {
l := len(data)
iNdEx := 0
@ -1294,268 +1105,6 @@ func (m *ClusterStatus) Unmarshal(data []byte) error {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
var keykey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
keykey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
var stringLenmapkey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
stringLenmapkey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapkey := int(stringLenmapkey)
if intStringLenmapkey < 0 {
return ErrInvalidLengthGenerated
}
postStringIndexmapkey := iNdEx + intStringLenmapkey
if postStringIndexmapkey > l {
return io.ErrUnexpectedEOF
}
mapkey := k8s_io_kubernetes_pkg_api_v1.ResourceName(data[iNdEx:postStringIndexmapkey])
iNdEx = postStringIndexmapkey
var valuekey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
valuekey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
var mapmsglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
mapmsglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if mapmsglen < 0 {
return ErrInvalidLengthGenerated
}
postmsgIndex := iNdEx + mapmsglen
if mapmsglen < 0 {
return ErrInvalidLengthGenerated
}
if postmsgIndex > l {
return io.ErrUnexpectedEOF
}
mapvalue := &k8s_io_kubernetes_pkg_api_resource.Quantity{}
if err := mapvalue.Unmarshal(data[iNdEx:postmsgIndex]); err != nil {
return err
}
iNdEx = postmsgIndex
if m.Capacity == nil {
m.Capacity = make(k8s_io_kubernetes_pkg_api_v1.ResourceList)
}
m.Capacity[k8s_io_kubernetes_pkg_api_v1.ResourceName(mapkey)] = *mapvalue
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Allocatable", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
var keykey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
keykey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
var stringLenmapkey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
stringLenmapkey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapkey := int(stringLenmapkey)
if intStringLenmapkey < 0 {
return ErrInvalidLengthGenerated
}
postStringIndexmapkey := iNdEx + intStringLenmapkey
if postStringIndexmapkey > l {
return io.ErrUnexpectedEOF
}
mapkey := k8s_io_kubernetes_pkg_api_v1.ResourceName(data[iNdEx:postStringIndexmapkey])
iNdEx = postStringIndexmapkey
var valuekey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
valuekey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
var mapmsglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
mapmsglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if mapmsglen < 0 {
return ErrInvalidLengthGenerated
}
postmsgIndex := iNdEx + mapmsglen
if mapmsglen < 0 {
return ErrInvalidLengthGenerated
}
if postmsgIndex > l {
return io.ErrUnexpectedEOF
}
mapvalue := &k8s_io_kubernetes_pkg_api_resource.Quantity{}
if err := mapvalue.Unmarshal(data[iNdEx:postmsgIndex]); err != nil {
return err
}
iNdEx = postmsgIndex
if m.Allocatable == nil {
m.Allocatable = make(k8s_io_kubernetes_pkg_api_v1.ResourceList)
}
m.Allocatable[k8s_io_kubernetes_pkg_api_v1.ResourceName(mapkey)] = *mapvalue
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ClusterMeta", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ClusterMeta.Unmarshal(data[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Zones", wireType)

View File

@ -21,7 +21,6 @@ syntax = 'proto2';
package k8s.io.kubernetes.federation.apis.federation.v1alpha1;
import "k8s.io/kubernetes/pkg/api/resource/generated.proto";
import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
import "k8s.io/kubernetes/pkg/util/intstr/generated.proto";
@ -73,12 +72,6 @@ message ClusterList {
repeated Cluster items = 2;
}
// Cluster metadata
message ClusterMeta {
// Release version of the cluster.
optional string version = 1;
}
// ClusterSpec describes the attributes of a kubernetes cluster.
message ClusterSpec {
// A map of client CIDR to server address.
@ -100,14 +93,6 @@ message ClusterStatus {
// Conditions is an array of current cluster conditions.
repeated ClusterCondition conditions = 1;
// Capacity represents the total resources of the cluster
map<string, k8s.io.kubernetes.pkg.api.resource.Quantity> capacity = 2;
// Allocatable represents the total resources of a cluster that are available for scheduling.
map<string, k8s.io.kubernetes.pkg.api.resource.Quantity> allocatable = 3;
optional ClusterMeta clusterMeta = 4;
// Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
// These will always be in the same region.
repeated string zones = 5;

View File

@ -25,10 +25,9 @@ import (
"errors"
"fmt"
codec1978 "github.com/ugorji/go/codec"
pkg3_resource "k8s.io/kubernetes/pkg/api/resource"
pkg2_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
pkg1_v1 "k8s.io/kubernetes/pkg/api/v1"
pkg4_types "k8s.io/kubernetes/pkg/types"
pkg3_types "k8s.io/kubernetes/pkg/types"
"reflect"
"runtime"
time "time"
@ -64,12 +63,11 @@ func init() {
panic(err)
}
if false { // reference the types, but skip this branch at build/run time
var v0 pkg3_resource.Quantity
var v1 pkg2_unversioned.Time
var v2 pkg1_v1.LocalObjectReference
var v3 pkg4_types.UID
var v4 time.Time
_, _, _, _, _ = v0, v1, v2, v3, v4
var v0 pkg2_unversioned.Time
var v1 pkg1_v1.LocalObjectReference
var v2 pkg3_types.UID
var v3 time.Time
_, _, _, _ = v0, v1, v2, v3
}
}
@ -985,175 +983,6 @@ func (x *ClusterCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ClusterMeta) 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 [1]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[0] = x.Version != ""
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(1)
} else {
yynn2 = 0
for _, b := range yyq2 {
if b {
yynn2++
}
}
r.EncodeMapStart(yynn2)
yynn2 = 0
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[0] {
yym4 := z.EncBinary()
_ = yym4
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Version))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("version"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym5 := z.EncBinary()
_ = yym5
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Version))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
}
}
}
}
func (x *ClusterMeta) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yym1 := z.DecBinary()
_ = yym1
if false {
} else if z.HasExtensions() && z.DecExt(x) {
} else {
yyct2 := r.ContainerType()
if yyct2 == codecSelferValueTypeMap1234 {
yyl2 := r.ReadMapStart()
if yyl2 == 0 {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
} else {
x.codecDecodeSelfFromMap(yyl2, d)
}
} else if yyct2 == codecSelferValueTypeArray1234 {
yyl2 := r.ReadArrayStart()
if yyl2 == 0 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
x.codecDecodeSelfFromArray(yyl2, d)
}
} else {
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
}
}
}
func (x *ClusterMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yys3Slc = z.DecScratchBuffer() // default slice to decode into
_ = yys3Slc
var yyhl3 bool = l >= 0
for yyj3 := 0; ; yyj3++ {
if yyhl3 {
if yyj3 >= l {
break
}
} else {
if r.CheckBreak() {
break
}
}
z.DecSendContainerState(codecSelfer_containerMapKey1234)
yys3Slc = r.DecodeBytes(yys3Slc, true, true)
yys3 := string(yys3Slc)
z.DecSendContainerState(codecSelfer_containerMapValue1234)
switch yys3 {
case "version":
if r.TryDecodeAsNil() {
x.Version = ""
} else {
x.Version = string(r.DecodeString())
}
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
} // end for yyj3
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ClusterMeta) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj5 int
var yyb5 bool
var yyhl5 bool = l >= 0
yyj5++
if yyhl5 {
yyb5 = yyj5 > l
} else {
yyb5 = r.CheckBreak()
}
if yyb5 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Version = ""
} else {
x.Version = string(r.DecodeString())
}
for {
yyj5++
if yyhl5 {
yyb5 = yyj5 > l
} else {
yyb5 = r.CheckBreak()
}
if yyb5 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj5-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
@ -1168,18 +997,15 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [6]bool
var yyq2 [3]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[0] = len(x.Conditions) != 0
yyq2[1] = len(x.Capacity) != 0
yyq2[2] = len(x.Allocatable) != 0
yyq2[3] = len(x.Zones) != 0
yyq2[4] = x.Region != ""
yyq2[5] = x.Version != ""
yyq2[1] = len(x.Zones) != 0
yyq2[2] = x.Region != ""
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(6)
r.EncodeArrayStart(3)
} else {
yynn2 = 0
for _, b := range yyq2 {
@ -1226,79 +1052,29 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[1] {
if x.Capacity == nil {
if x.Zones == nil {
r.EncodeNil()
} else {
yysf7 := &x.Capacity
yysf7.CodecEncodeSelf(e)
yym7 := z.EncBinary()
_ = yym7
if false {
} else {
z.F.EncSliceStringV(x.Zones, false, e)
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("capacity"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Capacity == nil {
r.EncodeNil()
} else {
yysf8 := &x.Capacity
yysf8.CodecEncodeSelf(e)
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] {
if x.Allocatable == nil {
r.EncodeNil()
} else {
yysf10 := &x.Allocatable
yysf10.CodecEncodeSelf(e)
}
} else {
r.EncodeNil()
}
} else {
if yyq2[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("allocatable"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Allocatable == nil {
r.EncodeNil()
} else {
yysf11 := &x.Allocatable
yysf11.CodecEncodeSelf(e)
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[3] {
if x.Zones == nil {
r.EncodeNil()
} else {
yym13 := z.EncBinary()
_ = yym13
if false {
} else {
z.F.EncSliceStringV(x.Zones, false, e)
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[3] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("zones"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Zones == nil {
r.EncodeNil()
} else {
yym14 := z.EncBinary()
_ = yym14
yym8 := z.EncBinary()
_ = yym8
if false {
} else {
z.F.EncSliceStringV(x.Zones, false, e)
@ -1308,9 +1084,9 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[4] {
yym16 := z.EncBinary()
_ = yym16
if yyq2[2] {
yym10 := z.EncBinary()
_ = yym10
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Region))
@ -1319,43 +1095,18 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[4] {
if yyq2[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("region"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym17 := z.EncBinary()
_ = yym17
yym11 := z.EncBinary()
_ = yym11
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Region))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[5] {
yym19 := z.EncBinary()
_ = yym19
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Version))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[5] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("version"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym20 := z.EncBinary()
_ = yym20
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Version))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
@ -1429,30 +1180,16 @@ func (x *ClusterStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
h.decSliceClusterCondition((*[]ClusterCondition)(yyv4), d)
}
}
case "capacity":
if r.TryDecodeAsNil() {
x.Capacity = nil
} else {
yyv6 := &x.Capacity
yyv6.CodecDecodeSelf(d)
}
case "allocatable":
if r.TryDecodeAsNil() {
x.Allocatable = nil
} else {
yyv7 := &x.Allocatable
yyv7.CodecDecodeSelf(d)
}
case "zones":
if r.TryDecodeAsNil() {
x.Zones = nil
} else {
yyv8 := &x.Zones
yym9 := z.DecBinary()
_ = yym9
yyv6 := &x.Zones
yym7 := z.DecBinary()
_ = yym7
if false {
} else {
z.F.DecSliceStringX(yyv8, false, d)
z.F.DecSliceStringX(yyv6, false, d)
}
}
case "region":
@ -1461,12 +1198,6 @@ func (x *ClusterStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
} else {
x.Region = string(r.DecodeString())
}
case "version":
if r.TryDecodeAsNil() {
x.Version = ""
} else {
x.Version = string(r.DecodeString())
}
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
@ -1478,16 +1209,16 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj12 int
var yyb12 bool
var yyhl12 bool = l >= 0
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
var yyj9 int
var yyb9 bool
var yyhl9 bool = l >= 0
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb12 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb12 {
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1495,55 +1226,21 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Conditions = nil
} else {
yyv13 := &x.Conditions
yym14 := z.DecBinary()
_ = yym14
yyv10 := &x.Conditions
yym11 := z.DecBinary()
_ = yym11
if false {
} else {
h.decSliceClusterCondition((*[]ClusterCondition)(yyv13), d)
h.decSliceClusterCondition((*[]ClusterCondition)(yyv10), d)
}
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb12 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Capacity = nil
} else {
yyv15 := &x.Capacity
yyv15.CodecDecodeSelf(d)
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb12 = r.CheckBreak()
}
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Allocatable = nil
} else {
yyv16 := &x.Allocatable
yyv16.CodecDecodeSelf(d)
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb12 = r.CheckBreak()
}
if yyb12 {
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1551,21 +1248,21 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Zones = nil
} else {
yyv17 := &x.Zones
yym18 := z.DecBinary()
_ = yym18
yyv12 := &x.Zones
yym13 := z.DecBinary()
_ = yym13
if false {
} else {
z.F.DecSliceStringX(yyv17, false, d)
z.F.DecSliceStringX(yyv12, false, d)
}
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb12 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb12 {
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1575,34 +1272,18 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} else {
x.Region = string(r.DecodeString())
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb12 = r.CheckBreak()
}
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Version = ""
} else {
x.Version = string(r.DecodeString())
}
for {
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb12 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb12 {
if yyb9 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj12-1, "")
z.DecStructFieldNotFound(yyj9-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
@ -2571,7 +2252,7 @@ func (x codecSelfer1234) decSliceCluster(v *[]Cluster, d *codec1978.Decoder) {
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 368)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 336)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]

View File

@ -71,21 +71,10 @@ type ClusterCondition struct {
Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
}
// Cluster metadata
type ClusterMeta struct {
// Release version of the cluster.
Version string `json:"version,omitempty" protobuf:"bytes,1,opt,name=version"`
}
// ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally.
type ClusterStatus struct {
// Conditions is an array of current cluster conditions.
Conditions []ClusterCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"`
// Capacity represents the total resources of the cluster
Capacity v1.ResourceList `json:"capacity,omitempty" protobuf:"bytes,2,rep,name=capacity,casttype=k8s.io/kubernetes/pkg/api/v1.ResourceList,castkey=k8s.io/kubernetes/pkg/api/v1.ResourceName"`
// Allocatable represents the total resources of a cluster that are available for scheduling.
Allocatable v1.ResourceList `json:"allocatable,omitempty" protobuf:"bytes,3,rep,name=allocatable,casttype=k8s.io/kubernetes/pkg/api/v1.ResourceList,castkey=k8s.io/kubernetes/pkg/api/v1.ResourceName"`
ClusterMeta `json:",inline" protobuf:"bytes,4,opt,name=clusterMeta"`
// Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
// These will always be in the same region.
Zones []string `json:"zones,omitempty" protobuf:"bytes,5,rep,name=zones"`

View File

@ -2116,22 +2116,6 @@ func describeCluster(cluster *federation.Cluster) (string, error) {
c.Message)
}
}
fmt.Fprintf(out, "Version:\t%s\n", cluster.Status.Version)
if len(cluster.Status.Capacity) > 0 {
fmt.Fprintf(out, "Capacity:\n")
for resource, value := range cluster.Status.Capacity {
fmt.Fprintf(out, " %s:\t%s\n", resource, value.String())
}
}
if len(cluster.Status.Allocatable) > 0 {
fmt.Fprintf(out, "Allocatable:\n")
for resource, value := range cluster.Status.Allocatable {
fmt.Fprintf(out, " %s:\t%s\n", resource, value.String())
}
}
return nil
})
}

View File

@ -568,7 +568,7 @@ func TestDescribeCluster(t *testing.T) {
if err != nil {
t.Errorf("unexpected error: %v", err)
}
if !strings.Contains(out, "foo") || !strings.Contains(out, "Version:") {
if !strings.Contains(out, "foo") {
t.Errorf("unexpected out: %s", out)
}
}

View File

@ -863,10 +863,9 @@ func printCluster(c *federation.Cluster, w io.Writer, options PrintOptions) erro
statuses = append(statuses, "Unknown")
}
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\n",
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\n",
c.Name,
strings.Join(statuses, ","),
c.Status.Version,
translateTimestamp(c.CreationTimestamp),
); err != nil {
return err