Cloud Native 9 min read

Applying APIServer to Baidu Waimai CMDB for Machine Resource Lifecycle Management

The article explains how Baidu Waimai’s CMDB adopts Kubernetes APIServer as a core component to model machine resources as objects, manage their five‑stage lifecycle, and leverage the Watch mechanism for efficient, consistent operations such as hostname changes and fault handling.

Baidu Waimai Technology Team
Baidu Waimai Technology Team
Baidu Waimai Technology Team
Applying APIServer to Baidu Waimai CMDB for Machine Resource Lifecycle Management

This paper starts from the practical scenario of Baidu Waimai’s CMDB and describes the lifecycle of machine‑related resources as well as how each stage is managed. It then introduces APIServer, borrowed from Kubernetes, as a core component of the CMDB.

APIServer treats every resource as an object stored in etcd and provides a unified RESTful API for create, read, update, delete, and watch operations. By abstracting machines, IPs, DNS records, and other assets as objects, the CMDB can perform lifecycle actions through standard API calls.

The Watch mechanism, inherited from Kubernetes, enables asynchronous, publish‑subscribe style notifications. Components subscribe to changes via APIServer, receiving updates when resources are created, modified, or deleted, which improves performance and data consistency.

The CMDB architecture uses APIServer to store machine objects in etcd, exposing CRUD and watch APIs to other services such as agents, workflow engines, DNS, and Puppet. The workflow for machine lifecycle includes five stages: synchronization, allocation, initialization, change, and repair, each implemented via specific API calls.

For the complex hostname‑change process, the workflow proceeds through order submission, approval, DNS/etcd update, local host update, and order completion, with each step triggering watch events and recording events for traceability.

In summary, APIServer provides a unified, object‑oriented interface that simplifies resource management, enables reliable watch‑based communication, and supports the current CMDB features (machine sync, repair, queries, hostname changes) while outlining future work on broader machine‑change operations.

KubernetesResource ManagementlifecycleCMDBWatchAPIServer
Baidu Waimai Technology Team
Written by

Baidu Waimai Technology Team

The Baidu Waimai Technology Team supports and drives the company's business growth. This account provides a platform for engineers to communicate, share, and learn. Follow us for team updates, top technical articles, and internal/external open courses.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.