This is the multi-page printable view of this section. Click here to print.
ModuleController Technical Documentation
1 - ModuleController Architecture Design
Introduction
ModuleController is a K8S controller that follows the K8S architecture. It defines and implements core models and reconciling capabilities such as ModuleDeployment, ModuleReplicaSet, and Module. This enables the second-level operation and maintenance scheduling of Serverless modules, as well as coordinated operation and maintenance capabilities with the infrastructure.
Basic Architecture
ModuleController currently consists of three components: ModuleDeployment Operator, ModuleReplicaSet Operator, and Module Operator. Similar to the native Deployment in K8S, creating a ModuleDeployment will reconcile a ModuleReplicaSet, which in turn reconciles a Module. Finally, the Module Operator will invoke the Arklet SDK inside the Pod to install or uninstall the module. Additionally, ModuleController will automatically generate a K8S Service for ModuleDeployment. Enterprises can listen for changes in the IP of this Service to integrate with their own traffic control system, enabling granular traffic cutting and hanging for modules.
Feature List and RoadMap
- 08.15: Version 0.2 Release (including asymmetric module deployment, uninstallation, scaling, replica maintenance, infrastructure operation and maintenance linkage).
- 08.25: Version 0.3 Release (including rollback chain, parameter validation, unit test coverage of 80/60, CI automation, developer guide).
- 09.31: Version 0.5 Release (1:1 scaling before scaling, module rollback, two scheduling strategies, state feedback, 1+ end-to-end integration tests).
- 10.30: Version 0.6 Release (support for enterprise layer 4/7 traffic control linkage via K8S Service, a total of 10+ end-to-end integration tests).
- 11.30: Version 1.0 Release (support for peer-to-peer deployment and operation, various fixes and polishing, a total of 20+ end-to-end integration tests).
- 12.30: Version 1.1 Release (support for automatic elastic scaling of modules and infrastructure, enhancement of peer-to-peer and asymmetric deployment and operation capabilities).
2 - CRD Model Design
Comparison of CRD Models
Native K8S CRD | ModuleController CRD | Relationship and Difference |
---|---|---|
Pod | Module | Pod: The smallest deployable computing unit created and managed in K8S. Module: The smallest deployable computing unit created and managed in Serverless. |
PodSpec | ModuleSpec | PodSpec: Describes the specifications of a Pod, including containers, scheduling, volumes, etc. ModuleSpec: Describes the specifications of a Module, including module, service, and scheduling (affinity). |
PodTemplate | ModuleTemplate | PodTemplate: Defines the template for generating Pod replicas, including PodSpec. ModuleTemplate: Defines the template for generating Module replicas, including ModuleGroupSpec. |
Deployment | ModuleDeployment | Deployment: Defines the desired state and replica count for Pods. ModuleDeployment: Defines the desired state and replica count for Modules. |
ReplicaSet | ModuleReplicaSet | ReplicaSet: Manages the running replicas of Pods. ModuleReplicaSet: Manages the running replicas of Modules. |
ModuleDeployment CRD Model
Module CRD Model
ModuleTemplate CRD Model
ModuleReplicaSet CRD Model
3 - 核心代码结构
The core code logic resides in moduledeployment_controller.go
, modulereplicaset_controller.go
, module_controller.go
, controller_utils.go
, with detailed comments.
4 - Module Lifecycle
Module Lifecycle
The module lifecycle is described by four quadrants: Prepare, Upgrading, Completed, Available.