Only process labels if the map is non-empty
@@ -160,8 +160,9 @@ func ToClusterTrial(t *redskyv1beta1.Trial, suggestion *redskyapi.TrialAssignmen
}
}
+ if len(suggestion.Labels) > 0 {
if t.Labels == nil {
- t.Labels = make(map[string]string)
+ t.Labels = make(map[string]string, len(suggestion.Labels))
}
for k, v := range suggestion.Labels {
if v != "" {
@@ -170,6 +171,7 @@ func ToClusterTrial(t *redskyv1beta1.Trial, suggestion *redskyapi.TrialAssignmen
delete(t.Labels, k)
}
}
+ }
trial.UpdateStatus(t)
