kubecost / kubectl-cost

CLI for determining the cost of Kubernetes workloads
Apache License 2.0
876 stars 55 forks source link

Missing components in total cost #85

Closed dwbrown2 closed 1 year ago

dwbrown2 commented 3 years ago

It looks like loadbalancers costs can cause a discrepancy between the total columns and it's subcomponents when passing -A. The same may be true for external costs.

image

The could be an opportunity to move to the new Allocation API so we have everything in one point if we haven't done that.

michaelmdresser commented 3 years ago

Unfortunately, the /aggregatedCostModel API does not support load balancer cost right now. First task will be to just update the --historical commands (which use /allocation) to have LB cost. This requires an update to the dependencies because the LB cost field in the Allocation struct is new.

This is: go get -u github.com/kubecost/cost-model@master go mod tidy

Unfortunately, this introduces another problem: the github.com/kubecost/cost/model/pkg/kubecost.Properties type was removed. Because of necessarily hacky work, the code for /aggregatedCostModel had to define the struct it receives from the API, including the Properties type: https://github.com/kubecost/kubectl-cost/blob/main/pkg/query/aggapi.go#L87. This code change must therefore also update this struct to use the new AllocationProperties (https://github.com/kubecost/cost-model/blob/b379abb469d84530c8f33686d1094a6979964d36/pkg/kubecost/allocationprops.go#L65) struct in that type instead.

michaelmdresser commented 3 years ago

With #92, load balancer cost is now included for --historical queries. LB cost should also be available for regular (rate) queries after #90 is completed.

After that, this issue will be revisited to consider external costs and any other possible contributors to total cost that are not currently displayed by kubectl cost.

michaelmdresser commented 3 years ago

As of #93, LB cost should be included for all results.

Adam-Stack-PM commented 1 year ago

This issue has been marked as stale because it has not had recent activity. It will be closed if no further action occurs.

michaelmdresser commented 1 year ago

I believe this issue is actually complete and I didn't close it out. Thanks for the heads up.