Commit Graph

125 Commits

Author SHA1 Message Date
zijiren a2a338dbcf perf(user): reduce controller cache memory usage (#7256)
* perf(user): reduce controller cache memory

* fix(user): resolve GVK for direct-read finalizers

* perf(user): cache projected user fields

* perf(user): project cached metadata fields

* style(user): satisfy cache lint checks
2026-08-27 16:22:19 +08:00
Yun Pan c82addbaa2 fix(user): avoid full User objects in webhook validation (#7240)
* fix(user): avoid full user lists in webhook validation

* fix(user): satisfy golangci-lint

* fix(user): use informer-backed user count

* style(user): satisfy formatter checks

* fix(user): wait for informer event sync
2026-08-21 11:18:19 +08:00
Yun Pan cc8ebb8743 fix(user): make kube API client rate limit configurable (#7203)
* fix(user): make kube API client rate limit configurable

* fix(user): add cloudDomain and cloudApiServerPort fallbacks

Signed-off-by: Yun Pan <dinoallo@netc.it>

* fix(user): increase the default kubeAPI.qps and kubeAPI.burst

Signed-off-by: Yun Pan <dinoallo@netc.it>

---------

Signed-off-by: Yun Pan <dinoallo@netc.it>
2026-08-11 19:07:40 +08:00
Yun Pan 82a30ff42d feat(user): issue kubeconfigs with token requests (#7196)
* feat(user): issue kubeconfigs with token requests

Use the ServiceAccount TokenRequest subresource instead of manually managed service-account-token Secrets, and request long-lived tokens as a transition for existing kubeconfig consumers.

* fix(user): bind token requests to a secret

* fix(user): restore random token secret names

* fix(user): satisfy golangci-lint

* fix(user): satisfy golines

* fix(user): clean up legacy service account token secrets

* fix(user): satisfy golines

* fix(user): clean up stale bound token secrets

* fix(user): satisfy golines

* fix(user): satisfy golines for token secret cleanup
2026-08-11 18:58:32 +08:00
Yun Pan d19bd067c7 fix(lint): resolve controller and service issues (#7095)
* fix(lint): resolve controller and service issues

* fix(lifecycle): add missing test licenses

* fix(account): format debt sync code

* fix(lifecycle): resolve staging lint issues

* ci: update golangci-lint to v2.12.2

* ci: update golangci-lint config

* ci: adjust golangci-lint config

* fix(webhook): resolve admission lint issues

* fix(lint): resolve remaining module issues

* fix(scan): resolve semgrep findings

* fix(ci): remove deleted pay service from matrix
2026-07-27 14:45:50 +08:00
Jiahui 5f3719fabc feat(core): standardized sealos cloud core component deployment (#6722)
* support core helm refactor:
core/
├── frontend/
│   ├── desktop-frontend
│   ├── costcenter-frontend
│   └── license-frontend
├── controller/
│   ├── user-controller
│   ├── account-controller
│   ├── license-controller
│   └── resources-controller
├── service/
│   └── account-service
└── job / misc
    ├── init-job
    └── init-heartbeat

* rebase
2026-04-02 11:41:21 +08:00
Jiahui cf1d385531 fix(user): Fix the concurrent creation restriction exception for user controller (#6801)
Fix the concurrent creation restriction exception for user controller
2026-03-21 11:56:31 +08:00
cuisongliu f3d634937e fix(user-controller): update namespace condition to exclude 'ns-admin' (#6799)
Signed-off-by: cuisongliu <cuisongliu@qq.com>
2026-03-13 17:17:44 +08:00
Jiahui 181f3b4e04 feat(user): supports rotating kubeconfig for users (#6568)
* supports rotating kc

# Conflicts:
#	controllers/user/controllers/user_controller.go
#	controllers/user/deploy/manifests/deploy.yaml.tmpl

* fix

* delete useless file
2026-02-07 18:59:02 +08:00
cuisongliu 3027fa8ff3 fix(user): remove pod-security labels for admin namespace (#6609)
Signed-off-by: cuisongliu <cuisongliu@qq.com>
2026-01-27 15:15:31 +08:00
cuisongliu d7cdc8048c fix(deployment): simplify image configuration and update pull policy (#6584) 2026-01-23 17:50:26 +08:00
cuisongliu 913fe9e64c fix(rbac): update role bindings and permissions for user management (#6577) 2026-01-23 11:42:20 +08:00
cuisongliu 44402fe10a fix(kubefile): add drop directory copy to Kubefile (#6571)
Signed-off-by: cuisongliu <cuisongliu@qq.com>
2026-01-22 22:07:10 +08:00
Jiahui d6d0845643 feat(license): suppor limit user count (#6556)
* Add a prompt for detecting the number of users exceeding the active license

Multiple Active licenses only use the latest License for restriction detection

init

# Conflicts:
#	controllers/user/api/v1/user_webhook.go
#	controllers/user/controllers/user_controller.go

* fix rebase conflict

* fix ci lint
2026-01-21 19:53:27 +08:00
cuisongliu e75ab5a9bd fix(user): refactor function signatures for improved readability and consis… (#6488)
* refactor: improve function signatures and error handling across multiple files

* fix(config): update configuration structure and environment variable names for clarity

* fix(user): add syncClusterRoleBinding method for admin role binding management

Signed-off-by: cuisongliu <cuisongliu@qq.com>

* fix(user): refactor user reconciliation methods to use userReconcileState for improved state management

* fix(tests): add context linting directive to webhook_suite_test for clarity

* feat(user): add initial Helm chart for user controller with necessary resources

* fix(deploy): rename deployment and RBAC manifests for clarity and streamline entrypoint script

* fix(makefile): copy CRD artifacts to user Helm chart directory for deployment

* fix(deployment): add checksum annotation for configmap to enable rolling updates

* fix(templates): update resource names and configurations to use fullname template function

* refactor: improve function signatures and error handling across multiple files

* refactor: improve function signatures and error handling across multiple files

* refactor: improve function signatures and error handling in user and license controllers

* disable: turn off metrics endpoint in user values.yaml

---------

Signed-off-by: cuisongliu <cuisongliu@qq.com>
2026-01-21 14:32:44 +08:00
Jiahui ad4f561524 feat(license): Adjust license default behavior and user gate (#6548)
Adjust license default behavior and user gate
2026-01-20 19:28:35 +08:00
Jiahui c1f249c7cd fix(user-controller): add AnnotationChangedPredicate for metadata Previously (#6267)
fix(user-controller): add AnnotationChangedPredicate for metadata changes

Previously, the User controller only watched for GenerationChangedPredicate,
which meant changes to metadata annotations (like owner transfers) would not
trigger reconciliation. This caused namespace owner annotations to become
out of sync when user ownership was transferred via OperationRequest.

Adding AnnotationChangedPredicate ensures that any annotation changes on the
User resource will trigger a reconcile, keeping namespace annotations in sync.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-01 19:15:29 +08:00
Jiahui 4e70494a70 optimize sendFlushQuotaRequest log & fix create or update quota (#5609)
* optimize sendFlushQuotaRequest log & fix create or update quota

* optimize: user remove the watching AnnotationChangedPredicate

* optimize initialize the account data
2025-05-27 17:04:30 +08:00
yy 4cc740443a upgrade: controller runtime version (#5597)
* upgrade: controller runtime version

* Upgrade k8s.io/client-go version v0.28.3 => v0.32.1; Upgrade golang version v1.22 => 1.24 to be compatible with client-go v0.32.1

* fix ci

* fix ci

* skip md5 semgrep check

---------

Co-authored-by: jiahui <bxy4543@gmail.com>
2025-05-14 14:48:42 +08:00
yy ef83190c42 fix: user controller with event filter. (#5433)
* fix: user controller with event filter.

* feat: add a flag to control restart predicat time.

* fix: user controller with event filter.

* fix: user controller with event filter.
2025-03-12 16:25:02 +08:00
Jiahui 2e4544941d operationrequest cr change to the user-system (#5144)
* operationrequest cr change to the user-system

* make pre-deploy

* move out using adapt rolebinding

* test

* operationrequest controller add user lock && add crd printcolumn: creationTimestamp
2024-10-21 15:43:07 +08:00
zijiren 7091b8665c feat: user private ns invite (#5043)
* feat: user private ns support invite

* feat: user controller

* feat: ns rename

* fix: canAbdicate

* feat: operationrequest controller cannot transfer personal workspace

* adapt old rolebinding (#73)

* replace owner reference user to bind user

* make format

---------

Co-authored-by: Jiahui <bxy4543@163.com>
Co-authored-by: jiahui <bxy4543@gmail.com>
2024-09-09 11:54:04 +08:00
yy e9087cf8e6 dep: upgrade controllers client-go and controller-runtime (#4898)
* dep: upgrade user controller client-go version and fix kc reconcile when delete secret.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* dep: upgrade terminal controller client-go version.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* dep: upgrade resource controller client-go and ctrl-runtime version.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* dep: upgrade objectstorage controller client-go and ctrl-runtime version.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* dep: upgrade node controller client-go and ctrl-runtime version.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* dep: upgrade license controller client-go and ctrl-runtime version.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* dep: upgrade jobs client-go and ctrl-runtime version.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* dep: upgrade db/adminer client-go and ctrl-runtime version.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* dep: upgrade account,app controller client-go and ctrl-runtime version.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* do go mod tidy in job/init.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* fix terminal cache.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* fix adminer cache.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* fix app main.go.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* run go mod tidy in controllers.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* fix license check.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* fix type is not found error in node-ctr

* fix type is not found in account-ctr

* fix

* fix account go lint.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* fix resource controller go lint.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* restore test files.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* delete useless admin label const.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

---------

Signed-off-by: yy <lingdie.yy@outlook.com>
Co-authored-by: xuziyi <nowinkey@tom.com>
2024-07-18 16:39:07 +08:00
zijiren 88961c5b64 feat: strip bin and trimpath (#4860) 2024-07-12 14:32:16 +08:00
yy efbda9539f chore: fix controller config lint. (#4702)
* chore: fix controller config lint.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* chore: fix controller config lint.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* chore: fix controller config lint.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* chore: fix controller config lint.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* chore: fix controller config lint.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* chore: fix license.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

---------

Signed-off-by: yy <lingdie.yy@outlook.com>
2024-04-23 10:19:19 +08:00
yy e00054f966 chore: optimize controllers config. (#4693)
* chore: optimize terminal config.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* chore: optimize user && terminal config.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* chore: optimize user && terminal config.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* chore: optimize user && terminal config.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* chore: optimize user && terminal config.
Signed-off-by: yy <lingdie.yy@outlook.com>

Signed-off-by: yy <lingdie.yy@outlook.com>

* chore(fmt): format code

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Signed-off-by: yy <lingdie.yy@outlook.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lingdie <lingdie@users.noreply.github.com>
2024-04-22 17:43:02 +08:00
yy ac53c02515 chore: add podAntiAffinity for desktop and some providers. (#4617)
* chore: add podAntiAffinity for desktop and some providers.

Signed-off-by: yy <lingdie.yy@outlook.com>

* chore: add podAntiAffinity for controllers and providers.

Signed-off-by: yy <lingdie.yy@outlook.com>

---------

Signed-off-by: yy <lingdie.yy@outlook.com>
2024-03-22 11:18:10 +08:00
Jiahui 424fcc7275 fix user change ns annotations (#4592) 2024-03-14 14:38:44 +08:00
yy a63d82f2ef chore: change sealos cloud component resource limit. (#4553)
Signed-off-by: yy <lingdie.yy@outlook.com>
2024-03-05 14:06:06 +08:00
yy 9c9c9d74f7 fix: desktop rbac for delete request of user. (#4308)
Signed-off-by: yy <lingdie.yy@outlook.com>
2023-11-16 16:50:01 +08:00
zzjin bd68a735b4 Depre Bytebase and imagehub. (#4273)
* Depre Bytebase.

Signed-off-by: zzjin <tczzjin@gmail.com>

* Fix format.

Signed-off-by: zzjin <tczzjin@gmail.com>

* Add code license header.

Signed-off-by: zzjin <tczzjin@gmail.com>

* Move imagehub && hub into staging.

Signed-off-by: zzjin <tczzjin@gmail.com>

* Update ci fix.

Signed-off-by: zzjin <tczzjin@gmail.com>

* Fix goimports format.

Signed-off-by: zzjin <tczzjin@gmail.com>

---------

Signed-off-by: zzjin <tczzjin@gmail.com>
2023-11-08 23:39:01 +08:00
yy d198269133 fix user controller. (#3894)
* fix user controller.

* fix
2023-09-11 16:36:04 +08:00
yy be1cc805ec user delete request (#3855)
* add delete request crd.

* add func.

* fix manifests.

* add print

* fix lint
2023-09-07 14:52:03 +08:00
yy b890eb75ec change user annotation for user owner. (#3850) 2023-09-06 15:54:35 +08:00
yy 8f4db16e0a add rbac for desktop. (#3825) 2023-09-04 15:41:26 +08:00
yy cb1fefe726 feat: add update operation request (#3802)
* fix: sealos aio cluster image arm64

* add update action for operation request.
2023-09-04 11:45:13 +08:00
yy 500fc6d94b fix user sa. (#3727) 2023-08-21 19:31:44 +08:00
yy db209d41be feat: add operationrequest for multi-namespace and update user controller. (#3595)
* User (#7)

* feat: expose mongo uri. (#3586)

* expose mongo uri env.

* feat: operation request -> rolebinding (sa <-> role)

* feat: operation request -> rolebinding (sa <-> role)

* feat: operation request

---------

Co-authored-by: yy <56745951+lingdie@users.noreply.github.com>

* init user controller for multi namespace feat.

* fix makefile.

* add samples

* init operation request webhook.

* init operationrequest webhook

* fix create rolebinding and log error.

* add samples.

* print status and other info.

* fix lint/makefile, add label for rolebinding

* fix crd.

* fix const.

---------

Co-authored-by: xy <135087223+Yurnero-Xy@users.noreply.github.com>
2023-08-21 16:45:33 +08:00
yy 9c3d1a9ed8 feat: adapt aio cluster image fot changeable port. (#3674) 2023-08-14 17:26:11 +08:00
fckc 384e84549d Adjusted the resource configuration for community edition (#3607)
* modify the resource limit
2023-08-01 10:24:24 +08:00
Qiu Xingye 0599f60faf feat(user_controller): create user -> sync three roles (#3555)
* feat(user_controller): create user -> sync three roles

* feat(user_controller): create user -> sync three roles
2023-07-21 18:17:15 +08:00
yy d7c046cc43 add anno and label for user, ns and so on. (#3544)
* add anno and label for user, ns and so on.

* reconcile if annotation changed
2023-07-19 18:09:52 +08:00
yy c5ae85a48f fix: change SyncPeriod to setable to avoid too many users need sync at one time. (#3508)
* change SyncPeriod to 30 day to days to avoid too many syncs.

* change rand import.

* change to user flag to set vars.
2023-07-17 15:24:41 +08:00
cuisongliu 74beff7eec refactor(user): delete https://codecov.io check (#3504)
* refactor(user): delete https://codecov.io check

Signed-off-by: cuisongliu <cuisongliu@qq.com>

* refactor(user): fmt user controller

Signed-off-by: cuisongliu <cuisongliu@qq.com>

* refactor(user): update go mod

Signed-off-by: cuisongliu <cuisongliu@qq.com>

* refactor(user): update go mod

Signed-off-by: cuisongliu <cuisongliu@qq.com>

* refactor(user): update go mod

Signed-off-by: cuisongliu <cuisongliu@qq.com>

* refactor(user): update go mod

Signed-off-by: cuisongliu <cuisongliu@qq.com>

---------

Signed-off-by: cuisongliu <cuisongliu@qq.com>
2023-07-14 12:17:36 +08:00
cuisongliu db75b6ad46 refactor(user): add operator sdk for user (#3503)
* refactor(user): add operator sdk for user

Signed-off-by: cuisongliu <cuisongliu@qq.com>

* refactor(user): delete https://codecov.io check

Signed-off-by: cuisongliu <cuisongliu@qq.com>

---------

Signed-off-by: cuisongliu <cuisongliu@qq.com>
2023-07-14 11:25:28 +08:00
cuisongliu 9e8e620b0a refactor(user): delete ns controller (#3490)
* refactor(user): delete ns controller

Signed-off-by: cuisongliu <cuisongliu@qq.com>

* refactor(user): refactor rate limter

Signed-off-by: cuisongliu <cuisongliu@qq.com>

* add log for user reconcile. (#600)

* refactor(user): refactor rate limter

Signed-off-by: cuisongliu <cuisongliu@qq.com>

---------

Signed-off-by: cuisongliu <cuisongliu@qq.com>
Co-authored-by: yy <56745951+lingdie@users.noreply.github.com>
2023-07-13 16:46:31 +08:00
yy 288c4f8589 update sealos cloud deploy docs. (#3483) 2023-07-10 15:36:09 +08:00
cuisongliu 0c00b99f2b build(main): dev to latest (#3482)
Signed-off-by: cuisongliu <cuisongliu@qq.com>
2023-07-10 11:58:39 +08:00
yy 22b0d6ce64 add user env (#3469)
* add cost-center env.

* add env for user controller
2023-07-06 10:52:11 +08:00
cuisongliu 9db0a98090 refactor(main): remove old code for convert (#3417)
Signed-off-by: cuisongliu <cuisongliu@qq.com>
2023-07-05 15:38:50 +08:00