You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/08/09 20:02:50 UTC

[camel-k] branch release-1.5.x updated: fix(controller): panic on nil annotation

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 <fp...@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(),
+			})
+		}
 	})
 }