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


##########
controllers/profiles/common/mutate_visitors.go:
##########
@@ -103,6 +106,41 @@ func ServiceMutateVisitor(workflow 
*operatorapi.SonataFlow) MutateVisitor {
        }
 }
 
+func SinkBindingMutateVisitor(workflow *operatorapi.SonataFlow) MutateVisitor {
+       return func(object client.Object) controllerutil.MutateFn {
+               return func() error {
+                       if kubeutil.IsObjectNew(object) {
+                               return nil
+                       }
+                       original, err := SinkBindingCreator(workflow)
+                       if err != nil {
+                               return err
+                       }
+                       return mergo.Merge(&object.(*v1.SinkBinding).Spec, 
original.(*v1.SinkBinding).Spec, mergo.WithOverride)
+               }
+       }
+}
+
+func TriggerMutateVisitor(workflow *operatorapi.SonataFlow) MutateVisitor {
+       return func(object client.Object) controllerutil.MutateFn {
+               return func() error {
+                       if kubeutil.IsObjectNew(object) {
+                               return nil
+                       }
+                       originals, err := TriggersCreator(workflow)
+                       if err != nil {
+                               return err
+                       }
+                       for _, original := range originals {
+                               if original.GetName() == object.GetName() {
+                                       return 
mergo.Merge(&object.(*v12.Trigger).Spec, original.(*v12.Trigger).Spec, 
mergo.WithOverride)

Review Comment:
   Oh I see! Yes, sure! Let's only reconcile the generated fields. This 
generated trigger can be used as a reference to users to create their own. It's 
enough for a first iteration.



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