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 fd54ffb fix: Use error condition when active platform cannot be
resolved
fd54ffb is described below
commit fd54ffbf4e22a9f380fa2307433be0233c980367
Author: James Netherton <[email protected]>
AuthorDate: Mon Jul 15 09:02:15 2019 +0100
fix: Use error condition when active platform cannot be resolved
---
pkg/controller/build/build_controller.go | 12 ++++++------
pkg/controller/integration/integration_controller.go | 12 ++++++------
pkg/controller/integrationkit/integrationkit_controller.go | 12 ++++++------
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/pkg/controller/build/build_controller.go
b/pkg/controller/build/build_controller.go
index e582e96..1d6ca04 100644
--- a/pkg/controller/build/build_controller.go
+++ b/pkg/controller/build/build_controller.go
@@ -168,17 +168,17 @@ func (r *ReconcileBuild) Reconcile(request
reconcile.Request) (reconcile.Result,
if target.Status.Phase == v1alpha1.BuildPhaseNone ||
target.Status.Phase == v1alpha1.BuildPhaseWaitingForPlatform {
pl, err := platform.GetOrLookup(ctx, r.client,
target.Namespace, target.Status.Platform)
- switch {
- case err != nil:
- target.Status.Phase = v1alpha1.BuildPhaseError
- target.Status.Failure = v1alpha1.NewErrorFailure(err)
- case pl.Status.Phase != v1alpha1.IntegrationPlatformPhaseReady:
+ if err != nil || pl.Status.Phase !=
v1alpha1.IntegrationPlatformPhaseReady {
target.Status.Phase =
v1alpha1.BuildPhaseWaitingForPlatform
- default:
+ } else {
target.Status.Phase = v1alpha1.BuildPhaseInitialization
}
if instance.Status.Phase != target.Status.Phase {
+ if err != nil {
+
target.Status.SetErrorCondition(v1alpha1.BuildConditionPlatformAvailable,
v1alpha1.BuildConditionPlatformAvailableReason, err)
+ }
+
if pl != nil {
target.SetIntegrationPlatform(pl)
}
diff --git a/pkg/controller/integration/integration_controller.go
b/pkg/controller/integration/integration_controller.go
index 641eaa3..0e4eabe 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -237,17 +237,17 @@ func (r *ReconcileIntegration) Reconcile(request
reconcile.Request) (reconcile.R
if target.Status.Phase == v1alpha1.IntegrationPhaseNone ||
target.Status.Phase == v1alpha1.IntegrationPhaseWaitingForPlatform {
pl, err := platform.GetOrLookup(ctx, r.client,
target.Namespace, target.Status.Platform)
- switch {
- case err != nil:
- target.Status.Phase = v1alpha1.IntegrationPhaseError
- target.Status.Failure = v1alpha1.NewErrorFailure(err)
- case pl.Status.Phase != v1alpha1.IntegrationPlatformPhaseReady:
+ if err != nil || pl.Status.Phase !=
v1alpha1.IntegrationPlatformPhaseReady {
target.Status.Phase =
v1alpha1.IntegrationPhaseWaitingForPlatform
- default:
+ } else {
target.Status.Phase =
v1alpha1.IntegrationPhaseInitialization
}
if instance.Status.Phase != target.Status.Phase {
+ if err != nil {
+
target.Status.SetErrorCondition(v1alpha1.IntegrationConditionPlatformAvailable,
v1alpha1.IntegrationConditionPlatformAvailableReason, err)
+ }
+
if pl != nil {
target.SetIntegrationPlatform(pl)
}
diff --git a/pkg/controller/integrationkit/integrationkit_controller.go
b/pkg/controller/integrationkit/integrationkit_controller.go
index 431b8ef..cb56053 100644
--- a/pkg/controller/integrationkit/integrationkit_controller.go
+++ b/pkg/controller/integrationkit/integrationkit_controller.go
@@ -187,17 +187,17 @@ func (r *ReconcileIntegrationKit) Reconcile(request
reconcile.Request) (reconcil
if target.Status.Phase == v1alpha1.IntegrationKitPhaseNone ||
target.Status.Phase == v1alpha1.IntegrationKitPhaseWaitingForPlatform {
pl, err := platform.GetOrLookup(ctx, r.client,
target.Namespace, target.Status.Platform)
- switch {
- case err != nil:
- target.Status.Phase = v1alpha1.IntegrationKitPhaseError
- target.Status.Failure = v1alpha1.NewErrorFailure(err)
- case pl.Status.Phase != v1alpha1.IntegrationPlatformPhaseReady:
+ if err != nil || pl.Status.Phase !=
v1alpha1.IntegrationPlatformPhaseReady {
target.Status.Phase =
v1alpha1.IntegrationKitPhaseWaitingForPlatform
- default:
+ } else {
target.Status.Phase =
v1alpha1.IntegrationKitPhaseInitialization
}
if instance.Status.Phase != target.Status.Phase {
+ if err != nil {
+
target.Status.SetErrorCondition(v1alpha1.IntegrationKitConditionPlatformAvailable,
v1alpha1.IntegrationKitConditionPlatformAvailableReason, err)
+ }
+
if pl != nil {
target.SetIntegrationPlatform(pl)
}