Skip to content

C02.1.18 Create Policy Model Reconciler Engine NodeCPUUtilization Compliance Check

Description

This feature implements a REST API endpoint that evaluates a Kubernetes node's CPU utilization compliance based on real-time metrics received from TDCME (Telemetry-Driven Cloud Monitoring Engine).

The TDCME provides granular CPU utilization data in the form of nanocores, which is ingested into the Policy Model Reconciler. The controller uses this data to verify whether each node meets the minimum CPU threshold (set at 4 cores) for performance and reliability compliance.

The output of this check is either a compliance confirmation or a violation message indicating insufficient CPU usage.

Endpoint

  • URL: POST /api/policyModelCompliance/check
  • Consumes: application/json
  • Produces: application/json

Request Payload from TDCME

{ "metrics": { "local": { "cpu": { "usage": { "core": { "ns": 2164039204021000 }, "nanocores": 1305320004 } }, "timestamp": "2025-04-16T13:59:17.409Z" }, "remote": {} }, "node_name": "enact-248.ic4e.uk", "resource_type": "node" }

Sample Response: HTTP 200 OK

{ "nodeName": "enact-248.ic4e.uk", "compliant": false, "violations": [ "CPU usage 1.31 cores is below minimum threshold of 4 cores" ] }

Sample Response: HTTP 400 Bad Request

Scenario: Invalid or unknown JSON fields (e.g., resource_typex)

{ "type": "about:blank", "title": "Bad Request", "status": 400, "detail": "JSON parse error: Unrecognized field 'resource_typex'..." }

Functionality Summary

  • Receives node CPU usage metrics from TDCME.
  • Extracts and converts nanocore values to actual CPU cores.
  • Compares against a static compliance threshold (4 cores).
  • Returns:
    • compliant: true when usage ≥ 4 cores
    • compliant: false with violation message when usage < 4 cores
  • Enables automated resource governance based on telemetry data.

Acceptance Criteria

ID Criteria Met When
AC1 API must return HTTP 200 for valid TDCME JSON input Valid input from TDCME gives compliance results
AC2 API must return HTTP 400 for malformed or unrecognized fields E.g., extra/misspelled fields cause validation errors
AC3 CPU usage < 4 cores results in compliant: false API returns detailed violation message showing current vs expected usage
AC4 CPU usage ≥ 4 cores results in compliant: true API returns compliant response without violations
AC5 DTO classes correctly map TDCME JSON (e.g., node_name, resource_type) Proper @JsonProperty usage ensures compatibility
AC6 Null or missing metric values handled gracefully No NullPointerExceptions or unexpected 500 errors