Return pointer for Affinity in api helper

This commit is contained in:
Wojciech Tyczynski
2016-07-22 12:48:35 +02:00
parent a63cccfafc
commit 898a6444e3
8 changed files with 36 additions and 17 deletions

View File

@@ -63,7 +63,7 @@ func (p *plugin) Admit(attributes admission.Attributes) (err error) {
glog.V(5).Infof("Invalid Affinity detected, but we will leave handling of this to validation phase")
return nil
}
if affinity.PodAntiAffinity != nil {
if affinity != nil && affinity.PodAntiAffinity != nil {
var podAntiAffinityTerms []api.PodAffinityTerm
if len(affinity.PodAntiAffinity.RequiredDuringSchedulingIgnoredDuringExecution) != 0 {
podAntiAffinityTerms = affinity.PodAntiAffinity.RequiredDuringSchedulingIgnoredDuringExecution