Set Job's labels from PodTemplateSpec if none are specified

This commit is contained in:
Maciej Szulik
2016-09-06 14:12:52 +02:00
parent 2fe1fcdab8
commit 43612afaae
7 changed files with 536 additions and 39 deletions

View File

@@ -39,4 +39,8 @@ func SetDefaults_Job(obj *Job) {
obj.Spec.Parallelism = new(int32)
*obj.Spec.Parallelism = 1
}
labels := obj.Spec.Template.Labels
if labels != nil && len(obj.Labels) == 0 {
obj.Labels = labels
}
}