For when a node or cluster monthly cost is added, the user will need to choose between CPU or Memory for where the Monthly cost should be distributed. This issue is to handle the distributed cost for when the User chooses cpu which will be our new default.
Python Changes Location
We can lean on the upsert_monthly_cluster_cost_line_item method within the ocp_report_db_accessor.py to handle this. (We will also need to do this for tags).
Database Changes
We change the default value of the monthly_infrastructure_cost from a decimal to a json to match the infrastructure and supplementary cost.
- Example of new infrastructure_monthly_cost & supplementary_monthly_cost:
- {"cpu": 0.000000}
If the user chooses a cpu in the cost model then the cpu will be populated (the default for now is the cpu so we will tackle it first. We may want to add a field in the daily summary to mark wether the cpu or memory was chosen. Additionally, this json field can easily be expanded to include the pvc or memory distributed cost later. Plus, it makes it easier to delete a monthly rate, without having to edit the json for the infrastructure & supplementary costs.
How do I figure out the cpu distributed cost?
- (node CPU capacity / cluster CPU capacity) x cluster cost
Notes:
- the current node monthly cost is being calculated in the no-node option. As a byproduct of this change, we may need to lose the no-node.
- blocks
-
COST-1448 Cluster to Node Memory Distribution
- Closed