Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KOGITO-9982] Add Persistence field in SonataFlow CRD #322

Conversation

jordigilh
Copy link
Contributor

  • Adds the Persistence field in the SonataFlow CRD
  • Adds the implementation to handle PostgreSQL persistence type
  • If Persistence field is empty or nil, no persistence is defined.

@tchughesiv @wmedvede @ricardozanini PTAL.

@jordigilh jordigilh force-pushed the kogito_9982_add_persistence_field_sonataflow_crd branch from a3b93f8 to 317038d Compare January 2, 2024 22:07
Copy link

@jakubschwan jakubschwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good to me. Please also check and resolve failing PR checks.

@domhanak
Copy link
Contributor

domhanak commented Jan 15, 2024

@jordigilh another rebase should solve the test issues.

@jordigilh jordigilh force-pushed the kogito_9982_add_persistence_field_sonataflow_crd branch from 317038d to 4391cad Compare January 15, 2024 18:22
@domhanak
Copy link
Contributor

Looks like the added test case is not working here on CI:
Needs to be stable to merge, I am trying to reproduce the test failure locally.

Validate the persistence  when deploying a SonataFlow CR with PostgreSQL persistence [It] defined in the workflow from an existing kubernetes service as a reference
/home/runner/work/incubator-kie-kogito-serverless-operator/incubator-kie-kogito-serverless-operator/test/e2e/persistence_test.go:123

  [FAILED] Timed out after 600.001s.
  Expected success, but got an error:
      <*errors.errorString | 0xc00007a2a0>: 
      kubectl wait pod -n test-546 -l sonataflow.org/workflow-app=callbackstatetimeouts --for condition=Ready --timeout=5s failed with error: (exit status 1) error: timed out waiting for the condition on pods/callbackstatetimeouts-7bf57f9968-5nfsl
      
      {
          s: "kubectl wait pod -n test-546 -l sonataflow.org/workflow-app=callbackstatetimeouts --for condition=Ready --timeout=5s failed with error: (exit status 1) error: timed out waiting for the condition on pods/callbackstatetimeouts-7bf57f9968-5nfsl\n",
      }

@jordigilh jordigilh force-pushed the kogito_9982_add_persistence_field_sonataflow_crd branch from 4391cad to ce93deb Compare January 18, 2024 15:03
@jordigilh
Copy link
Contributor Author

Looks like the added test case is not working here on CI: Needs to be stable to merge, I am trying to reproduce the test failure locally.

Validate the persistence  when deploying a SonataFlow CR with PostgreSQL persistence [It] defined in the workflow from an existing kubernetes service as a reference
/home/runner/work/incubator-kie-kogito-serverless-operator/incubator-kie-kogito-serverless-operator/test/e2e/persistence_test.go:123

  [FAILED] Timed out after 600.001s.
  Expected success, but got an error:
      <*errors.errorString | 0xc00007a2a0>: 
      kubectl wait pod -n test-546 -l sonataflow.org/workflow-app=callbackstatetimeouts --for condition=Ready --timeout=5s failed with error: (exit status 1) error: timed out waiting for the condition on pods/callbackstatetimeouts-7bf57f9968-5nfsl
      
      {
          s: "kubectl wait pod -n test-546 -l sonataflow.org/workflow-app=callbackstatetimeouts --for condition=Ready --timeout=5s failed with error: (exit status 1) error: timed out waiting for the condition on pods/callbackstatetimeouts-7bf57f9968-5nfsl\n",
      }

Fixed 😄

@jordigilh jordigilh force-pushed the kogito_9982_add_persistence_field_sonataflow_crd branch 5 times, most recently from 5a721cd to 81e5814 Compare January 19, 2024 00:39
@jordigilh
Copy link
Contributor Author

@ricardozanini ready to be merged. Please note that I had to remove the DEBUG=true env value in the job because it caused the kubectl commands to dump extra log entries and that caused errors when parsing the output as it did not match the expected output.

@ricardozanini
Copy link
Member

@jordigilh many thanks! we Will wait for QE verification first with @domhanak

@ricardozanini
Copy link
Member

Please note that I had to remove the DEBUG=true env value in the job because it caused the kubectl commands to dump extra log entries and that caused errors when parsing the output as it did not match the expected output.

Thanks! I've removed this env var too in an opened PR! 😄

Copy link
Member

@ricardozanini ricardozanini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just left some minor comments if you don't mind. Otherwise looks good! Many thanks!

controllers/platform/services/services.go Outdated Show resolved Hide resolved
}

var (
postgreSQLPort = 5432
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit; are you using this var outside the TestMergePodSpec_OverrideContainers_WithPostgreSQL_and_ServiceRef test scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep it within the test scope then.

test/e2e/persistence_test.go Outdated Show resolved Hide resolved
test/e2e/workflow_test.go Outdated Show resolved Hide resolved
template:
buildArgs:
- name: QUARKUS_EXTENSIONS
value: org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:999-SNAPSHOT,org.kie.kogito:kogito-addons-quarkus-persistence-jdbc:999-SNAPSHOT,io.quarkus:quarkus-jdbc-postgresql:3.2.9.Final,io.quarkus:quarkus-agroal:3.2.9.Final
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wmedvede I think it's worth adding those to the images, so we keep them in the cache to facilitate persistence use cases. wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jordigilh @ricardozanini @tchughesiv @masayag
I think we need to assess here, because the persistence is a sort of all or nothing.

I mean, if we add the org.kie.kogito:kogito-addons-quarkus-persistence-jdbc:999-SNAPSHOT to the kogito-swf-builder, then, every workflow image we produce must use persistence, otherwise we'll have runtime start-up failures.
Additionally, we have the following scenarios:

1) The images is produced externally:
The workflow must come already built with the proper extensions incorporated in the produced image, and users might decide in a per-workflow basis to include the persistence related addons.
The operator just relies on the workflow CRD con connect with the DB, and just produce the ENV vars as Jordi is doing.
If the image is not ok, it's not the operator problem. Which make sense in my opinion.

