From 07bd50be0d5069188b87554bca05b0a4b619864c Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Fri, 14 Oct 2016 00:50:26 -0400 Subject: [PATCH] Internal weight field for affinity must be int32 --- pkg/api/types.go | 2 +- plugin/pkg/scheduler/algorithm/priorities/interpod_affinity.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/api/types.go b/pkg/api/types.go index 1e180f545d6..d379cc40786 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -1605,7 +1605,7 @@ type PodAntiAffinity struct { type WeightedPodAffinityTerm struct { // weight associated with matching the corresponding podAffinityTerm, // in the range 1-100. - Weight int `json:"weight"` + Weight int32 `json:"weight"` // Required. A pod affinity term, associated with the corresponding weight. PodAffinityTerm PodAffinityTerm `json:"podAffinityTerm"` } diff --git a/plugin/pkg/scheduler/algorithm/priorities/interpod_affinity.go b/plugin/pkg/scheduler/algorithm/priorities/interpod_affinity.go index 5889402b2a4..394eb27239e 100644 --- a/plugin/pkg/scheduler/algorithm/priorities/interpod_affinity.go +++ b/plugin/pkg/scheduler/algorithm/priorities/interpod_affinity.go @@ -105,7 +105,7 @@ func (p *podAffinityPriorityMap) processTerm(term *api.PodAffinityTerm, podDefin func (p *podAffinityPriorityMap) processTerms(terms []api.WeightedPodAffinityTerm, podDefiningAffinityTerm, podToCheck *api.Pod, fixedNode *api.Node, multiplier int) { for i := range terms { term := &terms[i] - p.processTerm(&term.PodAffinityTerm, podDefiningAffinityTerm, podToCheck, fixedNode, float64(term.Weight*multiplier)) + p.processTerm(&term.PodAffinityTerm, podDefiningAffinityTerm, podToCheck, fixedNode, float64(term.Weight*int32(multiplier))) } }