Uploaded image for project: 'Cloud Enablement'
  1. Cloud Enablement
  2. CLOUD-3850

Inconsistency in Datasource Prefix Mapping

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • EAP7
    • None
    • False
    • False
    • Undefined
    • Hide

      Workaround is to use the fully qualified pool name.

      Show
      Workaround is to use the fully qualified pool name.
    • Hide

      1) Deploy a sample database (Postgres or MariaDB) or have one already available
      2) Instantiate the EAP Template, or reconfigure an existing Deployment/DeploymentConfig that uses EAP as its base image
      3) Add the datasource properties via ENV variables on the Deployment/DeploymentConfig, or another way adding ENV from ConfigMap or Secret.
      4) Verify that the datasource was created or not (the first few lines of the container will tell you if you are missing critical fields, but you can also use the jboss-cli to verify that the datasource is active)

      This EAP base image is registry.redhat.io/jboss-eap-7/eap72-openshift:1.2

      Example Broken ConfigMap Properties:

        DS1_DRIVER: mysql
        DS1_JNDI: 'java:/example'
        DB_SERVICE_PREFIX_MAPPING: example-mysql=DS1
        DS1_CONNECTION_CHECKER: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker
        DS1_USERNAME: user
        DS1_PASSWORD: password
        DS1_EXCEPTION_SORTER: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter
        DS1_DATABASE: test
      
        DS1_SERVICE_HOST: mariadb.demo1.svc.cluster.local
        DS1_SERVICE_PORT: '3306'
      

       

      Example Working ConfigMap Properties:

        DS1_DRIVER: mysql
        DS1_JNDI: 'java:/example'
        DB_SERVICE_PREFIX_MAPPING: example-mysql=DS1
        DS1_CONNECTION_CHECKER: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker
        DS1_USERNAME: user
        DS1_PASSWORD: password
        DS1_EXCEPTION_SORTER: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter
        DS1_DATABASE: test
      
        EXAMPLE_MYSQL_SERVICE_HOST: mariadb.demo1.svc.cluster.local
        EXAMPLE_MYSQL_SERVICE_PORT: '3306'
      
      Show
      1) Deploy a sample database (Postgres or MariaDB) or have one already available 2) Instantiate the EAP Template, or reconfigure an existing Deployment/DeploymentConfig that uses EAP as its base image 3) Add the datasource properties via ENV variables on the Deployment/DeploymentConfig, or another way adding ENV from ConfigMap or Secret. 4) Verify that the datasource was created or not (the first few lines of the container will tell you if you are missing critical fields, but you can also use the jboss-cli to verify that the datasource is active) This EAP base image is registry.redhat.io/jboss-eap-7/eap72-openshift:1.2 Example Broken ConfigMap Properties: DS1_DRIVER: mysql DS1_JNDI: 'java:/example' DB_SERVICE_PREFIX_MAPPING: example-mysql=DS1 DS1_CONNECTION_CHECKER: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker DS1_USERNAME: user DS1_PASSWORD: password DS1_EXCEPTION_SORTER: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter DS1_DATABASE: test DS1_SERVICE_HOST: mariadb.demo1.svc.cluster.local DS1_SERVICE_PORT: '3306'   Example Working ConfigMap Properties: DS1_DRIVER: mysql DS1_JNDI: 'java:/example' DB_SERVICE_PREFIX_MAPPING: example-mysql=DS1 DS1_CONNECTION_CHECKER: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker DS1_USERNAME: user DS1_PASSWORD: password DS1_EXCEPTION_SORTER: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter DS1_DATABASE: test EXAMPLE_MYSQL_SERVICE_HOST: mariadb.demo1.svc.cluster.local EXAMPLE_MYSQL_SERVICE_PORT: '3306'

      The EAP documentation says you can define datasources with ENV variables and a PREFIX.  For example:

      DB_SERVICE_PREFIX_MAPPING=test-mysql=TEST1

      This works as expected except in two cases.

       

      The prefix is not being honored when I define SERVICE_HOST or SERVICE_PORT.

      TEST1_SERVICE_HOST=abcd
      TEST1_SERVICE_PORT=1234
      

      The container spins up and says those two fields are missing, so it will not create the datasource.

       

      The only accepted format is the fully qualified pool name.

      TEST_MYSQL_SERVICE_HOST=abcd
      TEST_MYSQL_SERVICE_PORT=1234
      

       

      Note that pretty much all the other datasource properties follow the PREFIX convention, so it's confusing to end-users as to why these 2 properties need to be treated differently.

      I looked at the Git repository and saw all the tests are written as if the PREFIX is not allowed on these 2 fields.  The documentation needs to explicitly call this out if this is a technical limitation.

              istudens@redhat.com Ivo Studensky
              stran@redhat.com Steve Tran
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: