292 Commits

Author SHA1 Message Date
zijiren b3dcab4119 perf(account): reduce controller cache memory usage (#7255)
* perf(account): reduce controller cache memory usage

* test(account): satisfy cache test lint checks

* perf(account): limit pod informer cache

* perf(account): cache projected pod fields

* style(account): format pod cache test
2026-08-27 16:51:09 +08:00
Yun Pan beea1e56cb feat(account): expose admin account read APIs (#7220)
* feat(account): expose admin account read APIs

* fix(account): satisfy golangci-lint

* fix(account): satisfy golines formatting

* fix(account): apply golangci-lint formatting

* fix(account): address review feedback

* feat(account): isolate admin jwt authentication

* test(account): cover property reload admin auth

* fix(account): satisfy context-aware request lint

* fix(account): address admin auth review feedback
2026-08-21 15:05:38 +08:00
Yun Pan a706e3297a fix(account): prevent stale debt deletion after recharge (#7230)
* fix(account): prevent stale debt deletion after recharge

* style(account): satisfy golangci-lint formatting

* fix(account): improve debt deletion diagnostics
2026-08-18 11:26:51 +08:00
Phil Su a04e0eb544 feat(desktop): route Stripe returns to declared app (#7208)
* feat(billing): route Stripe returns to declared app

Signed-off-by: aimeritething <aimeritething@gmail.com>

* fix(billing): persist Stripe callback app

Signed-off-by: aimeritething <aimeritething@gmail.com>

* fix(billing): address review feedback for Stripe payApp routing

- Fix golangci-lint issues: use NewRequestWithContext and
  http.MethodPost in tests, drop a trailing blank line
- Normalize array-valued app query params in the desktop
  Stripe callback resolver and cover it with a test
- Simplify pendingTransactionPromotionCode with strings.SplitN
- Rename the parser test to reflect it only verifies JSON binding
- Refresh the stale callback URL example comment in buildURLs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: aimeritething <aimeritething@gmail.com>

* docs(pay): use placeholder values in callback URL example

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: aimeritething <aimeritething@gmail.com>

---------

Signed-off-by: aimeritething <aimeritething@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 16:39:09 +08:00
xzy 54e6c1da3d refactor(minio): remove minio service from monorepo (#7198) 2026-08-11 14:20:14 +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 e6ad22e041 chore(service): remove pay service (#7112)
remove pay service

# Conflicts:
#	service/go.work.sum
2026-07-27 13:26:10 +08:00
Jiahui cc4a72c142 fix(ci): ci build error (#7114)
fix ci
2026-07-27 12:07:14 +08:00
cuisongliu ac3023057b chore(service): remove hubble and exceptionmonitor (#7108)
* chore(service): remove hubble and exceptionmonitor

* fix(service/account): restore compile with gin logger

* Revert "fix(service/account): restore compile with gin logger"

This reverts commit c57c974f3c.
2026-07-27 10:32:18 +08:00
zijiren 95131f1208 refactor(devbox): Devbox and related gateway services (#7098)
remove(devbox): Devbox and related gateway services
2026-07-24 17:56:28 +08:00
Yun Pan b38d2ae17d fix(account): harden PAYG debt recovery (#7089)
* fix(account): recover debt status after balance normalization

* fix(account): retry debt refresh when user lock is busy

* fix(account): verify workspace subscriptions during debt recovery
2026-07-24 11:35:58 +08:00
cuisongliu 87cac0128a chore(aiproxy): remove aiproxy provider references from configuration (#7079)
Signed-off-by: cuisongliu <cuisongliu@qq.com>
2026-07-23 14:07:16 +08:00
Bearix a790df21b9 fix(monitor): fix launchpad monitor memory bug (#7006)
* fix(monitor): fix launchpad monitor bug.

* fix(monitor): fix launchpad monitor bug.
2026-06-17 16:53:53 +08:00
Bearix d55fe067f0 fix(monitor): fix db monitor bug. (#6997)
* feat(monitor): fix db monitor bug.

* feat(monitor): fix db monitor bug.

* feat(monitor): fix db monitor bug.
2026-06-17 15:19:44 +08:00
Bearix 0403d75ad4 feat(monitor): add network monitor (#6978)
* feat(monitor): add network monitor

* feat(monitor): add network monitor
2026-05-26 14:41:16 +08:00
Jiahui 0068c03d0b feat(devbox): add Prisma schemas for cockroach and postgresql (#6885) (#6920)
* feat(devbox): add dual Prisma schemas for cockroach and postgresql

- split schema/migrations into prisma/cockroach and prisma/postgresql

- route runtime client and deploy migration by DATABASE_PROVIDER

- add postgres migration compatibility for Kingbase UUID generation

- remove default prisma entrypoint and document explicit commands

* fix(devbox): package prisma migrations in runtime image

Copy CockroachDB and PostgreSQL migration directories into the runtime image so initContainer migrate deploy can find migration files for both providers.

Add frontend/.dockerignore to reduce Docker build context size.

* fix(frontend): copy devbox prisma provider migrations

Co-authored-by: Alex Lee <3076438032@qq.com>
2026-04-24 20:01:54 +08:00
cuisongliu 9632e12d89 chore(deps): remove license server from service (#6872)
* chore(deps): update dependencies to latest versions in go.work.sum

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

* chore(deps): remove deprecated dependencies from go.work.sum

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

---------

Signed-off-by: cuisongliu <cuisongliu@qq.com>
2026-04-08 14:52:12 +08:00
cuisongliu aa8f25ffe5 fix(service): remove unused project dependencies from workspace (#6870)
Signed-off-by: cuisongliu <cuisongliu@qq.com>
2026-04-07 17:57:40 +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
cuisongliu 22cf0687ab fix(account-service): add ingress resource adoption and create instal… (#6832)
* fix(account-service): add ingress resource adoption and create install script

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

* fix(config): add support for allowedAllOrigins in configmap and values

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

---------

Signed-off-by: cuisongliu <cuisongliu@qq.com>
2026-03-25 13:29:48 +08:00
shoufeng 6e415a8294 fix(cost-center): the billing module does not calculate LLMToken consumption (#6749)
fix: the billing module does not calculate LLMToken consumption
2026-03-11 15:03:23 +08:00
Jiahui a8ee36730e feat(account service): get pricing/role for creating a workspace plan (#6753)
* optimize preview new workspace plan amount

* get workspace subscription info api add role info
2026-03-03 15:11:45 +08:00
Jiahui 5d617ce2d0 fix(account-service): add ingress template to helm chart (#6733)
fix ingress add to templates
2026-02-27 18:26:06 +08:00
Jiahui 0b6e6b4b76 feat(account): migrate account-service deployment to Helm chart (#6646)
- Replace manifest-based deployment with Helm chart structure
- Add Helm chart with standard templates (deployment, service, configmap)
- Create account-service-entrypoint.sh for Helm installation
- Update Kubefile to use Helm chart instead of manifests
- Simplify deployment by reusing account-controller-manager service account
- Remove unnecessary components (no webhook, RBAC, metrics, certificates)
- Use compatible selector labels for seamless migration from manifests
- Add comprehensive README.md with configuration examples and troubleshooting guide

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-02 21:15:47 +08:00
Jiahui 7a93792579 fix(account): the processing logic for downgraded invoices webhook (#6629)
fix the processing logic for downgraded invoices webhook
2026-02-02 10:58:33 +08:00
Jiahui 437095418f feat(account): support custom gpu monitor (#6636)
add enum
2026-02-02 10:22:51 +08:00
zijiren 706ad3944a feat(ci): impl new docker image build method and makefile (#6632)
feat: impl new docker image build method and makefile
2026-01-30 17:40:09 +08:00
Bearix af57d37637 feat(launchpad): add gpu monitor. (#6625)
add gpu monitor.
2026-01-30 16:52:29 +08:00
cuisongliu 857e0955f2 feat(redis): add initial Helm chart and installation script for Redis… (#6615)
feat(redis): add initial Helm chart and installation script for Redis deployment

Signed-off-by: cuisongliu <cuisongliu@qq.com>
2026-01-28 10:20:46 +08:00
zijiren dc7bdfeeb8 feat(ci): service build on docker and arm runner (#6596)
* feat: service build on docker and arm runner

* fix: build context

* fix: go mod downlaod cache

* fix: go build main pachage

* fix: hubble build main package

* fix: remote jsoniter tag

* fix: configure ReadHeaderTimeout for minio http server (#129)

---------

Co-authored-by: xzy <nowinkey@tom.com>
2026-01-27 12:05:08 +08:00
Jiahui af5c39f896 feat(account): support subscription cancel/resume operator (#6593)
* feat(account): allow resuming workspace subscription

* fix
2026-01-26 14:24:30 +08:00
Jiahui f2bb5a88b4 fix(account): prevent multi-region conflicts in invoice.created webhook handling (#6565)
This commit resolves the issue where multiple regions simultaneously process
the same invoice.created event, causing Stripe API errors:
"This invoice is already finalized, you can't re-finalize a non-draft invoice."

Changes:
1. Add region check in handleWorkspaceSubscriptionInvoiceCreated
   - Only process events belonging to the current region
   - Skip events from other regions with appropriate logging
   - Use existing checkIsLocalEvent function for consistency

2. Add fault tolerance in ConfirmInvoice for FinalizeInvoice
   - Detect "already finalized" errors gracefully
   - Re-fetch invoice status when finalized by another region
   - Continue processing instead of failing

Impact:
- Eliminates race conditions in multi-region deployments
- Ensures only one region processes each invoice.created event
- Provides graceful fallback for edge cases
- Maintains backward compatibility with idempotent behavior

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-22 10:38:50 +08:00
Jiahui 3ae31df0d5 fix(account-service): fix mod (#6561)
fix mod
2026-01-21 18:09:05 +08:00
Jiahui 308153f403 fix(account): fixed the issue where the status of the last subscription might be synchronized for new subscriptions (#6558)
* fix the issue of inconsistent subscription periods

* fix the unhandled situation of the namespace controller

* fix the expiration time of the initial subscription

* Return the invoice order address after the due date if the payment is not made

* add handleWorkspaceSubscriptionInvoiceCreated

* support resubscription in an outstanding status

* optimize the return of unpaid invoice data

* Fixed the issue where the status of the last subscription might be synchronized for new subscriptions
2026-01-21 17:12:55 +08:00
Jiahui 8f6f977d10 feat(account): support reload account config api (#6458) (#6529)
* support reload account config api

* set account ingress with apply
2026-01-16 11:27:07 +08:00
zijiren 2bb61fa731 feat(sshgate): return errors message to ssh clients (#6490) 2026-01-06 15:28:29 +08:00
zijiren e315b7d3a0 feat(sshgate): add more sshgate log (#6487)
* feat(sshgate): add more sshgate log

* chore: add more log filed

* chore: add devbox runs on node name
2026-01-06 15:01:37 +08:00
Jiahui ffe1919dbc fix(account-service): fix repeatedly applying invoices (#6478)
fix the issue of repeatedly applying invoices
2026-01-05 15:14:11 +08:00
zijiren 41ad71fdba fix(sshgate): helath check error log move to debug level (#6476)
* fix(sshgate): helath check error log move to debug level

* fix: ci lint
2026-01-04 17:03:38 +08:00
Jiahui e070b0255e perf(account): skip traffic and AI quota queries for non-subscription users (#6444)
Check namespace annotation 'subscription.sealos.io/status' to identify subscription users. Only query and return traffic/ai_quota data for subscription users, reducing unnecessary database queries for non-subscription workspaces.

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-26 16:24:25 +08:00
Jiahui 53038abd25 fix(account-service): If the GPU does not exist, quota returns to remove the gpu data (#6435)
If the GPU does not exist, quota returns to remove the gpu data
2025-12-25 14:22:31 +08:00
Jiahui 5b2d873bd8 feat(account): workspace subscription card manager & support discount code with upgrade plan (#6425)
* feat: add workspace subscription card management APIs

- Add CreateWorkspaceSubscriptionCardManagePortal for creating Stripe portal sessions
- Add GetWorkspaceSubscriptionCardInfo for retrieving payment method details
- Add new request structs and route definitions
- Update constants for new API endpoints

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

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: implement subscription-specific card management portal

- Add CreateSubscriptionPortalSession method in Stripe service
- Modify CreateWorkspaceSubscriptionCardManagePortal to use workspace-specific subscription
- Use flow_data to restrict portal to payment method updates only
- This ensures users only see the current workspace's subscription in the portal

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

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: implement subscription upgrade billing cycle reset and discount code support

## Key Changes

### 1. New Billing Logic for Upgrades
- Changed from prorated remaining value to current plan remaining value calculation
- Formula: Upgrade Fee = New Plan Full Price - Current Plan Remaining Value
- Ensures fair pricing based on unused portion of current plan

### 2. Billing Cycle Reset for Upgrades
- Upgrade payments now start a new billing cycle from the upgrade date
- Next payment date resets to the same day next month
- Modified finalizeWorkspaceSubscriptionSuccess to handle upgrade cycle reset

### 3. Discount Code Integration
- Added DiscountCode field to WorkspaceSubscriptionOperatorReq
- Created CreateWorkspaceSubscriptionSessionWithDiscount method for payment sessions
- Enhanced UpdatePlanPricePreviewWithDiscount for accurate discount preview
- Discount information stored in transaction.StatusDesc

### 4. API Response Enhancement
- Upgrade amount API returns detailed discount information
- Supports amount preview with and without discount codes
- Frontend can display discount comparison and validation

### 5. Stripe SDK Integration
- Used InvoiceCreatePreviewParams.Discounts for discount preview
- Used CheckoutSessionParams.Discounts for payment discount
- Proper BillingCycleAnchor configuration for upgrade cycles

## Technical Implementation

- Maintains backward compatibility for existing operations
- Discount codes only apply to upgrade operations
- Consistent billing cycle logic across preview and payment
- No database schema changes required

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

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: enhance subscription upgrade package management with proper expiration

- Add upgrade-aware traffic and AI quota package management
- Implement proper expiration of old packages during upgrades
- Add AddTrafficPackageWithUpgrade and AddWorkspaceSubscriptionAIQuotaPackageWithUpgrade functions
- Fix stripe subscription cancellation and upgrade logic
- Maintain backward compatibility with existing package functions

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

Co-Authored-By: Claude <noreply@anthropic.com>

* add redirect url & create subscription setup intent

* support get create subscription amount with discount code.

* convert the discount code to the promotion code

* support cancel workspace subscription invoice

* support deleteImmediately

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-25 10:49:24 +08:00
yy eee4ade42b feat(devbox): v1alpha2 with daemon controller (#5781)
feat(devbox): v1alpha2 with daemon controller
2025-12-17 17:43:03 +08:00
zijiren 720e96a971 chore(sshgate): update sshgate default priority class (#6355) 2025-12-17 11:43:07 +08:00
zijiren 5737ecec9f chore(sshgate): update sshgate default resources (#6349) 2025-12-16 17:13:48 +08:00
zijiren c09eeb0e80 feat(sshgate): reduce informer memory usage (#6347) 2025-12-16 17:07:12 +08:00
zijiren 1830013fc4 feat(sshgate): add sshgate recover and disable resync default (#6344)
* feat: add sshgate recover

* fix: ci lint

* chore: defautl disable informer resync
2025-12-16 15:59:12 +08:00
Jiahui c52d1da971 feat(account): custom notification point (#6323)
* add user alert notification account

* debt supports multiple notification account

* feat: add UserAlertNotificationAccount CRUD interfaces with unified POST endpoints

- Implement user-level alert notification account management
- Add CREATE, LIST, DELETE operations using POST requests
- Remove GET and UPDATE operations as per requirements
- All endpoints use POST method with different route paths
- Delete operation is idempotent (succeeds even if record doesn't exist)
- Include proper authentication, validation, and error handling
- Add comprehensive API documentation with Swagger annotations

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

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: return 409 status for duplicate user alert notification accounts

- Add duplicate key error detection in CreateUserAlertNotificationAccount
- Return HTTP 409 Conflict instead of 500 for duplicate entries
- Add isDuplicatedKeyError helper function to handle various DB error messages
- Import necessary packages (errors, strings, gorm)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-12 11:43:59 +08:00
zijiren f59c097736 feat(sshgate): add devbox ssh gateway service (#6257)
* feat: add devbox ssh gateway service

* chore: bump golang version

* fix: install chart

* fix: chart ssh port

* fix: remove tcpip-forward limit

* fix: sshgate kubefile

* faet: sshgate support proxy protocol

* fix: sshgate kubefile chart

* fix: update sshgate deploy

* fix: charts

* fix: sshgate image values

* fix: ci lint

* fix: rollback the controller go version from 1.25 to 1.24

* fix: rollback the controller go version from 1.25 to 1.24
2025-12-10 14:50:42 +08:00
Jiahui 4145fc6a9b feat(account-service): migrate PaymentRefund table to support multiple refunds per order (#6315)
* feat: migrate PaymentRefund table to support multiple refunds per order

- Add OrderID field to PaymentRefund struct for business logic
- Add RowID UUID primary key for CockroachDB compatibility
- Migrate ID primary key to RowID using atomic transaction
- Copy existing ID values to OrderID field
- Remove primary key constraint from ID field
- Convert trade_no from UUID to TEXT type if needed
- Enable multiple partial refunds per payment order

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

Co-Authored-By: Claude <noreply@anthropic.com>

* ci fix

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-09 15:08:51 +08:00