This is an automated email from the ASF dual-hosted git repository.
ricardozanini pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-serverless-operator.git
The following commit(s) were added to refs/heads/main by this push:
new e9fce097 Fix #484 - :link: Add platform reference to workflow status
condition (#485)
e9fce097 is described below
commit e9fce097b236bce84304a867790ba8661988fa32
Author: Ricardo Zanini <[email protected]>
AuthorDate: Mon Jun 17 15:02:36 2024 -0300
Fix #484 - :link: Add platform reference to workflow status condition (#485)
Signed-off-by: Ricardo Zanini <[email protected]>
---
api/v1alpha08/sonataflow_types.go | 3 +++
api/v1alpha08/sonataflowplatform_types.go | 2 +-
api/v1alpha08/zz_generated.deepcopy.go | 5 +++++
.../sonataflow-operator.clusterserviceversion.yaml | 3 +++
bundle/manifests/sonataflow.org_sonataflows.yaml | 14 ++++++++++++++
config/crd/bases/sonataflow.org_sonataflows.yaml | 14 ++++++++++++++
.../bases/sonataflow-operator.clusterserviceversion.yaml | 3 +++
controllers/profiles/common/reconciler.go | 6 ++++++
controllers/sonataflow_controller_test.go | 3 +++
operator.yaml | 14 ++++++++++++++
10 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/api/v1alpha08/sonataflow_types.go
b/api/v1alpha08/sonataflow_types.go
index e751e003..66f8e360 100644
--- a/api/v1alpha08/sonataflow_types.go
+++ b/api/v1alpha08/sonataflow_types.go
@@ -182,6 +182,9 @@ type SonataFlowStatus struct {
// Services displays which platform services are being used by this
workflow
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="services"
Services *PlatformServicesStatus `json:"services,omitempty"`
+ // Platform displays which platform is being used by this workflow
+
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="platform"
+ Platform *SonataFlowPlatformRef `json:"platform,omitempty"`
}
func (s *SonataFlowStatus) GetTopLevelConditionType() api.ConditionType {
diff --git a/api/v1alpha08/sonataflowplatform_types.go
b/api/v1alpha08/sonataflowplatform_types.go
index a564cde0..b9f42c82 100644
--- a/api/v1alpha08/sonataflowplatform_types.go
+++ b/api/v1alpha08/sonataflowplatform_types.go
@@ -108,7 +108,7 @@ type SonataFlowClusterPlatformRefStatus struct {
Services *PlatformServicesStatus `json:"services,omitempty"`
}
-// PlatformServicesStatus displays which cluster-wide services are being used
by a SonataFlowPlatform
+// PlatformServicesStatus displays which cluster-wide services are being used
by a SonataFlowPlatform or SonataFlow
// +k8s:openapi-gen=true
type PlatformServicesStatus struct {
// DataIndexRef displays information on the cluster-wide Data Index
service
diff --git a/api/v1alpha08/zz_generated.deepcopy.go
b/api/v1alpha08/zz_generated.deepcopy.go
index 645d2b60..b1151889 100644
--- a/api/v1alpha08/zz_generated.deepcopy.go
+++ b/api/v1alpha08/zz_generated.deepcopy.go
@@ -1302,6 +1302,11 @@ func (in *SonataFlowStatus) DeepCopyInto(out
*SonataFlowStatus) {
*out = new(PlatformServicesStatus)
(*in).DeepCopyInto(*out)
}
+ if in.Platform != nil {
+ in, out := &in.Platform, &out.Platform
+ *out = new(SonataFlowPlatformRef)
+ **out = **in
+ }
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new SonataFlowStatus.
diff --git a/bundle/manifests/sonataflow-operator.clusterserviceversion.yaml
b/bundle/manifests/sonataflow-operator.clusterserviceversion.yaml
index 73037612..c9a617e2 100644
--- a/bundle/manifests/sonataflow-operator.clusterserviceversion.yaml
+++ b/bundle/manifests/sonataflow-operator.clusterserviceversion.yaml
@@ -328,6 +328,9 @@ spec:
path: endpoint
- displayName: lastTimeRecoverAttempt
path: lastTimeRecoverAttempt
+ - description: Platform displays which platform is being used by this
workflow
+ displayName: platform
+ path: platform
- description: keeps track of how many failure recovers a given workflow
had
so far
displayName: recoverFailureAttempts
diff --git a/bundle/manifests/sonataflow.org_sonataflows.yaml
b/bundle/manifests/sonataflow.org_sonataflows.yaml
index 6f2cb2e7..5ff75cae 100644
--- a/bundle/manifests/sonataflow.org_sonataflows.yaml
+++ b/bundle/manifests/sonataflow.org_sonataflows.yaml
@@ -9461,6 +9461,20 @@ spec:
description: The generation observed by the deployment
controller.
format: int64
type: integer
+ platform:
+ description: Platform displays which platform is being used by
this
+ workflow
+ properties:
+ name:
+ description: Name of the SonataFlowPlatform
+ type: string
+ namespace:
+ description: Namespace of the SonataFlowPlatform
+ type: string
+ required:
+ - name
+ - namespace
+ type: object
recoverFailureAttempts:
description: keeps track of how many failure recovers a given
workflow
had so far
diff --git a/config/crd/bases/sonataflow.org_sonataflows.yaml
b/config/crd/bases/sonataflow.org_sonataflows.yaml
index 61002c32..7ee4675c 100644
--- a/config/crd/bases/sonataflow.org_sonataflows.yaml
+++ b/config/crd/bases/sonataflow.org_sonataflows.yaml
@@ -9462,6 +9462,20 @@ spec:
description: The generation observed by the deployment
controller.
format: int64
type: integer
+ platform:
+ description: Platform displays which platform is being used by
this
+ workflow
+ properties:
+ name:
+ description: Name of the SonataFlowPlatform
+ type: string
+ namespace:
+ description: Namespace of the SonataFlowPlatform
+ type: string
+ required:
+ - name
+ - namespace
+ type: object
recoverFailureAttempts:
description: keeps track of how many failure recovers a given
workflow
had so far
diff --git
a/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml
b/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml
index c8fc4c8a..8bdae524 100644
--- a/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml
+++ b/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml
@@ -212,6 +212,9 @@ spec:
path: endpoint
- displayName: lastTimeRecoverAttempt
path: lastTimeRecoverAttempt
+ - description: Platform displays which platform is being used by this
workflow
+ displayName: platform
+ path: platform
- description: keeps track of how many failure recovers a given workflow
had
so far
displayName: recoverFailureAttempts
diff --git a/controllers/profiles/common/reconciler.go
b/controllers/profiles/common/reconciler.go
index 8af93699..5fb7913a 100644
--- a/controllers/profiles/common/reconciler.go
+++ b/controllers/profiles/common/reconciler.go
@@ -57,6 +57,12 @@ func (s *StateSupport) PerformStatusUpdate(ctx
context.Context, workflow *operat
}
workflow.Status.ObservedGeneration = workflow.Generation
services.SetServiceUrlsInWorkflowStatus(pl, workflow)
+ if workflow.Status.Platform == nil {
+ workflow.Status.Platform = &operatorapi.SonataFlowPlatformRef{}
+ }
+ workflow.Status.Platform.Name = pl.Name
+ workflow.Status.Platform.Namespace = pl.Namespace
+
if err = s.C.Status().Update(ctx, workflow); err != nil {
klog.V(log.E).ErrorS(err, "Failed to update Workflow status")
return false, err
diff --git a/controllers/sonataflow_controller_test.go
b/controllers/sonataflow_controller_test.go
index d16e485a..b2993d0e 100644
--- a/controllers/sonataflow_controller_test.go
+++ b/controllers/sonataflow_controller_test.go
@@ -80,5 +80,8 @@ func TestSonataFlowController(t *testing.T) {
assert.True(t, ksw.Spec.Flow.Start.StateName ==
"ChooseOnLanguage")
assert.True(t, len(ksw.Spec.Flow.States) == 4)
+
+ assert.Equal(t, ksp.Name,
afterReconcileWorkflow.Status.Platform.Name)
+ assert.Equal(t, ksp.Namespace,
afterReconcileWorkflow.Status.Platform.Namespace)
})
}
diff --git a/operator.yaml b/operator.yaml
index debd5bff..f7d09313 100644
--- a/operator.yaml
+++ b/operator.yaml
@@ -26358,6 +26358,20 @@ spec:
description: The generation observed by the deployment
controller.
format: int64
type: integer
+ platform:
+ description: Platform displays which platform is being used by
this
+ workflow
+ properties:
+ name:
+ description: Name of the SonataFlowPlatform
+ type: string
+ namespace:
+ description: Namespace of the SonataFlowPlatform
+ type: string
+ required:
+ - name
+ - namespace
+ type: object
recoverFailureAttempts:
description: keeps track of how many failure recovers a given
workflow
had so far
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]