opencost / opencost-plugins

Plugins for extending OpenCost with new Custom Cost Sources
Apache License 2.0
19 stars 9 forks source link

K8s CRD Plugin #58

Open timsanwald opened 1 week ago

timsanwald commented 1 week ago

Describe the solution you'd like Provide a plugin to track generic costs via CRD in opencost. This could be useful for tracking multiple cost scenarios e.g. Operating Costs ($100 per month per namespace), non-supported external assets (e.g. databases from third party).

Describe alternatives you've considered Other options would be to provide plugins for each and every system, or dummy values in cloud cost specifications. None is really valueable.

Additional context

Simple example, values are not thought through, might be worth to look at some other specifications.

apiVersion: io.opencost/v1
kind: Cost
metadata:
  name: namespace-operations
  namespace: blueprint
spec:
  cost: 100
  currency: "$"
  recurring: "Monthly"
ameijer commented 1 week ago

interesting idea! I like it

dwbrown2 commented 1 week ago

Have heard lots of requests for this across the community! Would be really interesting to find a solution... is plugin def the right approach?

dwbrown2 commented 1 day ago

@timsanwald @jggoebel both of you guys recently made this really cool proposal! excited to explore different paths here..

https://github.com/opencost/opencost/issues/2991

jggoebel commented 1 day ago

Thank you @dwbrown2 for linking this! What a coincidence that two people came up with a similar idea.

I think that the approach i proposed by adding labels to existing CRDs might be even better, that way the cost is directly linked to the CRD producing the cost. Otherwise for every CRD that produces cost we would have to create a Cost resource. However for some ressources managed outside the cluster there might be no CRD (Like the mentioned external database). Maybe a combined approach would be sufficient to solve this, provide a cost crd that also accepts the labels, like any other CRD producing costs like the ones i mentioned in my Issue.