Fix nil map when annotations are applied (#2916)

Co-authored-by: Hidetake Iwata <int128@gmail.com>
This commit is contained in:
Nikola Jokic
2023-09-26 11:21:16 +02:00
committed by GitHub
parent db061b33e7
commit fdf7b6c525
2 changed files with 152 additions and 1 deletions

View File

@@ -317,7 +317,9 @@ func (b *resourceBuilder) newScaleSetListenerPod(autoscalingListener *v1alpha1.A
}
func mergeListenerPodWithTemplate(pod *corev1.Pod, tmpl *corev1.PodTemplateSpec) {
// apply metadata
if pod.Annotations == nil {
pod.Annotations = make(map[string]string)
}
for k, v := range tmpl.Annotations {
if _, ok := pod.Annotations[k]; !ok {
pod.Annotations[k] = v