dennismdejong opened a new pull request, #13674:
URL: https://github.com/apache/gravitino/pull/13674

   ### What changes were proposed in this pull request?
   
   Adds an opt-in Helm Job to the Gravitino chart (`dev/charts/gravitino`) that 
automatically initializes the entity store schema for **external** 
MySQL/PostgreSQL databases.
   
   - New template `templates/gravitino-db-init-job.yaml` — a `batch/v1` Job 
that runs as a `pre-install`/`pre-upgrade` hook (`hook-weight: "-5"`).
     - An init container from the Gravitino image copies 
`/opt/gravitino/scripts` into an emptyDir and writes `version.txt` (server 
version parsed from the `gravitino-server-*` jar).
     - A `db-init` container from a lightweight client image (default 
`mysql:8.0` / `postgres:16-alpine`, derived from `databaseType`) waits for DB 
connectivity, selects the highest `schema-*.sql` and `upgrade-*-to-*.sql` whose 
version <= the server version, runs upgrade first (warning on failure) then 
schema — mirroring the existing bundled-DB init containers.
     - Credentials from `entity.jdbcUser`/`entity.jdbcPassword`, or an optional 
existing Secret (`entity.initializeSchema.passwordSecret`/`passwordSecretKey`).
     - Job pod mirrors the Deployment's scheduling/security settings; bounded 
by `activeDeadlineSeconds: 600`.
   - New values block `entity.initializeSchema` (enabled, databaseType, host, 
port, database, passwordSecret, image) and `db-init.image` helper in 
`_helpers.tpl`.
   - helm-unittest suite `tests/db-init-job_test.yaml` (rendering, gating, hook 
annotations, env/secret wiring, image defaults).
   - Docs: `docs/chart.md` replaces the manual `mysql < schema-*.sql` step with 
the Job-based flow and adds a PostgreSQL equivalent.
   
   ### Why are the changes needed?
   
   When Gravitino is deployed against an external database via 
`entity.jdbcUrl`, users must manually connect and run the matching 
`schema-x.x.x-[mysql|postgresql].sql` script before starting the server. This 
manual step is error-prone and conflicts with the automated Helm deployment 
experience.
   
   Fix: #9013
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes — a new opt-in configuration `entity.initializeSchema.*` for the Helm 
chart (enabled, databaseType, host, port, database, 
passwordSecret/passwordSecretKey, image). Default is disabled, so existing 
deployments are unaffected.
   
   ### How was this patch tested?
   
   - `helm unittest --with-subchart=false dev/charts/gravitino` — 7 suites / 45 
tests pass.
   - `helm lint dev/charts/gravitino` — 0 failures.
   - `helm template` rendered the Job for both `mysql` and `postgresql` 
database types (image, env, and hook annotations verified).
   


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

Reply via email to