You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/02/19 09:51:29 UTC

[camel-k] branch master updated: Enable status subresource for integration context

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

lburgazzoli 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 77636ef  Enable status subresource for integration context
77636ef is described below

commit 77636efdc3a0b321eaba3f8770dedf35c4d13e2e
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Feb 19 10:32:45 2019 +0100

    Enable status subresource for integration context
---
 deploy/crd-integration-context.yaml                         | 2 ++
 deploy/resources.go                                         | 2 ++
 pkg/controller/integrationcontext/build.go                  | 6 +++---
 pkg/controller/integrationcontext/build_failure_recovery.go | 4 ++--
 pkg/controller/integrationcontext/initialize.go             | 2 +-
 pkg/controller/integrationcontext/monitor.go                | 2 +-
 6 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/deploy/crd-integration-context.yaml b/deploy/crd-integration-context.yaml
index 7d82cd4..a940628 100644
--- a/deploy/crd-integration-context.yaml
+++ b/deploy/crd-integration-context.yaml
@@ -8,6 +8,8 @@ spec:
   group: camel.apache.org
   scope: Namespaced
   version: v1alpha1
+  subresources:
+    status: {}
   names:
     kind: IntegrationContext
     listKind: IntegrationContextList
diff --git a/deploy/resources.go b/deploy/resources.go
index 03806d3..76c56f7 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -6286,6 +6286,8 @@ spec:
   group: camel.apache.org
   scope: Namespaced
   version: v1alpha1
+  subresources:
+    status: {}
   names:
     kind: IntegrationContext
     listKind: IntegrationContextList
diff --git a/pkg/controller/integrationcontext/build.go b/pkg/controller/integrationcontext/build.go
index fa7ab58..fd90163 100644
--- a/pkg/controller/integrationcontext/build.go
+++ b/pkg/controller/integrationcontext/build.go
@@ -156,7 +156,7 @@ func (action *buildAction) handleBuildStateChange(ctx context.Context, res *buil
 
 		action.L.Info("IntegrationContext state transition", "phase", target.Status.Phase)
 
-		return action.client.Update(ctx, target)
+		return action.client.Status().Update(ctx, target)
 	case builder.StatusError:
 		// we should ensure that the integration context is still in the right
 		// phase, if not there is a chance that the context has been modified
@@ -188,7 +188,7 @@ func (action *buildAction) handleBuildStateChange(ctx context.Context, res *buil
 
 		action.L.Error(res.Error, "IntegrationContext state transition", "phase", target.Status.Phase)
 
-		return action.client.Update(ctx, target)
+		return action.client.Status().Update(ctx, target)
 	case builder.StatusCompleted:
 		// we should ensure that the integration context is still in the right
 		// phase, if not there is a chance that the context has been modified
@@ -220,7 +220,7 @@ func (action *buildAction) handleBuildStateChange(ctx context.Context, res *buil
 		}
 
 		action.L.Info("IntegrationContext state transition", "phase", target.Status.Phase)
-		if err := action.client.Update(ctx, target); err != nil {
+		if err := action.client.Status().Update(ctx, target); err != nil {
 			return err
 		}
 
diff --git a/pkg/controller/integrationcontext/build_failure_recovery.go b/pkg/controller/integrationcontext/build_failure_recovery.go
index 3087e6b..a32a751 100644
--- a/pkg/controller/integrationcontext/build_failure_recovery.go
+++ b/pkg/controller/integrationcontext/build_failure_recovery.go
@@ -69,7 +69,7 @@ func (action *errorRecoveryAction) Handle(ctx context.Context, ictx *v1alpha1.In
 
 		action.L.Info("Max recovery attempt reached, transition to error phase")
 
-		return action.client.Update(ctx, target)
+		return action.client.Status().Update(ctx, target)
 	}
 
 	if ictx.Status.Failure != nil {
@@ -98,7 +98,7 @@ func (action *errorRecoveryAction) Handle(ctx context.Context, ictx *v1alpha1.In
 			target.Status.Failure.Recovery.AttemptMax,
 		)
 
-		return action.client.Update(ctx, target)
+		return action.client.Status().Update(ctx, target)
 	}
 
 	return nil
diff --git a/pkg/controller/integrationcontext/initialize.go b/pkg/controller/integrationcontext/initialize.go
index 4fad950..0376008 100644
--- a/pkg/controller/integrationcontext/initialize.go
+++ b/pkg/controller/integrationcontext/initialize.go
@@ -77,5 +77,5 @@ func (action *initializeAction) Handle(ctx context.Context, ictx *v1alpha1.Integ
 
 	action.L.Info("IntegrationContext state transition", "phase", target.Status.Phase)
 
-	return action.client.Update(ctx, target)
+	return action.client.Status().Update(ctx, target)
 }
diff --git a/pkg/controller/integrationcontext/monitor.go b/pkg/controller/integrationcontext/monitor.go
index 1052deb..705edba 100644
--- a/pkg/controller/integrationcontext/monitor.go
+++ b/pkg/controller/integrationcontext/monitor.go
@@ -55,7 +55,7 @@ func (action *monitorAction) Handle(ctx context.Context, ictx *v1alpha1.Integrat
 
 		action.L.Info("IntegrationContext state transition", "phase", target.Status.Phase)
 
-		return action.client.Update(ctx, target)
+		return action.client.Status().Update(ctx, target)
 	}
 
 	return nil