Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Make project column nullable and improve container registry migration script #2978

Conversation

jopemachine
Copy link
Member

@jopemachine jopemachine commented Oct 25, 2024

Follow-up of #1917.

  • Make image table's project column nullable
    • If the "project" column is null, the string after the registry will be treated as the image name, following the existing logic.
  • Make container registry table's project column nullable
  • Modified the upgrade() to automatically generate the corresponding container registry row instead of raising an error when no container registry exists for the image canonical name.

Thoughts about local type container registry record

  • Local-type container registry records currently do not contain meaningful information. Additionally, having more than one local container registry type would be awkward.

  • Whether an image is local can be determined by checking if the container registry pointed to by image.registry_id is of the Local type, making the is_local column redundant.

Container registry row auto-generation example

🕙 18:58:36 ❯ ./py -m alembic upgrade +1
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade 20218a73401b -> 1d42c726d8a3, Migrate container registry config storage from `Etcd` to `PostgreSQL`
INFO  [alembic.runtime.migration] Following container registry row auto-generated: "cr.backend.ai" with the project "multiarch".
INFO  [alembic.runtime.migration] If credential required for the auto-generated container registry rows, you should fill their credential columns manually.

Caution

This PR contains updates to a revision script which has already been published to the stable release. Existing clusters operating Backend.AI 24.09 should execute following script to manually elaborate the database schema:

alembic downgrade 20218a73401b
alembic upgrade head

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Installer updates including:
    • Fixtures for db schema changes
    • New mandatory config options

@github-actions github-actions bot added comp:manager Related to Manager component comp:common Related to Common component require:db-migration Automatically set when alembic migrations are added or updated size:L 100~500 LoC labels Oct 25, 2024
@jopemachine jopemachine force-pushed the topic/10-25-refactor_make_project_column_nullable_and_improve_migration_script branch 3 times, most recently from 13fea68 to 6a2fc14 Compare October 25, 2024 06:59
@jopemachine jopemachine added this to the 24.09 milestone Oct 25, 2024
@jopemachine jopemachine changed the title refactor: Make project column nullable and improve migration script refactor: Make project column nullable and improve container registry migration script Oct 25, 2024
@jopemachine jopemachine marked this pull request as ready for review October 25, 2024 11:56
@jopemachine jopemachine force-pushed the topic/10-25-refactor_make_project_column_nullable_and_improve_migration_script branch 3 times, most recently from 41dd818 to 24b8f9a Compare October 29, 2024 05:12
@kyujin-cho kyujin-cho self-requested a review October 31, 2024 09:43
@kyujin-cho kyujin-cho force-pushed the topic/10-25-refactor_make_project_column_nullable_and_improve_migration_script branch from 4820271 to 7f04f87 Compare October 31, 2024 09:49
@jopemachine jopemachine added this pull request to the merge queue Nov 6, 2024
Merged via the queue into main with commit d2530c7 Nov 6, 2024
24 checks passed
@jopemachine jopemachine deleted the topic/10-25-refactor_make_project_column_nullable_and_improve_migration_script branch November 6, 2024 09:35
lablup-octodog pushed a commit that referenced this pull request Nov 6, 2024
…ry migration script (#2978)

Co-authored-by: Sanghun Lee <sanghun@lablup.com>
Backported-from: main (24.12)
Backported-to: 24.09
Backport-of: 2978
github-merge-queue bot pushed a commit that referenced this pull request Nov 6, 2024
…ry migration script (#2978) (#3038)

Co-authored-by: Gyubong Lee <jopemachine@naver.com>
Co-authored-by: Sanghun Lee <sanghun@lablup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:common Related to Common component comp:manager Related to Manager component require:db-migration Automatically set when alembic migrations are added or updated size:L 100~500 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants