Data center resource graph
This document describes the data center resource graph managed and validated by the DataCenterResource controller. It explains the design, the data model, how the graph is constructed, validated and some of the fields that are used to describe the graph.
Chantico is built on the foundation that physical and virtual components that
make up a data center can be related to each other. Each component that can be
monitored, aggregated or allocated energy-wise is represented as
a DataCenterResource custom resource. The relationships between these
resources define how energy flows from one resource to another. Together, the
resources and their relationships form a graph. Once the graph is completely
constructed, it allows for accounting all the energy usage in a data center.
One important property of the graph is that it is represented as a directed acyclic graph (DAG), meaning that there are no cycles in the graph. This is important because it allows for complete and unambiguous assignment of power consumption.
Fields and validation
| Field | Type | Description |
|---|---|---|
metadata.name |
string |
The name of the resource. This is used to reference the resource in spec.parents of other resources. |
spec.type |
string |
The type of the resource (see below). |
spec.energyMetricFrom |
TemplateFrom |
Prometheus expression source for a root resource, supplied by value or valueFrom |
spec.parents |
list of ParentRef |
Parent resources; each entry requires a coefficient expression in coefficientFrom |
spec.additionalLabels |
map of string to string |
Any additional fields to associate with the resource. This can be used to group resources together for energy accounting purposes. |
These fields are validated by the API schema and controller to ensure that the graph is constructed correctly, has no ambiguous or unknown information, and that there are no cycles or invalid flags on the resources:
spec.typemust be one of the resource types listed below. The controller rejects unknown types and does not use them in energy usage calculations.spec.parentsmust reference existing resources in the same namespace and those resources must not (indirectly) refer to this resource. If a parent resource does not exist, the controller will not use the resource in energy usage calculations.- Each entry in
spec.parentsmust includecoefficientFrom. Root resources (those without parents) must includeenergyMetricFrom. Both fields accept either an inlinevalueor avalueFromreference; Go-template placeholders can be supplied throughtemplateParameters.
Resource types
A resource type describes what a graph node represents, not how it is monitored.
The collection method, such as SNMP or a Prometheus exporter, belongs to the
PhysicalMeasurement. The resource type is also published as the type label
on the resource’s power timeseries.
| Type | Meaning |
|---|---|
grid |
An electricity grid connection supplying the data center. |
solar |
Solar generation directly connected to the data center, from a single installation or an aggregate source. |
wind |
Wind generation directly connected to the data center, from one or more turbines. |
generator |
An engine-driven electrical generator, such as a diesel generator. The type does not prescribe a particular fuel. |
battery |
Battery energy storage that can supply the data center. |
power-feed |
A supply path connecting one or more power sources to all or part of the data center. |
pdu |
A power distribution unit (PDU) supplying one or more connected resources. |
outlet |
An individual PDU outlet supplying a connected resource or service, not an entire PDU. |
baremetal |
A physical server, distinct from the virtual workloads running on it. |
hypervisor |
The virtualization layer hosting VMs on a bare-metal server, represented separately from the physical host. |
vm |
A virtual machine running on a hypervisor (or on a baremetal) with some way of selecting metrics for the individual VM. |
kubernetes |
A Kubernetes cluster whose parent resources can be bare-metal servers or VMs, not an individual pod. |
heat |
A heat output or heat reuse resource. |
For the initial power-feed model, resources connected to a feed are assumed to
be supplied by all sources referenced by that feed. Declare these relationships
through spec.parents; the type does not automatically create connections.
The existing kubernetes value denotes a cluster. There is no separate
kubernetes-cluster or pod type. Hypervisors and clusters provide intermediate
nodes for distinguishing whole-server power from the power attributed to hosted
workloads.
The graph does not require all types to be present in the graph. As such, the controller only restricts the parent types of a few resource types, and accepts any parent type for the other types:
| Type | Allowed parent types |
|---|---|
outlet |
pdu |
baremetal |
pdu, outlet |
vm |
baremetal, hypervisor |
kubernetes |
baremetal, vm |
A resource with a parent of another type fails validation.
Example graph
In the following graph, the nodes represent DataCenterResource custom
resources and the edges represent the relationships between them. The edges are
directed from parent to child, indicating the flow of energy from one resource
to another.
The red nodes represent power sources and power feeds, the blue nodes represent resources that are not directly part of a service subscription (PDUs, bare metals, VMs, Kubernetes clusters that are sold per namespace or pod, etc.), and the green nodes represent resources that are part of a service subscription (bare metals, VMs, Kubernetes clusters, pods, etc.).
As such, the red nodes have no parents other than upstream power inputs, and the
green nodes have no children. The green nodes are marked with a serviceId in
their corresponding additionalLabels fields of their resources, to indicate
they form client-facing services with any resource with the same ID.
This diagram is a conceptual view rather than a literal resource manifest. Its
PDU nodes represent physical distribution equipment; outlet identifies
individual PDU connections in the resource model. Pods illustrate a future
extension and do not currently have their own resource type. Solar, wind,
hypervisor and heat resources are not shown.
Energy accounting
Accounting remains generic: a resource’s type does not select a different aggregation algorithm. Root resources provide a power timeseries, and child resources derive their power from their parents and the coefficients on those relationships. The new types remain subject to the same validation rules.
New algorithms for source allocation and overhead calculation are outside the scope of issue #200. Adding resource types does not itself implement those calculations or automatic discovery of resources.
More details on the implementation of energy accounting with Prometheus recording rules can be found in the energy accounting document.