How cloudforet-io/repository works
Project Type and Purpose
• This is a backend microservice (part of a larger SpaceONE platform) responsible for managing container-image repositories and plugin definitions.
• It exposes both gRPC and REST APIs, schedules background jobs, runs worker processes, and interfaces with external container registries (Docker Hub, AWS ECR, GCP Artifact Registry).
• It persists metadata (plugins, dashboard templates, capabilities) in a database and uses a layered (hexagonal/clean) architecture.
Main Components
A. API Layer
• gRPC Server (“application-grpc”)
• REST Server (“application-rest”, fronted by nginx)
B. Scheduler
• Periodic job dispatcher (“application-scheduler”)
C. Worker
• Background job executor (“application-worker”)
D. Service Layer
• spaceone.repository.service
– plugin_service
– repository_service
– dashboard_template_service
E. Manager & Repository Layer
• Managers (local, managed, remote)
• Connectors (registry_connector, AWSPrivateECRConnector, GCPPrivateGCRConnector)
• Data models & Info objects
F. External Systems
• Container registries (Docker Hub, AWS ECR, GCP Artifact Registry)
G. Persistent Storage
• Relational or document database (configured via database-conf.yaml)
H. Deployment & Delivery
• Helm charts (deploy/helm)
• Docker (Dockerfile)
• CI/CD pipelines (GitHub Actions, Skaffold)
Relationships & Data Flows
1. Client → API Layer
• External clients call REST (HTTP/JSON) or gRPC endpoints.
2. API Layer → Service Layer
• API controllers invoke service methods.
3. Service Layer → Manager Layer
• Services delegate to managers for business logic, data transformations.
4. Manager Layer → Repository Layer (Ports & Adapters)
• Connectors pull/push images to external registries.
• Repository implementations read/write from the internal database.
5. Scheduler → Worker
• Scheduler enqueues tasks.
• Worker picks up tasks and uses connectors to sync repository/plugin metadata.
6. Database
• All services and managers persist or query metadata from the database.
Architectural Patterns & Principles
• Layered architecture (API → Service → Manager → Repository)
• Hexagonal/Ports & Adapters: repository interfaces in src/spaceone/repository/interface, adapters in connector/* and managed_resource/*.
• Separation of concerns:
• API adapters (REST, gRPC)
• Domain logic (service + manager)
• Persistence & external calls (repository + connectors)
• Infrastructure as code: Helm templates for Kubernetes deployment.
Putting It All Together
• To the side, show the database.
• Scheduler and Worker drawn as separate pods invoking the same service code.
• External registry nodes on the far right.