Skip to content

feat: add independent scale permission#4598

Open
leebrouse wants to merge 5 commits intokoderover:mainfrom
leebrouse:feature/replica-scale-permission-control
Open

feat: add independent scale permission#4598
leebrouse wants to merge 5 commits intokoderover:mainfrom
leebrouse:feature/replica-scale-permission-control

Conversation

@leebrouse
Copy link
Copy Markdown
Contributor

@leebrouse leebrouse commented Apr 2, 2026

What this PR does / Why we need it:

This PR introduces an independent permission for replica scaling ("调整副本") to decouple scale operations from generic environment management permissions.

Previously, scale APIs were controlled by broader permissions (e.g. manage pods or rollback in some SAE paths), which made authorization boundaries unclear. This change makes scale authorization explicit and consistent across interfaces.

What is changed and how it works?

  • Added new project-level permission verbs:
    • scale_environment
    • scale_production_environment
  • Added corresponding auth fields in project permission aggregation:
    • Env.Scale
    • ProductionEnv.Scale
  • Updated permission mapping logic in user auth service:
    • scale_environment -> Env.Scale = true
    • scale_production_environment -> ProductionEnv.Scale = true
  • Updated collaboration mode action constants for scale:
    • EnvActionScale
    • ProductionEnvActionScale
  • Switched scale-related authorization checks in Aslan handlers from old permissions to the new scale permission:
    • environment service scale API (scaleNew)
    • OpenAPI scale API
    • SAE rescale API
  • Synchronized action initialization scripts for both MySQL and DM:
    • added "调整副本" actions for Environment and ProductionEnvironment in:
      • action_initialization.sql
      • dm_action_initialization.sql

Does this PR introduce a user-facing change?

  • API change
  • database schema change
  • upgrade assistant change
  • change in non-functional attributes such as efficiency or availability
  • fix of a previous issue

This change is Reviewable

Signed-off-by: YuTang Song <2313186065@qq.com>
Copy link
Copy Markdown
Contributor

@PetrusZ PetrusZ left a comment

Choose a reason for hiding this comment

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

另外还需要增加一下ua的代码

Rollback bool
Delete bool
DebugPod bool
// 副本扩展
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

副本扩展?

Signed-off-by: YuTang Song <2313186065@qq.com>
@leebrouse leebrouse requested a review from PetrusZ April 3, 2026 03:45
return err
}

err = migrateScalePermissions(migrationInfo)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

用户有ManagePods权限时,才能给他添加Scale权限。协作模式同理。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

另外最好能优化一下ua的代码,现在太冗长了

@leebrouse leebrouse requested a review from PetrusZ April 3, 2026 08:48
…on backfill

Signed-off-by: YuTang Song <2313186065@qq.com>
…ole-template and collaboration mode

Signed-off-by: YuTang Song <2313186065@qq.com>
Signed-off-by: YuTang Song <2313186065@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants