Skip to content

Commit 1b7c95f

Browse files
committed
feat(limitplan): add volume
1 parent dc6357a commit 1b7c95f

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 4.2.22 on 2025-07-17 06:43
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('api', '0023_migration_k8s_alter_volume_type'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='limitplan',
15+
name='container_volume_mounts',
16+
field=models.JSONField(default=list),
17+
),
18+
migrations.AddField(
19+
model_name='limitplan',
20+
name='pod_volumes',
21+
field=models.JSONField(default=list),
22+
),
23+
]

rootfs/api/models/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ def _get_private_registry_config(self, ptype, image, registry=None):
11651165
})
11661166
return docker_config, name, True
11671167

1168-
def _get_volumes_and_mounts(self, ptype, volumes):
1168+
def _get_volumes_and_mounts(self, ptype, volumes, limit_plan):
11691169
k8s_volumes, k8s_volume_mounts = [], []
11701170
if volumes:
11711171
for volume in volumes:
@@ -1220,6 +1220,8 @@ def _gather_app_settings(self, release, app_settings, ptype, replicas, volumes=N
12201220

12211221
healthcheck = config.healthcheck.get(ptype, {})
12221222
volumes, volume_mounts = self._get_volumes_and_mounts(ptype, volumes)
1223+
volumes.extend(limit_plan.pod_volumes)
1224+
volume_mounts.extend(limit_plan.container_volume_mounts)
12231225
return {
12241226
'tags': config.tags.get(ptype, {}),
12251227
'envs': envs,

rootfs/api/models/limit.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ class LimitPlan(AuditedModel):
117117
node_selector = models.JSONField(default=dict)
118118
runtime_class_name = models.CharField(max_length=63, default="")
119119
pod_security_context = models.JSONField(default=dict)
120+
pod_volumes = models.JSONField(default=list)
120121
container_security_context = models.JSONField(default=dict)
122+
container_volume_mounts = models.JSONField(default=list)
121123

122124
class Meta:
123125
get_latest_by = 'created'

0 commit comments

Comments
 (0)