astefanutti commented on a change in pull request #799: Move waiting for
platform to controller
URL: https://github.com/apache/camel-k/pull/799#discussion_r300269439
##########
File path: pkg/controller/integration/integration_controller.go
##########
@@ -224,48 +226,62 @@ func (r *ReconcileIntegration) Reconcile(request
reconcile.Request) (reconcile.R
return reconcile.Result{}, err
}
- actions := []Action{
- NewInitializeAction(),
- NewBuildKitAction(),
- NewDeployAction(),
- NewMonitorAction(),
- NewDeleteAction(),
- }
-
// Delete phase
if instance.GetDeletionTimestamp() != nil {
instance.Status.Phase = v1alpha1.IntegrationPhaseDeleting
}
- var targetPhase v1alpha1.IntegrationPhase
- var err error
-
target := instance.DeepCopy()
targetLog := rlog.ForIntegration(target)
+ if target.Status.Phase == v1alpha1.IntegrationPhaseNone ||
target.Status.Phase == v1alpha1.IntegrationPhaseWaitingForPlatform {
+ pl, err := platform.GetCurrentPlatform(ctx, r.client,
target.Namespace)
+ switch {
+ case err != nil:
+ target.Status.Phase = v1alpha1.IntegrationPhaseError
+ target.Status.Failure = v1alpha1.NewErrorFailure(err)
+ case pl.Status.Phase != v1alpha1.IntegrationPlatformPhaseReady:
+ target.Status.Phase =
v1alpha1.IntegrationPhaseWaitingForPlatform
+ default:
+ target.Status.Phase =
v1alpha1.IntegrationPhaseInitialization
+ }
+
+ if instance.Status.Phase != target.Status.Phase {
+ err = r.update(ctx, target)
+ if err != nil {
Review comment:
We may want to factorise the conflict error handling in the `update` method
as well.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services