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 2019/10/10 06:53:54 UTC
[camel-k] branch master updated: fix: Handle traits update
conflicts gracefully
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/master by this push:
new 45d5e3f fix: Handle traits update conflicts gracefully
45d5e3f is described below
commit 45d5e3fc62643b37278315422102e8cf857313e1
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed Oct 9 17:50:15 2019 +0200
fix: Handle traits update conflicts gracefully
---
pkg/controller/integration/integration_controller.go | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/pkg/controller/integration/integration_controller.go b/pkg/controller/integration/integration_controller.go
index a8c7935..33ecdb2 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -19,8 +19,9 @@ package integration
import (
"context"
+ "github.com/pkg/errors"
+
appsv1 "k8s.io/api/apps/v1"
- "k8s.io/apimachinery/pkg/api/errors"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
@@ -215,7 +216,7 @@ func (r *ReconcileIntegration) Reconcile(request reconcile.Request) (reconcile.R
var instance v1alpha1.Integration
if err := r.client.Get(ctx, request.NamespacedName, &instance); err != nil {
- if errors.IsNotFound(err) {
+ if k8serrors.IsNotFound(err) {
// Request object not found, could have been deleted after reconcile request.
// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.
// Return and don't requeue
@@ -268,6 +269,16 @@ func (r *ReconcileIntegration) Reconcile(request reconcile.Request) (reconcile.R
newTarget, err := a.Handle(ctx, target)
if err != nil {
+ // Some traits, like the deployment and knative service ones,
+ // update owned resources in the running phase, so it's better
+ // handling update conflicts gracefully, consistently with the
+ // primary integration update requests.
+ if cause := errors.Cause(err); k8serrors.IsConflict(cause) {
+ log.Error(cause, "conflict")
+ return reconcile.Result{
+ Requeue: true,
+ }, nil
+ }
return reconcile.Result{}, err
}