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 17:14:43 UTC

[camel-k] branch main 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 main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new fda220c  fix(controller): panic on nil annotation
fda220c is described below

commit fda220c629329d24bc41ea2b73c1ce679806b7e7
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(),
+			})
+		}
 	})
 }