Skip to content

Commit

Permalink
Merge branch 'main' into sth/oci-usage-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
chipzoller authored Sep 20, 2024
2 parents 8c3945a + 88ad775 commit e3ddd29
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 25 deletions.
Binary file modified .gitbook/assets/new-budget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apis/apis-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The External Costs API displays costs related to third party services, currently

#### [Budget API](governance-apis/budget-api.md)

The Budget API allows you to establish spending budget rules for your workload across clusters and namespaces to ensure you don't go over your allotted budget.
The Budget API allows you to establish spending budget rules for your workloads to ensure you don't go over your allotted budget.

#### [Forecast API](governance-apis/forecast-api.md)

Expand Down
30 changes: 19 additions & 11 deletions apis/governance-apis/budget-api.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Budget API

The Budget API allows you to create, update, and delete recurring budget rules to control your Kubernetes spending. Weekly and monthly budgets can be established on namespaces, clusters, and labels to set limits on cost spend, with the option to configure alerts for reaching specified budget thresholds via email, Slack, or Microsoft Teams.
The Budget API allows you to create, update, and delete recurring budget rules to control your Kubernetes spending. Weekly and monthly budgets can be established on workloads to set limits on cost spend, with the option to configure alerts for reaching specified budget thresholds via email, Slack, or Microsoft Teams.

{% swagger method="post" path="/model/budget" baseUrl="http://<your-kubecost-address>" summary="Budget API" %}
{% swagger-description %}
Expand All @@ -11,16 +11,20 @@ Creates a recurring budget rule or updates a recurring budget rule when provided
Name of the budget rule
{% endswagger-parameter %}

{% swagger-parameter in="body" name="values" type="string" required="true" %}
Used for specifying the group and name where the budget rule is applied to in the form of a key-value pair. Accepts `namespace`, `cluster`, or `label` for the first value, followed by the corresponding item. For example, when applying a budget rule to a namespace named `kubecost`, this parameter is configured as `values=namespace:kubecost`.
{% swagger-parameter in="body" name="type" type="string" required="true" %}
Budget type. Accepts `allocations`, `asset`, `cloud` or `collections`
{% endswagger-parameter %}

{% swagger-parameter in="body" name="values" type="map" required="true" %}
Used for specifying the workload category and name(s) for which the budget rule is applied, in the form of a key-value pair. The keys represent the workload category, while each value is a list containing one or more names.
{% endswagger-parameter %}

{% swagger-parameter in="body" name="interval" type="string" required="true" %}
The interval that the budget will reset with (either `weekly` or `monthly`).
{% endswagger-parameter %}

{% swagger-parameter in="body" name="intervalDay" type="int" %}
The day the budget will reset. When `interval=weekly`, `intervalDay` is the day of the week, with `intervalDay=0` for Sunday, `intervalDay=1` for Monday, etc. When `interval=monthly`, `intervalDay` corresponds with the day of the month.
The day the budget will reset. When `interval=weekly`, `intervalDay` is the day of the week, with `intervalDay=0` for Sunday, `intervalDay=1` for Monday, etc. When `interval=monthly`, `intervalDay` corresponds to the day of the month.
{% endswagger-parameter %}

