-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
132 additions
and
16 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/middlewared/middlewared/alembic/versions/25.04/2024-11-15_12-14_docker_ipv6_support.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" | ||
Docker ipv6 support | ||
Revision ID: bb352e66987f | ||
Revises: 2b59607575b8 | ||
Create Date: 2024-11-15 12:14:35.553785+00:00 | ||
""" | ||
import json | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
revision = 'bb352e66987f' | ||
down_revision = '2b59607575b8' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
conn = op.get_bind() | ||
with op.batch_alter_table('services_docker', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('cidr_v6', sa.String(), nullable=False, server_default='fdd0::/64')) | ||
|
||
if docker_config := list(map( | ||
dict, conn.execute('SELECT * FROM services_docker').fetchall() | ||
)): | ||
docker_config = docker_config[0] | ||
address_pool_config = json.loads(docker_config['address_pools']) | ||
address_pool_config.append({'base': 'fdd0::/48', 'size': 64}) | ||
|
||
conn.execute("UPDATE services_docker SET address_pools = ? WHERE id = ?", [ | ||
json.dumps(address_pool_config), | ||
docker_config['id']] | ||
) | ||
|
||
|
||
def downgrade(): | ||
pass |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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