You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "wmedvede (via GitHub)" <gi...@apache.org> on 2024/04/29 17:29:44 UTC

[PR] kie-kogito-serverless-operator-441: Make the SonataFlowBuild smarter to manage persistence related extensions/props based on configuration [incubator-kie-kogito-serverless-operator]

wmedvede opened a new pull request, #456:
URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/456

   <!--
   
   Welcome to the SonataFlow Operator! Before contributing, make sure to:
   
   - Rebase your branch on the latest upstream main
   - Link any relevant issues, PR's, or documentation
   - Check that the commit message is concise and helpful:
       - When fixing an issue, add "Closes #<ISSUE_NUMBER>"
   - Follow the below checklist 
   
   -->
   
   **Description of the change:**
   
   
   **Motivation for the change:**
   
   
   **Checklist**
   
   - [ ] Add or Modify a unit test for your change
   - [ ] Have you verified that tall the tests are passing?
   
   <details>
   <summary>
   How to backport a pull request to a different branch?
   </summary>
   
   In order to automatically create a **backporting pull request** please add one or more labels having the following format `backport-<branch-name>`, where `<branch-name>` is the name of the branch where the pull request must be backported to (e.g., `backport-7.67.x` to backport the original PR to the `7.67.x` branch).
   
   > **NOTE**: **backporting** is an action aiming to move a change (usually a commit) from a branch (usually the main one) to another one, which is generally referring to a still maintained release branch. Keeping it simple: it is about to move a specific change or a set of them from one branch to another.
   
   Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.
   
   If something goes wrong, the author will be notified and at this point a manual backporting is needed.
   
   > **NOTE**: this automated backporting is triggered whenever a pull request on `main` branch is labeled or closed, but both conditions must be satisfied to get the new PR created.
   </details>


-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-kogito-serverless-operator-441: Make the SonataFlowBuild smarter to manage persistence related extensions/props based on configuration [incubator-kie-kogito-serverless-operator]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on PR #456:
URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/456#issuecomment-2083299588

   Hi  @ricardozanini , would you mind take a look at the solution proposal.
   I have tested it locally in minikube and the idea works, it was possible to make the WF work with persistence by adding no extra extensions or build-time properties.
   
   The OpenShift bits I need to test, but the idea is equivalent.
   
   


-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-kogito-serverless-operator-441: Make the SonataFlowBuild smarter to manage persistence related extensions/props based on configuration [incubator-kie-kogito-serverless-operator]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on code in PR #456:
URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/456#discussion_r1583468712


##########
controllers/profiles/preview/states_preview.go:
##########
@@ -62,6 +64,25 @@ func (h *newBuilderState) Do(ctx context.Context, workflow *operatorapi.SonataFl
 		klog.V(log.E).ErrorS(err, "Failed to get active platform")
 		return ctrl.Result{RequeueAfter: requeueWhileWaitForPlatform}, nil, err
 	}
+
+	//TODO WM remove this comment.
+	fmt.Printf("XXXX: Preparing workflow properties before build for workflow: %s\n", workflow.Name)
+	// Ensure the properties are prepared before starting the build process, and thus, we make them available at build time.
+	userPropsCM, _, err := h.ensurers.userPropsConfigMap.Ensure(ctx, workflow)

Review Comment:
   @ricardozanini And here, to ensure the configmaps with the applications properites are available at build time, we create them before going to the build phase.



-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-kogito-serverless-operator-441: Make the SonataFlowBuild smarter to manage persistence related extensions/props based on configuration [incubator-kie-kogito-serverless-operator]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on code in PR #456:
URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/456#discussion_r1583466755


##########
controllers/builder/openshiftbuilder.go:
##########
@@ -196,6 +196,15 @@ func (o *openshiftBuilderManager) addExternalResources(config *buildv1.BuildConf
 			DestinationDir: workflowRes.WorkflowPath,
 		})
 	}
