-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor api #7
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
Refactor api #7
Conversation
feature/account: implement auth service and user RUD service
feature/account: refactor project init process
account/rbac: implement role and auth handlers, and add handler integration test
account/rbac: implement repository mongo test and add swag document
impl k8s adapter
strategy/api: implement strategy post and get api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR represents a major architectural refactoring that transforms a monolithic API server into a modular microservices-based architecture. The changes introduce a new manager-decisionmaker pattern, add a web UI, implement MongoDB-based persistence with RBAC, and restructure the codebase into cleaner, more maintainable packages.
Key changes:
- Restructured from monolithic to manager/decisionmaker architecture with separate command entry points
- Added comprehensive web UI with HTML/CSS/JavaScript for API interaction
- Introduced MongoDB repository layer with migrations and RBAC system
- Replaced simple in-memory storage with persistent database storage
- Added Kubernetes adapter with pod caching and informer-based watching
Reviewed changes
Copilot reviewed 114 out of 120 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| main.go | Refactored from monolithic server to Cobra command-based multi-service architecture |
| web/static/style.css | Added comprehensive CSS styling for new web UI |
| web/static/index.html | Added HTML interface for API interaction |
| web/static/app.js | Added JavaScript client for authentication, metrics, and strategy management |
| manager/service/*.go | New service layer with authentication, RBAC, and scheduling strategy logic |
| manager/rest/*.go | New REST handlers with proper error handling and Swagger documentation |
| manager/repository/*.go | MongoDB repository implementation with query builders |
| manager/k8s_adapter/adapter.go | Kubernetes integration with informer-based pod watching and caching |
| manager/domain/*.go | Domain models with BSON serialization and business logic |
| manager/migration/*.json | MongoDB schema migrations with collections and indexes |
| pkg/util/*.go | Reusable utilities including generic maps, pointer helpers, and Argon2 encryption |
| pkg/logger/logger.go | Zerolog-based structured logging |
| pkg/middleware/logger.go | HTTP request/response logging middleware |
| pkg/container/*.go | Docker container management for testing |
| rootCmd.AddCommand(managercmd.ManagerCmd, dmcmd.DMCmd) | ||
| if err := rootCmd.Execute(); err != nil { | ||
| log.Fatalf("Command execution failed: %v", err) | ||
| os.Exit(1) |
Copilot
AI
Dec 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This statement is unreachable.
No description provided.