This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch release-1.5.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/release-1.5.x by this push:
     new 244115a  fix(controller): panic on nil annotation
244115a is described below

commit 244115a45062f61ac39040e7aa41c228faa4bb67
Author: Abirdcfly <fp544037...@gmail.com>
AuthorDate: Mon Aug 9 14:00:19 2021 +0800

    fix(controller): panic on nil annotation
---
 pkg/controller/build/monitor_pod.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pkg/controller/build/monitor_pod.go 
b/pkg/controller/build/monitor_pod.go
index c14300d..3c3bf13 100644
--- a/pkg/controller/build/monitor_pod.go
+++ b/pkg/controller/build/monitor_pod.go
@@ -224,7 +224,13 @@ func (action *monitorPodAction) addTimeoutAnnotation(ctx 
context.Context, pod *c
                return nil
        }
        return action.patchPod(ctx, pod, func(p *corev1.Pod) {
-               p.GetAnnotations()[timeoutAnnotation] = time.String()
+               if p.GetAnnotations() != nil {
+                       p.GetAnnotations()[timeoutAnnotation] = time.String()
+               } else {
+                       p.SetAnnotations(map[string]string{
+                               timeoutAnnotation: time.String(),
+                       })
+               }
        })
 }
 

Reply via email to