mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #38871 from k82cn/k8s_25318
Automatic merge from submit-queue Made multi-scheduler graduated to Beta and then v1. fixes #25318
This commit is contained in:
commit
05c2a0825e
@ -37534,6 +37534,10 @@
|
||||
"description": "Restart policy for all containers within the pod. One of Always, OnFailure, Never. Default to Always. More info: http://kubernetes.io/docs/user-guide/pod-states#restartpolicy",
|
||||
"type": "string"
|
||||
},
|
||||
"schedulername": {
|
||||
"description": "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.",
|
||||
"type": "string"
|
||||
},
|
||||
"securityContext": {
|
||||
"description": "SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty. See type description for default values of each field.",
|
||||
"$ref": "#/definitions/v1.PodSecurityContext"
|
||||
|
@ -1353,6 +1353,10 @@
|
||||
"affinity": {
|
||||
"$ref": "v1.Affinity",
|
||||
"description": "If specified, the pod's scheduling constraints"
|
||||
},
|
||||
"schedulername": {
|
||||
"type": "string",
|
||||
"description": "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1358,6 +1358,10 @@
|
||||
"affinity": {
|
||||
"$ref": "v1.Affinity",
|
||||
"description": "If specified, the pod's scheduling constraints"
|
||||
},
|
||||
"schedulername": {
|
||||
"type": "string",
|
||||
"description": "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -7730,6 +7730,10 @@
|
||||
"affinity": {
|
||||
"$ref": "v1.Affinity",
|
||||
"description": "If specified, the pod's scheduling constraints"
|
||||
},
|
||||
"schedulername": {
|
||||
"type": "string",
|
||||
"description": "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -18272,6 +18272,10 @@
|
||||
"affinity": {
|
||||
"$ref": "v1.Affinity",
|
||||
"description": "If specified, the pod's scheduling constraints"
|
||||
},
|
||||
"schedulername": {
|
||||
"type": "string",
|
||||
"description": "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -4511,6 +4511,13 @@ The StatefulSet guarantees that a given network identity will always map to the
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_affinity">v1.Affinity</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">schedulername</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -4960,7 +4967,7 @@ Examples:<br>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2017-01-06 18:13:59 UTC
|
||||
Last updated 2017-01-18 15:32:06 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -4498,6 +4498,13 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_affinity">v1.Affinity</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">schedulername</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -4892,7 +4899,7 @@ Examples:<br>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2017-01-06 18:14:24 UTC
|
||||
Last updated 2017-01-18 15:32:28 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -4124,6 +4124,13 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_affinity">v1.Affinity</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">schedulername</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -7509,7 +7516,7 @@ Both these may change in the future. Incoming requests are matched against the h
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2017-01-11 19:09:46 UTC
|
||||
Last updated 2017-01-18 15:32:45 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -4762,6 +4762,13 @@ The resulting set of endpoints can be viewed as:<br>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_affinity">v1.Affinity</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">schedulername</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -9136,7 +9143,7 @@ Examples:<br>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2017-01-06 18:13:51 UTC
|
||||
Last updated 2017-01-18 15:31:58 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -11313,6 +11313,10 @@
|
||||
"description": "Restart policy for all containers within the pod. One of Always, OnFailure, Never. Default to Always. More info: http://kubernetes.io/docs/user-guide/pod-states#restartpolicy",
|
||||
"type": "string"
|
||||
},
|
||||
"schedulername": {
|
||||
"description": "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.",
|
||||
"type": "string"
|
||||
},
|
||||
"securityContext": {
|
||||
"description": "SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty. See type description for default values of each field.",
|
||||
"$ref": "#/definitions/v1.PodSecurityContext"
|
||||
|
@ -366,6 +366,7 @@ func TestEncodePtr(t *testing.T) {
|
||||
TerminationGracePeriodSeconds: &grace,
|
||||
|
||||
SecurityContext: &api.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
}
|
||||
obj := runtime.Object(pod)
|
||||
|
@ -134,6 +134,9 @@ func FuzzerFor(t *testing.T, version schema.GroupVersion, src rand.Source) *fuzz
|
||||
if s.Affinity == nil {
|
||||
s.Affinity = new(api.Affinity)
|
||||
}
|
||||
if s.SchedulerName == "" {
|
||||
s.SchedulerName = api.DefaultSchedulerName
|
||||
}
|
||||
},
|
||||
func(j *api.PodPhase, c fuzz.Continue) {
|
||||
statuses := []api.PodPhase{api.PodPending, api.PodRunning, api.PodFailed, api.PodUnknown}
|
||||
|
@ -29,6 +29,7 @@ func DeepEqualSafePodSpec() api.PodSpec {
|
||||
DNSPolicy: api.DNSClusterFirst,
|
||||
TerminationGracePeriodSeconds: &grace,
|
||||
SecurityContext: &api.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1856,6 +1856,10 @@ type PodSpec struct {
|
||||
// If specified, the pod's scheduling constraints
|
||||
// +optional
|
||||
Affinity *Affinity
|
||||
// If specified, the pod will be dispatched by specified scheduler.
|
||||
// If not specified, the pod will be dispatched by default scheduler.
|
||||
// +optional
|
||||
SchedulerName string
|
||||
}
|
||||
|
||||
// Sysctl defines a kernel parameter to be set
|
||||
|
@ -174,6 +174,9 @@ func SetDefaults_PodSpec(obj *PodSpec) {
|
||||
period := int64(DefaultTerminationGracePeriodSeconds)
|
||||
obj.TerminationGracePeriodSeconds = &period
|
||||
}
|
||||
if obj.SchedulerName == "" {
|
||||
obj.SchedulerName = DefaultSchedulerName
|
||||
}
|
||||
}
|
||||
func SetDefaults_Probe(obj *Probe) {
|
||||
if obj.TimeoutSeconds == 0 {
|
||||
|
@ -807,3 +807,12 @@ func TestSetDefaultProbe(t *testing.T) {
|
||||
t.Errorf("Expected probe: %+v\ngot: %+v\n", expectedProbe, actualProbe)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetDefaultSchedulerName(t *testing.T) {
|
||||
pod := &v1.Pod{}
|
||||
|
||||
output := roundTrip(t, runtime.Object(pod)).(*v1.Pod)
|
||||
if output.Spec.SchedulerName != v1.DefaultSchedulerName {
|
||||
t.Errorf("Expected scheduler name: %+v\ngot: %+v\n", v1.DefaultSchedulerName, output.Spec.SchedulerName)
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2553,6 +2553,11 @@ message PodSpec {
|
||||
// If specified, the pod's scheduling constraints
|
||||
// +optional
|
||||
optional Affinity affinity = 18;
|
||||
|
||||
// If specified, the pod will be dispatched by specified scheduler.
|
||||
// If not specified, the pod will be dispatched by default scheduler.
|
||||
// +optional
|
||||
optional string schedulername = 19;
|
||||
}
|
||||
|
||||
// PodStatus represents information about the status of a pod. Status may trail the actual
|
||||
|
@ -29772,7 +29772,7 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
} else {
|
||||
yysep2 := !z.EncBinary()
|
||||
yy2arr2 := z.EncBasicHandle().StructToArray
|
||||
var yyq2 [18]bool
|
||||
var yyq2 [19]bool
|
||||
_, _, _ = yysep2, yyq2, yy2arr2
|
||||
const yyr2 bool = false
|
||||
yyq2[0] = len(x.Volumes) != 0
|
||||
@ -29792,9 +29792,10 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
yyq2[15] = x.Hostname != ""
|
||||
yyq2[16] = x.Subdomain != ""
|
||||
yyq2[17] = x.Affinity != nil
|
||||
yyq2[18] = x.SchedulerName != ""
|
||||
var yynn2 int
|
||||
if yyr2 || yy2arr2 {
|
||||
r.EncodeArrayStart(18)
|
||||
r.EncodeArrayStart(19)
|
||||
} else {
|
||||
yynn2 = 1
|
||||
for _, b := range yyq2 {
|
||||
@ -30277,6 +30278,31 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if yyq2[18] {
|
||||
yym62 := z.EncBinary()
|
||||
_ = yym62
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.SchedulerName))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
}
|
||||
} else {
|
||||
if yyq2[18] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("schedulername"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
yym63 := z.EncBinary()
|
||||
_ = yym63
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.SchedulerName))
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
} else {
|
||||
@ -30550,6 +30576,18 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
x.Affinity.CodecDecodeSelf(d)
|
||||
}
|
||||
case "schedulername":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.SchedulerName = ""
|
||||
} else {
|
||||
yyv36 := &x.SchedulerName
|
||||
yym37 := z.DecBinary()
|
||||
_ = yym37
|
||||
if false {
|
||||
} else {
|
||||
*((*string)(yyv36)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
default:
|
||||
z.DecStructFieldNotFound(-1, yys3)
|
||||
} // end switch yys3
|
||||
@ -30561,16 +30599,16 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj36 int
|
||||
var yyb36 bool
|
||||
var yyhl36 bool = l >= 0
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
var yyj38 int
|
||||
var yyb38 bool
|
||||
var yyhl38 bool = l >= 0
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30578,21 +30616,21 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Volumes = nil
|
||||
} else {
|
||||
yyv37 := &x.Volumes
|
||||
yym38 := z.DecBinary()
|
||||
_ = yym38
|
||||
yyv39 := &x.Volumes
|
||||
yym40 := z.DecBinary()
|
||||
_ = yym40
|
||||
if false {
|
||||
} else {
|
||||
h.decSliceVolume((*[]Volume)(yyv37), d)
|
||||
h.decSliceVolume((*[]Volume)(yyv39), d)
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30600,21 +30638,21 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Containers = nil
|
||||
} else {
|
||||
yyv39 := &x.Containers
|
||||
yym40 := z.DecBinary()
|
||||
_ = yym40
|
||||
yyv41 := &x.Containers
|
||||
yym42 := z.DecBinary()
|
||||
_ = yym42
|
||||
if false {
|
||||
} else {
|
||||
h.decSliceContainer((*[]Container)(yyv39), d)
|
||||
h.decSliceContainer((*[]Container)(yyv41), d)
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30622,16 +30660,16 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.RestartPolicy = ""
|
||||
} else {
|
||||
yyv41 := &x.RestartPolicy
|
||||
yyv41.CodecDecodeSelf(d)
|
||||
yyv43 := &x.RestartPolicy
|
||||
yyv43.CodecDecodeSelf(d)
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30644,20 +30682,20 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if x.TerminationGracePeriodSeconds == nil {
|
||||
x.TerminationGracePeriodSeconds = new(int64)
|
||||
}
|
||||
yym43 := z.DecBinary()
|
||||
_ = yym43
|
||||
yym45 := z.DecBinary()
|
||||
_ = yym45
|
||||
if false {
|
||||
} else {
|
||||
*((*int64)(x.TerminationGracePeriodSeconds)) = int64(r.DecodeInt(64))
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30670,20 +30708,20 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if x.ActiveDeadlineSeconds == nil {
|
||||
x.ActiveDeadlineSeconds = new(int64)
|
||||
}
|
||||
yym45 := z.DecBinary()
|
||||
_ = yym45
|
||||
yym47 := z.DecBinary()
|
||||
_ = yym47
|
||||
if false {
|
||||
} else {
|
||||
*((*int64)(x.ActiveDeadlineSeconds)) = int64(r.DecodeInt(64))
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30691,16 +30729,16 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.DNSPolicy = ""
|
||||
} else {
|
||||
yyv46 := &x.DNSPolicy
|
||||
yyv46.CodecDecodeSelf(d)
|
||||
yyv48 := &x.DNSPolicy
|
||||
yyv48.CodecDecodeSelf(d)
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30708,21 +30746,21 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.NodeSelector = nil
|
||||
} else {
|
||||
yyv47 := &x.NodeSelector
|
||||
yym48 := z.DecBinary()
|
||||
_ = yym48
|
||||
yyv49 := &x.NodeSelector
|
||||
yym50 := z.DecBinary()
|
||||
_ = yym50
|
||||
if false {
|
||||
} else {
|
||||
z.F.DecMapStringStringX(yyv47, false, d)
|
||||
z.F.DecMapStringStringX(yyv49, false, d)
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30730,29 +30768,7 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ServiceAccountName = ""
|
||||
} else {
|
||||
yyv49 := &x.ServiceAccountName
|
||||
yym50 := z.DecBinary()
|
||||
_ = yym50
|
||||
if false {
|
||||
} else {
|
||||
*((*string)(yyv49)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.DeprecatedServiceAccount = ""
|
||||
} else {
|
||||
yyv51 := &x.DeprecatedServiceAccount
|
||||
yyv51 := &x.ServiceAccountName
|
||||
yym52 := z.DecBinary()
|
||||
_ = yym52
|
||||
if false {
|
||||
@ -30760,21 +30776,21 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
*((*string)(yyv51)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.NodeName = ""
|
||||
x.DeprecatedServiceAccount = ""
|
||||
} else {
|
||||
yyv53 := &x.NodeName
|
||||
yyv53 := &x.DeprecatedServiceAccount
|
||||
yym54 := z.DecBinary()
|
||||
_ = yym54
|
||||
if false {
|
||||
@ -30782,13 +30798,35 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
*((*string)(yyv53)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.NodeName = ""
|
||||
} else {
|
||||
yyv55 := &x.NodeName
|
||||
yym56 := z.DecBinary()
|
||||
_ = yym56
|
||||
if false {
|
||||
} else {
|
||||
*((*string)(yyv55)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30796,29 +30834,7 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.HostNetwork = false
|
||||
} else {
|
||||
yyv55 := &x.HostNetwork
|
||||
yym56 := z.DecBinary()
|
||||
_ = yym56
|
||||
if false {
|
||||
} else {
|
||||
*((*bool)(yyv55)) = r.DecodeBool()
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.HostPID = false
|
||||
} else {
|
||||
yyv57 := &x.HostPID
|
||||
yyv57 := &x.HostNetwork
|
||||
yym58 := z.DecBinary()
|
||||
_ = yym58
|
||||
if false {
|
||||
@ -30826,21 +30842,21 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
*((*bool)(yyv57)) = r.DecodeBool()
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.HostIPC = false
|
||||
x.HostPID = false
|
||||
} else {
|
||||
yyv59 := &x.HostIPC
|
||||
yyv59 := &x.HostPID
|
||||
yym60 := z.DecBinary()
|
||||
_ = yym60
|
||||
if false {
|
||||
@ -30848,13 +30864,35 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
*((*bool)(yyv59)) = r.DecodeBool()
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.HostIPC = false
|
||||
} else {
|
||||
yyv61 := &x.HostIPC
|
||||
yym62 := z.DecBinary()
|
||||
_ = yym62
|
||||
if false {
|
||||
} else {
|
||||
*((*bool)(yyv61)) = r.DecodeBool()
|
||||
}
|
||||
}
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30869,13 +30907,13 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
x.SecurityContext.CodecDecodeSelf(d)
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30883,21 +30921,21 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ImagePullSecrets = nil
|
||||
} else {
|
||||
yyv62 := &x.ImagePullSecrets
|
||||
yym63 := z.DecBinary()
|
||||
_ = yym63
|
||||
yyv64 := &x.ImagePullSecrets
|
||||
yym65 := z.DecBinary()
|
||||
_ = yym65
|
||||
if false {
|
||||
} else {
|
||||
h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv62), d)
|
||||
h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv64), d)
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30905,29 +30943,7 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Hostname = ""
|
||||
} else {
|
||||
yyv64 := &x.Hostname
|
||||
yym65 := z.DecBinary()
|
||||
_ = yym65
|
||||
if false {
|
||||
} else {
|
||||
*((*string)(yyv64)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Subdomain = ""
|
||||
} else {
|
||||
yyv66 := &x.Subdomain
|
||||
yyv66 := &x.Hostname
|
||||
yym67 := z.DecBinary()
|
||||
_ = yym67
|
||||
if false {
|
||||
@ -30935,13 +30951,35 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
*((*string)(yyv66)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb36 {
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Subdomain = ""
|
||||
} else {
|
||||
yyv68 := &x.Subdomain
|
||||
yym69 := z.DecBinary()
|
||||
_ = yym69
|
||||
if false {
|
||||
} else {
|
||||
*((*string)(yyv68)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -30956,18 +30994,40 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
x.Affinity.CodecDecodeSelf(d)
|
||||
}
|
||||
for {
|
||||
yyj36++
|
||||
if yyhl36 {
|
||||
yyb36 = yyj36 > l
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb38 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.SchedulerName = ""
|
||||
} else {
|
||||
yyv71 := &x.SchedulerName
|
||||
yym72 := z.DecBinary()
|
||||
_ = yym72
|
||||
if false {
|
||||
} else {
|
||||
yyb36 = r.CheckBreak()
|
||||
*((*string)(yyv71)) = r.DecodeString()
|
||||
}
|
||||
if yyb36 {
|
||||
}
|
||||
for {
|
||||
yyj38++
|
||||
if yyhl38 {
|
||||
yyb38 = yyj38 > l
|
||||
} else {
|
||||
yyb38 = r.CheckBreak()
|
||||
}
|
||||
if yyb38 {
|
||||
break
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
z.DecStructFieldNotFound(yyj36-1, "")
|
||||
z.DecStructFieldNotFound(yyj38-1, "")
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
@ -64225,7 +64285,7 @@ func (x codecSelfer1234) decSlicePod(v *[]Pod, d *codec1978.Decoder) {
|
||||
|
||||
yyrg1 := len(yyv1) > 0
|
||||
yyv21 := yyv1
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 688)
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 704)
|
||||
if yyrt1 {
|
||||
if yyrl1 <= cap(yyv1) {
|
||||
yyv1 = yyv1[:yyrl1]
|
||||
@ -64344,7 +64404,7 @@ func (x codecSelfer1234) decSlicePodTemplate(v *[]PodTemplate, d *codec1978.Deco
|
||||
|
||||
yyrg1 := len(yyv1) > 0
|
||||
yyv21 := yyv1
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 736)
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 752)
|
||||
if yyrt1 {
|
||||
if yyrl1 <= cap(yyv1) {
|
||||
yyv1 = yyv1[:yyrl1]
|
||||
|
@ -2140,6 +2140,10 @@ type PodSpec struct {
|
||||
// If specified, the pod's scheduling constraints
|
||||
// +optional
|
||||
Affinity *Affinity `json:"affinity,omitempty" protobuf:"bytes,18,opt,name=affinity"`
|
||||
// If specified, the pod will be dispatched by specified scheduler.
|
||||
// If not specified, the pod will be dispatched by default scheduler.
|
||||
// +optional
|
||||
SchedulerName string `json:"schedulername,omitempty" protobuf:"bytes,19,opt,name=schedulername"`
|
||||
}
|
||||
|
||||
// PodSecurityContext holds pod-level security attributes and common container settings.
|
||||
|
@ -1294,6 +1294,7 @@ var map_PodSpec = map[string]string{
|
||||
"hostname": "Specifies the hostname of the Pod If not specified, the pod's hostname will be set to a system-defined value.",
|
||||
"subdomain": "If specified, the fully qualified Pod hostname will be \"<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>\". If not specified, the pod will not have a domainname at all.",
|
||||
"affinity": "If specified, the pod's scheduling constraints",
|
||||
"schedulername": "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.",
|
||||
}
|
||||
|
||||
func (PodSpec) SwaggerDoc() map[string]string {
|
||||
|
@ -3069,6 +3069,7 @@ func autoConvert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conv
|
||||
out.Hostname = in.Hostname
|
||||
out.Subdomain = in.Subdomain
|
||||
out.Affinity = (*api.Affinity)(unsafe.Pointer(in.Affinity))
|
||||
out.SchedulerName = in.SchedulerName
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -3106,6 +3107,7 @@ func autoConvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conv
|
||||
out.Hostname = in.Hostname
|
||||
out.Subdomain = in.Subdomain
|
||||
out.Affinity = (*Affinity)(unsafe.Pointer(in.Affinity))
|
||||
out.SchedulerName = in.SchedulerName
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1679,7 +1679,7 @@ func (x codecSelfer1234) decSliceStatefulSet(v *[]StatefulSet, d *codec1978.Deco
|
||||
|
||||
yyrg1 := len(yyv1) > 0
|
||||
yyv21 := yyv1
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 808)
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 824)
|
||||
if yyrt1 {
|
||||
if yyrl1 <= cap(yyv1) {
|
||||
yyv1 = yyv1[:yyrl1]
|
||||
|
@ -2481,7 +2481,7 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) {
|
||||
|
||||
yyrg1 := len(yyv1) > 0
|
||||
yyv21 := yyv1
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 832)
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 848)
|
||||
if yyrt1 {
|
||||
if yyrl1 <= cap(yyv1) {
|
||||
yyv1 = yyv1[:yyrl1]
|
||||
|
@ -4534,7 +4534,7 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) {
|
||||
|
||||
yyrg1 := len(yyv1) > 0
|
||||
yyv21 := yyv1
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 832)
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 848)
|
||||
if yyrt1 {
|
||||
if yyrl1 <= cap(yyv1) {
|
||||
yyv1 = yyv1[:yyrl1]
|
||||
@ -4772,7 +4772,7 @@ func (x codecSelfer1234) decSliceCronJob(v *[]CronJob, d *codec1978.Decoder) {
|
||||
|
||||
yyrg1 := len(yyv1) > 0
|
||||
yyv21 := yyv1
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 1080)
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 1096)
|
||||
if yyrt1 {
|
||||
if yyrl1 <= cap(yyv1) {
|
||||
yyv1 = yyv1[:yyrl1]
|
||||
|
@ -561,8 +561,7 @@ type KubeSchedulerConfiguration struct {
|
||||
// kubeAPIBurst is the QPS burst to use while talking with kubernetes apiserver.
|
||||
KubeAPIBurst int32
|
||||
// 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'.
|
||||
// will be processed by this scheduler, based on pod's "spec.SchedulerName".
|
||||
SchedulerName string
|
||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||
|
@ -122,8 +122,7 @@ type KubeSchedulerConfiguration struct {
|
||||
// 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'.
|
||||
// will be processed by this scheduler, based on pod's "spec.SchedulerName".
|
||||
SchedulerName string `json:"schedulerName"`
|
||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||
|
@ -40,6 +40,7 @@ func TestSetDefaultDaemonSet(t *testing.T) {
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
TerminationGracePeriodSeconds: &period,
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: defaultLabels,
|
||||
@ -51,6 +52,7 @@ func TestSetDefaultDaemonSet(t *testing.T) {
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
TerminationGracePeriodSeconds: &period,
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
}
|
||||
tests := []struct {
|
||||
@ -155,6 +157,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
TerminationGracePeriodSeconds: &period,
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
}
|
||||
tests := []struct {
|
||||
|
@ -21093,7 +21093,7 @@ func (x codecSelfer1234) decSliceDeployment(v *[]Deployment, d *codec1978.Decode
|
||||
|
||||
yyrg1 := len(yyv1) > 0
|
||||
yyv21 := yyv1
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 872)
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 888)
|
||||
if yyrt1 {
|
||||
if yyrl1 <= cap(yyv1) {
|
||||
yyv1 = yyv1[:yyrl1]
|
||||
@ -21212,7 +21212,7 @@ func (x codecSelfer1234) decSliceDaemonSet(v *[]DaemonSet, d *codec1978.Decoder)
|
||||
|
||||
yyrg1 := len(yyv1) > 0
|
||||
yyv21 := yyv1
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 768)
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 784)
|
||||
if yyrt1 {
|
||||
if yyrl1 <= cap(yyv1) {
|
||||
yyv1 = yyv1[:yyrl1]
|
||||
@ -21926,7 +21926,7 @@ func (x codecSelfer1234) decSliceReplicaSet(v *[]ReplicaSet, d *codec1978.Decode
|
||||
|
||||
yyrg1 := len(yyv1) > 0
|
||||
yyv21 := yyv1
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 808)
|
||||
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 824)
|
||||
if yyrt1 {
|
||||
if yyrl1 <= cap(yyv1) {
|
||||
yyv1 = yyv1[:yyrl1]
|
||||
|
@ -6131,6 +6131,13 @@ var OpenAPIDefinitions *openapi.OpenAPIDefinitions = &openapi.OpenAPIDefinitions
|
||||
Ref: spec.MustCreateRef("#/definitions/v1.Affinity"),
|
||||
},
|
||||
},
|
||||
"schedulername": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"containers"},
|
||||
},
|
||||
@ -9659,7 +9666,7 @@ var OpenAPIDefinitions *openapi.OpenAPIDefinitions = &openapi.OpenAPIDefinitions
|
||||
},
|
||||
"schedulerName": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "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'.",
|
||||
Description: "schedulerName is name of the scheduler, used to select which pods will be processed by this scheduler, based on pod's \"spec.SchedulerName\".",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
|
@ -131,6 +131,7 @@ func TestMerge(t *testing.T) {
|
||||
DNSPolicy: api.DNSClusterFirst,
|
||||
TerminationGracePeriodSeconds: &grace,
|
||||
SecurityContext: &api.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -53,6 +53,7 @@ func TestDecodeSinglePod(t *testing.T) {
|
||||
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(),
|
||||
}},
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
}
|
||||
json, err := runtime.Encode(testapi.Default.Codec(), pod)
|
||||
@ -113,6 +114,7 @@ func TestDecodePodList(t *testing.T) {
|
||||
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(),
|
||||
}},
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
}
|
||||
podList := &v1.PodList{
|
||||
|
@ -188,6 +188,7 @@ func getTestCases(hostname types.NodeName) []*testCase {
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{{Name: "image", Image: "test/image", SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults()}},
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
Status: v1.PodStatus{
|
||||
Phase: v1.PodPending,
|
||||
@ -213,6 +214,7 @@ func getTestCases(hostname types.NodeName) []*testCase {
|
||||
ImagePullPolicy: "Always",
|
||||
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults()}},
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
Status: v1.PodStatus{
|
||||
Phase: v1.PodPending,
|
||||
|
@ -147,6 +147,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
||||
NodeName: string(nodeName),
|
||||
Containers: []v1.Container{{Name: "1", Image: "foo", ImagePullPolicy: v1.PullAlways}},
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
Status: v1.PodStatus{
|
||||
Phase: v1.PodPending,
|
||||
@ -168,6 +169,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
||||
DNSPolicy: v1.DNSClusterFirst,
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
TerminationGracePeriodSeconds: &grace,
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
|
||||
Containers: []v1.Container{{
|
||||
Name: "1",
|
||||
@ -198,6 +200,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
||||
NodeName: nodeName,
|
||||
Containers: []v1.Container{{Name: "1", Image: "foo", ImagePullPolicy: v1.PullAlways}},
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
Status: v1.PodStatus{
|
||||
Phase: v1.PodPending,
|
||||
@ -212,6 +215,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
||||
NodeName: nodeName,
|
||||
Containers: []v1.Container{{Name: "2", Image: "bar:bartag", ImagePullPolicy: ""}},
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
Status: v1.PodStatus{
|
||||
Phase: v1.PodPending,
|
||||
@ -235,6 +239,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
||||
DNSPolicy: v1.DNSClusterFirst,
|
||||
TerminationGracePeriodSeconds: &grace,
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
|
||||
Containers: []v1.Container{{
|
||||
Name: "1",
|
||||
@ -261,6 +266,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
||||
DNSPolicy: v1.DNSClusterFirst,
|
||||
TerminationGracePeriodSeconds: &grace,
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
|
||||
Containers: []v1.Container{{
|
||||
Name: "2",
|
||||
|
@ -73,6 +73,7 @@ func validNewPod() *api.Pod {
|
||||
},
|
||||
},
|
||||
SecurityContext: &api.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -659,6 +660,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
|
||||
},
|
||||
},
|
||||
SecurityContext: &api.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
}, nil, 1)
|
||||
if err != nil {
|
||||
@ -687,6 +689,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
|
||||
|
||||
TerminationGracePeriodSeconds: &grace,
|
||||
SecurityContext: &api.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
}
|
||||
_, _, err = storage.Update(ctx, podIn.Name, rest.DefaultUpdatedObjectInfo(&podIn, api.Scheme))
|
||||
@ -727,6 +730,7 @@ func TestEtcdUpdateStatus(t *testing.T) {
|
||||
},
|
||||
},
|
||||
SecurityContext: &api.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
}
|
||||
err := storage.Storage.Create(ctx, key, &podStart, nil, 0)
|
||||
@ -751,6 +755,7 @@ func TestEtcdUpdateStatus(t *testing.T) {
|
||||
},
|
||||
},
|
||||
SecurityContext: &api.PodSecurityContext{},
|
||||
SchedulerName: api.DefaultSchedulerName,
|
||||
},
|
||||
Status: api.PodStatus{
|
||||
Phase: api.PodRunning,
|
||||
|
@ -66,7 +66,7 @@ func (s *SchedulerServer) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&s.ContentType, "kube-api-content-type", s.ContentType, "Content type of requests sent to apiserver.")
|
||||
fs.Float32Var(&s.KubeAPIQPS, "kube-api-qps", s.KubeAPIQPS, "QPS to use while talking with kubernetes apiserver")
|
||||
fs.Int32Var(&s.KubeAPIBurst, "kube-api-burst", s.KubeAPIBurst, "Burst to use while talking with kubernetes apiserver")
|
||||
fs.StringVar(&s.SchedulerName, "scheduler-name", s.SchedulerName, "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'")
|
||||
fs.StringVar(&s.SchedulerName, "scheduler-name", s.SchedulerName, "Name of the scheduler, used to select which pods will be processed by this scheduler, based on pod's \"spec.SchedulerName\".")
|
||||
fs.IntVar(&s.HardPodAffinitySymmetricWeight, "hard-pod-affinity-symmetric-weight", api.DefaultHardPodAffinitySymmetricWeight,
|
||||
"RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule corresponding "+
|
||||
"to every RequiredDuringScheduling affinity rule. --hard-pod-affinity-symmetric-weight represents the weight of implicit PreferredDuringScheduling affinity rule.")
|
||||
|
@ -48,9 +48,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
SchedulerAnnotationKey = "scheduler.alpha.kubernetes.io/name"
|
||||
initialGetBackoff = 100 * time.Millisecond
|
||||
maximalGetBackoff = time.Minute
|
||||
initialGetBackoff = 100 * time.Millisecond
|
||||
maximalGetBackoff = time.Minute
|
||||
)
|
||||
|
||||
// ConfigFactory is the default implementation of the scheduler.Configurator interface.
|
||||
@ -90,8 +89,7 @@ type ConfigFactory struct {
|
||||
schedulerCache schedulercache.Cache
|
||||
|
||||
// SchedulerName of a scheduler is used to select which pods will be
|
||||
// processed by this scheduler, based on pods's annotation key:
|
||||
// 'scheduler.alpha.kubernetes.io/name'
|
||||
// processed by this scheduler, based on pods's "spec.SchedulerName".
|
||||
schedulerName string
|
||||
|
||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||
@ -514,11 +512,7 @@ func (f *ConfigFactory) getNextPod() *v1.Pod {
|
||||
}
|
||||
|
||||
func (f *ConfigFactory) ResponsibleForPod(pod *v1.Pod) bool {
|
||||
if f.schedulerName == v1.DefaultSchedulerName {
|
||||
return pod.Annotations[SchedulerAnnotationKey] == f.schedulerName || pod.Annotations[SchedulerAnnotationKey] == ""
|
||||
} else {
|
||||
return pod.Annotations[SchedulerAnnotationKey] == f.schedulerName
|
||||
}
|
||||
return f.schedulerName == pod.Spec.SchedulerName
|
||||
}
|
||||
|
||||
func getNodeConditionPredicate() cache.NodeConditionPredicate {
|
||||
|
@ -251,39 +251,33 @@ func TestResponsibleForPod(t *testing.T) {
|
||||
// factory of "foo-scheduler"
|
||||
factoryFooScheduler := NewConfigFactory(client, "foo-scheduler", v1.DefaultHardPodAffinitySymmetricWeight, v1.DefaultFailureDomains)
|
||||
// scheduler annotations to be tested
|
||||
schedulerAnnotationFitsDefault := map[string]string{"scheduler.alpha.kubernetes.io/name": "default-scheduler"}
|
||||
schedulerAnnotationFitsFoo := map[string]string{"scheduler.alpha.kubernetes.io/name": "foo-scheduler"}
|
||||
schedulerAnnotationFitsNone := map[string]string{"scheduler.alpha.kubernetes.io/name": "bar-scheduler"}
|
||||
schedulerFitsDefault := "default-scheduler"
|
||||
schedulerFitsFoo := "foo-scheduler"
|
||||
schedulerFitsNone := "bar-scheduler"
|
||||
|
||||
tests := []struct {
|
||||
pod *v1.Pod
|
||||
pickedByDefault bool
|
||||
pickedByFoo bool
|
||||
}{
|
||||
{
|
||||
// pod with no annotation "scheduler.alpha.kubernetes.io/name=<scheduler-name>" should be
|
||||
// picked by the default scheduler, NOT by the one of name "foo-scheduler"
|
||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"}},
|
||||
pickedByDefault: true,
|
||||
pickedByFoo: false,
|
||||
},
|
||||
{
|
||||
// pod with annotation "scheduler.alpha.kubernetes.io/name=default-scheduler" should be picked
|
||||
// pod with "spec.Schedulername=default-scheduler" should be picked
|
||||
// by the scheduler of name "default-scheduler", NOT by the one of name "foo-scheduler"
|
||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar", Annotations: schedulerAnnotationFitsDefault}},
|
||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"}, Spec: v1.PodSpec{SchedulerName: schedulerFitsDefault}},
|
||||
pickedByDefault: true,
|
||||
pickedByFoo: false,
|
||||
},
|
||||
{
|
||||
// pod with annotataion "scheduler.alpha.kubernetes.io/name=foo-scheduler" should be NOT
|
||||
// pod with "spec.SchedulerName=foo-scheduler" should be NOT
|
||||
// be picked by the scheduler of name "default-scheduler", but by the one of name "foo-scheduler"
|
||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar", Annotations: schedulerAnnotationFitsFoo}},
|
||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"}, Spec: v1.PodSpec{SchedulerName: schedulerFitsFoo}},
|
||||
pickedByDefault: false,
|
||||
pickedByFoo: true,
|
||||
},
|
||||
{
|
||||
// pod with annotataion "scheduler.alpha.kubernetes.io/name=foo-scheduler" should be NOT
|
||||
// pod with "spec.SchedulerName=foo-scheduler" should be NOT
|
||||
// be picked by niether the scheduler of name "default-scheduler" nor the one of name "foo-scheduler"
|
||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar", Annotations: schedulerAnnotationFitsNone}},
|
||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"}, Spec: v1.PodSpec{SchedulerName: schedulerFitsNone}},
|
||||
pickedByDefault: false,
|
||||
pickedByFoo: false,
|
||||
},
|
||||
|
@ -561,8 +561,7 @@ type KubeSchedulerConfiguration struct {
|
||||
// kubeAPIBurst is the QPS burst to use while talking with kubernetes apiserver.
|
||||
KubeAPIBurst int32
|
||||
// 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'.
|
||||
// will be processed by this scheduler, based on pod's "spec.SchedulerName".
|
||||
SchedulerName string
|
||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||
|
@ -122,8 +122,7 @@ type KubeSchedulerConfiguration struct {
|
||||
// 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'.
|
||||
// will be processed by this scheduler, based on pod's "spec.SchedulerName".
|
||||
SchedulerName string `json:"schedulerName"`
|
||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||
|
@ -84,9 +84,6 @@ func createTerminatingPod(f *framework.Framework) (*v1.Pod, error) {
|
||||
pod := &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: string(uuid),
|
||||
Annotations: map[string]string{
|
||||
"scheduler.alpha.kubernetes.io/name": "please don't schedule my pods",
|
||||
},
|
||||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
@ -95,6 +92,7 @@ func createTerminatingPod(f *framework.Framework) (*v1.Pod, error) {
|
||||
Image: "gcr.io/google_containers/busybox:1.24",
|
||||
},
|
||||
},
|
||||
SchedulerName: "please don't schedule my pods",
|
||||
},
|
||||
}
|
||||
return f.ClientSet.Core().Pods(f.Namespace.Name).Create(pod)
|
||||
|
@ -352,48 +352,48 @@ func TestMultiScheduler(t *testing.T) {
|
||||
clientSet.Core().Nodes().Create(node)
|
||||
|
||||
// 3. create 3 pods for testing
|
||||
podWithNoAnnotation := createPod(clientSet, "pod-with-no-annotation", nil)
|
||||
testPodNoAnnotation, err := clientSet.Core().Pods(ns.Name).Create(podWithNoAnnotation)
|
||||
podWithoutSchedulerName := createPod(clientSet, "pod-without-scheduler-name", "")
|
||||
testPod, err := clientSet.Core().Pods(ns.Name).Create(podWithoutSchedulerName)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create pod: %v", err)
|
||||
}
|
||||
|
||||
schedulerAnnotationFitsDefault := map[string]string{"scheduler.alpha.kubernetes.io/name": "default-scheduler"}
|
||||
podWithAnnotationFitsDefault := createPod(clientSet, "pod-with-annotation-fits-default", schedulerAnnotationFitsDefault)
|
||||
testPodWithAnnotationFitsDefault, err := clientSet.Core().Pods(ns.Name).Create(podWithAnnotationFitsDefault)
|
||||
schedulerFitsDefault := "default-scheduler"
|
||||
podFitsDefault := createPod(clientSet, "pod-fits-default", schedulerFitsDefault)
|
||||
testPodFitsDefault, err := clientSet.Core().Pods(ns.Name).Create(podFitsDefault)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create pod: %v", err)
|
||||
}
|
||||
|
||||
schedulerAnnotationFitsFoo := map[string]string{"scheduler.alpha.kubernetes.io/name": "foo-scheduler"}
|
||||
podWithAnnotationFitsFoo := createPod(clientSet, "pod-with-annotation-fits-foo", schedulerAnnotationFitsFoo)
|
||||
testPodWithAnnotationFitsFoo, err := clientSet.Core().Pods(ns.Name).Create(podWithAnnotationFitsFoo)
|
||||
schedulerFitsFoo := "foo-scheduler"
|
||||
podFitsFoo := createPod(clientSet, "pod-fits-foo", schedulerFitsFoo)
|
||||
testPodFitsFoo, err := clientSet.Core().Pods(ns.Name).Create(podFitsFoo)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create pod: %v", err)
|
||||
}
|
||||
|
||||
// 4. **check point-1**:
|
||||
// - testPodNoAnnotation, testPodWithAnnotationFitsDefault should be scheduled
|
||||
// - testPodWithAnnotationFitsFoo should NOT be scheduled
|
||||
err = wait.Poll(time.Second, time.Second*5, podScheduled(clientSet, testPodNoAnnotation.Namespace, testPodNoAnnotation.Name))
|
||||
// - testPod, testPodFitsDefault should be scheduled
|
||||
// - testPodFitsFoo should NOT be scheduled
|
||||
err = wait.Poll(time.Second, time.Second*5, podScheduled(clientSet, testPod.Namespace, testPod.Name))
|
||||
if err != nil {
|
||||
t.Errorf("Test MultiScheduler: %s Pod not scheduled: %v", testPodNoAnnotation.Name, err)
|
||||
t.Errorf("Test MultiScheduler: %s Pod not scheduled: %v", testPod.Name, err)
|
||||
} else {
|
||||
t.Logf("Test MultiScheduler: %s Pod scheduled", testPodNoAnnotation.Name)
|
||||
t.Logf("Test MultiScheduler: %s Pod scheduled", testPod.Name)
|
||||
}
|
||||
|
||||
err = wait.Poll(time.Second, time.Second*5, podScheduled(clientSet, testPodWithAnnotationFitsDefault.Namespace, testPodWithAnnotationFitsDefault.Name))
|
||||
err = wait.Poll(time.Second, time.Second*5, podScheduled(clientSet, testPodFitsDefault.Namespace, testPodFitsDefault.Name))
|
||||
if err != nil {
|
||||
t.Errorf("Test MultiScheduler: %s Pod not scheduled: %v", testPodWithAnnotationFitsDefault.Name, err)
|
||||
t.Errorf("Test MultiScheduler: %s Pod not scheduled: %v", testPodFitsDefault.Name, err)
|
||||
} else {
|
||||
t.Logf("Test MultiScheduler: %s Pod scheduled", testPodWithAnnotationFitsDefault.Name)
|
||||
t.Logf("Test MultiScheduler: %s Pod scheduled", testPodFitsDefault.Name)
|
||||
}
|
||||
|
||||
err = wait.Poll(time.Second, time.Second*5, podScheduled(clientSet, testPodWithAnnotationFitsFoo.Namespace, testPodWithAnnotationFitsFoo.Name))
|
||||
err = wait.Poll(time.Second, time.Second*5, podScheduled(clientSet, testPodFitsFoo.Namespace, testPodFitsFoo.Name))
|
||||
if err == nil {
|
||||
t.Errorf("Test MultiScheduler: %s Pod got scheduled, %v", testPodWithAnnotationFitsFoo.Name, err)
|
||||
t.Errorf("Test MultiScheduler: %s Pod got scheduled, %v", testPodFitsFoo.Name, err)
|
||||
} else {
|
||||
t.Logf("Test MultiScheduler: %s Pod not scheduled", testPodWithAnnotationFitsFoo.Name)
|
||||
t.Logf("Test MultiScheduler: %s Pod not scheduled", testPodFitsFoo.Name)
|
||||
}
|
||||
|
||||
// 5. create and start a scheduler with name "foo-scheduler"
|
||||
@ -413,19 +413,19 @@ func TestMultiScheduler(t *testing.T) {
|
||||
|
||||
// 6. **check point-2**:
|
||||
// - testPodWithAnnotationFitsFoo should be scheduled
|
||||
err = wait.Poll(time.Second, time.Second*5, podScheduled(clientSet, testPodWithAnnotationFitsFoo.Namespace, testPodWithAnnotationFitsFoo.Name))
|
||||
err = wait.Poll(time.Second, time.Second*5, podScheduled(clientSet, testPodFitsFoo.Namespace, testPodFitsFoo.Name))
|
||||
if err != nil {
|
||||
t.Errorf("Test MultiScheduler: %s Pod not scheduled, %v", testPodWithAnnotationFitsFoo.Name, err)
|
||||
t.Errorf("Test MultiScheduler: %s Pod not scheduled, %v", testPodFitsFoo.Name, err)
|
||||
} else {
|
||||
t.Logf("Test MultiScheduler: %s Pod scheduled", testPodWithAnnotationFitsFoo.Name)
|
||||
t.Logf("Test MultiScheduler: %s Pod scheduled", testPodFitsFoo.Name)
|
||||
}
|
||||
|
||||
// 7. delete the pods that were scheduled by the default scheduler, and stop the default scheduler
|
||||
err = clientSet.Core().Pods(ns.Name).Delete(testPodNoAnnotation.Name, v1.NewDeleteOptions(0))
|
||||
err = clientSet.Core().Pods(ns.Name).Delete(testPod.Name, v1.NewDeleteOptions(0))
|
||||
if err != nil {
|
||||
t.Errorf("Failed to delete pod: %v", err)
|
||||
}
|
||||
err = clientSet.Core().Pods(ns.Name).Delete(testPodWithAnnotationFitsDefault.Name, v1.NewDeleteOptions(0))
|
||||
err = clientSet.Core().Pods(ns.Name).Delete(testPodFitsDefault.Name, v1.NewDeleteOptions(0))
|
||||
if err != nil {
|
||||
t.Errorf("Failed to delete pod: %v", err)
|
||||
}
|
||||
@ -469,11 +469,12 @@ func TestMultiScheduler(t *testing.T) {
|
||||
*/
|
||||
}
|
||||
|
||||
func createPod(client clientset.Interface, name string, annotation map[string]string) *v1.Pod {
|
||||
func createPod(client clientset.Interface, name string, scheduler string) *v1.Pod {
|
||||
return &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: name, Annotations: annotation},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: name},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{{Name: "container", Image: e2e.GetPauseImageName(client)}},
|
||||
Containers: []v1.Container{{Name: "container", Image: e2e.GetPauseImageName(client)}},
|
||||
SchedulerName: scheduler,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user