Open Anddd7 opened 1 year ago
在应用架构中,我们通过采用MVC模式,分离关注点,以确保代码具有单一职责,以提高可维护性。同样,这也适用于基础设施即代码(IaC)的编写。对于基础设施,不同的角色关注不同的方面。特别是,不同的基础设施在其生命周期上有着不同的特点,与一般代码不同,基础设施无法随意删除或修改,比如网络结构。因此,对于IaC的分层管理变得非常必要。
例如,layer0 是构建最基础资源的层级,与应用无关,包括网络、权限、存储等。这些资源只有DevOps团队会关心和管理。
layer1 开始构建平台,提供标准的公共可复用的抽象资源,如集群、IP段、用户组等。这些资源通过约定(例如工单)进行分发和消费。
layer2 提供可插拔、按需使用的标准化组件,以提升资源利用率。
最终,在这些基础层级之上,应用团队可以构建自己的业务应用,以此来完善整个架构。
In application architecture, we adopt the MVC pattern to separate concerns and ensure code has a single responsibility, thus enhancing maintainability. This principle also applies to Infrastructure as Code (IaC). For infrastructure, different roles have different areas of focus. Notably, the lifecycle of different infrastructure components varies significantly from regular code; they cannot be casually removed or modified, as seen in the case of networking. Hence, a layered approach to managing IaC becomes essential.
For instance, layer0
constructs the most fundamental resources, which are application-agnostic, encompassing aspects like networking, permissions, storage, etc. These resources are solely managed and cared for by the DevOps team.
layer1
involves constructing the platform, providing standardized, publicly reusable abstract resources such as clusters, IP ranges, user groups, etc. Distribution and consumption of these resources occur via agreements such as tickets.
layer2
furnishes standardized components that are pluggable and can be utilized on-demand, thereby elevating resource utilization.
Ultimately, atop these foundational layers, the application team can build their own business applications to complete the overall architecture.