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:41:17 UTC
[camel-k] branch master updated: Enable status subresource for
integration platform
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 38ff3ef Enable status subresource for integration platform
38ff3ef is described below
commit 38ff3ef3b6c54a6983595c6c60b45a91d3fd7f7d
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Feb 19 10:18:32 2019 +0100
Enable status subresource for integration platform
---
deploy/crd-integration-platform.yaml | 2 ++
deploy/resources.go | 2 ++
pkg/controller/integrationplatform/create.go | 2 +-
pkg/controller/integrationplatform/initialize.go | 14 +++++++++-----
pkg/controller/integrationplatform/start.go | 2 +-
5 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/deploy/crd-integration-platform.yaml b/deploy/crd-integration-platform.yaml
index cb41fe4..868831d 100644
--- a/deploy/crd-integration-platform.yaml
+++ b/deploy/crd-integration-platform.yaml
@@ -8,6 +8,8 @@ spec:
group: camel.apache.org
scope: Namespaced
version: v1alpha1
+ subresources:
+ status: {}
names:
kind: IntegrationPlatform
listKind: IntegrationPlatformList
diff --git a/deploy/resources.go b/deploy/resources.go
index 104c1f2..03806d3 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -6320,6 +6320,8 @@ spec:
group: camel.apache.org
scope: Namespaced
version: v1alpha1
+ subresources:
+ status: {}
names:
kind: IntegrationPlatform
listKind: IntegrationPlatformList
diff --git a/pkg/controller/integrationplatform/create.go b/pkg/controller/integrationplatform/create.go
index d531b2f..572fb31 100644
--- a/pkg/controller/integrationplatform/create.go
+++ b/pkg/controller/integrationplatform/create.go
@@ -104,5 +104,5 @@ func (action *createAction) Handle(ctx context.Context, platform *v1alpha1.Integ
target.Status.Phase = v1alpha1.IntegrationPlatformPhaseStarting
action.L.Info("IntegrationPlatform state transition", "phase", target.Status.Phase)
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
diff --git a/pkg/controller/integrationplatform/initialize.go b/pkg/controller/integrationplatform/initialize.go
index 43cb71e..cda5272 100644
--- a/pkg/controller/integrationplatform/initialize.go
+++ b/pkg/controller/integrationplatform/initialize.go
@@ -59,7 +59,7 @@ func (action *initializeAction) Handle(ctx context.Context, platform *v1alpha1.I
action.L.Info("IntegrationPlatform state transition", "phase", target.Status.Phase)
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
return nil
}
@@ -94,9 +94,6 @@ func (action *initializeAction) Handle(ctx context.Context, platform *v1alpha1.I
target.Spec.Profile = platformutils.GetProfile(target)
}
- // next status
- target.Status.Phase = v1alpha1.IntegrationPlatformPhaseCreating
-
if target.Spec.Build.CamelVersion == "" {
target.Spec.Build.CamelVersion = defaults.CamelVersion
}
@@ -113,7 +110,14 @@ func (action *initializeAction) Handle(ctx context.Context, platform *v1alpha1.I
action.L.Info("IntegrationPlatform state transition", "phase", target.Status.Phase)
- return action.client.Update(ctx, target)
+ err = action.client.Update(ctx, target)
+ if err != nil {
+ return err
+ }
+
+ // next status
+ target.Status.Phase = v1alpha1.IntegrationPlatformPhaseCreating
+ return action.client.Status().Update(ctx, target)
}
func (action *initializeAction) isDuplicate(ctx context.Context, thisPlatform *v1alpha1.IntegrationPlatform) (bool, error) {
diff --git a/pkg/controller/integrationplatform/start.go b/pkg/controller/integrationplatform/start.go
index e9974ed..2fa8a7e 100644
--- a/pkg/controller/integrationplatform/start.go
+++ b/pkg/controller/integrationplatform/start.go
@@ -53,7 +53,7 @@ func (action *startAction) Handle(ctx context.Context, platform *v1alpha1.Integr
action.L.Info("IntegrationPlatform state transition", "phase", target.Status.Phase)
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
// wait
return nil