1 - ModuleController Architecture Design

Koupleless 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

CRD Model Design for Koupleless ModuleController

Comparison of CRD Models

Native K8S CRDModuleController CRDRelationship and Difference
PodModulePod: The smallest deployable computing unit created and managed in K8S. Module: The smallest deployable computing unit created and managed in Serverless.
PodSpecModuleSpecPodSpec: Describes the specifications of a Pod, including containers, scheduling, volumes, etc. ModuleSpec: Describes the specifications of a Module, including module, service, and scheduling (affinity).
PodTemplateModuleTemplatePodTemplate: Defines the template for generating Pod replicas, including PodSpec. ModuleTemplate: Defines the template for generating Module replicas, including ModuleGroupSpec.
DeploymentModuleDeploymentDeployment: Defines the desired state and replica count for Pods. ModuleDeployment: Defines the desired state and replica count for Modules.
ReplicaSetModuleReplicaSetReplicaSet: Manages the running replicas of Pods. ModuleReplicaSet: Manages the running replicas of Modules.

ModuleDeployment CRD Model

image

Module CRD Model

image

ModuleTemplate CRD Model

image

ModuleReplicaSet CRD Model

image


3 - 核心代码结构

Koupleless ModuleController 核心代码结构

image.png

image.png


The core code logic resides in moduledeployment_controller.go, modulereplicaset_controller.go, module_controller.go, controller_utils.go, with detailed comments.



4 - Module Lifecycle

Lifecycle of Koupleless Modules

Module Lifecycle

The module lifecycle is described by four quadrants: Prepare, Upgrading, Completed, Available.

image

Module State Machine

image


5 - Core Process Sequence Diagram

Sequence diagram of Koupleless ModuleController core processes

Module Initial Deployment

image

Module Secondary Deployment

image

Module Decommissioning

image

symmetry Base Scaling Up

image

symmetry Base Scaling Down

image