refactor(db): add extraInitContainers hooks and writable migration - #166
Open
inaki321 wants to merge 1 commit into
Open
refactor(db): add extraInitContainers hooks and writable migration #166inaki321 wants to merge 1 commit into
inaki321 wants to merge 1 commit into
Conversation
Contributor
|
Hi @inaki321. Thanks! Some thoughts I had about it. If you think it might be beneficial, we could open an issue to discuss whether adding this behavior to the Helm chart would make sense in the future. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
refactor
What is the current behavior?
Currently, the database initialization process is strictly tied to static files provided via ConfigMaps. Users cannot dynamically fetch migration or seed data (e.g., from AWS S3, Google Cloud Storage, or external APIs) because the custom-migrations volume is read-only.
Additionally, there are no lifecycle hooks to perform pre-initialization setup or post-initialization validation.
What is the new behavior?
This PR introduces Life Cycle Hooks and a Writable Workspace for the database initialization process:
Pre/Post Init Hooks: Added extraInitContainersBefore and extraInitContainersAfter to the DB StatefulSet. This allows users to inject sidecars (like aws-cli or rclone) to fetch data or run validation scripts.
Shared Writable Volume: Introduced a new emptyDir volume (custom-fetch-scripts) mounted at /custom-fetch.
Dynamic Migration Loading: Updated the init-db script to automatically detect and copy any SQL files found in the /custom-fetch directory into the final /initdb.d/migrations/ path.
Additional context (TEST)
WITHOUT stays the same as before
Example:
WITH new params, adds the new init container:
Example: