wmedvede commented on PR #2790:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2790#issuecomment-2692124114

   @rhkp
   **Wrong default schema calculation when not set in the persistence config.**
   
   When we configure a SPF like below, see that we are not providing the schema 
name.
   
   ```
   apiVersion: sonataflow.org/v1alpha08
   kind: SonataFlowPlatform
   metadata:
     name: sonataflow-platform
   spec:
     services:
       dataIndex:
         enabled: true
         persistence:
           postgresql:
             serviceRef:
               name: postgres
               databaseName: sonataflow
             secretRef:
               name: postgres-secrets
               userKey: POSTGRESQL_USER
               passwordKey: POSTGRESQL_PASSWORD
         podTemplate:
           initContainers:
             - name: init-postgres
               image: registry.access.redhat.com/ubi9/ubi-minimal:latest
               imagePullPolicy: IfNotPresent
               command: [ 'sh', '-c', 'until (echo 1 > /dev/tcp/postgres.$(cat 
/var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local/5432)
 >/dev/null 2>&1; do echo "Waiting for postgres server"; sleep 3; done;' ]
       jobService:
         enabled: true
         persistence:
           postgresql:
             serviceRef:
               name: postgres
               databaseName: sonataflow
             secretRef:
               name: postgres-secrets
               userKey: POSTGRESQL_USER
               passwordKey: POSTGRESQL_PASSWORD
         podTemplate:
           initContainers:
             - name: init-postgres
               image: registry.access.redhat.com/ubi9/ubi-minimal:latest
               imagePullPolicy: IfNotPresent
               command: [ 'sh', '-c', 'until (echo 1 > /dev/tcp/postgres.$(cat 
/var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local/5432)
 >/dev/null 2>&1; do echo "Waiting for postgres server"; sleep 3; done;' ]
   
   ```
   
   The operator produces the following default schema name calculations for DI 
and JS
   
   
![DataIndexAndJobsServiceNoSchemaConfigured](https://github.com/user-attachments/assets/b14c5372-565a-425d-881e-84d75d12f93d)
   
   
   But, if we enable the DB migrator on the same SFP:
   
   ```
   apiVersion: sonataflow.org/v1alpha08
   kind: SonataFlowPlatform
   metadata:
     name: sonataflow-platform
   spec:
     services:
       dataIndex:
         enabled: true
         persistence:
           dbMigrationStrategy: job
           postgresql:
             serviceRef:
               name: postgres
               databaseName: sonataflow
             secretRef:
               name: postgres-secrets
               userKey: POSTGRESQL_USER
               passwordKey: POSTGRESQL_PASSWORD
         podTemplate:
           initContainers:
             - name: init-postgres
               image: registry.access.redhat.com/ubi9/ubi-minimal:latest
               imagePullPolicy: IfNotPresent
               command: [ 'sh', '-c', 'until (echo 1 > /dev/tcp/postgres.$(cat 
/var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local/5432)
 >/dev/null 2>&1; do echo "Waiting for postgres server"; sleep 3; done;' ]
       jobService:
         enabled: true
         persistence:
           dbMigrationStrategy: job
           postgresql:
             serviceRef:
               name: postgres
               databaseName: sonataflow
             secretRef:
               name: postgres-secrets
               userKey: POSTGRESQL_USER
               passwordKey: POSTGRESQL_PASSWORD
         podTemplate:
           initContainers:
             - name: init-postgres
               image: registry.access.redhat.com/ubi9/ubi-minimal:latest
               imagePullPolicy: IfNotPresent
               command: [ 'sh', '-c', 'until (echo 1 > /dev/tcp/postgres.$(cat 
/var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local/5432)
 >/dev/null 2>&1; do echo "Waiting for postgres server"; sleep 3; done;' ]
   
   ```
   
   We get the following results:
   
   Migrator job generated these by default wrong schema names:
   
   
![image](https://github.com/user-attachments/assets/bec81317-5b88-4b73-8336-285cae62bf8e)
   
   
   DI deployment was generated with the correct by default schema name:
   
   ![Screenshot from 2025-03-01 
11-14-47](https://github.com/user-attachments/assets/bbe3a472-4b6c-4e17-b61d-0217bfdf6d7a)
   
   JS deployment was generated with the correct by default schema name:
   
   
![image](https://github.com/user-attachments/assets/670fc660-5b8d-4c63-be2f-be3ff0d724c8)
   
   Migrator job must generate the correct by default schema names
   
   
   
   


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