wmedvede commented on code in PR #345:
URL:
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/345#discussion_r1464952833
##########
controllers/platform/services/properties.go:
##########
@@ -160,7 +160,8 @@ func GenerateDataIndexWorkflowProperties(workflow
*operatorapi.SonataFlow, platf
props := properties.NewProperties()
props.Set(constants.KogitoProcessDefinitionsEventsEnabled, "false")
props.Set(constants.KogitoProcessInstancesEventsEnabled, "false")
- if workflow != nil && !profiles.IsDevProfile(workflow) &&
dataIndexEnabled(platform) {
+ di := NewDataIndexHandler(platform)
Review Comment:
another silly question... , imagine that in the current platform (the one
existing in the worfklow namespace) we don't have for example a DataIndex
configured, but instead we have a cluster platform that has.
At which point are we taking the url of the cluster platform to configure
this workflow?
##########
controllers/sonataflowplatform_controller.go:
##########
@@ -166,12 +170,106 @@ func (r *SonataFlowPlatformReconciler) Reconcile(ctx
context.Context, req reconc
}
+// If an active cluster platform exists, update platform.Status accordingly
+func (r *SonataFlowPlatformReconciler) SonataFlowPlatformUpdateStatus(ctx
context.Context, req reconcile.Request, target *operatorapi.SonataFlowPlatform)
error {
+ // Fetch the active SonataFlowClusterPlatform instance
+ sfcPlatform, err := clusterplatform.GetActiveClusterPlatform(ctx,
r.Client)
+ if err != nil && !errors.IsNotFound(err) {
+ klog.V(log.E).ErrorS(err, "Failed to get active
SonataFlowClusterPlatform")
+ return err
+ }
+
+ if sfcPlatform != nil {
+ sfPlatform := &operatorapi.SonataFlowPlatform{}
+
+ platformRef := sfcPlatform.Spec.PlatformRef
+ namespacedName := types.NamespacedName{Namespace:
platformRef.Namespace, Name: platformRef.Name}
+ if req.NamespacedName == namespacedName {
+ sfPlatform = target.DeepCopy()
+ } else {
+ // retrieve referenced platform object
+ err := r.Reader.Get(ctx, namespacedName, sfPlatform)
+ if err != nil && !errors.IsNotFound(err) {
+ klog.V(log.E).ErrorS(err, "Failed to get
referenced SonataFlowPlatform", namespacedName)
+ return err
+ }
+ }
+
+ target.Status.ClusterPlatformRef =
&operatorapi.SonataFlowClusterPlatformRefStatus{
+ Name: sfcPlatform.Name,
+ PlatformRef: operatorapi.SonataFlowPlatformRef{
+ Name: platformRef.Name,
+ Namespace: platformRef.Namespace,
+ },
+ }
+
+ tpsDI := services.NewDataIndexHandler(target)
+ tpsDI.SetServiceUrlInStatus(sfPlatform)
+
+ tpsJS := services.NewJobServiceHandler(target)
+ tpsJS.SetServiceUrlInStatus(sfPlatform)
Review Comment:
Same question for the jobs-service
##########
controllers/sonataflowplatform_controller.go:
##########
@@ -166,12 +170,106 @@ func (r *SonataFlowPlatformReconciler) Reconcile(ctx
context.Context, req reconc
}
+// If an active cluster platform exists, update platform.Status accordingly
+func (r *SonataFlowPlatformReconciler) SonataFlowPlatformUpdateStatus(ctx
context.Context, req reconcile.Request, target *operatorapi.SonataFlowPlatform)
error {
+ // Fetch the active SonataFlowClusterPlatform instance
+ sfcPlatform, err := clusterplatform.GetActiveClusterPlatform(ctx,
r.Client)
+ if err != nil && !errors.IsNotFound(err) {
+ klog.V(log.E).ErrorS(err, "Failed to get active
SonataFlowClusterPlatform")
+ return err
+ }
+
+ if sfcPlatform != nil {
+ sfPlatform := &operatorapi.SonataFlowPlatform{}
+
+ platformRef := sfcPlatform.Spec.PlatformRef
+ namespacedName := types.NamespacedName{Namespace:
platformRef.Namespace, Name: platformRef.Name}
+ if req.NamespacedName == namespacedName {
+ sfPlatform = target.DeepCopy()
+ } else {
+ // retrieve referenced platform object
+ err := r.Reader.Get(ctx, namespacedName, sfPlatform)
+ if err != nil && !errors.IsNotFound(err) {
+ klog.V(log.E).ErrorS(err, "Failed to get
referenced SonataFlowPlatform", namespacedName)
+ return err
+ }
+ }
+
+ target.Status.ClusterPlatformRef =
&operatorapi.SonataFlowClusterPlatformRefStatus{
+ Name: sfcPlatform.Name,
+ PlatformRef: operatorapi.SonataFlowPlatformRef{
+ Name: platformRef.Name,
+ Namespace: platformRef.Namespace,
+ },
+ }
+
+ tpsDI := services.NewDataIndexHandler(target)
+ tpsDI.SetServiceUrlInStatus(sfPlatform)
Review Comment:
Here I don't understand the final result of this method execution.
Let me explain the following scenario.
1) ok, a SonataFlowClusterPlatorm platform already exist, and let's says
that refers to **my-previous-sonataflow-platform** , and imagine, that it has
already a data-index already provisioned, let's say
**http://my-previous-data-index**
2) in the platform that is being reconciled now, I want to deploy my own
data-index, let's say, **http://my-own-data-index**. So, I don't want to use
the one defined in the SonataFlowClusterPlatorm, all good, this is possible.
3) after this method executes, it looks like the **sfPlaform**, that in the
end points too the cluster wide SonataFlowPlatorm referenced by the current
SonataFlowClusterPlatorm -> **my-previous-sonataflow-platform**, will now
point too: **http://my-own-data-index**
I am correct?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]