Update godeps

This commit is contained in:
Prashanth Balasubramanian 2016-06-21 11:58:43 -07:00
parent 423433bc5f
commit 701c5a0e30
482 changed files with 86915 additions and 19741 deletions

View file

@ -35,6 +35,7 @@ func init() {
DeepCopy_federation_ClusterMeta,
DeepCopy_federation_ClusterSpec,
DeepCopy_federation_ClusterStatus,
DeepCopy_federation_ServerAddressByClientCIDR,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
@ -100,16 +101,24 @@ func DeepCopy_federation_ClusterMeta(in ClusterMeta, out *ClusterMeta, c *conver
func DeepCopy_federation_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conversion.Cloner) error {
if in.ServerAddressByClientCIDRs != nil {
in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
*out = make([]unversioned.ServerAddressByClientCIDR, len(in))
*out = make([]ServerAddressByClientCIDR, len(in))
for i := range in {
if err := unversioned.DeepCopy_unversioned_ServerAddressByClientCIDR(in[i], &(*out)[i], c); err != nil {
if err := DeepCopy_federation_ServerAddressByClientCIDR(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.ServerAddressByClientCIDRs = nil
}
out.Credential = in.Credential
if in.SecretRef != nil {
in, out := in.SecretRef, &out.SecretRef
*out = new(api.LocalObjectReference)
if err := api.DeepCopy_api_LocalObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.SecretRef = nil
}
return nil
}
@ -154,5 +163,19 @@ func DeepCopy_federation_ClusterStatus(in ClusterStatus, out *ClusterStatus, c *
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))
copy(*out, in)
} else {
out.Zones = nil
}
out.Region = in.Region
return nil
}
func DeepCopy_federation_ServerAddressByClientCIDR(in ServerAddressByClientCIDR, out *ServerAddressByClientCIDR, c *conversion.Cloner) error {
out.ClientCIDR = in.ClientCIDR
out.ServerAddress = in.ServerAddress
return nil
}

View file

@ -1,5 +1,5 @@
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
Copyright 2016 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.
@ -25,13 +25,12 @@ import (
"errors"
"fmt"
codec1978 "github.com/ugorji/go/codec"
pkg2_api "k8s.io/kubernetes/pkg/api"
pkg1_api "k8s.io/kubernetes/pkg/api"
pkg3_resource "k8s.io/kubernetes/pkg/api/resource"
pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
pkg5_types "k8s.io/kubernetes/pkg/types"
pkg2_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
pkg4_types "k8s.io/kubernetes/pkg/types"
"reflect"
"runtime"
pkg4_inf "speter.net/go/exp/math/dec/inf"
time "time"
)
@ -65,16 +64,218 @@ func init() {
panic(err)
}
if false { // reference the types, but skip this branch at build/run time
var v0 pkg2_api.ConditionStatus
var v0 pkg1_api.LocalObjectReference
var v1 pkg3_resource.Quantity
var v2 pkg1_unversioned.ServerAddressByClientCIDR
var v3 pkg5_types.UID
var v4 pkg4_inf.Dec
var v5 time.Time
_, _, _, _, _, _ = v0, v1, v2, v3, v4, v5
var v2 pkg2_unversioned.Time
var v3 pkg4_types.UID
var v4 time.Time
_, _, _, _, _ = v0, v1, v2, v3, v4
}
}
func (x *ServerAddressByClientCIDR) 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
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(2)
} else {
yynn2 = 2
for _, b := range yyq2 {
if b {
yynn2++
}
}
r.EncodeMapStart(yynn2)
yynn2 = 0
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yym4 := z.EncBinary()
_ = yym4
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.ClientCIDR))
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("clientCIDR"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym5 := z.EncBinary()
_ = yym5
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.ClientCIDR))
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yym7 := z.EncBinary()
_ = yym7
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.ServerAddress))
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("serverAddress"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym8 := z.EncBinary()
_ = yym8
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.ServerAddress))
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
}
}
}
}
func (x *ServerAddressByClientCIDR) 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 *ServerAddressByClientCIDR) 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 "clientCIDR":
if r.TryDecodeAsNil() {
x.ClientCIDR = ""
} else {
x.ClientCIDR = string(r.DecodeString())
}
case "serverAddress":
if r.TryDecodeAsNil() {
x.ServerAddress = ""
} else {
x.ServerAddress = string(r.DecodeString())
}
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
} // end for yyj3
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ServerAddressByClientCIDR) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj6 int
var yyb6 bool
var yyhl6 bool = l >= 0
yyj6++
if yyhl6 {
yyb6 = yyj6 > l
} else {
yyb6 = r.CheckBreak()
}
if yyb6 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ClientCIDR = ""
} else {
x.ClientCIDR = string(r.DecodeString())
}
yyj6++
if yyhl6 {
yyb6 = yyj6 > l
} else {
yyb6 = r.CheckBreak()
}
if yyb6 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ServerAddress = ""
} else {
x.ServerAddress = string(r.DecodeString())
}
for {
yyj6++
if yyhl6 {
yyb6 = yyj6 > l
} else {
yyb6 = r.CheckBreak()
}
if yyb6 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj6-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ClusterSpec) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
@ -92,7 +293,7 @@ func (x *ClusterSpec) CodecEncodeSelf(e *codec1978.Encoder) {
var yyq2 [2]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[1] = x.Credential != ""
yyq2[1] = x.SecretRef != nil
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(2)
@ -115,7 +316,7 @@ func (x *ClusterSpec) CodecEncodeSelf(e *codec1978.Encoder) {
_ = yym4
if false {
} else {
h.encSliceunversioned_ServerAddressByClientCIDR(([]pkg1_unversioned.ServerAddressByClientCIDR)(x.ServerAddressByClientCIDRs), e)
h.encSliceServerAddressByClientCIDR(([]ServerAddressByClientCIDR)(x.ServerAddressByClientCIDRs), e)
}
}
} else {
@ -129,32 +330,30 @@ func (x *ClusterSpec) CodecEncodeSelf(e *codec1978.Encoder) {
_ = yym5
if false {
} else {
h.encSliceunversioned_ServerAddressByClientCIDR(([]pkg1_unversioned.ServerAddressByClientCIDR)(x.ServerAddressByClientCIDRs), e)
h.encSliceServerAddressByClientCIDR(([]ServerAddressByClientCIDR)(x.ServerAddressByClientCIDRs), e)
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[1] {
yym7 := z.EncBinary()
_ = yym7
if false {
if x.SecretRef == nil {
r.EncodeNil()
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Credential))
x.SecretRef.CodecEncodeSelf(e)
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
r.EncodeNil()
}
} else {
if yyq2[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("credential"))
r.EncodeString(codecSelferC_UTF81234, string("secretRef"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym8 := z.EncBinary()
_ = yym8
if false {
if x.SecretRef == nil {
r.EncodeNil()
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Credential))
x.SecretRef.CodecEncodeSelf(e)
}
}
}
@ -228,14 +427,19 @@ func (x *ClusterSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
_ = yym5
if false {
} else {
h.decSliceunversioned_ServerAddressByClientCIDR((*[]pkg1_unversioned.ServerAddressByClientCIDR)(yyv4), d)
h.decSliceServerAddressByClientCIDR((*[]ServerAddressByClientCIDR)(yyv4), d)
}
}
case "credential":
case "secretRef":
if r.TryDecodeAsNil() {
x.Credential = ""
if x.SecretRef != nil {
x.SecretRef = nil
}
} else {
x.Credential = string(r.DecodeString())
if x.SecretRef == nil {
x.SecretRef = new(pkg1_api.LocalObjectReference)
}
x.SecretRef.CodecDecodeSelf(d)
}
default:
z.DecStructFieldNotFound(-1, yys3)
@ -270,7 +474,7 @@ func (x *ClusterSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
_ = yym9
if false {
} else {
h.decSliceunversioned_ServerAddressByClientCIDR((*[]pkg1_unversioned.ServerAddressByClientCIDR)(yyv8), d)
h.decSliceServerAddressByClientCIDR((*[]ServerAddressByClientCIDR)(yyv8), d)
}
}
yyj7++
@ -285,9 +489,14 @@ func (x *ClusterSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Credential = ""
if x.SecretRef != nil {
x.SecretRef = nil
}
} else {
x.Credential = string(r.DecodeString())
if x.SecretRef == nil {
x.SecretRef = new(pkg1_api.LocalObjectReference)
}
x.SecretRef.CodecDecodeSelf(d)
}
for {
yyj7++
@ -580,11 +789,11 @@ func (x *ClusterCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Status = ""
} else {
x.Status = pkg2_api.ConditionStatus(r.DecodeString())
x.Status = pkg1_api.ConditionStatus(r.DecodeString())
}
case "lastProbeTime":
if r.TryDecodeAsNil() {
x.LastProbeTime = pkg1_unversioned.Time{}
x.LastProbeTime = pkg2_unversioned.Time{}
} else {
yyv6 := &x.LastProbeTime
yym7 := z.DecBinary()
@ -601,7 +810,7 @@ func (x *ClusterCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
}
case "lastTransitionTime":
if r.TryDecodeAsNil() {
x.LastTransitionTime = pkg1_unversioned.Time{}
x.LastTransitionTime = pkg2_unversioned.Time{}
} else {
yyv8 := &x.LastTransitionTime
yym9 := z.DecBinary()
@ -672,7 +881,7 @@ func (x *ClusterCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
if r.TryDecodeAsNil() {
x.Status = ""
} else {
x.Status = pkg2_api.ConditionStatus(r.DecodeString())
x.Status = pkg1_api.ConditionStatus(r.DecodeString())
}
yyj12++
if yyhl12 {
@ -686,7 +895,7 @@ func (x *ClusterCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.LastProbeTime = pkg1_unversioned.Time{}
x.LastProbeTime = pkg2_unversioned.Time{}
} else {
yyv15 := &x.LastProbeTime
yym16 := z.DecBinary()
@ -713,7 +922,7 @@ func (x *ClusterCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.LastTransitionTime = pkg1_unversioned.Time{}
x.LastTransitionTime = pkg2_unversioned.Time{}
} else {
yyv17 := &x.LastTransitionTime
yym18 := z.DecBinary()
@ -959,16 +1168,18 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [4]bool
var yyq2 [6]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] = x.Version != ""
yyq2[3] = len(x.Zones) != 0
yyq2[4] = x.Region != ""
yyq2[5] = x.Version != ""
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(4)
r.EncodeArrayStart(6)
} else {
yynn2 = 0
for _, b := range yyq2 {
@ -1065,8 +1276,66 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[3] {
yym13 := z.EncBinary()
_ = yym13
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
if false {
} else {
z.F.EncSliceStringV(x.Zones, false, e)
}
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[4] {
yym16 := z.EncBinary()
_ = yym16
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Region))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[4] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("region"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym17 := z.EncBinary()
_ = yym17
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))
@ -1075,12 +1344,12 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[3] {
if yyq2[5] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("version"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym14 := z.EncBinary()
_ = yym14
yym20 := z.EncBinary()
_ = yym20
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Version))
@ -1174,6 +1443,24 @@ func (x *ClusterStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
yyv7 := &x.Allocatable
yyv7.CodecDecodeSelf(d)
}
case "zones":
if r.TryDecodeAsNil() {
x.Zones = nil
} else {
yyv8 := &x.Zones
yym9 := z.DecBinary()
_ = yym9
if false {
} else {
z.F.DecSliceStringX(yyv8, false, d)
}
}
case "region":
if r.TryDecodeAsNil() {
x.Region = ""
} else {
x.Region = string(r.DecodeString())
}
case "version":
if r.TryDecodeAsNil() {
x.Version = ""
@ -1191,16 +1478,16 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj9 int
var yyb9 bool
var yyhl9 bool = l >= 0
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
var yyj12 int
var yyb12 bool
var yyhl12 bool = l >= 0
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb9 = r.CheckBreak()
yyb12 = r.CheckBreak()
}
if yyb9 {
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1208,21 +1495,21 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Conditions = nil
} else {
yyv10 := &x.Conditions
yym11 := z.DecBinary()
_ = yym11
yyv13 := &x.Conditions
yym14 := z.DecBinary()
_ = yym14
if false {
} else {
h.decSliceClusterCondition((*[]ClusterCondition)(yyv10), d)
h.decSliceClusterCondition((*[]ClusterCondition)(yyv13), d)
}
}
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb9 = r.CheckBreak()
yyb12 = r.CheckBreak()
}
if yyb9 {
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1230,16 +1517,16 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Capacity = nil
} else {
yyv12 := &x.Capacity
yyv12.CodecDecodeSelf(d)
yyv15 := &x.Capacity
yyv15.CodecDecodeSelf(d)
}
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb9 = r.CheckBreak()
yyb12 = r.CheckBreak()
}
if yyb9 {
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1247,16 +1534,54 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Allocatable = nil
} else {
yyv13 := &x.Allocatable
yyv13.CodecDecodeSelf(d)
yyv16 := &x.Allocatable
yyv16.CodecDecodeSelf(d)
}
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb9 = r.CheckBreak()
yyb12 = r.CheckBreak()
}
if yyb9 {
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Zones = nil
} else {
yyv17 := &x.Zones
yym18 := z.DecBinary()
_ = yym18
if false {
} else {
z.F.DecSliceStringX(yyv17, false, 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.Region = ""
} else {
x.Region = string(r.DecodeString())
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb12 = r.CheckBreak()
}
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1267,17 +1592,17 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
x.Version = string(r.DecodeString())
}
for {
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb9 = r.CheckBreak()
yyb12 = r.CheckBreak()
}
if yyb9 {
if yyb12 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj9-1, "")
z.DecStructFieldNotFound(yyj12-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
@ -1481,7 +1806,7 @@ func (x *Cluster) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
switch yys3 {
case "metadata":
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_api.ObjectMeta{}
x.ObjectMeta = pkg1_api.ObjectMeta{}
} else {
yyv4 := &x.ObjectMeta
yyv4.CodecDecodeSelf(d)
@ -1538,7 +1863,7 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_api.ObjectMeta{}
x.ObjectMeta = pkg1_api.ObjectMeta{}
} else {
yyv10 := &x.ObjectMeta
yyv10.CodecDecodeSelf(d)
@ -1827,7 +2152,7 @@ func (x *ClusterList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
switch yys3 {
case "metadata":
if r.TryDecodeAsNil() {
x.ListMeta = pkg1_unversioned.ListMeta{}
x.ListMeta = pkg2_unversioned.ListMeta{}
} else {
yyv4 := &x.ListMeta
yym5 := z.DecBinary()
@ -1888,7 +2213,7 @@ func (x *ClusterList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ListMeta = pkg1_unversioned.ListMeta{}
x.ListMeta = pkg2_unversioned.ListMeta{}
} else {
yyv11 := &x.ListMeta
yym12 := z.DecBinary()
@ -1969,7 +2294,7 @@ func (x *ClusterList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) encSliceunversioned_ServerAddressByClientCIDR(v []pkg1_unversioned.ServerAddressByClientCIDR, e *codec1978.Encoder) {
func (x codecSelfer1234) encSliceServerAddressByClientCIDR(v []ServerAddressByClientCIDR, e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -1977,18 +2302,12 @@ func (x codecSelfer1234) encSliceunversioned_ServerAddressByClientCIDR(v []pkg1_
for _, yyv1 := range v {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yy2 := &yyv1
yym3 := z.EncBinary()
_ = yym3
if false {
} else if z.HasExtensions() && z.EncExt(yy2) {
} else {
z.EncFallback(yy2)
}
yy2.CodecEncodeSelf(e)
}
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1_unversioned.ServerAddressByClientCIDR, d *codec1978.Decoder) {
func (x codecSelfer1234) decSliceServerAddressByClientCIDR(v *[]ServerAddressByClientCIDR, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -1999,7 +2318,7 @@ func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1
_ = yyc1
if yyl1 == 0 {
if yyv1 == nil {
yyv1 = []pkg1_unversioned.ServerAddressByClientCIDR{}
yyv1 = []ServerAddressByClientCIDR{}
yyc1 = true
} else if len(yyv1) != 0 {
yyv1 = yyv1[:0]
@ -2019,10 +2338,10 @@ func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
} else {
yyv1 = make([]pkg1_unversioned.ServerAddressByClientCIDR, yyrl1)
yyv1 = make([]ServerAddressByClientCIDR, yyrl1)
}
} else {
yyv1 = make([]pkg1_unversioned.ServerAddressByClientCIDR, yyrl1)
yyv1 = make([]ServerAddressByClientCIDR, yyrl1)
}
yyc1 = true
yyrr1 = len(yyv1)
@ -2037,34 +2356,22 @@ func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1
for ; yyj1 < yyrr1; yyj1++ {
yyh1.ElemContainerState(yyj1)
if r.TryDecodeAsNil() {
yyv1[yyj1] = pkg1_unversioned.ServerAddressByClientCIDR{}
yyv1[yyj1] = ServerAddressByClientCIDR{}
} else {
yyv2 := &yyv1[yyj1]
yym3 := z.DecBinary()
_ = yym3
if false {
} else if z.HasExtensions() && z.DecExt(yyv2) {
} else {
z.DecFallback(yyv2, false)
}
yyv2.CodecDecodeSelf(d)
}
}
if yyrt1 {
for ; yyj1 < yyl1; yyj1++ {
yyv1 = append(yyv1, pkg1_unversioned.ServerAddressByClientCIDR{})
yyv1 = append(yyv1, ServerAddressByClientCIDR{})
yyh1.ElemContainerState(yyj1)
if r.TryDecodeAsNil() {
yyv1[yyj1] = pkg1_unversioned.ServerAddressByClientCIDR{}
yyv1[yyj1] = ServerAddressByClientCIDR{}
} else {
yyv4 := &yyv1[yyj1]
yym5 := z.DecBinary()
_ = yym5
if false {
} else if z.HasExtensions() && z.DecExt(yyv4) {
} else {
z.DecFallback(yyv4, false)
}
yyv3 := &yyv1[yyj1]
yyv3.CodecDecodeSelf(d)
}
}
@ -2075,22 +2382,16 @@ func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1
for ; !r.CheckBreak(); yyj1++ {
if yyj1 >= len(yyv1) {
yyv1 = append(yyv1, pkg1_unversioned.ServerAddressByClientCIDR{}) // var yyz1 pkg1_unversioned.ServerAddressByClientCIDR
yyv1 = append(yyv1, ServerAddressByClientCIDR{}) // var yyz1 ServerAddressByClientCIDR
yyc1 = true
}
yyh1.ElemContainerState(yyj1)
if yyj1 < len(yyv1) {
if r.TryDecodeAsNil() {
yyv1[yyj1] = pkg1_unversioned.ServerAddressByClientCIDR{}
yyv1[yyj1] = ServerAddressByClientCIDR{}
} else {
yyv6 := &yyv1[yyj1]
yym7 := z.DecBinary()
_ = yym7
if false {
} else if z.HasExtensions() && z.DecExt(yyv6) {
} else {
z.DecFallback(yyv6, false)
}
yyv4 := &yyv1[yyj1]
yyv4.CodecDecodeSelf(d)
}
} else {
@ -2102,7 +2403,7 @@ func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1
yyv1 = yyv1[:yyj1]
yyc1 = true
} else if yyj1 == 0 && yyv1 == nil {
yyv1 = []pkg1_unversioned.ServerAddressByClientCIDR{}
yyv1 = []ServerAddressByClientCIDR{}
yyc1 = true
}
}
@ -2270,7 +2571,7 @@ func (x codecSelfer1234) decSliceCluster(v *[]Cluster, d *codec1978.Decoder) {
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 336)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 368)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]

View file

@ -21,17 +21,28 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
)
// ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.
type ServerAddressByClientCIDR struct {
// The CIDR with which clients can match their IP to figure out the server address that they should use.
ClientCIDR string `json:"clientCIDR" protobuf:"bytes,1,opt,name=clientCIDR"`
// Address of this server, suitable for a client that matches the above CIDR.
// This can be a hostname, hostname:port, IP or IP:port.
ServerAddress string `json:"serverAddress" protobuf:"bytes,2,opt,name=serverAddress"`
}
// ClusterSpec describes the attributes of a kubernetes cluster.
type ClusterSpec struct {
// A map of client CIDR to server address.
// This is to help clients reach servers in the most network-efficient way possible.
// Clients can use the appropriate server address as per the CIDR that they match.
// In case of multiple matches, clients should use the longest matching CIDR.
ServerAddressByClientCIDRs []unversioned.ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs" patchStrategy:"merge" patchMergeKey:"clientCIDR"`
// the type (e.g. bearer token, client certificate etc) and data of the credential used to access cluster.
// Its used for system routines (not behalf of users)
// TODO: string may not enough, https://github.com/kubernetes/kubernetes/pull/23847#discussion_r59301275
Credential string `json:"credential,omitempty"`
ServerAddressByClientCIDRs []ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs" patchStrategy:"merge" patchMergeKey:"clientCIDR"`
// Name of the secret containing kubeconfig to access this cluster.
// The secret is read from the kubernetes cluster that is hosting federation control plane.
// Admin needs to ensure that the required secret exists. Secret should be in the same namespace where federation control plane is hosted and it should have kubeconfig in its data with key "kubeconfig".
// This will later be changed to a reference to secret in federation control plane when the federation control plane supports secrets.
// This can be left empty if the cluster allows insecure access.
SecretRef *api.LocalObjectReference `json:"secretRef,omitempty"`
}
type ClusterConditionType string
@ -75,6 +86,11 @@ type ClusterStatus struct {
// 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"`
// Region is the name of the region in which all of the nodes in the cluster exist. e.g. 'us-east1'.
Region string `json:"region,omitempty"`
}
// +genclient=true,nonNamespaced=true

View file

@ -24,7 +24,6 @@ import (
federation "k8s.io/kubernetes/federation/apis/federation"
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"
)
@ -43,6 +42,8 @@ func init() {
Convert_federation_ClusterSpec_To_v1alpha1_ClusterSpec,
Convert_v1alpha1_ClusterStatus_To_federation_ClusterStatus,
Convert_federation_ClusterStatus_To_v1alpha1_ClusterStatus,
Convert_v1alpha1_ServerAddressByClientCIDR_To_federation_ServerAddressByClientCIDR,
Convert_federation_ServerAddressByClientCIDR_To_v1alpha1_ServerAddressByClientCIDR,
); err != nil {
// if one of the conversion functions is malformed, detect it immediately.
panic(err)
@ -198,17 +199,25 @@ func Convert_federation_ClusterMeta_To_v1alpha1_ClusterMeta(in *federation.Clust
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
*out = make([]unversioned.ServerAddressByClientCIDR, len(*in))
*out = make([]federation.ServerAddressByClientCIDR, len(*in))
for i := range *in {
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&(*in)[i], &(*out)[i], 0); err != nil {
if err := Convert_v1alpha1_ServerAddressByClientCIDR_To_federation_ServerAddressByClientCIDR(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.ServerAddressByClientCIDRs = nil
}
out.Credential = in.Credential
if in.SecretRef != nil {
in, out := &in.SecretRef, &out.SecretRef
*out = new(api.LocalObjectReference)
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(*in, *out, 0); err != nil {
return err
}
} else {
out.SecretRef = nil
}
return nil
}
@ -219,17 +228,25 @@ func Convert_v1alpha1_ClusterSpec_To_federation_ClusterSpec(in *ClusterSpec, out
func autoConvert_federation_ClusterSpec_To_v1alpha1_ClusterSpec(in *federation.ClusterSpec, out *ClusterSpec, s conversion.Scope) error {
if in.ServerAddressByClientCIDRs != nil {
in, out := &in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
*out = make([]unversioned.ServerAddressByClientCIDR, len(*in))
*out = make([]ServerAddressByClientCIDR, len(*in))
for i := range *in {
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&(*in)[i], &(*out)[i], 0); err != nil {
if err := Convert_federation_ServerAddressByClientCIDR_To_v1alpha1_ServerAddressByClientCIDR(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.ServerAddressByClientCIDRs = nil
}
out.Credential = in.Credential
if in.SecretRef != nil {
in, out := &in.SecretRef, &out.SecretRef
*out = new(v1.LocalObjectReference)
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(*in, *out, 0); err != nil {
return err
}
} else {
out.SecretRef = nil
}
return nil
}
@ -258,6 +275,8 @@ func autoConvert_v1alpha1_ClusterStatus_To_federation_ClusterStatus(in *ClusterS
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
}
@ -306,9 +325,31 @@ func autoConvert_federation_ClusterStatus_To_v1alpha1_ClusterStatus(in *federati
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
}
func Convert_federation_ClusterStatus_To_v1alpha1_ClusterStatus(in *federation.ClusterStatus, out *ClusterStatus, s conversion.Scope) error {
return autoConvert_federation_ClusterStatus_To_v1alpha1_ClusterStatus(in, out, s)
}
func autoConvert_v1alpha1_ServerAddressByClientCIDR_To_federation_ServerAddressByClientCIDR(in *ServerAddressByClientCIDR, out *federation.ServerAddressByClientCIDR, s conversion.Scope) error {
out.ClientCIDR = in.ClientCIDR
out.ServerAddress = in.ServerAddress
return nil
}
func Convert_v1alpha1_ServerAddressByClientCIDR_To_federation_ServerAddressByClientCIDR(in *ServerAddressByClientCIDR, out *federation.ServerAddressByClientCIDR, s conversion.Scope) error {
return autoConvert_v1alpha1_ServerAddressByClientCIDR_To_federation_ServerAddressByClientCIDR(in, out, s)
}
func autoConvert_federation_ServerAddressByClientCIDR_To_v1alpha1_ServerAddressByClientCIDR(in *federation.ServerAddressByClientCIDR, out *ServerAddressByClientCIDR, s conversion.Scope) error {
out.ClientCIDR = in.ClientCIDR
out.ServerAddress = in.ServerAddress
return nil
}
func Convert_federation_ServerAddressByClientCIDR_To_v1alpha1_ServerAddressByClientCIDR(in *federation.ServerAddressByClientCIDR, out *ServerAddressByClientCIDR, s conversion.Scope) error {
return autoConvert_federation_ServerAddressByClientCIDR_To_v1alpha1_ServerAddressByClientCIDR(in, out, s)
}

View file

@ -36,6 +36,7 @@ func init() {
DeepCopy_v1alpha1_ClusterMeta,
DeepCopy_v1alpha1_ClusterSpec,
DeepCopy_v1alpha1_ClusterStatus,
DeepCopy_v1alpha1_ServerAddressByClientCIDR,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
@ -101,16 +102,24 @@ func DeepCopy_v1alpha1_ClusterMeta(in ClusterMeta, out *ClusterMeta, c *conversi
func DeepCopy_v1alpha1_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conversion.Cloner) error {
if in.ServerAddressByClientCIDRs != nil {
in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
*out = make([]unversioned.ServerAddressByClientCIDR, len(in))
*out = make([]ServerAddressByClientCIDR, len(in))
for i := range in {
if err := unversioned.DeepCopy_unversioned_ServerAddressByClientCIDR(in[i], &(*out)[i], c); err != nil {
if err := DeepCopy_v1alpha1_ServerAddressByClientCIDR(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.ServerAddressByClientCIDRs = nil
}
out.Credential = in.Credential
if in.SecretRef != nil {
in, out := in.SecretRef, &out.SecretRef
*out = new(v1.LocalObjectReference)
if err := v1.DeepCopy_v1_LocalObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.SecretRef = nil
}
return nil
}
@ -155,5 +164,19 @@ func DeepCopy_v1alpha1_ClusterStatus(in ClusterStatus, out *ClusterStatus, c *co
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))
copy(*out, in)
} else {
out.Zones = nil
}
out.Region = in.Region
return nil
}
func DeepCopy_v1alpha1_ServerAddressByClientCIDR(in ServerAddressByClientCIDR, out *ServerAddressByClientCIDR, c *conversion.Cloner) error {
out.ClientCIDR = in.ClientCIDR
out.ServerAddress = in.ServerAddress
return nil
}

View file

@ -31,6 +31,7 @@ limitations under the License.
ClusterMeta
ClusterSpec
ClusterStatus
ServerAddressByClientCIDR
*/
package v1alpha1
@ -39,7 +40,7 @@ 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_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
import k8s_io_kubernetes_pkg_api_v1 "k8s.io/kubernetes/pkg/api/v1"
import io "io"
@ -73,6 +74,10 @@ func (m *ClusterStatus) Reset() { *m = ClusterStatus{} }
func (m *ClusterStatus) String() string { return proto.CompactTextString(m) }
func (*ClusterStatus) ProtoMessage() {}
func (m *ServerAddressByClientCIDR) Reset() { *m = ServerAddressByClientCIDR{} }
func (m *ServerAddressByClientCIDR) String() string { return proto.CompactTextString(m) }
func (*ServerAddressByClientCIDR) ProtoMessage() {}
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")
@ -80,6 +85,7 @@ func init() {
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")
}
func (m *Cluster) Marshal() (data []byte, err error) {
size := m.Size()
@ -260,10 +266,16 @@ func (m *ClusterSpec) MarshalTo(data []byte) (int, error) {
i += n
}
}
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64(len(m.Credential)))
i += copy(data[i:], m.Credential)
if m.SecretRef != nil {
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64(m.SecretRef.Size()))
n7, err := m.SecretRef.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n7
}
return i, nil
}
@ -309,11 +321,11 @@ func (m *ClusterStatus) MarshalTo(data []byte) (int, error) {
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64((&v).Size()))
n7, err := (&v).MarshalTo(data[i:])
n8, err := (&v).MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n7
i += n8
}
}
if len(m.Allocatable) > 0 {
@ -331,21 +343,66 @@ func (m *ClusterStatus) MarshalTo(data []byte) (int, error) {
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64((&v).Size()))
n8, err := (&v).MarshalTo(data[i:])
n9, err := (&v).MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n8
i += n9
}
}
data[i] = 0x22
i++
i = encodeVarintGenerated(data, i, uint64(m.ClusterMeta.Size()))
n9, err := m.ClusterMeta.MarshalTo(data[i:])
n10, err := m.ClusterMeta.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n9
i += n10
if len(m.Zones) > 0 {
for _, s := range m.Zones {
data[i] = 0x2a
i++
l = len(s)
for l >= 1<<7 {
data[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
data[i] = uint8(l)
i++
i += copy(data[i:], s)
}
}
data[i] = 0x32
i++
i = encodeVarintGenerated(data, i, uint64(len(m.Region)))
i += copy(data[i:], m.Region)
return i, nil
}
func (m *ServerAddressByClientCIDR) 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 *ServerAddressByClientCIDR) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
_ = l
data[i] = 0xa
i++
i = encodeVarintGenerated(data, i, uint64(len(m.ClientCIDR)))
i += copy(data[i:], m.ClientCIDR)
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64(len(m.ServerAddress)))
i += copy(data[i:], m.ServerAddress)
return i, nil
}
@ -437,8 +494,10 @@ func (m *ClusterSpec) Size() (n int) {
n += 1 + l + sovGenerated(uint64(l))
}
}
l = len(m.Credential)
n += 1 + l + sovGenerated(uint64(l))
if m.SecretRef != nil {
l = m.SecretRef.Size()
n += 1 + l + sovGenerated(uint64(l))
}
return n
}
@ -471,6 +530,24 @@ func (m *ClusterStatus) Size() (n int) {
}
l = m.ClusterMeta.Size()
n += 1 + l + sovGenerated(uint64(l))
if len(m.Zones) > 0 {
for _, s := range m.Zones {
l = len(s)
n += 1 + l + sovGenerated(uint64(l))
}
}
l = len(m.Region)
n += 1 + l + sovGenerated(uint64(l))
return n
}
func (m *ServerAddressByClientCIDR) Size() (n int) {
var l int
_ = l
l = len(m.ClientCIDR)
n += 1 + l + sovGenerated(uint64(l))
l = len(m.ServerAddress)
n += 1 + l + sovGenerated(uint64(l))
return n
}
@ -1098,16 +1175,16 @@ func (m *ClusterSpec) Unmarshal(data []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ServerAddressByClientCIDRs = append(m.ServerAddressByClientCIDRs, k8s_io_kubernetes_pkg_api_unversioned.ServerAddressByClientCIDR{})
m.ServerAddressByClientCIDRs = append(m.ServerAddressByClientCIDRs, ServerAddressByClientCIDR{})
if err := m.ServerAddressByClientCIDRs[len(m.ServerAddressByClientCIDRs)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Credential", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field SecretRef", wireType)
}
var stringLen uint64
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
@ -1117,20 +1194,24 @@ func (m *ClusterSpec) Unmarshal(data []byte) error {
}
b := data[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + intStringLen
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Credential = string(data[iNdEx:postIndex])
if m.SecretRef == nil {
m.SecretRef = &k8s_io_kubernetes_pkg_api_v1.LocalObjectReference{}
}
if err := m.SecretRef.Unmarshal(data[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
@ -1475,6 +1556,172 @@ func (m *ClusterStatus) Unmarshal(data []byte) error {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Zones", 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.Zones = append(m.Zones, string(data[iNdEx:postIndex]))
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Region", 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.Region = 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 *ServerAddressByClientCIDR) 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: ServerAddressByClientCIDR: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ServerAddressByClientCIDR: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ClientCIDR", 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.ClientCIDR = string(data[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ServerAddress", 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.ServerAddress = string(data[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(data[iNdEx:])

View file

@ -85,12 +85,14 @@ message ClusterSpec {
// This is to help clients reach servers in the most network-efficient way possible.
// Clients can use the appropriate server address as per the CIDR that they match.
// In case of multiple matches, clients should use the longest matching CIDR.
repeated k8s.io.kubernetes.pkg.api.unversioned.ServerAddressByClientCIDR serverAddressByClientCIDRs = 1;
repeated ServerAddressByClientCIDR serverAddressByClientCIDRs = 1;
// the type (e.g. bearer token, client certificate etc) and data of the credential used to access cluster.
// Its used for system routines (not behalf of users)
// TODO: string may not enough, https://github.com/kubernetes/kubernetes/pull/23847#discussion_r59301275
optional string credential = 2;
// Name of the secret containing kubeconfig to access this cluster.
// The secret is read from the kubernetes cluster that is hosting federation control plane.
// Admin needs to ensure that the required secret exists. Secret should be in the same namespace where federation control plane is hosted and it should have kubeconfig in its data with key "kubeconfig".
// This will later be changed to a reference to secret in federation control plane when the federation control plane supports secrets.
// This can be left empty if the cluster allows insecure access.
optional k8s.io.kubernetes.pkg.api.v1.LocalObjectReference secretRef = 2;
}
// ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally.
@ -105,5 +107,22 @@ message ClusterStatus {
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;
// Region is the name of the region in which all of the nodes in the cluster exist. e.g. 'us-east1'.
optional string region = 6;
}
// ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.
message ServerAddressByClientCIDR {
// The CIDR with which clients can match their IP to figure out the server address that they should use.
optional string clientCIDR = 1;
// Address of this server, suitable for a client that matches the above CIDR.
// This can be a hostname, hostname:port, IP or IP:port.
optional string serverAddress = 2;
}

View file

@ -1,5 +1,5 @@
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
Copyright 2016 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.
@ -26,12 +26,11 @@ import (
"fmt"
codec1978 "github.com/ugorji/go/codec"
pkg3_resource "k8s.io/kubernetes/pkg/api/resource"
pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
pkg2_v1 "k8s.io/kubernetes/pkg/api/v1"
pkg5_types "k8s.io/kubernetes/pkg/types"
pkg2_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
pkg1_v1 "k8s.io/kubernetes/pkg/api/v1"
pkg4_types "k8s.io/kubernetes/pkg/types"
"reflect"
"runtime"
pkg4_inf "speter.net/go/exp/math/dec/inf"
time "time"
)
@ -66,15 +65,217 @@ func init() {
}
if false { // reference the types, but skip this branch at build/run time
var v0 pkg3_resource.Quantity
var v1 pkg1_unversioned.ServerAddressByClientCIDR
var v2 pkg2_v1.ConditionStatus
var v3 pkg5_types.UID
var v4 pkg4_inf.Dec
var v5 time.Time
_, _, _, _, _, _ = v0, v1, v2, v3, v4, v5
var v1 pkg2_unversioned.Time
var v2 pkg1_v1.LocalObjectReference
var v3 pkg4_types.UID
var v4 time.Time
_, _, _, _, _ = v0, v1, v2, v3, v4
}
}
func (x *ServerAddressByClientCIDR) 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
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(2)
} else {
yynn2 = 2
for _, b := range yyq2 {
if b {
yynn2++
}
}
r.EncodeMapStart(yynn2)
yynn2 = 0
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yym4 := z.EncBinary()
_ = yym4
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.ClientCIDR))
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("clientCIDR"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym5 := z.EncBinary()
_ = yym5
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.ClientCIDR))
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yym7 := z.EncBinary()
_ = yym7
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.ServerAddress))
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("serverAddress"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym8 := z.EncBinary()
_ = yym8
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.ServerAddress))
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
}
}
}
}
func (x *ServerAddressByClientCIDR) 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 *ServerAddressByClientCIDR) 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 "clientCIDR":
if r.TryDecodeAsNil() {
x.ClientCIDR = ""
} else {
x.ClientCIDR = string(r.DecodeString())
}
case "serverAddress":
if r.TryDecodeAsNil() {
x.ServerAddress = ""
} else {
x.ServerAddress = string(r.DecodeString())
}
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
} // end for yyj3
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ServerAddressByClientCIDR) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj6 int
var yyb6 bool
var yyhl6 bool = l >= 0
yyj6++
if yyhl6 {
yyb6 = yyj6 > l
} else {
yyb6 = r.CheckBreak()
}
if yyb6 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ClientCIDR = ""
} else {
x.ClientCIDR = string(r.DecodeString())
}
yyj6++
if yyhl6 {
yyb6 = yyj6 > l
} else {
yyb6 = r.CheckBreak()
}
if yyb6 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ServerAddress = ""
} else {
x.ServerAddress = string(r.DecodeString())
}
for {
yyj6++
if yyhl6 {
yyb6 = yyj6 > l
} else {
yyb6 = r.CheckBreak()
}
if yyb6 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj6-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ClusterSpec) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
@ -92,7 +293,7 @@ func (x *ClusterSpec) CodecEncodeSelf(e *codec1978.Encoder) {
var yyq2 [2]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[1] = x.Credential != ""
yyq2[1] = x.SecretRef != nil
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(2)
@ -115,7 +316,7 @@ func (x *ClusterSpec) CodecEncodeSelf(e *codec1978.Encoder) {
_ = yym4
if false {
} else {
h.encSliceunversioned_ServerAddressByClientCIDR(([]pkg1_unversioned.ServerAddressByClientCIDR)(x.ServerAddressByClientCIDRs), e)
h.encSliceServerAddressByClientCIDR(([]ServerAddressByClientCIDR)(x.ServerAddressByClientCIDRs), e)
}
}
} else {
@ -129,32 +330,30 @@ func (x *ClusterSpec) CodecEncodeSelf(e *codec1978.Encoder) {
_ = yym5
if false {
} else {
h.encSliceunversioned_ServerAddressByClientCIDR(([]pkg1_unversioned.ServerAddressByClientCIDR)(x.ServerAddressByClientCIDRs), e)
h.encSliceServerAddressByClientCIDR(([]ServerAddressByClientCIDR)(x.ServerAddressByClientCIDRs), e)
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[1] {
yym7 := z.EncBinary()
_ = yym7
if false {
if x.SecretRef == nil {
r.EncodeNil()
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Credential))
x.SecretRef.CodecEncodeSelf(e)
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
r.EncodeNil()
}
} else {
if yyq2[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("credential"))
r.EncodeString(codecSelferC_UTF81234, string("secretRef"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym8 := z.EncBinary()
_ = yym8
if false {
if x.SecretRef == nil {
r.EncodeNil()
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Credential))
x.SecretRef.CodecEncodeSelf(e)
}
}
}
@ -228,14 +427,19 @@ func (x *ClusterSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
_ = yym5
if false {
} else {
h.decSliceunversioned_ServerAddressByClientCIDR((*[]pkg1_unversioned.ServerAddressByClientCIDR)(yyv4), d)
h.decSliceServerAddressByClientCIDR((*[]ServerAddressByClientCIDR)(yyv4), d)
}
}
case "credential":
case "secretRef":
if r.TryDecodeAsNil() {
x.Credential = ""
if x.SecretRef != nil {
x.SecretRef = nil
}
} else {
x.Credential = string(r.DecodeString())
if x.SecretRef == nil {
x.SecretRef = new(pkg1_v1.LocalObjectReference)
}
x.SecretRef.CodecDecodeSelf(d)
}
default:
z.DecStructFieldNotFound(-1, yys3)
@ -270,7 +474,7 @@ func (x *ClusterSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
_ = yym9
if false {
} else {
h.decSliceunversioned_ServerAddressByClientCIDR((*[]pkg1_unversioned.ServerAddressByClientCIDR)(yyv8), d)
h.decSliceServerAddressByClientCIDR((*[]ServerAddressByClientCIDR)(yyv8), d)
}
}
yyj7++
@ -285,9 +489,14 @@ func (x *ClusterSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Credential = ""
if x.SecretRef != nil {
x.SecretRef = nil
}
} else {
x.Credential = string(r.DecodeString())
if x.SecretRef == nil {
x.SecretRef = new(pkg1_v1.LocalObjectReference)
}
x.SecretRef.CodecDecodeSelf(d)
}
for {
yyj7++
@ -580,11 +789,11 @@ func (x *ClusterCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Status = ""
} else {
x.Status = pkg2_v1.ConditionStatus(r.DecodeString())
x.Status = pkg1_v1.ConditionStatus(r.DecodeString())
}
case "lastProbeTime":
if r.TryDecodeAsNil() {
x.LastProbeTime = pkg1_unversioned.Time{}
x.LastProbeTime = pkg2_unversioned.Time{}
} else {
yyv6 := &x.LastProbeTime
yym7 := z.DecBinary()
@ -601,7 +810,7 @@ func (x *ClusterCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
}
case "lastTransitionTime":
if r.TryDecodeAsNil() {
x.LastTransitionTime = pkg1_unversioned.Time{}
x.LastTransitionTime = pkg2_unversioned.Time{}
} else {
yyv8 := &x.LastTransitionTime
yym9 := z.DecBinary()
@ -672,7 +881,7 @@ func (x *ClusterCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
if r.TryDecodeAsNil() {
x.Status = ""
} else {
x.Status = pkg2_v1.ConditionStatus(r.DecodeString())
x.Status = pkg1_v1.ConditionStatus(r.DecodeString())
}
yyj12++
if yyhl12 {
@ -686,7 +895,7 @@ func (x *ClusterCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.LastProbeTime = pkg1_unversioned.Time{}
x.LastProbeTime = pkg2_unversioned.Time{}
} else {
yyv15 := &x.LastProbeTime
yym16 := z.DecBinary()
@ -713,7 +922,7 @@ func (x *ClusterCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.LastTransitionTime = pkg1_unversioned.Time{}
x.LastTransitionTime = pkg2_unversioned.Time{}
} else {
yyv17 := &x.LastTransitionTime
yym18 := z.DecBinary()
@ -959,16 +1168,18 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [4]bool
var yyq2 [6]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] = x.Version != ""
yyq2[3] = len(x.Zones) != 0
yyq2[4] = x.Region != ""
yyq2[5] = x.Version != ""
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(4)
r.EncodeArrayStart(6)
} else {
yynn2 = 0
for _, b := range yyq2 {
@ -1065,8 +1276,66 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[3] {
yym13 := z.EncBinary()
_ = yym13
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
if false {
} else {
z.F.EncSliceStringV(x.Zones, false, e)
}
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[4] {
yym16 := z.EncBinary()
_ = yym16
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Region))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[4] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("region"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym17 := z.EncBinary()
_ = yym17
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))
@ -1075,12 +1344,12 @@ func (x *ClusterStatus) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[3] {
if yyq2[5] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("version"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym14 := z.EncBinary()
_ = yym14
yym20 := z.EncBinary()
_ = yym20
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Version))
@ -1174,6 +1443,24 @@ func (x *ClusterStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
yyv7 := &x.Allocatable
yyv7.CodecDecodeSelf(d)
}
case "zones":
if r.TryDecodeAsNil() {
x.Zones = nil
} else {
yyv8 := &x.Zones
yym9 := z.DecBinary()
_ = yym9
if false {
} else {
z.F.DecSliceStringX(yyv8, false, d)
}
}
case "region":
if r.TryDecodeAsNil() {
x.Region = ""
} else {
x.Region = string(r.DecodeString())
}
case "version":
if r.TryDecodeAsNil() {
x.Version = ""
@ -1191,16 +1478,16 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj9 int
var yyb9 bool
var yyhl9 bool = l >= 0
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
var yyj12 int
var yyb12 bool
var yyhl12 bool = l >= 0
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb9 = r.CheckBreak()
yyb12 = r.CheckBreak()
}
if yyb9 {
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1208,21 +1495,21 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Conditions = nil
} else {
yyv10 := &x.Conditions
yym11 := z.DecBinary()
_ = yym11
yyv13 := &x.Conditions
yym14 := z.DecBinary()
_ = yym14
if false {
} else {
h.decSliceClusterCondition((*[]ClusterCondition)(yyv10), d)
h.decSliceClusterCondition((*[]ClusterCondition)(yyv13), d)
}
}
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb9 = r.CheckBreak()
yyb12 = r.CheckBreak()
}
if yyb9 {
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1230,16 +1517,16 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Capacity = nil
} else {
yyv12 := &x.Capacity
yyv12.CodecDecodeSelf(d)
yyv15 := &x.Capacity
yyv15.CodecDecodeSelf(d)
}
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb9 = r.CheckBreak()
yyb12 = r.CheckBreak()
}
if yyb9 {
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1247,16 +1534,54 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Allocatable = nil
} else {
yyv13 := &x.Allocatable
yyv13.CodecDecodeSelf(d)
yyv16 := &x.Allocatable
yyv16.CodecDecodeSelf(d)
}
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb9 = r.CheckBreak()
yyb12 = r.CheckBreak()
}
if yyb9 {
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Zones = nil
} else {
yyv17 := &x.Zones
yym18 := z.DecBinary()
_ = yym18
if false {
} else {
z.F.DecSliceStringX(yyv17, false, 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.Region = ""
} else {
x.Region = string(r.DecodeString())
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb12 = r.CheckBreak()
}
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@ -1267,17 +1592,17 @@ func (x *ClusterStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
x.Version = string(r.DecodeString())
}
for {
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb9 = r.CheckBreak()
yyb12 = r.CheckBreak()
}
if yyb9 {
if yyb12 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj9-1, "")
z.DecStructFieldNotFound(yyj12-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
@ -1481,7 +1806,7 @@ func (x *Cluster) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
switch yys3 {
case "metadata":
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_v1.ObjectMeta{}
x.ObjectMeta = pkg1_v1.ObjectMeta{}
} else {
yyv4 := &x.ObjectMeta
yyv4.CodecDecodeSelf(d)
@ -1538,7 +1863,7 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_v1.ObjectMeta{}
x.ObjectMeta = pkg1_v1.ObjectMeta{}
} else {
yyv10 := &x.ObjectMeta
yyv10.CodecDecodeSelf(d)
@ -1827,7 +2152,7 @@ func (x *ClusterList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
switch yys3 {
case "metadata":
if r.TryDecodeAsNil() {
x.ListMeta = pkg1_unversioned.ListMeta{}
x.ListMeta = pkg2_unversioned.ListMeta{}
} else {
yyv4 := &x.ListMeta
yym5 := z.DecBinary()
@ -1888,7 +2213,7 @@ func (x *ClusterList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ListMeta = pkg1_unversioned.ListMeta{}
x.ListMeta = pkg2_unversioned.ListMeta{}
} else {
yyv11 := &x.ListMeta
yym12 := z.DecBinary()
@ -1969,7 +2294,7 @@ func (x *ClusterList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) encSliceunversioned_ServerAddressByClientCIDR(v []pkg1_unversioned.ServerAddressByClientCIDR, e *codec1978.Encoder) {
func (x codecSelfer1234) encSliceServerAddressByClientCIDR(v []ServerAddressByClientCIDR, e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -1977,18 +2302,12 @@ func (x codecSelfer1234) encSliceunversioned_ServerAddressByClientCIDR(v []pkg1_
for _, yyv1 := range v {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yy2 := &yyv1
yym3 := z.EncBinary()
_ = yym3
if false {
} else if z.HasExtensions() && z.EncExt(yy2) {
} else {
z.EncFallback(yy2)
}
yy2.CodecEncodeSelf(e)
}
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1_unversioned.ServerAddressByClientCIDR, d *codec1978.Decoder) {
func (x codecSelfer1234) decSliceServerAddressByClientCIDR(v *[]ServerAddressByClientCIDR, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -1999,7 +2318,7 @@ func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1
_ = yyc1
if yyl1 == 0 {
if yyv1 == nil {
yyv1 = []pkg1_unversioned.ServerAddressByClientCIDR{}
yyv1 = []ServerAddressByClientCIDR{}
yyc1 = true
} else if len(yyv1) != 0 {
yyv1 = yyv1[:0]
@ -2019,10 +2338,10 @@ func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
} else {
yyv1 = make([]pkg1_unversioned.ServerAddressByClientCIDR, yyrl1)
yyv1 = make([]ServerAddressByClientCIDR, yyrl1)
}
} else {
yyv1 = make([]pkg1_unversioned.ServerAddressByClientCIDR, yyrl1)
yyv1 = make([]ServerAddressByClientCIDR, yyrl1)
}
yyc1 = true
yyrr1 = len(yyv1)
@ -2037,34 +2356,22 @@ func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1
for ; yyj1 < yyrr1; yyj1++ {
yyh1.ElemContainerState(yyj1)
if r.TryDecodeAsNil() {
yyv1[yyj1] = pkg1_unversioned.ServerAddressByClientCIDR{}
yyv1[yyj1] = ServerAddressByClientCIDR{}
} else {
yyv2 := &yyv1[yyj1]
yym3 := z.DecBinary()
_ = yym3
if false {
} else if z.HasExtensions() && z.DecExt(yyv2) {
} else {
z.DecFallback(yyv2, false)
}
yyv2.CodecDecodeSelf(d)
}
}
if yyrt1 {
for ; yyj1 < yyl1; yyj1++ {
yyv1 = append(yyv1, pkg1_unversioned.ServerAddressByClientCIDR{})
yyv1 = append(yyv1, ServerAddressByClientCIDR{})
yyh1.ElemContainerState(yyj1)
if r.TryDecodeAsNil() {
yyv1[yyj1] = pkg1_unversioned.ServerAddressByClientCIDR{}
yyv1[yyj1] = ServerAddressByClientCIDR{}
} else {
yyv4 := &yyv1[yyj1]
yym5 := z.DecBinary()
_ = yym5
if false {
} else if z.HasExtensions() && z.DecExt(yyv4) {
} else {
z.DecFallback(yyv4, false)
}
yyv3 := &yyv1[yyj1]
yyv3.CodecDecodeSelf(d)
}
}
@ -2075,22 +2382,16 @@ func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1
for ; !r.CheckBreak(); yyj1++ {
if yyj1 >= len(yyv1) {
yyv1 = append(yyv1, pkg1_unversioned.ServerAddressByClientCIDR{}) // var yyz1 pkg1_unversioned.ServerAddressByClientCIDR
yyv1 = append(yyv1, ServerAddressByClientCIDR{}) // var yyz1 ServerAddressByClientCIDR
yyc1 = true
}
yyh1.ElemContainerState(yyj1)
if yyj1 < len(yyv1) {
if r.TryDecodeAsNil() {
yyv1[yyj1] = pkg1_unversioned.ServerAddressByClientCIDR{}
yyv1[yyj1] = ServerAddressByClientCIDR{}
} else {
yyv6 := &yyv1[yyj1]
yym7 := z.DecBinary()
_ = yym7
if false {
} else if z.HasExtensions() && z.DecExt(yyv6) {
} else {
z.DecFallback(yyv6, false)
}
yyv4 := &yyv1[yyj1]
yyv4.CodecDecodeSelf(d)
}
} else {
@ -2102,7 +2403,7 @@ func (x codecSelfer1234) decSliceunversioned_ServerAddressByClientCIDR(v *[]pkg1
yyv1 = yyv1[:yyj1]
yyc1 = true
} else if yyj1 == 0 && yyv1 == nil {
yyv1 = []pkg1_unversioned.ServerAddressByClientCIDR{}
yyv1 = []ServerAddressByClientCIDR{}
yyc1 = true
}
}
@ -2270,7 +2571,7 @@ func (x codecSelfer1234) decSliceCluster(v *[]Cluster, d *codec1978.Decoder) {
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 336)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 368)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]

View file

@ -21,17 +21,28 @@ import (
"k8s.io/kubernetes/pkg/api/v1"
)
// ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.
type ServerAddressByClientCIDR struct {
// The CIDR with which clients can match their IP to figure out the server address that they should use.
ClientCIDR string `json:"clientCIDR" protobuf:"bytes,1,opt,name=clientCIDR"`
// Address of this server, suitable for a client that matches the above CIDR.
// This can be a hostname, hostname:port, IP or IP:port.
ServerAddress string `json:"serverAddress" protobuf:"bytes,2,opt,name=serverAddress"`
}
// ClusterSpec describes the attributes of a kubernetes cluster.
type ClusterSpec struct {
// A map of client CIDR to server address.
// This is to help clients reach servers in the most network-efficient way possible.
// Clients can use the appropriate server address as per the CIDR that they match.
// In case of multiple matches, clients should use the longest matching CIDR.
ServerAddressByClientCIDRs []unversioned.ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs" patchStrategy:"merge" patchMergeKey:"clientCIDR" protobuf:"bytes,1,rep,name=serverAddressByClientCIDRs"`
// the type (e.g. bearer token, client certificate etc) and data of the credential used to access cluster.
// Its used for system routines (not behalf of users)
// TODO: string may not enough, https://github.com/kubernetes/kubernetes/pull/23847#discussion_r59301275
Credential string `json:"credential,omitempty" protobuf:"bytes,2,opt,name=credential"`
ServerAddressByClientCIDRs []ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs" patchStrategy:"merge" patchMergeKey:"clientCIDR" protobuf:"bytes,1,rep,name=serverAddressByClientCIDRs"`
// Name of the secret containing kubeconfig to access this cluster.
// The secret is read from the kubernetes cluster that is hosting federation control plane.
// Admin needs to ensure that the required secret exists. Secret should be in the same namespace where federation control plane is hosted and it should have kubeconfig in its data with key "kubeconfig".
// This will later be changed to a reference to secret in federation control plane when the federation control plane supports secrets.
// This can be left empty if the cluster allows insecure access.
SecretRef *v1.LocalObjectReference `json:"secretRef,omitempty" protobuf:"bytes,2,opt,name=secretRef"`
}
type ClusterConditionType string
@ -75,6 +86,11 @@ type ClusterStatus struct {
// 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"`
// Region is the name of the region in which all of the nodes in the cluster exist. e.g. 'us-east1'.
Region string `json:"region,omitempty" protobuf:"bytes,6,opt,name=region"`
}
// +genclient=true,nonNamespaced=true

View file

@ -0,0 +1,106 @@
/*
Copyright 2016 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 federation_internalclientset
import (
"github.com/golang/glog"
unversionedcore "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/core/unversioned"
unversionedfederation "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/federation/unversioned"
restclient "k8s.io/kubernetes/pkg/client/restclient"
discovery "k8s.io/kubernetes/pkg/client/typed/discovery"
"k8s.io/kubernetes/pkg/util/flowcontrol"
)
type Interface interface {
Discovery() discovery.DiscoveryInterface
Federation() unversionedfederation.FederationInterface
Core() unversionedcore.CoreInterface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
*unversionedfederation.FederationClient
*unversionedcore.CoreClient
}
// Federation retrieves the FederationClient
func (c *Clientset) Federation() unversionedfederation.FederationInterface {
if c == nil {
return nil
}
return c.FederationClient
}
// Core retrieves the CoreClient
func (c *Clientset) Core() unversionedcore.CoreInterface {
if c == nil {
return nil
}
return c.CoreClient
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return c.DiscoveryClient
}
// NewForConfig creates a new Clientset for the given config.
func NewForConfig(c *restclient.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}
var clientset Clientset
var err error
clientset.FederationClient, err = unversionedfederation.NewForConfig(&configShallowCopy)
if err != nil {
return &clientset, err
}
clientset.CoreClient, err = unversionedcore.NewForConfig(&configShallowCopy)
if err != nil {
return &clientset, err
}
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err)
}
return &clientset, err
}
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.FederationClient = unversionedfederation.NewForConfigOrDie(c)
clientset.CoreClient = unversionedcore.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
}
// New creates a new Clientset for the given RESTClient.
func New(c *restclient.RESTClient) *Clientset {
var clientset Clientset
clientset.FederationClient = unversionedfederation.New(c)
clientset.CoreClient = unversionedcore.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset
}

View file

@ -0,0 +1,20 @@
/*
Copyright 2016 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.
*/
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service] --input=[../../federation/apis/federation/,api/]
// This package has the automatically generated clientset.
package federation_internalclientset

View file

@ -0,0 +1,25 @@
/*
Copyright 2016 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 federation_internalclientset
// These imports are the API groups the client will support.
import (
_ "k8s.io/kubernetes/federation/apis/federation/install"
)
func init() {
}

View file

@ -0,0 +1,101 @@
/*
Copyright 2016 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 unversioned
import (
api "k8s.io/kubernetes/pkg/api"
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
restclient "k8s.io/kubernetes/pkg/client/restclient"
)
type CoreInterface interface {
GetRESTClient() *restclient.RESTClient
ServicesGetter
}
// CoreClient is used to interact with features provided by the Core group.
type CoreClient struct {
*restclient.RESTClient
}
func (c *CoreClient) Services(namespace string) ServiceInterface {
return newServices(c, namespace)
}
// NewForConfig creates a new CoreClient for the given config.
func NewForConfig(c *restclient.Config) (*CoreClient, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &CoreClient{client}, nil
}
// NewForConfigOrDie creates a new CoreClient for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *CoreClient {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new CoreClient for the given RESTClient.
func New(c *restclient.RESTClient) *CoreClient {
return &CoreClient{c}
}
func setConfigDefaults(config *restclient.Config) error {
// if core group is not registered, return an error
g, err := registered.Group("")
if err != nil {
return err
}
config.APIPath = "/api"
if config.UserAgent == "" {
config.UserAgent = restclient.DefaultKubernetesUserAgent()
}
// TODO: Unconditionally set the config.Version, until we fix the config.
//if config.Version == "" {
copyGroupVersion := g.GroupVersion
config.GroupVersion = &copyGroupVersion
//}
config.NegotiatedSerializer = api.Codecs
if config.QPS == 0 {
config.QPS = 5
}
if config.Burst == 0 {
config.Burst = 10
}
return nil
}
// GetRESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *CoreClient) GetRESTClient() *restclient.RESTClient {
if c == nil {
return nil
}
return c.RESTClient
}

View file

@ -0,0 +1,20 @@
/*
Copyright 2016 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.
*/
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service] --input=[../../federation/apis/federation/,api/]
// This package has the automatically generated typed clients.
package unversioned

View file

@ -0,0 +1,19 @@
/*
Copyright 2016 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 unversioned
type ServiceExpansion interface{}

View file

@ -0,0 +1,149 @@
/*
Copyright 2016 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 unversioned
import (
api "k8s.io/kubernetes/pkg/api"
watch "k8s.io/kubernetes/pkg/watch"
)
// ServicesGetter has a method to return a ServiceInterface.
// A group's client should implement this interface.
type ServicesGetter interface {
Services(namespace string) ServiceInterface
}
// ServiceInterface has methods to work with Service resources.
type ServiceInterface interface {
Create(*api.Service) (*api.Service, error)
Update(*api.Service) (*api.Service, error)
UpdateStatus(*api.Service) (*api.Service, error)
Delete(name string, options *api.DeleteOptions) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Get(name string) (*api.Service, error)
List(opts api.ListOptions) (*api.ServiceList, error)
Watch(opts api.ListOptions) (watch.Interface, error)
ServiceExpansion
}
// services implements ServiceInterface
type services struct {
client *CoreClient
ns string
}
// newServices returns a Services
func newServices(c *CoreClient, namespace string) *services {
return &services{
client: c,
ns: namespace,
}
}
// Create takes the representation of a service and creates it. Returns the server's representation of the service, and an error, if there is any.
func (c *services) Create(service *api.Service) (result *api.Service, err error) {
result = &api.Service{}
err = c.client.Post().
Namespace(c.ns).
Resource("services").
Body(service).
Do().
Into(result)
return
}
// Update takes the representation of a service and updates it. Returns the server's representation of the service, and an error, if there is any.
func (c *services) Update(service *api.Service) (result *api.Service, err error) {
result = &api.Service{}
err = c.client.Put().
Namespace(c.ns).
Resource("services").
Name(service.Name).
Body(service).
Do().
Into(result)
return
}
func (c *services) UpdateStatus(service *api.Service) (result *api.Service, err error) {
result = &api.Service{}
err = c.client.Put().
Namespace(c.ns).
Resource("services").
Name(service.Name).
SubResource("status").
Body(service).
Do().
Into(result)
return
}
// Delete takes name of the service and deletes it. Returns an error if one occurs.
func (c *services) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("services").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *services) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("services").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the service, and returns the corresponding service object, and an error if there is any.
func (c *services) Get(name string) (result *api.Service, err error) {
result = &api.Service{}
err = c.client.Get().
Namespace(c.ns).
Resource("services").
Name(name).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Services that match those selectors.
func (c *services) List(opts api.ListOptions) (result *api.ServiceList, err error) {
result = &api.ServiceList{}
err = c.client.Get().
Namespace(c.ns).
Resource("services").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested services.
func (c *services) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("services").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -0,0 +1,140 @@
/*
Copyright 2016 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 unversioned
import (
federation "k8s.io/kubernetes/federation/apis/federation"
api "k8s.io/kubernetes/pkg/api"
watch "k8s.io/kubernetes/pkg/watch"
)
// ClustersGetter has a method to return a ClusterInterface.
// A group's client should implement this interface.
type ClustersGetter interface {
Clusters() ClusterInterface
}
// ClusterInterface has methods to work with Cluster resources.
type ClusterInterface interface {
Create(*federation.Cluster) (*federation.Cluster, error)
Update(*federation.Cluster) (*federation.Cluster, error)
UpdateStatus(*federation.Cluster) (*federation.Cluster, error)
Delete(name string, options *api.DeleteOptions) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Get(name string) (*federation.Cluster, error)
List(opts api.ListOptions) (*federation.ClusterList, error)
Watch(opts api.ListOptions) (watch.Interface, error)
ClusterExpansion
}
// clusters implements ClusterInterface
type clusters struct {
client *FederationClient
}
// newClusters returns a Clusters
func newClusters(c *FederationClient) *clusters {
return &clusters{
client: c,
}
}
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Create(cluster *federation.Cluster) (result *federation.Cluster, err error) {
result = &federation.Cluster{}
err = c.client.Post().
Resource("clusters").
Body(cluster).
Do().
Into(result)
return
}
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Update(cluster *federation.Cluster) (result *federation.Cluster, err error) {
result = &federation.Cluster{}
err = c.client.Put().
Resource("clusters").
Name(cluster.Name).
Body(cluster).
Do().
Into(result)
return
}
func (c *clusters) UpdateStatus(cluster *federation.Cluster) (result *federation.Cluster, err error) {
result = &federation.Cluster{}
err = c.client.Put().
Resource("clusters").
Name(cluster.Name).
SubResource("status").
Body(cluster).
Do().
Into(result)
return
}
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
func (c *clusters) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().
Resource("clusters").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusters) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete().
Resource("clusters").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
func (c *clusters) Get(name string) (result *federation.Cluster, err error) {
result = &federation.Cluster{}
err = c.client.Get().
Resource("clusters").
Name(name).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
func (c *clusters) List(opts api.ListOptions) (result *federation.ClusterList, err error) {
result = &federation.ClusterList{}
err = c.client.Get().
Resource("clusters").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *clusters) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Resource("clusters").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -0,0 +1,20 @@
/*
Copyright 2016 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.
*/
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service] --input=[../../federation/apis/federation/,api/]
// This package has the automatically generated typed clients.
package unversioned

View file

@ -0,0 +1,101 @@
/*
Copyright 2016 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 unversioned
import (
api "k8s.io/kubernetes/pkg/api"
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
restclient "k8s.io/kubernetes/pkg/client/restclient"
)
type FederationInterface interface {
GetRESTClient() *restclient.RESTClient
ClustersGetter
}
// FederationClient is used to interact with features provided by the Federation group.
type FederationClient struct {
*restclient.RESTClient
}
func (c *FederationClient) Clusters() ClusterInterface {
return newClusters(c)
}
// NewForConfig creates a new FederationClient for the given config.
func NewForConfig(c *restclient.Config) (*FederationClient, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &FederationClient{client}, nil
}
// NewForConfigOrDie creates a new FederationClient for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *FederationClient {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new FederationClient for the given RESTClient.
func New(c *restclient.RESTClient) *FederationClient {
return &FederationClient{c}
}
func setConfigDefaults(config *restclient.Config) error {
// if federation group is not registered, return an error
g, err := registered.Group("federation")
if err != nil {
return err
}
config.APIPath = "/apis"
if config.UserAgent == "" {
config.UserAgent = restclient.DefaultKubernetesUserAgent()
}
// TODO: Unconditionally set the config.Version, until we fix the config.
//if config.Version == "" {
copyGroupVersion := g.GroupVersion
config.GroupVersion = &copyGroupVersion
//}
config.NegotiatedSerializer = api.Codecs
if config.QPS == 0 {
config.QPS = 5
}
if config.Burst == 0 {
config.Burst = 10
}
return nil
}
// GetRESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FederationClient) GetRESTClient() *restclient.RESTClient {
if c == nil {
return nil
}
return c.RESTClient
}

View file

@ -0,0 +1,19 @@
/*
Copyright 2016 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 unversioned
type ClusterExpansion interface{}