{% swagger-parameter in="body" name="spendLimit" type="int" required="true" %}
Expand All @@ -41,10 +45,11 @@ Only should be used when updating a budget rule; ID of the budget rule being mod
"data": [
{
"name": "<budget name>",
"type": "<budget type>",
"id": "<budget id>",
"values": {
"<namespace or cluster>": [
"<name of namespace of cluster>"
"<category1>": [
"<name1>"
]
},
"kind": "",
Expand Down Expand Up @@ -84,16 +89,17 @@ Lists all existing recurring budget rules
"data": [
{
"name": "<budget name>",
"type": "<budget type>",
"id": "<budget id>",
"values": {
"<namespace or cluster>": [
"<name of namespace of cluster>"
"<category1>": [
"<name1>"
]
},
"kind": "",
"interval": "",
"intervalDay": ,
"spendLimit": ,
"intervalDay": "",
"spendLimit": "",
"actions": [
{
"percentage": 1,
Expand All @@ -107,7 +113,7 @@ Lists all existing recurring budget rules
"start": "",
"end": ""
},
"currentSpend":
"currentSpend": 0.0
}
}
```
Expand Down Expand Up @@ -189,6 +195,7 @@ curl --location '<your-kubecost-address>/model/budget' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "budget-rule",
"type": "allocations",
"values": {
"cluster":["test"]
},
Expand All @@ -214,6 +221,7 @@ curl --location '<your-kubecost-address>/model/budget' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "budget-rule-2",
"type": "allocations",
"values": {
"namespace":["kubecost"]
},
Expand Down
Binary file modified images/newcollection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 12 additions & 10 deletions using-kubecost/navigating-the-kubecost-ui/budgets.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Budgets

Budgets are a way of establishing spend limits for your clusters, namespaces, or labels. They can be created in moments using the Budgets dashboard.
Budgets are a way of establishing spend limits for your workloads. They can be created in moments using the Budgets dashboard.

## Creating a budget

Expand All @@ -10,21 +10,23 @@ Begin by selecting the _New Budget_ button in the top right corner of the dashbo

Provide the following fields:

* _Budget name_: The name of your budget
* _Budget cap_: The allotted amount of your budget per interval
* __Budget name__: The name of your budget
* __Budget type__: The type of workloads monitored under the budget; the supported options are Allocations, Assets, Cloud and Collection
* __Budget cap__: The allotted amount of your budget per interval

{% hint style="info" %}
The currency of your budget is unchangeable in the Budgets dashboard. To change currency type, go to _Settings >_ Currency. Then, select _Save_ at the bottom of the Settings page to apply changes. Changing currency type will affect cost displays across all of your Kubecost, not just the Budgets dashboard. Kubecost does **not** convert spending costs to other currency types; it will only change the symbol displayed next to cost. For best results, configure your currency to what matches your spend.
The currency of your budget cannot be changed directly in the Budgets dashboard. To change currency type, go to _Settings >_ Currency. Then, select _Save_ at the bottom of the Settings page to apply changes. Changing currency type will affect cost displays across all of your Kubecost, not just the Budgets dashboard. Kubecost does **not** convert spending costs to other currency types; it will only change the symbol displayed next to the cost. For best results, configure your currency to what matches your spend.
{% endhint %}

Determine the length of your budget and reset date using the two dropdowns under the Budget cap text box. Budgets can be either _Weekly_ or _Monthly_, and can reset on any day of the week/month. This means you don't need to recreate your budgets repeatedly and can align them with your schedules or processes.

### Workloads

From the first dropdown, select whether this budget will apply to a namespace, cluster, or a label. In the second dropdown, choose the individual item in that category. When _Namespace_ or _Cluster_ has been selected, the dropdown menu should attempt to autocomplete by searching for all potential items.
You can configure one or more workload(s) to be targeted by the budget. From the first dropdown, select the desired workload category. Once the workload category has been selected, the dropdown menu should display all possible values for that category. Select 'Add Filter' to persist your choice. You can repeat for as many workload categories as you need to.
There are multiple workload properties available for the Allocation, Asset and Cloud budgets. For Collection budgets, you can select one collection from the dropdown displaying all available collections. At the moment, Kubecost can only track spend for a single collection per budget.

{% hint style="info" %}
Labels need to be provided in a key:value format that describes the object where the budget applies to.
Labels need to be provided in a `key:value` format that describes the object that the budget applies to.
{% endhint %}

### **Actions**
Expand All @@ -45,17 +47,17 @@ Finalize your budget by selecting _Save_. Your budget has been created and shoul

## Budget options

Once your budget has been created, it will immediately display your current spending. There are multiple ways of inspecting or adjusting your existing budgets.
Once your budget has been created, it will immediately display your current spending. There are multiple ways of inspecting or adjusting your existing budgets:

### Details

Selecting _Details_ in the row of a specific budget will open a window displaying all details for your budget, including current spending, budget remaining, reset date, and any existing Actions.
Selecting _Details_ in the row of a specific budget will open a window displaying all details for your budget including current spend, remaining budget, reset date and any existing Actions.

You can also select _View detailed breakdown_ to display an [Allocations](/using-kubecost/navigating-the-kubecost-ui/cost-allocation/README.md) query for your budgeted item, or _Download Budget Report_ to download your budget as a PDF file.
You can select _View detailed breakdown_ to be redirected to the corresponding view on the Monitor page, or _Download Budget Report_ to download a PDF report of the budget.

### Editing a budget

Selecting _Edit_ in the row of a specific budget will open a window allowing you to edit all details about your budget, similar to when you initially created it. All details are able to be changed here.
Selecting _Edit_ in the row of a specific budget will open a window allowing you to edit all details about your budget, similar to when you initially created it.

### Deleting a budget

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ You can adjust your displayed metrics by aggregating your cost by category. Supp

| Aggregation | Description |
| :------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Account | The ID of the billing account your cloud provider bill comes from. (ex: AWS Management/Payer Account ID, GCP Billing Account ID, Azure Billing Account ID) |
| Invoice Entity | The ID of the billing account your cloud provider bill comes from. (ex: AWS Management/Payer Account ID, GCP Billing Account ID, Azure Billing Account ID) |
| Invoice Entity Name | Non-unique name associated with the above ID |
| Provider | Cloud service provider (ex: AWS, Azure, GCP) |
| Provider ID | ID of a cloud service provider account |
| Invoice Entity | Cloud provider account (ex: AWS Account, Azure Subscription, GCP Project) |
| Account | unique identifier for cloud provider account (ex: AWS Account, Azure Subscription, GCP Project) |
| Account Name | non-unique name for cloud provider account (ex: AWS Account, Azure Subscription, GCP Project) |
| Region | The region code for your cloud resource. |
| Availability Zone | The availability zone code for your cloud resource. |
| Service | Cloud provider services (ex: S3, microsoft.compute, BigQuery) |
| Item | Individual items from your cloud billing report(s) |
| Labels | Labels/tags on your cloud resources (ex: AWS tags, Azure tags, GCP labels) |
Expand Down
8 changes: 8 additions & 0 deletions using-kubecost/navigating-the-kubecost-ui/collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,11 @@ Selecting the three vertical dots in the top right of the collection tile will p
* *Export as CSV*
* *Export as PDF*

## Viewing idle costs

Costs in the Kubernetes domain have a corresponding idle component. For any Kubernetes costs part of a Collection, the idle cost can be optionally configured to be _included_ in the total cost displayed. The idle cost can be shared by cluster or by node. This can be configured on the Settings page under Idle in Collections. By default, idle costs are hidden.

If enabled, the 'Idle' column on the _Costs in Collection_ view will display the corresponding idle cost under each item.

To learn more about sharing idle costs, see [here](/using-kubecost/navigating-the-kubecost-ui/cost-allocation/efficiency-idle.md#sharing-idle).

Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ To use the generated key, you must send a `X-API-KEY` header with every request
### Example with cURL

```shell
curl -H "X-API-KEY:exampleAPIKey" "https:/kubecost.example.com/model/allocation?window=1d"
curl -H "X-API-KEY:exampleAPIKey" "https://kubecost.example.com/model/allocation?window=1d"
```

0 comments on commit e3ddd29

Please sign in to comment.