diff --git a/pkg/apis/componentconfig/register.go b/pkg/apis/componentconfig/register.go index eaf67580996..3604129a651 100644 --- a/pkg/apis/componentconfig/register.go +++ b/pkg/apis/componentconfig/register.go @@ -45,7 +45,9 @@ func addKnownTypes(scheme *runtime.Scheme) { // TODO this will get cleaned up with the scheme types are fixed scheme.AddKnownTypes(SchemeGroupVersion, &KubeProxyConfiguration{}, + &KubeSchedulerConfiguration{}, ) } -func (obj *KubeProxyConfiguration) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *KubeProxyConfiguration) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *KubeSchedulerConfiguration) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/pkg/apis/componentconfig/types.generated.go b/pkg/apis/componentconfig/types.generated.go index 08c28edb10b..00ec437be27 100644 --- a/pkg/apis/componentconfig/types.generated.go +++ b/pkg/apis/componentconfig/types.generated.go @@ -4327,12 +4327,14 @@ func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { } else { yysep500 := !z.EncBinary() yy2arr500 := z.EncBasicHandle().StructToArray - var yyq500 [9]bool + var yyq500 [11]bool _, _, _ = yysep500, yyq500, yy2arr500 const yyr500 bool = false + yyq500[0] = x.Kind != "" + yyq500[1] = x.APIVersion != "" var yynn500 int if yyr500 || yy2arr500 { - r.EncodeArrayStart(9) + r.EncodeArrayStart(11) } else { yynn500 = 9 for _, b := range yyq500 { @@ -4345,40 +4347,52 @@ func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { } if yyr500 || yy2arr500 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yym502 := z.EncBinary() - _ = yym502 - if false { + if yyq500[0] { + yym502 := z.EncBinary() + _ = yym502 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } } else { - r.EncodeInt(int64(x.Port)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("port")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym503 := z.EncBinary() - _ = yym503 - if false { - } else { - r.EncodeInt(int64(x.Port)) + if yyq500[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym503 := z.EncBinary() + _ = yym503 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } } } if yyr500 || yy2arr500 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yym505 := z.EncBinary() - _ = yym505 - if false { + if yyq500[1] { + yym505 := z.EncBinary() + _ = yym505 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Address)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("address")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym506 := z.EncBinary() - _ = yym506 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Address)) + if yyq500[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym506 := z.EncBinary() + _ = yym506 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } } } if yyr500 || yy2arr500 { @@ -4387,17 +4401,17 @@ func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { _ = yym508 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.AlgorithmProvider)) + r.EncodeInt(int64(x.Port)) } } else { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("algorithmProvider")) + r.EncodeString(codecSelferC_UTF81234, string("port")) z.EncSendContainerState(codecSelfer_containerMapValue1234) yym509 := z.EncBinary() _ = yym509 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.AlgorithmProvider)) + r.EncodeInt(int64(x.Port)) } } if yyr500 || yy2arr500 { @@ -4406,17 +4420,17 @@ func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { _ = yym511 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.PolicyConfigFile)) + r.EncodeString(codecSelferC_UTF81234, string(x.Address)) } } else { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("policyConfigFile")) + r.EncodeString(codecSelferC_UTF81234, string("address")) z.EncSendContainerState(codecSelfer_containerMapValue1234) yym512 := z.EncBinary() _ = yym512 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.PolicyConfigFile)) + r.EncodeString(codecSelferC_UTF81234, string(x.Address)) } } if yyr500 || yy2arr500 { @@ -4425,17 +4439,17 @@ func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { _ = yym514 if false { } else { - r.EncodeBool(bool(x.EnableProfiling)) + r.EncodeString(codecSelferC_UTF81234, string(x.AlgorithmProvider)) } } else { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("enableProfiling")) + r.EncodeString(codecSelferC_UTF81234, string("algorithmProvider")) z.EncSendContainerState(codecSelfer_containerMapValue1234) yym515 := z.EncBinary() _ = yym515 if false { } else { - r.EncodeBool(bool(x.EnableProfiling)) + r.EncodeString(codecSelferC_UTF81234, string(x.AlgorithmProvider)) } } if yyr500 || yy2arr500 { @@ -4444,17 +4458,17 @@ func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { _ = yym517 if false { } else { - r.EncodeFloat32(float32(x.KubeAPIQPS)) + r.EncodeString(codecSelferC_UTF81234, string(x.PolicyConfigFile)) } } else { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("kubeAPIQPS")) + r.EncodeString(codecSelferC_UTF81234, string("policyConfigFile")) z.EncSendContainerState(codecSelfer_containerMapValue1234) yym518 := z.EncBinary() _ = yym518 if false { } else { - r.EncodeFloat32(float32(x.KubeAPIQPS)) + r.EncodeString(codecSelferC_UTF81234, string(x.PolicyConfigFile)) } } if yyr500 || yy2arr500 { @@ -4463,17 +4477,17 @@ func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { _ = yym520 if false { } else { - r.EncodeInt(int64(x.KubeAPIBurst)) + r.EncodeBool(bool(x.EnableProfiling)) } } else { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("kubeAPIBurst")) + r.EncodeString(codecSelferC_UTF81234, string("enableProfiling")) z.EncSendContainerState(codecSelfer_containerMapValue1234) yym521 := z.EncBinary() _ = yym521 if false { } else { - r.EncodeInt(int64(x.KubeAPIBurst)) + r.EncodeBool(bool(x.EnableProfiling)) } } if yyr500 || yy2arr500 { @@ -4481,6 +4495,44 @@ func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { yym523 := z.EncBinary() _ = yym523 if false { + } else { + r.EncodeFloat32(float32(x.KubeAPIQPS)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeAPIQPS")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym524 := z.EncBinary() + _ = yym524 + if false { + } else { + r.EncodeFloat32(float32(x.KubeAPIQPS)) + } + } + if yyr500 || yy2arr500 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym526 := z.EncBinary() + _ = yym526 + if false { + } else { + r.EncodeInt(int64(x.KubeAPIBurst)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeAPIBurst")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym527 := z.EncBinary() + _ = yym527 + if false { + } else { + r.EncodeInt(int64(x.KubeAPIBurst)) + } + } + if yyr500 || yy2arr500 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym529 := z.EncBinary() + _ = yym529 + if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.SchedulerName)) } @@ -4488,8 +4540,8 @@ func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("schedulerName")) z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym524 := z.EncBinary() - _ = yym524 + yym530 := z.EncBinary() + _ = yym530 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.SchedulerName)) @@ -4497,14 +4549,14 @@ func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { } if yyr500 || yy2arr500 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yy526 := &x.LeaderElection - yy526.CodecEncodeSelf(e) + yy532 := &x.LeaderElection + yy532.CodecEncodeSelf(e) } else { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("leaderElection")) z.EncSendContainerState(codecSelfer_containerMapValue1234) - yy527 := &x.LeaderElection - yy527.CodecEncodeSelf(e) + yy533 := &x.LeaderElection + yy533.CodecEncodeSelf(e) } if yyr500 || yy2arr500 { z.EncSendContainerState(codecSelfer_containerArrayEnd1234) @@ -4519,25 +4571,25 @@ func (x *KubeSchedulerConfiguration) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym528 := z.DecBinary() - _ = yym528 + yym534 := z.DecBinary() + _ = yym534 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - yyct529 := r.ContainerType() - if yyct529 == codecSelferValueTypeMap1234 { - yyl529 := r.ReadMapStart() - if yyl529 == 0 { + yyct535 := r.ContainerType() + if yyct535 == codecSelferValueTypeMap1234 { + yyl535 := r.ReadMapStart() + if yyl535 == 0 { z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl529, d) + x.codecDecodeSelfFromMap(yyl535, d) } - } else if yyct529 == codecSelferValueTypeArray1234 { - yyl529 := r.ReadArrayStart() - if yyl529 == 0 { + } else if yyct535 == codecSelferValueTypeArray1234 { + yyl535 := r.ReadArrayStart() + if yyl535 == 0 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl529, d) + x.codecDecodeSelfFromArray(yyl535, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4549,12 +4601,12 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978. var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys530Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys530Slc - var yyhl530 bool = l >= 0 - for yyj530 := 0; ; yyj530++ { - if yyhl530 { - if yyj530 >= l { + var yys536Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys536Slc + var yyhl536 bool = l >= 0 + for yyj536 := 0; ; yyj536++ { + if yyhl536 { + if yyj536 >= l { break } } else { @@ -4563,10 +4615,22 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978. } } z.DecSendContainerState(codecSelfer_containerMapKey1234) - yys530Slc = r.DecodeBytes(yys530Slc, true, true) - yys530 := string(yys530Slc) + yys536Slc = r.DecodeBytes(yys536Slc, true, true) + yys536 := string(yys536Slc) z.DecSendContainerState(codecSelfer_containerMapValue1234) - switch yys530 { + switch yys536 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } case "port": if r.TryDecodeAsNil() { x.Port = 0 @@ -4619,13 +4683,13 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978. if r.TryDecodeAsNil() { x.LeaderElection = LeaderElectionConfiguration{} } else { - yyv539 := &x.LeaderElection - yyv539.CodecDecodeSelf(d) + yyv547 := &x.LeaderElection + yyv547.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys530) - } // end switch yys530 - } // end for yyj530 + z.DecStructFieldNotFound(-1, yys536) + } // end switch yys536 + } // end for yyj536 z.DecSendContainerState(codecSelfer_containerMapEnd1234) } @@ -4633,16 +4697,48 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec197 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj540 int - var yyb540 bool - var yyhl540 bool = l >= 0 - yyj540++ - if yyhl540 { - yyb540 = yyj540 > l + var yyj548 int + var yyb548 bool + var yyhl548 bool = l >= 0 + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l } else { - yyb540 = r.CheckBreak() + yyb548 = r.CheckBreak() } - if yyb540 { + if yyb548 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l + } else { + yyb548 = r.CheckBreak() + } + if yyb548 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l + } else { + yyb548 = r.CheckBreak() + } + if yyb548 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -4652,13 +4748,13 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec197 } else { x.Port = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj540++ - if yyhl540 { - yyb540 = yyj540 > l + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l } else { - yyb540 = r.CheckBreak() + yyb548 = r.CheckBreak() } - if yyb540 { + if yyb548 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -4668,13 +4764,13 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec197 } else { x.Address = string(r.DecodeString()) } - yyj540++ - if yyhl540 { - yyb540 = yyj540 > l + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l } else { - yyb540 = r.CheckBreak() + yyb548 = r.CheckBreak() } - if yyb540 { + if yyb548 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -4684,13 +4780,13 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec197 } else { x.AlgorithmProvider = string(r.DecodeString()) } - yyj540++ - if yyhl540 { - yyb540 = yyj540 > l + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l } else { - yyb540 = r.CheckBreak() + yyb548 = r.CheckBreak() } - if yyb540 { + if yyb548 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -4700,13 +4796,13 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec197 } else { x.PolicyConfigFile = string(r.DecodeString()) } - yyj540++ - if yyhl540 { - yyb540 = yyj540 > l + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l } else { - yyb540 = r.CheckBreak() + yyb548 = r.CheckBreak() } - if yyb540 { + if yyb548 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -4716,13 +4812,13 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec197 } else { x.EnableProfiling = bool(r.DecodeBool()) } - yyj540++ - if yyhl540 { - yyb540 = yyj540 > l + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l } else { - yyb540 = r.CheckBreak() + yyb548 = r.CheckBreak() } - if yyb540 { + if yyb548 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -4732,13 +4828,13 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec197 } else { x.KubeAPIQPS = float32(r.DecodeFloat(true)) } - yyj540++ - if yyhl540 { - yyb540 = yyj540 > l + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l } else { - yyb540 = r.CheckBreak() + yyb548 = r.CheckBreak() } - if yyb540 { + if yyb548 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -4748,13 +4844,13 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec197 } else { x.KubeAPIBurst = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj540++ - if yyhl540 { - yyb540 = yyj540 > l + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l } else { - yyb540 = r.CheckBreak() + yyb548 = r.CheckBreak() } - if yyb540 { + if yyb548 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -4764,13 +4860,13 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec197 } else { x.SchedulerName = string(r.DecodeString()) } - yyj540++ - if yyhl540 { - yyb540 = yyj540 > l + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l } else { - yyb540 = r.CheckBreak() + yyb548 = r.CheckBreak() } - if yyb540 { + if yyb548 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -4778,21 +4874,21 @@ func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec197 if r.TryDecodeAsNil() { x.LeaderElection = LeaderElectionConfiguration{} } else { - yyv549 := &x.LeaderElection - yyv549.CodecDecodeSelf(d) + yyv559 := &x.LeaderElection + yyv559.CodecDecodeSelf(d) } for { - yyj540++ - if yyhl540 { - yyb540 = yyj540 > l + yyj548++ + if yyhl548 { + yyb548 = yyj548 > l } else { - yyb540 = r.CheckBreak() + yyb548 = r.CheckBreak() } - if yyb540 { + if yyb548 { break } z.DecSendContainerState(codecSelfer_containerArrayElem1234) - z.DecStructFieldNotFound(yyj540-1, "") + z.DecStructFieldNotFound(yyj548-1, "") } z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } @@ -4804,33 +4900,33 @@ func (x *LeaderElectionConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym550 := z.EncBinary() - _ = yym550 + yym560 := z.EncBinary() + _ = yym560 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep551 := !z.EncBinary() - yy2arr551 := z.EncBasicHandle().StructToArray - var yyq551 [4]bool - _, _, _ = yysep551, yyq551, yy2arr551 - const yyr551 bool = false - var yynn551 int - if yyr551 || yy2arr551 { + yysep561 := !z.EncBinary() + yy2arr561 := z.EncBasicHandle().StructToArray + var yyq561 [4]bool + _, _, _ = yysep561, yyq561, yy2arr561 + const yyr561 bool = false + var yynn561 int + if yyr561 || yy2arr561 { r.EncodeArrayStart(4) } else { - yynn551 = 4 - for _, b := range yyq551 { + yynn561 = 4 + for _, b := range yyq561 { if b { - yynn551++ + yynn561++ } } - r.EncodeMapStart(yynn551) - yynn551 = 0 + r.EncodeMapStart(yynn561) + yynn561 = 0 } - if yyr551 || yy2arr551 { + if yyr561 || yy2arr561 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yym553 := z.EncBinary() - _ = yym553 + yym563 := z.EncBinary() + _ = yym563 if false { } else { r.EncodeBool(bool(x.LeaderElect)) @@ -4839,70 +4935,16 @@ func (x *LeaderElectionConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("leaderElect")) z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym554 := z.EncBinary() - _ = yym554 + yym564 := z.EncBinary() + _ = yym564 if false { } else { r.EncodeBool(bool(x.LeaderElect)) } } - if yyr551 || yy2arr551 { + if yyr561 || yy2arr561 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yy556 := &x.LeaseDuration - yym557 := z.EncBinary() - _ = yym557 - if false { - } else if z.HasExtensions() && z.EncExt(yy556) { - } else if !yym557 && z.IsJSONHandle() { - z.EncJSONMarshal(yy556) - } else { - z.EncFallback(yy556) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("leaseDuration")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - yy558 := &x.LeaseDuration - yym559 := z.EncBinary() - _ = yym559 - if false { - } else if z.HasExtensions() && z.EncExt(yy558) { - } else if !yym559 && z.IsJSONHandle() { - z.EncJSONMarshal(yy558) - } else { - z.EncFallback(yy558) - } - } - if yyr551 || yy2arr551 { - z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yy561 := &x.RenewDeadline - yym562 := z.EncBinary() - _ = yym562 - if false { - } else if z.HasExtensions() && z.EncExt(yy561) { - } else if !yym562 && z.IsJSONHandle() { - z.EncJSONMarshal(yy561) - } else { - z.EncFallback(yy561) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("renewDeadline")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - yy563 := &x.RenewDeadline - yym564 := z.EncBinary() - _ = yym564 - if false { - } else if z.HasExtensions() && z.EncExt(yy563) { - } else if !yym564 && z.IsJSONHandle() { - z.EncJSONMarshal(yy563) - } else { - z.EncFallback(yy563) - } - } - if yyr551 || yy2arr551 { - z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yy566 := &x.RetryPeriod + yy566 := &x.LeaseDuration yym567 := z.EncBinary() _ = yym567 if false { @@ -4914,9 +4956,9 @@ func (x *LeaderElectionConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { } } else { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("retryPeriod")) + r.EncodeString(codecSelferC_UTF81234, string("leaseDuration")) z.EncSendContainerState(codecSelfer_containerMapValue1234) - yy568 := &x.RetryPeriod + yy568 := &x.LeaseDuration yym569 := z.EncBinary() _ = yym569 if false { @@ -4927,7 +4969,61 @@ func (x *LeaderElectionConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { z.EncFallback(yy568) } } - if yyr551 || yy2arr551 { + if yyr561 || yy2arr561 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy571 := &x.RenewDeadline + yym572 := z.EncBinary() + _ = yym572 + if false { + } else if z.HasExtensions() && z.EncExt(yy571) { + } else if !yym572 && z.IsJSONHandle() { + z.EncJSONMarshal(yy571) + } else { + z.EncFallback(yy571) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("renewDeadline")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy573 := &x.RenewDeadline + yym574 := z.EncBinary() + _ = yym574 + if false { + } else if z.HasExtensions() && z.EncExt(yy573) { + } else if !yym574 && z.IsJSONHandle() { + z.EncJSONMarshal(yy573) + } else { + z.EncFallback(yy573) + } + } + if yyr561 || yy2arr561 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy576 := &x.RetryPeriod + yym577 := z.EncBinary() + _ = yym577 + if false { + } else if z.HasExtensions() && z.EncExt(yy576) { + } else if !yym577 && z.IsJSONHandle() { + z.EncJSONMarshal(yy576) + } else { + z.EncFallback(yy576) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("retryPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy578 := &x.RetryPeriod + yym579 := z.EncBinary() + _ = yym579 + if false { + } else if z.HasExtensions() && z.EncExt(yy578) { + } else if !yym579 && z.IsJSONHandle() { + z.EncJSONMarshal(yy578) + } else { + z.EncFallback(yy578) + } + } + if yyr561 || yy2arr561 { z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } else { z.EncSendContainerState(codecSelfer_containerMapEnd1234) @@ -4940,25 +5036,25 @@ func (x *LeaderElectionConfiguration) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym570 := z.DecBinary() - _ = yym570 + yym580 := z.DecBinary() + _ = yym580 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - yyct571 := r.ContainerType() - if yyct571 == codecSelferValueTypeMap1234 { - yyl571 := r.ReadMapStart() - if yyl571 == 0 { + yyct581 := r.ContainerType() + if yyct581 == codecSelferValueTypeMap1234 { + yyl581 := r.ReadMapStart() + if yyl581 == 0 { z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl571, d) + x.codecDecodeSelfFromMap(yyl581, d) } - } else if yyct571 == codecSelferValueTypeArray1234 { - yyl571 := r.ReadArrayStart() - if yyl571 == 0 { + } else if yyct581 == codecSelferValueTypeArray1234 { + yyl581 := r.ReadArrayStart() + if yyl581 == 0 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl571, d) + x.codecDecodeSelfFromArray(yyl581, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4970,12 +5066,12 @@ func (x *LeaderElectionConfiguration) codecDecodeSelfFromMap(l int, d *codec1978 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys572Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys572Slc - var yyhl572 bool = l >= 0 - for yyj572 := 0; ; yyj572++ { - if yyhl572 { - if yyj572 >= l { + var yys582Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys582Slc + var yyhl582 bool = l >= 0 + for yyj582 := 0; ; yyj582++ { + if yyhl582 { + if yyj582 >= l { break } } else { @@ -4984,10 +5080,10 @@ func (x *LeaderElectionConfiguration) codecDecodeSelfFromMap(l int, d *codec1978 } } z.DecSendContainerState(codecSelfer_containerMapKey1234) - yys572Slc = r.DecodeBytes(yys572Slc, true, true) - yys572 := string(yys572Slc) + yys582Slc = r.DecodeBytes(yys582Slc, true, true) + yys582 := string(yys582Slc) z.DecSendContainerState(codecSelfer_containerMapValue1234) - switch yys572 { + switch yys582 { case "leaderElect": if r.TryDecodeAsNil() { x.LeaderElect = false @@ -4998,51 +5094,51 @@ func (x *LeaderElectionConfiguration) codecDecodeSelfFromMap(l int, d *codec1978 if r.TryDecodeAsNil() { x.LeaseDuration = pkg1_unversioned.Duration{} } else { - yyv574 := &x.LeaseDuration - yym575 := z.DecBinary() - _ = yym575 + yyv584 := &x.LeaseDuration + yym585 := z.DecBinary() + _ = yym585 if false { - } else if z.HasExtensions() && z.DecExt(yyv574) { - } else if !yym575 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv574) + } else if z.HasExtensions() && z.DecExt(yyv584) { + } else if !yym585 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv584) } else { - z.DecFallback(yyv574, false) + z.DecFallback(yyv584, false) } } case "renewDeadline": if r.TryDecodeAsNil() { x.RenewDeadline = pkg1_unversioned.Duration{} } else { - yyv576 := &x.RenewDeadline - yym577 := z.DecBinary() - _ = yym577 + yyv586 := &x.RenewDeadline + yym587 := z.DecBinary() + _ = yym587 if false { - } else if z.HasExtensions() && z.DecExt(yyv576) { - } else if !yym577 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv576) + } else if z.HasExtensions() && z.DecExt(yyv586) { + } else if !yym587 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv586) } else { - z.DecFallback(yyv576, false) + z.DecFallback(yyv586, false) } } case "retryPeriod": if r.TryDecodeAsNil() { x.RetryPeriod = pkg1_unversioned.Duration{} } else { - yyv578 := &x.RetryPeriod - yym579 := z.DecBinary() - _ = yym579 + yyv588 := &x.RetryPeriod + yym589 := z.DecBinary() + _ = yym589 if false { - } else if z.HasExtensions() && z.DecExt(yyv578) { - } else if !yym579 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv578) + } else if z.HasExtensions() && z.DecExt(yyv588) { + } else if !yym589 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv588) } else { - z.DecFallback(yyv578, false) + z.DecFallback(yyv588, false) } } default: - z.DecStructFieldNotFound(-1, yys572) - } // end switch yys572 - } // end for yyj572 + z.DecStructFieldNotFound(-1, yys582) + } // end switch yys582 + } // end for yyj582 z.DecSendContainerState(codecSelfer_containerMapEnd1234) } @@ -5050,16 +5146,16 @@ func (x *LeaderElectionConfiguration) codecDecodeSelfFromArray(l int, d *codec19 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj580 int - var yyb580 bool - var yyhl580 bool = l >= 0 - yyj580++ - if yyhl580 { - yyb580 = yyj580 > l + var yyj590 int + var yyb590 bool + var yyhl590 bool = l >= 0 + yyj590++ + if yyhl590 { + yyb590 = yyj590 > l } else { - yyb580 = r.CheckBreak() + yyb590 = r.CheckBreak() } - if yyb580 { + if yyb590 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -5069,13 +5165,13 @@ func (x *LeaderElectionConfiguration) codecDecodeSelfFromArray(l int, d *codec19 } else { x.LeaderElect = bool(r.DecodeBool()) } - yyj580++ - if yyhl580 { - yyb580 = yyj580 > l + yyj590++ + if yyhl590 { + yyb590 = yyj590 > l } else { - yyb580 = r.CheckBreak() + yyb590 = r.CheckBreak() } - if yyb580 { + if yyb590 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -5083,24 +5179,24 @@ func (x *LeaderElectionConfiguration) codecDecodeSelfFromArray(l int, d *codec19 if r.TryDecodeAsNil() { x.LeaseDuration = pkg1_unversioned.Duration{} } else { - yyv582 := &x.LeaseDuration - yym583 := z.DecBinary() - _ = yym583 + yyv592 := &x.LeaseDuration + yym593 := z.DecBinary() + _ = yym593 if false { - } else if z.HasExtensions() && z.DecExt(yyv582) { - } else if !yym583 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv582) + } else if z.HasExtensions() && z.DecExt(yyv592) { + } else if !yym593 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv592) } else { - z.DecFallback(yyv582, false) + z.DecFallback(yyv592, false) } } - yyj580++ - if yyhl580 { - yyb580 = yyj580 > l + yyj590++ + if yyhl590 { + yyb590 = yyj590 > l } else { - yyb580 = r.CheckBreak() + yyb590 = r.CheckBreak() } - if yyb580 { + if yyb590 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -5108,24 +5204,24 @@ func (x *LeaderElectionConfiguration) codecDecodeSelfFromArray(l int, d *codec19 if r.TryDecodeAsNil() { x.RenewDeadline = pkg1_unversioned.Duration{} } else { - yyv584 := &x.RenewDeadline - yym585 := z.DecBinary() - _ = yym585 + yyv594 := &x.RenewDeadline + yym595 := z.DecBinary() + _ = yym595 if false { - } else if z.HasExtensions() && z.DecExt(yyv584) { - } else if !yym585 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv584) + } else if z.HasExtensions() && z.DecExt(yyv594) { + } else if !yym595 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv594) } else { - z.DecFallback(yyv584, false) + z.DecFallback(yyv594, false) } } - yyj580++ - if yyhl580 { - yyb580 = yyj580 > l + yyj590++ + if yyhl590 { + yyb590 = yyj590 > l } else { - yyb580 = r.CheckBreak() + yyb590 = r.CheckBreak() } - if yyb580 { + if yyb590 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -5133,29 +5229,29 @@ func (x *LeaderElectionConfiguration) codecDecodeSelfFromArray(l int, d *codec19 if r.TryDecodeAsNil() { x.RetryPeriod = pkg1_unversioned.Duration{} } else { - yyv586 := &x.RetryPeriod - yym587 := z.DecBinary() - _ = yym587 + yyv596 := &x.RetryPeriod + yym597 := z.DecBinary() + _ = yym597 if false { - } else if z.HasExtensions() && z.DecExt(yyv586) { - } else if !yym587 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv586) + } else if z.HasExtensions() && z.DecExt(yyv596) { + } else if !yym597 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv596) } else { - z.DecFallback(yyv586, false) + z.DecFallback(yyv596, false) } } for { - yyj580++ - if yyhl580 { - yyb580 = yyj580 > l + yyj590++ + if yyhl590 { + yyb590 = yyj590 > l } else { - yyb580 = r.CheckBreak() + yyb590 = r.CheckBreak() } - if yyb580 { + if yyb590 { break } z.DecSendContainerState(codecSelfer_containerArrayElem1234) - z.DecStructFieldNotFound(yyj580-1, "") + z.DecStructFieldNotFound(yyj590-1, "") } z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } diff --git a/pkg/apis/componentconfig/types.go b/pkg/apis/componentconfig/types.go index 1717a7c0ddd..cee57431e92 100644 --- a/pkg/apis/componentconfig/types.go +++ b/pkg/apis/componentconfig/types.go @@ -291,6 +291,8 @@ type KubeletConfiguration struct { } type KubeSchedulerConfiguration struct { + unversioned.TypeMeta + // port is the port that the scheduler's http service runs on. Port int `json:"port"` // address is the IP address to serve on. diff --git a/pkg/apis/componentconfig/v1alpha1/conversion_generated.go b/pkg/apis/componentconfig/v1alpha1/conversion_generated.go index e3d565a4977..c11acb52ef6 100644 --- a/pkg/apis/componentconfig/v1alpha1/conversion_generated.go +++ b/pkg/apis/componentconfig/v1alpha1/conversion_generated.go @@ -66,6 +66,56 @@ func Convert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyConfigu return autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyConfiguration(in, out, s) } +func autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in *componentconfig.KubeSchedulerConfiguration, out *KubeSchedulerConfiguration, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*componentconfig.KubeSchedulerConfiguration))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + out.Port = in.Port + out.Address = in.Address + out.AlgorithmProvider = in.AlgorithmProvider + out.PolicyConfigFile = in.PolicyConfigFile + if err := api.Convert_bool_To_bool_ref(&in.EnableProfiling, &out.EnableProfiling, s); err != nil { + return err + } + out.KubeAPIQPS = in.KubeAPIQPS + out.KubeAPIBurst = in.KubeAPIBurst + out.SchedulerName = in.SchedulerName + if err := Convert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { + return err + } + return nil +} + +func Convert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in *componentconfig.KubeSchedulerConfiguration, out *KubeSchedulerConfiguration, s conversion.Scope) error { + return autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in, out, s) +} + +func autoConvert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(in *componentconfig.LeaderElectionConfiguration, out *LeaderElectionConfiguration, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*componentconfig.LeaderElectionConfiguration))(in) + } + if err := api.Convert_bool_To_bool_ref(&in.LeaderElect, &out.LeaderElect, s); err != nil { + return err + } + if err := s.Convert(&in.LeaseDuration, &out.LeaseDuration, 0); err != nil { + return err + } + if err := s.Convert(&in.RenewDeadline, &out.RenewDeadline, 0); err != nil { + return err + } + if err := s.Convert(&in.RetryPeriod, &out.RetryPeriod, 0); err != nil { + return err + } + return nil +} + +func Convert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(in *componentconfig.LeaderElectionConfiguration, out *LeaderElectionConfiguration, s conversion.Scope) error { + return autoConvert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(in, out, s) +} + func autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyConfiguration(in *KubeProxyConfiguration, out *componentconfig.KubeProxyConfiguration, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*KubeProxyConfiguration))(in) @@ -106,10 +156,64 @@ func Convert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyConfigu return autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyConfiguration(in, out, s) } +func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration(in *KubeSchedulerConfiguration, out *componentconfig.KubeSchedulerConfiguration, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*KubeSchedulerConfiguration))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + out.Port = in.Port + out.Address = in.Address + out.AlgorithmProvider = in.AlgorithmProvider + out.PolicyConfigFile = in.PolicyConfigFile + if err := api.Convert_bool_ref_To_bool(&in.EnableProfiling, &out.EnableProfiling, s); err != nil { + return err + } + out.KubeAPIQPS = in.KubeAPIQPS + out.KubeAPIBurst = in.KubeAPIBurst + out.SchedulerName = in.SchedulerName + if err := Convert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { + return err + } + return nil +} + +func Convert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration(in *KubeSchedulerConfiguration, out *componentconfig.KubeSchedulerConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration(in *LeaderElectionConfiguration, out *componentconfig.LeaderElectionConfiguration, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*LeaderElectionConfiguration))(in) + } + if err := api.Convert_bool_ref_To_bool(&in.LeaderElect, &out.LeaderElect, s); err != nil { + return err + } + if err := s.Convert(&in.LeaseDuration, &out.LeaseDuration, 0); err != nil { + return err + } + if err := s.Convert(&in.RenewDeadline, &out.RenewDeadline, 0); err != nil { + return err + } + if err := s.Convert(&in.RetryPeriod, &out.RetryPeriod, 0); err != nil { + return err + } + return nil +} + +func Convert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration(in *LeaderElectionConfiguration, out *componentconfig.LeaderElectionConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration(in, out, s) +} + func init() { err := api.Scheme.AddGeneratedConversionFuncs( autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyConfiguration, + autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration, + autoConvert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration, autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyConfiguration, + autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration, + autoConvert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration, ) if err != nil { // If one of the conversion functions is malformed, detect it immediately. diff --git a/pkg/apis/componentconfig/v1alpha1/deep_copy_generated.go b/pkg/apis/componentconfig/v1alpha1/deep_copy_generated.go index 8e105a22e3f..0012e90414e 100644 --- a/pkg/apis/componentconfig/v1alpha1/deep_copy_generated.go +++ b/pkg/apis/componentconfig/v1alpha1/deep_copy_generated.go @@ -68,11 +68,55 @@ func deepCopy_v1alpha1_KubeProxyConfiguration(in KubeProxyConfiguration, out *Ku return nil } +func deepCopy_v1alpha1_KubeSchedulerConfiguration(in KubeSchedulerConfiguration, out *KubeSchedulerConfiguration, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + out.Port = in.Port + out.Address = in.Address + out.AlgorithmProvider = in.AlgorithmProvider + out.PolicyConfigFile = in.PolicyConfigFile + if in.EnableProfiling != nil { + out.EnableProfiling = new(bool) + *out.EnableProfiling = *in.EnableProfiling + } else { + out.EnableProfiling = nil + } + out.KubeAPIQPS = in.KubeAPIQPS + out.KubeAPIBurst = in.KubeAPIBurst + out.SchedulerName = in.SchedulerName + if err := deepCopy_v1alpha1_LeaderElectionConfiguration(in.LeaderElection, &out.LeaderElection, c); err != nil { + return err + } + return nil +} + +func deepCopy_v1alpha1_LeaderElectionConfiguration(in LeaderElectionConfiguration, out *LeaderElectionConfiguration, c *conversion.Cloner) error { + if in.LeaderElect != nil { + out.LeaderElect = new(bool) + *out.LeaderElect = *in.LeaderElect + } else { + out.LeaderElect = nil + } + if err := deepCopy_unversioned_Duration(in.LeaseDuration, &out.LeaseDuration, c); err != nil { + return err + } + if err := deepCopy_unversioned_Duration(in.RenewDeadline, &out.RenewDeadline, c); err != nil { + return err + } + if err := deepCopy_unversioned_Duration(in.RetryPeriod, &out.RetryPeriod, c); err != nil { + return err + } + return nil +} + func init() { err := api.Scheme.AddGeneratedDeepCopyFuncs( deepCopy_unversioned_Duration, deepCopy_unversioned_TypeMeta, deepCopy_v1alpha1_KubeProxyConfiguration, + deepCopy_v1alpha1_KubeSchedulerConfiguration, + deepCopy_v1alpha1_LeaderElectionConfiguration, ) if err != nil { // if one of the deep copy functions is malformed, detect it immediately. diff --git a/pkg/apis/componentconfig/v1alpha1/defaults.go b/pkg/apis/componentconfig/v1alpha1/defaults.go index 0ce963f9263..c7544f304ee 100644 --- a/pkg/apis/componentconfig/v1alpha1/defaults.go +++ b/pkg/apis/componentconfig/v1alpha1/defaults.go @@ -19,8 +19,10 @@ package v1alpha1 import ( "time" + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/kubelet/qos" + "k8s.io/kubernetes/pkg/master/ports" "k8s.io/kubernetes/pkg/runtime" ) @@ -44,5 +46,37 @@ func addDefaultingFuncs(scheme *runtime.Scheme) { obj.IPTablesSyncPeriod = unversioned.Duration{5 * time.Second} } }, + func(obj *KubeSchedulerConfiguration) { + if obj.Port == 0 { + obj.Port = ports.SchedulerPort + } + if obj.Address == "" { + obj.Address = "0.0.0.0" + } + if obj.AlgorithmProvider == "" { + obj.AlgorithmProvider = "DefaultProvider" + } + if obj.KubeAPIQPS == 0 { + obj.KubeAPIQPS = 50.0 + } + if obj.KubeAPIBurst == 0 { + obj.KubeAPIBurst = 100 + } + if obj.SchedulerName == "" { + obj.SchedulerName = api.DefaultSchedulerName + } + }, + func(obj *LeaderElectionConfiguration) { + zero := unversioned.Duration{} + if obj.LeaseDuration == zero { + obj.LeaseDuration = unversioned.Duration{15 * time.Second} + } + if obj.RenewDeadline == zero { + obj.RenewDeadline = unversioned.Duration{10 * time.Second} + } + if obj.RetryPeriod == zero { + obj.RetryPeriod = unversioned.Duration{2 * time.Second} + } + }, ) } diff --git a/pkg/apis/componentconfig/v1alpha1/register.go b/pkg/apis/componentconfig/v1alpha1/register.go index ab0bdd5fa8f..4510fac9263 100644 --- a/pkg/apis/componentconfig/v1alpha1/register.go +++ b/pkg/apis/componentconfig/v1alpha1/register.go @@ -35,7 +35,9 @@ func AddToScheme(scheme *runtime.Scheme) { func addKnownTypes(scheme *runtime.Scheme) { scheme.AddKnownTypes(SchemeGroupVersion, &KubeProxyConfiguration{}, + &KubeSchedulerConfiguration{}, ) } -func (obj *KubeProxyConfiguration) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *KubeProxyConfiguration) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *KubeSchedulerConfiguration) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/pkg/apis/componentconfig/v1alpha1/types.generated.go b/pkg/apis/componentconfig/v1alpha1/types.generated.go index 0d426891cc1..1326d7526be 100644 --- a/pkg/apis/componentconfig/v1alpha1/types.generated.go +++ b/pkg/apis/componentconfig/v1alpha1/types.generated.go @@ -1022,3 +1022,1006 @@ func (x *ProxyMode) CodecDecodeSelf(d *codec1978.Decoder) { *((*string)(x)) = r.DecodeString() } } + +func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym108 := z.EncBinary() + _ = yym108 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep109 := !z.EncBinary() + yy2arr109 := z.EncBasicHandle().StructToArray + var yyq109 [11]bool + _, _, _ = yysep109, yyq109, yy2arr109 + const yyr109 bool = false + yyq109[0] = x.Kind != "" + yyq109[1] = x.APIVersion != "" + var yynn109 int + if yyr109 || yy2arr109 { + r.EncodeArrayStart(11) + } else { + yynn109 = 9 + for _, b := range yyq109 { + if b { + yynn109++ + } + } + r.EncodeMapStart(yynn109) + yynn109 = 0 + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq109[0] { + yym111 := z.EncBinary() + _ = yym111 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq109[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym112 := z.EncBinary() + _ = yym112 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq109[1] { + yym114 := z.EncBinary() + _ = yym114 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq109[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym115 := z.EncBinary() + _ = yym115 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym117 := z.EncBinary() + _ = yym117 + if false { + } else { + r.EncodeInt(int64(x.Port)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("port")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym118 := z.EncBinary() + _ = yym118 + if false { + } else { + r.EncodeInt(int64(x.Port)) + } + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym120 := z.EncBinary() + _ = yym120 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Address)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("address")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym121 := z.EncBinary() + _ = yym121 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Address)) + } + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym123 := z.EncBinary() + _ = yym123 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.AlgorithmProvider)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("algorithmProvider")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym124 := z.EncBinary() + _ = yym124 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.AlgorithmProvider)) + } + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym126 := z.EncBinary() + _ = yym126 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PolicyConfigFile)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("policyConfigFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym127 := z.EncBinary() + _ = yym127 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PolicyConfigFile)) + } + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.EnableProfiling == nil { + r.EncodeNil() + } else { + yy129 := *x.EnableProfiling + yym130 := z.EncBinary() + _ = yym130 + if false { + } else { + r.EncodeBool(bool(yy129)) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("enableProfiling")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.EnableProfiling == nil { + r.EncodeNil() + } else { + yy131 := *x.EnableProfiling + yym132 := z.EncBinary() + _ = yym132 + if false { + } else { + r.EncodeBool(bool(yy131)) + } + } + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym134 := z.EncBinary() + _ = yym134 + if false { + } else { + r.EncodeFloat32(float32(x.KubeAPIQPS)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeAPIQPS")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym135 := z.EncBinary() + _ = yym135 + if false { + } else { + r.EncodeFloat32(float32(x.KubeAPIQPS)) + } + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym137 := z.EncBinary() + _ = yym137 + if false { + } else { + r.EncodeInt(int64(x.KubeAPIBurst)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeAPIBurst")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym138 := z.EncBinary() + _ = yym138 + if false { + } else { + r.EncodeInt(int64(x.KubeAPIBurst)) + } + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym140 := z.EncBinary() + _ = yym140 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SchedulerName)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("schedulerName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym141 := z.EncBinary() + _ = yym141 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SchedulerName)) + } + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy143 := &x.LeaderElection + yy143.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("leaderElection")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy144 := &x.LeaderElection + yy144.CodecEncodeSelf(e) + } + if yyr109 || yy2arr109 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *KubeSchedulerConfiguration) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym145 := z.DecBinary() + _ = yym145 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct146 := r.ContainerType() + if yyct146 == codecSelferValueTypeMap1234 { + yyl146 := r.ReadMapStart() + if yyl146 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl146, d) + } + } else if yyct146 == codecSelferValueTypeArray1234 { + yyl146 := r.ReadArrayStart() + if yyl146 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl146, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *KubeSchedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys147Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys147Slc + var yyhl147 bool = l >= 0 + for yyj147 := 0; ; yyj147++ { + if yyhl147 { + if yyj147 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys147Slc = r.DecodeBytes(yys147Slc, true, true) + yys147 := string(yys147Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys147 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + case "port": + if r.TryDecodeAsNil() { + x.Port = 0 + } else { + x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "address": + if r.TryDecodeAsNil() { + x.Address = "" + } else { + x.Address = string(r.DecodeString()) + } + case "algorithmProvider": + if r.TryDecodeAsNil() { + x.AlgorithmProvider = "" + } else { + x.AlgorithmProvider = string(r.DecodeString()) + } + case "policyConfigFile": + if r.TryDecodeAsNil() { + x.PolicyConfigFile = "" + } else { + x.PolicyConfigFile = string(r.DecodeString()) + } + case "enableProfiling": + if r.TryDecodeAsNil() { + if x.EnableProfiling != nil { + x.EnableProfiling = nil + } + } else { + if x.EnableProfiling == nil { + x.EnableProfiling = new(bool) + } + yym155 := z.DecBinary() + _ = yym155 + if false { + } else { + *((*bool)(x.EnableProfiling)) = r.DecodeBool() + } + } + case "kubeAPIQPS": + if r.TryDecodeAsNil() { + x.KubeAPIQPS = 0 + } else { + x.KubeAPIQPS = float32(r.DecodeFloat(true)) + } + case "kubeAPIBurst": + if r.TryDecodeAsNil() { + x.KubeAPIBurst = 0 + } else { + x.KubeAPIBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "schedulerName": + if r.TryDecodeAsNil() { + x.SchedulerName = "" + } else { + x.SchedulerName = string(r.DecodeString()) + } + case "leaderElection": + if r.TryDecodeAsNil() { + x.LeaderElection = LeaderElectionConfiguration{} + } else { + yyv159 := &x.LeaderElection + yyv159.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys147) + } // end switch yys147 + } // end for yyj147 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj160 int + var yyb160 bool + var yyhl160 bool = l >= 0 + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Port = 0 + } else { + x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Address = "" + } else { + x.Address = string(r.DecodeString()) + } + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.AlgorithmProvider = "" + } else { + x.AlgorithmProvider = string(r.DecodeString()) + } + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PolicyConfigFile = "" + } else { + x.PolicyConfigFile = string(r.DecodeString()) + } + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.EnableProfiling != nil { + x.EnableProfiling = nil + } + } else { + if x.EnableProfiling == nil { + x.EnableProfiling = new(bool) + } + yym168 := z.DecBinary() + _ = yym168 + if false { + } else { + *((*bool)(x.EnableProfiling)) = r.DecodeBool() + } + } + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.KubeAPIQPS = 0 + } else { + x.KubeAPIQPS = float32(r.DecodeFloat(true)) + } + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.KubeAPIBurst = 0 + } else { + x.KubeAPIBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SchedulerName = "" + } else { + x.SchedulerName = string(r.DecodeString()) + } + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.LeaderElection = LeaderElectionConfiguration{} + } else { + yyv172 := &x.LeaderElection + yyv172.CodecDecodeSelf(d) + } + for { + yyj160++ + if yyhl160 { + yyb160 = yyj160 > l + } else { + yyb160 = r.CheckBreak() + } + if yyb160 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj160-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *LeaderElectionConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym173 := z.EncBinary() + _ = yym173 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep174 := !z.EncBinary() + yy2arr174 := z.EncBasicHandle().StructToArray + var yyq174 [4]bool + _, _, _ = yysep174, yyq174, yy2arr174 + const yyr174 bool = false + var yynn174 int + if yyr174 || yy2arr174 { + r.EncodeArrayStart(4) + } else { + yynn174 = 4 + for _, b := range yyq174 { + if b { + yynn174++ + } + } + r.EncodeMapStart(yynn174) + yynn174 = 0 + } + if yyr174 || yy2arr174 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.LeaderElect == nil { + r.EncodeNil() + } else { + yy176 := *x.LeaderElect + yym177 := z.EncBinary() + _ = yym177 + if false { + } else { + r.EncodeBool(bool(yy176)) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("leaderElect")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.LeaderElect == nil { + r.EncodeNil() + } else { + yy178 := *x.LeaderElect + yym179 := z.EncBinary() + _ = yym179 + if false { + } else { + r.EncodeBool(bool(yy178)) + } + } + } + if yyr174 || yy2arr174 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy181 := &x.LeaseDuration + yym182 := z.EncBinary() + _ = yym182 + if false { + } else if z.HasExtensions() && z.EncExt(yy181) { + } else if !yym182 && z.IsJSONHandle() { + z.EncJSONMarshal(yy181) + } else { + z.EncFallback(yy181) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("leaseDuration")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy183 := &x.LeaseDuration + yym184 := z.EncBinary() + _ = yym184 + if false { + } else if z.HasExtensions() && z.EncExt(yy183) { + } else if !yym184 && z.IsJSONHandle() { + z.EncJSONMarshal(yy183) + } else { + z.EncFallback(yy183) + } + } + if yyr174 || yy2arr174 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy186 := &x.RenewDeadline + yym187 := z.EncBinary() + _ = yym187 + if false { + } else if z.HasExtensions() && z.EncExt(yy186) { + } else if !yym187 && z.IsJSONHandle() { + z.EncJSONMarshal(yy186) + } else { + z.EncFallback(yy186) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("renewDeadline")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy188 := &x.RenewDeadline + yym189 := z.EncBinary() + _ = yym189 + if false { + } else if z.HasExtensions() && z.EncExt(yy188) { + } else if !yym189 && z.IsJSONHandle() { + z.EncJSONMarshal(yy188) + } else { + z.EncFallback(yy188) + } + } + if yyr174 || yy2arr174 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy191 := &x.RetryPeriod + yym192 := z.EncBinary() + _ = yym192 + if false { + } else if z.HasExtensions() && z.EncExt(yy191) { + } else if !yym192 && z.IsJSONHandle() { + z.EncJSONMarshal(yy191) + } else { + z.EncFallback(yy191) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("retryPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy193 := &x.RetryPeriod + yym194 := z.EncBinary() + _ = yym194 + if false { + } else if z.HasExtensions() && z.EncExt(yy193) { + } else if !yym194 && z.IsJSONHandle() { + z.EncJSONMarshal(yy193) + } else { + z.EncFallback(yy193) + } + } + if yyr174 || yy2arr174 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *LeaderElectionConfiguration) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym195 := z.DecBinary() + _ = yym195 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct196 := r.ContainerType() + if yyct196 == codecSelferValueTypeMap1234 { + yyl196 := r.ReadMapStart() + if yyl196 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl196, d) + } + } else if yyct196 == codecSelferValueTypeArray1234 { + yyl196 := r.ReadArrayStart() + if yyl196 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl196, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *LeaderElectionConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys197Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys197Slc + var yyhl197 bool = l >= 0 + for yyj197 := 0; ; yyj197++ { + if yyhl197 { + if yyj197 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys197Slc = r.DecodeBytes(yys197Slc, true, true) + yys197 := string(yys197Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys197 { + case "leaderElect": + if r.TryDecodeAsNil() { + if x.LeaderElect != nil { + x.LeaderElect = nil + } + } else { + if x.LeaderElect == nil { + x.LeaderElect = new(bool) + } + yym199 := z.DecBinary() + _ = yym199 + if false { + } else { + *((*bool)(x.LeaderElect)) = r.DecodeBool() + } + } + case "leaseDuration": + if r.TryDecodeAsNil() { + x.LeaseDuration = pkg1_unversioned.Duration{} + } else { + yyv200 := &x.LeaseDuration + yym201 := z.DecBinary() + _ = yym201 + if false { + } else if z.HasExtensions() && z.DecExt(yyv200) { + } else if !yym201 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv200) + } else { + z.DecFallback(yyv200, false) + } + } + case "renewDeadline": + if r.TryDecodeAsNil() { + x.RenewDeadline = pkg1_unversioned.Duration{} + } else { + yyv202 := &x.RenewDeadline + yym203 := z.DecBinary() + _ = yym203 + if false { + } else if z.HasExtensions() && z.DecExt(yyv202) { + } else if !yym203 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv202) + } else { + z.DecFallback(yyv202, false) + } + } + case "retryPeriod": + if r.TryDecodeAsNil() { + x.RetryPeriod = pkg1_unversioned.Duration{} + } else { + yyv204 := &x.RetryPeriod + yym205 := z.DecBinary() + _ = yym205 + if false { + } else if z.HasExtensions() && z.DecExt(yyv204) { + } else if !yym205 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv204) + } else { + z.DecFallback(yyv204, false) + } + } + default: + z.DecStructFieldNotFound(-1, yys197) + } // end switch yys197 + } // end for yyj197 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *LeaderElectionConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj206 int + var yyb206 bool + var yyhl206 bool = l >= 0 + yyj206++ + if yyhl206 { + yyb206 = yyj206 > l + } else { + yyb206 = r.CheckBreak() + } + if yyb206 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.LeaderElect != nil { + x.LeaderElect = nil + } + } else { + if x.LeaderElect == nil { + x.LeaderElect = new(bool) + } + yym208 := z.DecBinary() + _ = yym208 + if false { + } else { + *((*bool)(x.LeaderElect)) = r.DecodeBool() + } + } + yyj206++ + if yyhl206 { + yyb206 = yyj206 > l + } else { + yyb206 = r.CheckBreak() + } + if yyb206 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.LeaseDuration = pkg1_unversioned.Duration{} + } else { + yyv209 := &x.LeaseDuration + yym210 := z.DecBinary() + _ = yym210 + if false { + } else if z.HasExtensions() && z.DecExt(yyv209) { + } else if !yym210 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv209) + } else { + z.DecFallback(yyv209, false) + } + } + yyj206++ + if yyhl206 { + yyb206 = yyj206 > l + } else { + yyb206 = r.CheckBreak() + } + if yyb206 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RenewDeadline = pkg1_unversioned.Duration{} + } else { + yyv211 := &x.RenewDeadline + yym212 := z.DecBinary() + _ = yym212 + if false { + } else if z.HasExtensions() && z.DecExt(yyv211) { + } else if !yym212 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv211) + } else { + z.DecFallback(yyv211, false) + } + } + yyj206++ + if yyhl206 { + yyb206 = yyj206 > l + } else { + yyb206 = r.CheckBreak() + } + if yyb206 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RetryPeriod = pkg1_unversioned.Duration{} + } else { + yyv213 := &x.RetryPeriod + yym214 := z.DecBinary() + _ = yym214 + if false { + } else if z.HasExtensions() && z.DecExt(yyv213) { + } else if !yym214 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv213) + } else { + z.DecFallback(yyv213, false) + } + } + for { + yyj206++ + if yyhl206 { + yyb206 = yyj206 > l + } else { + yyb206 = r.CheckBreak() + } + if yyb206 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj206-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} diff --git a/pkg/apis/componentconfig/v1alpha1/types.go b/pkg/apis/componentconfig/v1alpha1/types.go index 9da97f84ed9..47cab1ec409 100644 --- a/pkg/apis/componentconfig/v1alpha1/types.go +++ b/pkg/apis/componentconfig/v1alpha1/types.go @@ -74,3 +74,53 @@ const ( ProxyModeUserspace ProxyMode = "userspace" ProxyModeIPTables ProxyMode = "iptables" ) + +type KubeSchedulerConfiguration struct { + unversioned.TypeMeta + + // port is the port that the scheduler's http service runs on. + Port int `json:"port"` + // address is the IP address to serve on. + Address string `json:"address"` + // algorithmProvider is the scheduling algorithm provider to use. + AlgorithmProvider string `json:"algorithmProvider"` + // policyConfigFile is the filepath to the scheduler policy configuration. + PolicyConfigFile string `json:"policyConfigFile"` + // enableProfiling enables profiling via web interface. + EnableProfiling *bool `json:"enableProfiling"` + // kubeAPIQPS is the QPS to use while talking with kubernetes apiserver. + KubeAPIQPS float32 `json:"kubeAPIQPS"` + // kubeAPIBurst is the QPS burst to use while talking with kubernetes apiserver. + KubeAPIBurst int `json:"kubeAPIBurst"` + // schedulerName is name of the scheduler, used to select which pods + // will be processed by this scheduler, based on pod's annotation with + // key 'scheduler.alpha.kubernetes.io/name'. + SchedulerName string `json:"schedulerName"` + // leaderElection defines the configuration of leader election client. + LeaderElection LeaderElectionConfiguration `json:"leaderElection"` +} + +// LeaderElectionConfiguration defines the configuration of leader election +// clients for components that can run with leader election enabled. +type LeaderElectionConfiguration struct { + // leaderElect enables a leader election client to gain leadership + // before executing the main loop. Enable this when running replicated + // components for high availability. + LeaderElect *bool `json:"leaderElect"` + // leaseDuration is the duration that non-leader candidates will wait + // after observing a leadership renewal until attempting to acquire + // leadership of a led but unrenewed leader slot. This is effectively the + // maximum duration that a leader can be stopped before it is replaced + // by another candidate. This is only applicable if leader election is + // enabled. + LeaseDuration unversioned.Duration `json:"leaseDuration"` + // renewDeadline is the interval between attempts by the acting master to + // renew a leadership slot before it stops leading. This must be less + // than or equal to the lease duration. This is only applicable if leader + // election is enabled. + RenewDeadline unversioned.Duration `json:"renewDeadline"` + // retryPeriod is the duration the clients should wait between attempting + // acquisition and renewal of a leadership. This is only applicable if + // leader election is enabled. + RetryPeriod unversioned.Duration `json:"retryPeriod"` +} diff --git a/plugin/cmd/kube-scheduler/app/options/options.go b/plugin/cmd/kube-scheduler/app/options/options.go index 4975d60d679..9696fe03bd8 100644 --- a/plugin/cmd/kube-scheduler/app/options/options.go +++ b/plugin/cmd/kube-scheduler/app/options/options.go @@ -20,8 +20,8 @@ package options import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/componentconfig" + "k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1" "k8s.io/kubernetes/pkg/client/leaderelection" - "k8s.io/kubernetes/pkg/master/ports" "k8s.io/kubernetes/plugin/pkg/scheduler/factory" "github.com/spf13/pflag" @@ -40,16 +40,10 @@ type SchedulerServer struct { // NewSchedulerServer creates a new SchedulerServer with default parameters func NewSchedulerServer() *SchedulerServer { + config := componentconfig.KubeSchedulerConfiguration{} + api.Scheme.Convert(&v1alpha1.KubeSchedulerConfiguration{}, &config) s := SchedulerServer{ - KubeSchedulerConfiguration: componentconfig.KubeSchedulerConfiguration{ - Port: ports.SchedulerPort, - Address: "0.0.0.0", - AlgorithmProvider: factory.DefaultProvider, - KubeAPIQPS: 50.0, - KubeAPIBurst: 100, - SchedulerName: api.DefaultSchedulerName, - LeaderElection: leaderelection.DefaultLeaderElectionConfiguration(), - }, + KubeSchedulerConfiguration: config, } return &s }