Configuring a cost model allows users to associate prices to metrics and usage, and fine-tune the costs of running their cloud. This is an essential piece of running OpenShift on Prem, because without a cost model we can generate any costs. Therefore, a majority of the features available for the cost models are related to OCP sources. However, you can still apply a markup or discount through cost models to our cloud providers (AWS, Azure, GCP, OCI).
Helpful Links:
- Cost Managements Docs:
A price list is a mapping used to associate prices to metrics and usage. We use this mapping on the backend to calculate additional costs.
- Price list
- usage metrics
- monthly rates
The following usage metrics use a simple equation of usage * rate
to populate an additional cost in the database:
cost_model_cpu_cost
cpu_core_usage_per_hour
cpu_core_request_per_hour
cpu_core_effective_usage_per_hour
cost_model_memory_cost
memory_gb_usage_per_hour
memory_gb_request_per_hour
memory_gb_effective_usage_per_hour
cost_model_volume_cost
storage_gb_usage_per_month
storage_gb_request_per_month
These metrics are multipled by the rate then aggregated to create the corresponding cost_model_{type}_cost
column in the usage_costs.sql file.
After these columns are populated in the database, they are added to the overall cost in the provider map to generate the user facing cost.
Monthly rates are flat rates that are intended to cover a subscription cost.
Cluster and Node These cost are amortized, which means we distribute that cost evenly throughout the month so that each day has an equal portion of the total cost for the month. We distribute the rates applied to the node & cluster metrics within the monthly_cost_cluster_and_node.sql.
node_cost_per_month
cluster_cost_per_month
using the following equation:
effective_usage / capacity * monthly_rate
These costs are also inserted into the cost_model_cpu_cost
and cost_model_memory_cost
; however, we insert a value into the monthly_cost_type
column to distinguish these values.
cluster_cost_per_month
select * from reporting_ocpusagelineitem_daily_summary where monthly_cost_type='Cluster';
node_cost_per_month
select * from reporting_ocpusagelineitem_daily_summary where monthly_cost_type='Node';
PVC The monthly PVC cost follows a slightly different logic, where rate is divided by the number of unique persistent volume claims within monthly_cost_persistentvolumeclaim.sql.
Equation:
rate / pvc_count
pvc_cost_per_month
select * from reporting_ocpusagelineitem_daily_summary where monthly_cost_type='Node';