From bf2d834594b0b8d54fb555155b324864c83f23d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 17:03:27 +1000 Subject: [PATCH 1/4] Bump postcss from 8.4.38 to 8.4.39 (#263) Bumps [postcss](https://github.com/postcss/postcss) from 8.4.38 to 8.4.39. - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/postcss/postcss/compare/8.4.38...8.4.39) --- updated-dependencies: - dependency-name: postcss dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 38 ++++++++++++++++++++++++++++++++------ package.json | 2 +- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 368fe27..b5464d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "clsx": "^2.0.0", "core-js": "^3.27.2", "mobx": "^6.12.4", - "postcss": "^8.4.14", + "postcss": "^8.4.39", "prism-react-renderer": "^2.3.0", "react": "^18.0.0", "react-dom": "^18.0.0", @@ -13496,9 +13496,9 @@ } }, "node_modules/postcss": { - "version": "8.4.38", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", - "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", + "version": "8.4.39", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.39.tgz", + "integrity": "sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==", "funding": [ { "type": "opencollective", @@ -13513,10 +13513,9 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.0.0", + "picocolors": "^1.0.1", "source-map-js": "^1.2.0" }, "engines": { @@ -16279,6 +16278,33 @@ "react-dom": ">= 16.8.0" } }, + "node_modules/styled-components/node_modules/postcss": { + "version": "8.4.38", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", + "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.0", + "source-map-js": "^1.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/styled-components/node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", diff --git a/package.json b/package.json index 08589d1..629cdfb 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "autoprefixer": "^10.4.7", "core-js": "^3.27.2", "mobx": "^6.12.4", - "postcss": "^8.4.14", + "postcss": "^8.4.39", "react-github-btn": "^1.3.0", "react-icons": "^5.2.1", "styled-components": "^6.1.11", From 0eaa48191439d6a64959e9615283c8efa67fd138 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 17:06:21 +1000 Subject: [PATCH 2/4] Bump mobx from 6.12.4 to 6.13.0 (#266) Bumps [mobx](https://github.com/mobxjs/mobx) from 6.12.4 to 6.13.0. - [Release notes](https://github.com/mobxjs/mobx/releases) - [Commits](https://github.com/mobxjs/mobx/compare/mobx@6.12.4...mobx@6.13.0) --- updated-dependencies: - dependency-name: mobx dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 9 ++++----- package.json | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index b5464d8..ee34ae8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "autoprefixer": "^10.4.7", "clsx": "^2.0.0", "core-js": "^3.27.2", - "mobx": "^6.12.4", + "mobx": "^6.13.0", "postcss": "^8.4.39", "prism-react-renderer": "^2.3.0", "react": "^18.0.0", @@ -12569,10 +12569,9 @@ } }, "node_modules/mobx": { - "version": "6.12.4", - "resolved": "https://registry.npmjs.org/mobx/-/mobx-6.12.4.tgz", - "integrity": "sha512-uIymg89x+HmItX1p3MG+d09irn2k63J6biftZ5Ok+UpNojS1I3NJPLfcmJT9ANnUltNlHi+HQqrVyxiAN8ISYg==", - "license": "MIT", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/mobx/-/mobx-6.13.0.tgz", + "integrity": "sha512-1laWODrBWmB7mDJ8EClCjUQTyLwJ0ydJgE4FtK7t9r3JnjXgc9OhmYs2P4RtHrY1co5+4T6cKP2UswX2SU29mA==", "funding": { "type": "opencollective", "url": "https://opencollective.com/mobx" diff --git a/package.json b/package.json index 629cdfb..7578539 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@mdx-js/react": "^3.0.0", "autoprefixer": "^10.4.7", "core-js": "^3.27.2", - "mobx": "^6.12.4", + "mobx": "^6.13.0", "postcss": "^8.4.39", "react-github-btn": "^1.3.0", "react-icons": "^5.2.1", From e3123903b499d7b7e762f656d13c5df2fd3d684f Mon Sep 17 00:00:00 2001 From: Matt Ray Date: Fri, 5 Jul 2024 07:46:58 -0700 Subject: [PATCH 3/4] Minor typos (#267) Signed-off-by: Matt Ray --- docs/specification.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/specification.md b/docs/specification.md index fca4301..9b50e33 100644 --- a/docs/specification.md +++ b/docs/specification.md @@ -13,7 +13,7 @@ The OpenCost Spec is a vendor-neutral specification for measuring and allocating ## Introduction -Kubernetes enables complex deployments of containerized workloads, which are often transient and consume variable amounts of cluster resources. While this enables teams to construct powerful solutions to a broad range of technical problems, it also creates complexities when measuring the resource utilization and costs of workloads and their associated infrastructure within the dynamics of shared Kubernetes environments. +Kubernetes enables complex deployments of containerized workloads, which are often transient and consume variable amounts of cluster resources. While this enables teams to construct powerful solutions to a broad range of technical problems, it also creates complexities when measuring the resource utilization and costs of workloads and their associated infrastructure within the dynamics of shared Kubernetes environments. As Kubernetes adoption increases within an organization, these complexities become a business-critical challenge to solve. In this document, we specify a vendor-agnostic methodology for accurately measuring and allocating the costs of a Kubernetes cluster to its hosted tenants. This community resource is maintained by Kubernetes practitioners and we welcome all contributions. @@ -35,7 +35,7 @@ As Kubernetes adoption increases within an organization, these complexities beco -Cluster Asset Costs can be further segmented into **Resource Allocation Costs** and **Resource Usage Costs**. Resource Allocation Costs are expenses that accumulate based on the amount of time provisioned irrespective of usage (e.g. CPU hourly rate) whereas Resource Usage Costs accumulate on a per-unit basis (e.g. cost per byte egressed). Costs for an individual Asset are the summation of it’s Resource Allocation and Usage Costs, e.g. a Node’s cost is equal to CPU cost + GPU cost + RAM cost + Node Network Costs +Cluster Asset Costs can be further segmented into **Resource Allocation Costs** and **Resource Usage Costs**. Resource Allocation Costs are expenses that accumulate based on the amount of time provisioned irrespective of usage (e.g. CPU hourly rate) whereas Resource Usage Costs accumulate on a per-unit basis (e.g. cost per byte egressed). Costs for an individual Asset are the summation of its Resource Allocation and Usage Costs, e.g. a Node’s cost is equal to CPU cost + GPU cost + RAM cost + Node Network Costs From 7f5fea6ee0653cb2cf3dba860e108c8e84cd0b30 Mon Sep 17 00:00:00 2001 From: Patrick von Steht <59927356+patrick-vonsteht@users.noreply.github.com> Date: Thu, 25 Jul 2024 08:24:59 +0200 Subject: [PATCH 4/4] Document shareIdle and idleByNode allocation API parameters (#268) * Add API documentation for shareIdle and idleByNode parameter Signed-off-by: Patrick von Steht * Add API example for shareIdle and idleByNode parameter Signed-off-by: Patrick von Steht --------- Signed-off-by: Patrick von Steht Co-authored-by: Patrick von Steht --- docs/integrations/api-examples.md | 22 ++++++++++++++++- docs/integrations/api.md | 40 +++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/docs/integrations/api-examples.md b/docs/integrations/api-examples.md index 6cfbcca..35c701e 100644 --- a/docs/integrations/api-examples.md +++ b/docs/integrations/api-examples.md @@ -54,7 +54,7 @@ curl -G http://localhost:9003/allocation \ curl -G http://localhost:9003/allocation/compute \ -d window=9d \ -d step=3d \ - -d resolution=10m + -d resolution=10m \ -d aggregate=namespace ``` @@ -81,6 +81,26 @@ curl -G http://localhost:9003/allocation/compute \ } ``` + +### Allocation data with distributed idle costs + +Here's an example of an OpenCost API query that distributes cluster idle costs across all allocations in the cluster: + +```sh +curl -G http://localhost:9003/allocation \ + -d window=1d \ + -d shareIdle=true +``` + +Here's the same query, but distributing the idle costs of each *node* across all allocations on that node: + +```sh +curl -G http://localhost:9003/allocation \ + -d window=1d \ + -d shareIdle=true \ + -d idleByNode=true +``` + ## `/cloudCost` Examples The OpenCost `/cloudCost` API has query parameters for `window`, `aggregate`, and `filter`. Below are several examples of queries using this API. Please refer to the [OpenCost API](api#cloudcost) for the full API specifics. diff --git a/docs/integrations/api.md b/docs/integrations/api.md index 6a5893f..ceb1d74 100644 --- a/docs/integrations/api.md +++ b/docs/integrations/api.md @@ -13,7 +13,7 @@ Examples using the API endpoints are provided in the [API Examples](api-examples ## Allocation API -The standard OpenCost API query for costs and resources allocated to Kubernetes workloads based on on-demand list pricing. You may specify the `window` date range, the Kubernetes primitive(s) to `aggregate` on, the `step` for the duration of returned sets, the `resolution` for the duration to use for Prometheus queries, and `includeIdle` for whether to include the `__idle__` usage for the cluster. +The standard OpenCost API query for costs and resources allocated to Kubernetes workloads based on on-demand list pricing. You may specify the `window` date range, the Kubernetes primitive(s) to `aggregate` on, the `step` for the duration of returned sets, the `resolution` for the duration to use for Prometheus queries, `includeIdle` for whether to include the `__idle__` usage for the cluster, `shareIdle` for whether to distribute idle costs across non-idle allocations, and `idleByNode` for whether to calculate idle costs per node instead of per cluster. ### `/allocation` QUERY PARAMETERS @@ -102,7 +102,7 @@ QUERY PARAMETERS + + + + + + + + + + + + + +
- Whether to return the calculated __idle__ field for the query. Default is false. + Whether to return the calculated \_\_idle\_\_ field for the query. Default is false.

Examples:
    @@ -110,6 +110,42 @@ QUERY PARAMETERS
shareIdleboolean
+ + Whether to distribute idle costs across non-idle allocations. Default is false. + + When disabled, idle costs are allocated to a separate \_\_idle\_\_ allocation. + When enabled, idle costs are distributed across non-idle allocations. This happens proportionally to the non-idle costs of each allocation. For example, if one allocation has twice as much non-idle costs as another, it also receives twice the amount of idle costs. This calculation happens separately for each resource (like CPU or RAM). + + You can choose to distribute idle costs per cluster or per node using the idleByNode parameter. + +

+ Examples:
+
    +
  • shareIdle=true
  • +
+
idleByNodeboolean
+ + Whether to calculate idle costs per node instead of per cluster. Default is false. +

+ Examples:
+
    +
  • idleByNode=true
  • +
+
## Cloud Costs API