+	//TODO WM remove this comment
+	//make the workflow properties available to the OpenShift build config.
+	configMapSources = append(configMapSources, buildv1.ConfigMapBuildSource{

Review Comment:
   @ricardozanini for the OpenShift build, we do something similar than with the kaniko build task. And we basically add the application.properties to the build.



-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-kogito-serverless-operator-441: Make the SonataFlowBuild smarter to manage persistence related extensions/props based on configuration [incubator-kie-kogito-serverless-operator]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on code in PR #456:
URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/456#discussion_r1583463862


##########
controllers/builder/kogitoserverlessbuild_manager.go:
##########
@@ -54,7 +63,21 @@ func (k *sonataFlowBuildManager) GetOrCreateBuild(workflow *operatorapi.SonataFl
 			if plat, err = platform.GetActivePlatform(k.ctx, k.client, workflow.Namespace); err != nil {
 				return nil, err
 			}
-			buildInstance.Spec.BuildTemplate = plat.Spec.Build.Template
+			fmt.Println("XXXX original build template")
+			fmt.Println(plat.Spec.Build.Template)
+
+			workflowBuildTemplate := plat.Spec.Build.Template.DeepCopy()
+			if workflow.Spec.Persistence != nil && workflow.Spec.Persistence.PostgreSQL != nil {
+				//TODO WM, remove this comment

Review Comment:
   @ricardozanini , here the idea is: when we create the SonataFlowBuild, we add the persistence related extensions and maven_build_args accordingly.
   We do a smart adding...., if we detect that users already added stuff related to the persistence at the SonataFlowPlatform, we respect these settings.  



-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-kogito-serverless-operator-441: Make the SonataFlowBuild smarter to manage persistence related extensions/props based on configuration [incubator-kie-kogito-serverless-operator]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede closed pull request #456: kie-kogito-serverless-operator-441: Make the SonataFlowBuild smarter to manage persistence related extensions/props based on configuration
URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/456


-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-kogito-serverless-operator-441: Make the SonataFlowBuild smarter to manage persistence related extensions/props based on configuration [incubator-kie-kogito-serverless-operator]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on code in PR #456:
URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/456#discussion_r1583484307


##########
controllers/profiles/common/persistence/postgresql.go:
##########
@@ -145,3 +172,20 @@ func RetrieveConfiguration(primary *v1alpha08.PersistenceOptionsSpec, platformPe
 	}
 	return c
 }
+
+func GetPostgreSQLExtensions() []GAV {
+	//TODO WM
+	//we need a smart way to distinguish the artifacts in case we have different ones for product/community release.
+	return []GAV{
+		{"io.quarkus", "quarkus-jdbc-postgresql", "3.2.10.Final"},

Review Comment:
   @ricardozanini And here, similar to the DI and JS images, I think we need a smart/configurable way to tell the operator which extensions to use depending if we are in community or customized product builds.
   
   Mabye we can use the controllers_cfg.yaml
   
   wdyt?
   
   
   



-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-kogito-serverless-operator-441: Make the SonataFlowBuild smarter to manage persistence related extensions/props based on configuration [incubator-kie-kogito-serverless-operator]

Posted by "wmedvede (via GitHub)" <gi...@apache.org>.
wmedvede commented on code in PR #456:
URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/456#discussion_r1583458974


##########
controllers/builder/containerbuilder.go:
##########
@@ -200,6 +206,12 @@ func newBuild(buildInput kanikoBuildInput, platform api.PlatformContainerBuild,
 		newBuilder.AddConfigMapResource(res.ConfigMap, res.WorkflowPath)
 	}
 
+	//TODO WM, remove this comment.
+	//make the workflow properties available to the kaniko build.
+	for _, props := range buildInput.workflowProperties {
+		newBuilder.AddConfigMapResource(props.ConfigMap, props.WorkflowPath)

Review Comment:
   @ricardozanini So, the idea is:
   At the time of launching the kaniko build, we configure additionally the application.properties and the managed properties. In that way, both properties are available at build time.
   



-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org