(right now, AFAIK Parodos team is using the kogito-swf-builder series, however they might eventually produce the images by adding the persistence related extensions in a per-workflow basis,
or always add them if they always want persistence)

2) The Image is produced by the operator, and thus, managed by Kaniko or OpenShift based builds, etc.
In these cases, we could eventually manage to add the persistence extensions somehow dynamically, since in the end, for example with the Kaniko build we are producing a sonataflow-my-workflow-builder CM and here we can maybe manage to add these extensions.

But, since Parodos is working with 1), I think they should add those extensions in their images build system.

@ricardozanini
Copy link
Member

@tchughesiv can you please review it too?

Copy link
Contributor

@tchughesiv tchughesiv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jordigilh jordigilh force-pushed the kogito_9982_add_persistence_field_sonataflow_crd branch 2 times, most recently from 1d717ba to 0af9418 Compare January 19, 2024 19:36
Copy link
Contributor

@wmedvede wmedvede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I have added a general comment regarding the images generation that I think make sense, take a look please

@jordigilh jordigilh force-pushed the kogito_9982_add_persistence_field_sonataflow_crd branch from e7d5100 to 76116ce Compare January 22, 2024 19:05
@wmedvede
Copy link
Contributor

Hi @jordigilh , it looks like we have some merge conflicts now, would you mind take a look please.

@jordigilh jordigilh force-pushed the kogito_9982_add_persistence_field_sonataflow_crd branch 5 times, most recently from 811f961 to 1086910 Compare January 24, 2024 23:39
@jordigilh jordigilh force-pushed the kogito_9982_add_persistence_field_sonataflow_crd branch from 1086910 to fa42ecd Compare January 25, 2024 13:58
@jordigilh jordigilh force-pushed the kogito_9982_add_persistence_field_sonataflow_crd branch from fa42ecd to 89ef882 Compare January 25, 2024 14:23
@jordigilh
Copy link
Contributor Author

@ricardozanini PR is green. Can we merge it?

@ricardozanini
Copy link
Member

Let's wait for @wmedvede approval. I'll also take a look on it tomorrow.

@wmedvede
Copy link
Contributor

Let's wait for @wmedvede approval. I'll also take a look on it tomorrow.

@jordigilh @ricardozanini
This PR was already approved from my side guys.

@ricardozanini ricardozanini merged commit 2b5056d into apache:main Jan 26, 2024
4 checks passed
@ricardozanini
Copy link
Member

@jordigilh can you please open a task to update the docs too? Thank you!

rgdoliveira pushed a commit to rgdoliveira/kogito-serverless-operator that referenced this pull request Jan 29, 2024
* Added Persistence field in SonataFlow CRD

Signed-off-by: Jordi Gil <[email protected]>

* Added implementation to manage PostgreSQL persistence type in the SonataFlow CRD

Signed-off-by: Jordi Gil <[email protected]>

* Added end to end tests

Signed-off-by: Jordi Gil <[email protected]>

* Retry health endpoints

Signed-off-by: Jordi Gil <[email protected]>

* Changes based on Ricardo's feedback

Signed-off-by: Jordi Gil <[email protected]>

* Reorganized persistence e2e test and tweaked health check to cover for worfklows that end very quickly, like callbackstatetimeouts

Signed-off-by: Jordi Gil <[email protected]>

* Changes after merge conflicts with platform e2e tests

Signed-off-by: Jordi Gil <[email protected]>

* Added additional check for failing test in workflowproj

Signed-off-by: Jordi Gil <[email protected]>

---------

Signed-off-by: Jordi Gil <[email protected]>
rgdoliveira pushed a commit to rgdoliveira/kogito-serverless-operator that referenced this pull request Jan 29, 2024
* Added Persistence field in SonataFlow CRD

Signed-off-by: Jordi Gil <[email protected]>

* Added implementation to manage PostgreSQL persistence type in the SonataFlow CRD

Signed-off-by: Jordi Gil <[email protected]>

* Added end to end tests

Signed-off-by: Jordi Gil <[email protected]>

* Retry health endpoints

Signed-off-by: Jordi Gil <[email protected]>

* Changes based on Ricardo's feedback

Signed-off-by: Jordi Gil <[email protected]>

* Reorganized persistence e2e test and tweaked health check to cover for worfklows that end very quickly, like callbackstatetimeouts

Signed-off-by: Jordi Gil <[email protected]>

* Changes after merge conflicts with platform e2e tests

Signed-off-by: Jordi Gil <[email protected]>

* Added additional check for failing test in workflowproj

Signed-off-by: Jordi Gil <[email protected]>

---------

Signed-off-by: Jordi Gil <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants