ricardozanini commented on code in PR #367:
URL: 
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/367#discussion_r1472996469


##########
controllers/profiles/common/mutate_visitors.go:
##########
@@ -105,32 +105,28 @@ func ServiceMutateVisitor(workflow 
*operatorapi.SonataFlow) MutateVisitor {
        }
 }
 
-func WorkflowPropertiesMutateVisitor(ctx context.Context, catalog 
discovery.ServiceCatalog,
-       workflow *operatorapi.SonataFlow, platform 
*operatorapi.SonataFlowPlatform) MutateVisitor {
+func UserPropertiesMutateVisitor(ctx context.Context, catalog 
discovery.ServiceCatalog,
+       workflow *operatorapi.SonataFlow, platform 
*operatorapi.SonataFlowPlatform, userProps *corev1.ConfigMap) MutateVisitor {
        return func(object client.Object) controllerutil.MutateFn {
                return func() error {
-                       if kubeutil.IsObjectNew(object) {
-                               return nil
-                       }
-                       cm := object.(*corev1.ConfigMap)
-                       cm.Labels = workflow.GetLabels()
-                       _, hasKey := 
cm.Data[workflowproj.ApplicationPropertiesFileName]
+                       managedProps := object.(*corev1.ConfigMap)
+                       managedProps.Labels = workflow.GetLabels()
+                       _, hasKey := 
managedProps.Data[workflowproj.GetManagedPropertiesFileName(workflow)]
                        if !hasKey {
-                               cm.Data = make(map[string]string, 1)
-                               props, err := 
properties.ImmutableApplicationProperties(workflow, platform)
-                               if err != nil {
-                                       return err
-                               }
-                               
cm.Data[workflowproj.ApplicationPropertiesFileName] = props
-                               return nil
+                               managedProps.Data = make(map[string]string, 1)
+                               
managedProps.Data[workflowproj.GetManagedPropertiesFileName(workflow)] = ""
                        }
 
+                       userProperties, hasKey := 
userProps.Data[workflowproj.ApplicationPropertiesFileName]
+                       if !hasKey {
+                               userProperties = ""
+                       }
                        // In the future, if this needs change, instead we can 
receive an AppPropertyHandler in this mutator
                        props, err := 
properties.NewAppPropertyHandler(workflow, platform)
                        if err != nil {
                                return err
                        }
-                       cm.Data[workflowproj.ApplicationPropertiesFileName] = 
props.WithUserProperties(cm.Data[workflowproj.ApplicationPropertiesFileName]).
+                       
managedProps.Data[workflowproj.GetManagedPropertiesFileName(workflow)] = 
props.WithUserProperties(userProperties).

Review Comment:
   OH YEAH, you're right! Thanks for the clarification!



-- 
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]

Reply via email to