Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

[KOGITO-165] - Kogito Runtime Services integration with Infinispan #116

Merged
merged 1 commit into from
Nov 29, 2019

Conversation

ricardozanini
Copy link
Member

@ricardozanini ricardozanini commented Nov 22, 2019

TODO:

  • CLI integration
  • Integration tests with onboarding example
  • Documentation

------------ 8< -------------

See:
https://issues.jboss.org/browse/KOGITO-165

In this PR:

  1. Introduced the possibility to deploy Infinispan
  2. New spec added to KogitoApp: Infra.InstallInfinispan. Always means that the operator should always install a Infinispan instance; Never won't install, even if requires - the user will provision and configure their own installation; Auto will try to figure out scanning image metadata

The only problem I saw is that if the service doesn't set the infinispan properties in the application.properties, won't work since Quarkus is not reading from env. See a working example here: https://github.com/ricardozanini/kogito-examples/blob/infinispan-props/onboarding-example/onboarding/src/main/resources/application.properties#L4-L6

@mswiderski is this a problem? We can set the -D in the images if the envs where found in the container. For Quarkus:

  - env:
            - name: NAMESPACE
              value: kogito
            - name: KOGITO_DATAINDEX_URL
            - name: QUARKUS_INFINISPAN_CLIENT_SERVER_LIST
              value: 'kogito-infinispan:11222'
            - name: QUARKUS_INFINISPAN_CLIENT_AUTH_USERNAME
              value: developer
            - name: QUARKUS_INFINISPAN_CLIENT_AUTH_PASSWORD
              value: Z1Nz34JpuVdzMQKi
            - name: QUARKUS_INFINISPAN_CLIENT_SASL_MECHANISM
              value: PLAIN

@mswiderski one more thing, the onboarding example is failing (I just deployed the onboarding, not the others services): https://pastebin.com/AHXuMRPu. Fixed, to work all three services must be running.

Is this the expected behavior? Tomorrow I'll try to deploy the other services.

Many thanks for submiting your Pull Request ❤️!

Please make sure that your PR meets the following requirements:

  • You have read the contributors guide
  • Pull Request title is properly formatted: [KOGITO-XYZ] Subject
  • Pull Request contains link to the JIRA issue
  • Pull Request contains description of the issue
  • Pull Request does not include fixes for issues other than the main ticket
  • Your feature/bug fix has a unit test that verifies it
  • You've tested the new feature/bug fix in an actual OpenShift cluster

@ricardozanini ricardozanini added the needs review 🔍 Pull Request that needs reviewers label Nov 22, 2019
@ricardozanini ricardozanini added this to the v0.6.0 milestone Nov 22, 2019
@ricardozanini ricardozanini added WIP 👷‍♂️ Pull Request is on work in progress and removed needs review 🔍 Pull Request that needs reviewers labels Nov 22, 2019
@ricardozanini
Copy link
Member Author

Infinispan being accessed successfully via onboarding example:

sh-4.4$ curl -vvv -u developer:Z1Nz34JpuVdzMQKi  http://172.30.40.183:11222/rest/v2/caches
*   Trying 172.30.40.183...
* TCP_NODELAY set
* Connected to 172.30.40.183 (172.30.40.183) port 11222 (#0)
* Server auth using Basic with user 'developer'
> GET /rest/v2/caches HTTP/1.1
> Host: 172.30.40.183:11222
> Authorization: Basic ZGV2ZWxvcGVyOloxTnozNEpwdVZkek1RS2k=
> User-Agent: curl/7.61.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< connection: keep-alive
< content-length: 131
<
* Connection #0 to host 172.30.40.183 left intact
["onboarding.setupPayroll_store","___protobuf_metadata","onboarding.setupHR_store","onboarding.onboarding_store","___script_cache"]

Use the following onboarding CR:

apiVersion: app.kiegroup.org/v1alpha1
kind: KogitoApp
metadata:
  name: onboarding-service
  namespace: kogito
spec:
  build:
    env:
    - name: MAVEN_MIRROR_URL
      value: 
    - name: MAVEN_ARGS_APPEND
      value: -Ppersistence
    gitSource:
      contextDir: onboarding-example/onboarding
      reference: infinispan-props
      uri: https://github.com/ricardozanini/kogito-examples
    imageRuntime:
      imageStreamTag: 0.6.0-rc1
    imageS2I:
      imageStreamTag: 0.6.0-rc1
    resources: {}
  env:
  - name: NAMESPACE
    value: kogito
  infra:
    installInfinispan: Always
  resources: {}
  runtime: quarkus
  service:
    labels:
      onboarding: process

And of course the payroll and hr services also have to be deployed.

@ricardozanini
Copy link
Member Author

Regarding the requirement of having properties set in the application.properties file:
quarkusio/quarkus#5708

Copy link
Contributor

@radtriste radtriste left a comment

Choose a reason for hiding this comment

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

code seems ok to me. I am going to test a bit :)

@ricardozanini ricardozanini added needs review 🔍 Pull Request that needs reviewers and removed WIP 👷‍♂️ Pull Request is on work in progress labels Nov 22, 2019
@ricardozanini
Copy link
Member Author

ricardozanini commented Nov 22, 2019

@xiezhang7 @spolti could you guys please review? I intend to merge this by Monday EOD to start working on others JIRAs that depend on this one. Many thanks!

deploy/crds/app.kiegroup.org_kogitoinfras_crd.yaml Outdated Show resolved Hide resolved
deploy/examples/onboarding-example.yaml Show resolved Hide resolved
pkg/resource/image_metadata.go Show resolved Hide resolved
pkg/resource/image_metadata.go Show resolved Hide resolved
pkg/resource/image_metadata.go Show resolved Hide resolved
@ricardozanini
Copy link
Member Author

@radtriste as soon as you finish your tests, please report back so we can decide if should be merged.

@ricardozanini
Copy link
Member Author

@radtriste infinispan/infinispan-operator#226

Copy link
Contributor

@radtriste radtriste left a comment

Choose a reason for hiding this comment

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

Seems good to me.
Tested with CLI and CR file.

CLI command used (for onboarding service):
kogito deploy-service onboarding-service https://github.com/kiegroup/kogito-examples/ --context-dir=onboarding-example/onboarding --install-infinispan=Always --incremental-build --build-env MAVEN_ARGS_APPEND=-Ppersistence -e NAMESPACE=kogito-165

@ricardozanini ricardozanini added ready 🚀 PR is ready to be merged and removed needs review 🔍 Pull Request that needs reviewers labels Nov 29, 2019
@ricardozanini ricardozanini merged commit 0a83741 into apache:master Nov 29, 2019
@ricardozanini ricardozanini deleted the kogito-165 branch November 29, 2019 10:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ready 🚀 PR is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants