gravitino icon indicating copy to clipboard operation
gravitino copied to clipboard

[FEATURE] Add Helm Job to automate DB schema initialization for external databases

Open HaJunYoo opened this issue 1 month ago • 1 comments

Describe the feature

When deploying Gravitino with the Helm chart using an external database (PostgreSQL or MySQL), users must manually initialize the database schema by connecting to the database and executing the appropriate schema-x.x.x-[db].sql script before starting the server.

This manual step is inconvenient, error-prone, and conflicts with the automated deployment experience users expect from Helm charts.

Suggests adding a Helm Job to automate database schema initialization.

Motivation

Current Pain Points

  • Manual database initialization is required for external database connection while using helm chart.
  • This kinds of error-prone process that can lead to deployment failures

Benefits of This Improvement

  • Reduces deployment friction and potential errors

Describe the solution

Add a Helm Job that runs as a pre-install and pre-upgrade hook to automatically initialize the entity store schema.

Implementation Details

  1. Job Resource
    • Create a new Job template in helm-chart/templates/gravitino-db-init-job.yaml
  2. Container Configuration
    • Use lightweight database client images like postgres:16-alpine, mysql:8-client
    • Mount SQL scripts from the /scripts directory
    • Use db credentials from values.yaml

values.yaml will be as below.

# for example
entity:
  store:
    jdbc:
      initializeSchema:
        enabled: true  # Enable/disable the init job
        image:
          repository: postgres
          tag: 16-alpine

Additional context

No response

HaJunYoo avatar Nov 04 '25 08:11 HaJunYoo

Hi I would like to work on implementing this feature. Please assign me in this issue.

HaJunYoo avatar Nov 04 '25 08:11 HaJunYoo