The Audit API applies a series of tests to the various cached data sources of Kubecost to check the validity of the data sources and the processes that act upon them. Each of the Audits tests represents an invariance that should remain true despite any changes that occur to the system as a whole. Each Audit is stored in an AuditSet, which besides audits contains a window for the timeframe that the Audits it contains cover. The Audits themselves each have a timestamp for their last run, a status, a description and other audit-specific structures which contain the results of the run.
Audit types are optional parameters to filter your requests to audit select parts of your workload or perform additional actions. The endpoint for using an audit type will look like:
Tests that CPU, GPU and RAM cost totals by node from the Allocation store after reconciliation are equal to the values costs of each node in the Asset Store.
Detects divergence in the totaling of Allocation store and Total store by querying the Allocation store and comparing the totaled results against the contents of the total store
Detects divergence in the aggregation of Allocation store and Agg store by querying the Allocation store and comparing the aggregated results against the contents of the total store
Tests that Assets have the same total cost as their corresponding CloudUsages
Detects divergence in the totaling of Asset store and Total store by querying the Asset store and comparing the totaled results against the contents of the total store
Tests that the aggregate by cluster of the asset store is equal to the aggregate by cluster of the reconciliation allocation store after idle and tenancy costs have been applied
The base return types are used by each Audit result to express any discrepancies that have been detected.
Audit Missing Value
Audit Missing Value denotes a value that was present in one data source and not another. The presence of this base result will generally result in a Warning status in the Audit that contains it. It contains a
Descriptionof the missing value and the
keywhich acts as a way of identifying the missing value.
Audit Float Result
Audit Float Result represents a difference in float values between two data sources. The presence of this base result generally indicates a Failed status on the Audit. It contains an
Actualvalue derived from the data source being audited and
Expectedvalue which is generated by the Audit itself.
Each Audit result contains the following values.
status: gives the end result of the Audit as
lastRun: a timestamp of when the Audit was run
description: a string describing the result of the audit. Generally used for failures in preliminary checks.
*AuditMissingValuecontaining any values that were found to be missing during the audit
Allocation Reconciliation Audit
Allocation Reconciliation Audit records the differences of between compute resources (CPU, RAM, GPU) costs between allocations by nodes and node assets. It contains the additional fields:
map[string]map[string]*AuditFloatResultrecords difference in resource values between asset and allocations. Keyed on node name and resource name
Total Audit records the differences between a total store and the totaled results of the store. It contains the additional fields:
map[string]*AuditFloatResultwhich records differences of calculated total by node. Keyed on node name
map[string]*AuditFloatResultwhich records differences of calculated total by cluster. Keyed on cluster id
Agg Audit contains the results of an Audit on an AggStore which checks if the aggregate of the store it draws from matches it.
map[string]map[string]*AuditFloatResultwhich records differences of calculated agg. Keyed on aggregation prop and allocation or asset key
Asset Reconciliation Audit
Asset Reconciliation Audit records differences in assets and the Cloud items that it is able to successfully match.
map[string]map[string]*AuditFloatResultwhich records differences in cloud assets and matched assets. Keyed on providerId and category
Equality Audit records the difference in cost between Allocations and Assets aggregated by cluster and Keyed on cluster
map[string]*AuditFloatResultwhich records differences in allocations by cluster and assets by cluster. Keyed by cluster id