lburgazzoli commented on code in PR #5218: URL: https://github.com/apache/camel-k/pull/5218#discussion_r1514061488
########## pkg/util/kubernetes/lookup.go: ########## @@ -52,6 +52,17 @@ func LookupConfigmap(ctx context.Context, c client.Client, ns string, name strin return &cm } +// LookupResourceVersion will look for any k8s resource with a given name in a given namespace, returning its resource version only. +// It makes this safe against any resource that the operator is not allowed to inspect. +func LookupResourceVersion(ctx context.Context, c client.Client, object ctrl.Object) string { + if err := c.Get(ctx, ctrl.ObjectKeyFromObject(object), object); err != nil && k8serrors.IsNotFound(err) { + return "" + } else if err != nil { + return "" Review Comment: is swallowing the error expected ? if so `k8serrors.IsNotFound(err)` can probably be removed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org