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

feat: paas-service plan 支持多租户 #211

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdks/paas-service/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# 版本历史
## 2.0.2
- Support multi tenant

## 2.0.1
- Support querying service instance with parameter to_be_deleted
Expand Down
2 changes: 1 addition & 1 deletion sdks/paas-service/paas_service/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
We undertake not to change the open source license (MIT license) applicable
to the current version of the project delivered to anyone in the future.
"""
__version__ = '2.0.1'
__version__ = '2.0.2'

default_app_config = 'paas_service.apps.PaaSServiceConfig'
2 changes: 2 additions & 0 deletions sdks/paas-service/paas_service/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ class Category(int, Enum):

# Login 服务的重定向链接字段名
REDIRECT_FIELD_NAME = "c_url"

DEFAULT_TENANT_ID = "default"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

增加说明

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.16 on 2025-01-09 13:44

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('paas_service', '0008_auto_20220426_0429'),
]

operations = [
migrations.AddField(
model_name='plan',
name='display_name',
field=models.CharField(default='', max_length=64, verbose_name='方案展示名称'),
),
migrations.AddField(
model_name='plan',
name='tenant_id',
field=models.CharField(default='default', help_text='所属租户', max_length=128),
),
]
5 changes: 4 additions & 1 deletion sdks/paas-service/paas_service/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
from django.utils.translation import gettext_lazy as _
from jsonfield import JSONField
from translated_fields import TranslatedField

from blue_krill.models.fields import EncryptField

from paas_service.constants import DEFAULT_TENANT_ID

# Base Models start


Expand Down Expand Up @@ -214,6 +215,8 @@ def render_instance_data(request: HttpRequest, instance: ServiceInstance) -> Dic

class Plan(UuidAuditedModel):
name = models.CharField(verbose_name='方案名称', max_length=64)
display_name = models.CharField("方案展示名称", max_length=64, default="")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

display_name 需要国际化

tenant_id = models.CharField(help_text="所属租户", max_length=128, default=DEFAULT_TENANT_ID)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以添加一个索引

db_index=True,


# the "properties" field stores custom properties of a plan object. the property itself is
# nothing more than a simple annotation. But the service hub which it was registed to may
Expand Down
2 changes: 1 addition & 1 deletion sdks/paas-service/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool]
[tool.poetry]
name = "paas_service"
version = "2.0.1"
version = "2.0.2"
description = "A Django application for developing BK-PaaS add-on services."
readme = "README.md"
authors = ["blueking <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion sdks/paas-service/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
setup(
long_description=readme,
name='paas_service',
version='2.0.0',
version='2.0.2',
python_requires='<3.12,>=3.8',
author='blueking',
author_email='[email protected]',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更新相关的单测代码?

Expand Down