This is an automated email from the ASF dual-hosted git repository.
nferraro 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 f7714fe Enable status subresource for integration
f7714fe is described below
commit f7714fe1de55454f2f7a26f9c29b87f9e4d97e0e
Author: Antonin Stefanutti <[email protected]>
AuthorDate: Tue Jan 22 13:05:59 2019 +0100
Enable status subresource for integration
---
deploy/crd-integration.yaml | 2 ++
deploy/resources.go | 2 ++
pkg/controller/integration/build_context.go | 10 +++++-----
pkg/controller/integration/build_image.go | 4 ++--
pkg/controller/integration/build_image_failure_recovery.go | 4 ++--
pkg/controller/integration/deploy.go | 2 +-
pkg/controller/integration/initialize.go | 8 ++++----
pkg/controller/integration/monitor.go | 2 +-
8 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/deploy/crd-integration.yaml b/deploy/crd-integration.yaml
index 11db52b..e6e2657 100644
--- a/deploy/crd-integration.yaml
+++ b/deploy/crd-integration.yaml
@@ -8,6 +8,8 @@ spec:
group: camel.apache.org
scope: Namespaced
version: v1alpha1
+ subresources:
+ status: {}
names:
kind: Integration
listKind: IntegrationList
diff --git a/deploy/resources.go b/deploy/resources.go
index 211bda6..68cfc91 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -2870,6 +2870,8 @@ spec:
group: camel.apache.org
scope: Namespaced
version: v1alpha1
+ subresources:
+ status: {}
names:
kind: Integration
listKind: IntegrationList
diff --git a/pkg/controller/integration/build_context.go
b/pkg/controller/integration/build_context.go
index 26315c1..c78c588 100644
--- a/pkg/controller/integration/build_context.go
+++ b/pkg/controller/integration/build_context.go
@@ -66,7 +66,7 @@ func (action *buildContextAction) Handle(ctx context.Context,
integration *v1alp
// with a context
target := integration.DeepCopy()
target.Status.Context = ""
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx,
target)
}
}
@@ -83,7 +83,7 @@ func (action *buildContextAction) Handle(ctx context.Context,
integration *v1alp
logrus.Info("Integration ", target.Name, "
transitioning to state ", target.Status.Phase)
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
if ictx.Status.Phase == v1alpha1.IntegrationContextPhaseReady {
@@ -104,14 +104,14 @@ func (action *buildContextAction) Handle(ctx
context.Context, integration *v1alp
logrus.Info("Integration ", target.Name, "
transitioning to state ", target.Status.Phase)
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
if integration.Status.Context == "" {
// We need to set the context
target := integration.DeepCopy()
target.Status.Context = ictx.Name
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
return nil
@@ -145,5 +145,5 @@ func (action *buildContextAction) Handle(ctx
context.Context, integration *v1alp
target := integration.DeepCopy()
target.Status.Context = platformCtxName
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
diff --git a/pkg/controller/integration/build_image.go
b/pkg/controller/integration/build_image.go
index f381ad5..5a0778e 100644
--- a/pkg/controller/integration/build_image.go
+++ b/pkg/controller/integration/build_image.go
@@ -146,7 +146,7 @@ func (action *buildImageAction) handleBuildStateChange(ctx
context.Context, res
logrus.Infof("Integration %s transitioning to state %s, reason:
%s", target.Name, target.Status.Phase, res.Error.Error())
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
case builder.StatusCompleted:
target.Status.Phase = v1alpha1.IntegrationPhaseDeploying
if res.PublicImage != "" {
@@ -164,7 +164,7 @@ func (action *buildImageAction) handleBuildStateChange(ctx
context.Context, res
logrus.Info("Integration ", target.Name, " transitioning to
state ", 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/integration/build_image_failure_recovery.go
b/pkg/controller/integration/build_image_failure_recovery.go
index c4f41de..0accf10 100644
--- a/pkg/controller/integration/build_image_failure_recovery.go
+++ b/pkg/controller/integration/build_image_failure_recovery.go
@@ -68,7 +68,7 @@ func (action *errorRecoveryAction) Handle(ctx
context.Context, integration *v1al
logrus.Infof("Max recovery attempt reached for integration %s,
transition to phase %s", integration.Name, string(target.Status.Phase))
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
if integration.Status.Failure != nil {
@@ -97,7 +97,7 @@ func (action *errorRecoveryAction) Handle(ctx
context.Context, integration *v1al
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/integration/deploy.go
b/pkg/controller/integration/deploy.go
index a8ac087..f53c37e 100644
--- a/pkg/controller/integration/deploy.go
+++ b/pkg/controller/integration/deploy.go
@@ -75,5 +75,5 @@ func (action *deployAction) Handle(ctx context.Context,
integration *v1alpha1.In
target.Status.Phase = v1alpha1.IntegrationPhaseRunning
logrus.Info("Integration ", target.Name, " transitioning to state ",
target.Status.Phase)
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
diff --git a/pkg/controller/integration/initialize.go
b/pkg/controller/integration/initialize.go
index 1e321a4..1ec852c 100644
--- a/pkg/controller/integration/initialize.go
+++ b/pkg/controller/integration/initialize.go
@@ -62,7 +62,7 @@ func (action *initializeAction) Handle(ctx context.Context,
integration *v1alpha
logrus.Info("Integration ", target.Name, "
transitioning to state ", target.Status.Phase)
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
return nil
@@ -74,7 +74,7 @@ func (action *initializeAction) Handle(ctx context.Context,
integration *v1alpha
}
//
- // restore phase to initial phase ase traits are not aware of
+ // restore phase to initial phase as traits are not aware of
// WaitingForPlatform phase
//
if integration.Status.Phase ==
v1alpha1.IntegrationPhaseWaitingForPlatform {
@@ -82,7 +82,7 @@ func (action *initializeAction) Handle(ctx context.Context,
integration *v1alpha
target.Status.Phase = v1alpha1.IntegrationPhaseInitial
target.Status.Digest = dgst
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
// better not changing the spec section of the target because it may be
used for comparison by a
@@ -109,5 +109,5 @@ func (action *initializeAction) Handle(ctx context.Context,
integration *v1alpha
logrus.Info("Integration ", target.Name, " transitioning to state ",
target.Status.Phase)
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
diff --git a/pkg/controller/integration/monitor.go
b/pkg/controller/integration/monitor.go
index 3f0d6a5..8ef911b 100644
--- a/pkg/controller/integration/monitor.go
+++ b/pkg/controller/integration/monitor.go
@@ -59,7 +59,7 @@ func (action *monitorAction) Handle(ctx context.Context,
integration *v1alpha1.I
logrus.Info("Integration ", target.Name, " transitioning to
state ", target.Status.Phase)
- return action.client.Update(ctx, target)
+ return action.client.Status().Update(ctx, target)
}
// TODO check also if deployment matches (e.g. replicas)