Skip to content

Commit

Permalink
FOPTS-3387 Added changes to create aggregation query param for the Al…
Browse files Browse the repository at this point in the history
…location API
  • Loading branch information
JesusParada committed Jun 4, 2024
1 parent fcd8a7a commit 9081115
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 53 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.15.0

- Added some modifications building aggregation query param to address Kubecost Allocation API changes made for versions 2.3 and higher.

## v1.14.0

- Improved OpenCost support. Added description of settings for integration with OpenCost in README.md
Expand Down
56 changes: 32 additions & 24 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ description: Kubecost exporter helm chart for Kubernetes
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.14.0
version: 1.15.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.14"
appVersion: "1.15"
6 changes: 3 additions & 3 deletions helm-chart/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cbi-oi-kubecost-exporter

![Version: 1.14.0](https://img.shields.io/badge/Version-1.14.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.14](https://img.shields.io/badge/AppVersion-1.14-informational?style=flat-square)
![Version: 1.15.0](https://img.shields.io/badge/Version-1.15.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.15](https://img.shields.io/badge/AppVersion-1.15-informational?style=flat-square)

### Kubecost exporter helm chart for Kubernetes

Expand Down Expand Up @@ -98,10 +98,10 @@ You should see 200/201s in the logs, which indicates that the exporter is workin
| flexera.shard | string | `"NAM"` | The zone of your Flexera One account. Valid values are NAM, EU or AU. |
| image.pullPolicy | string | `"Always"` | |
| image.repository | string | `"public.ecr.aws/flexera/cbi-oi-kubecost-exporter"` | |
| image.tag | string | `"1.14"` | |
| image.tag | string | `"1.15"` | |
| imagePullSecrets | list | `[]` | |
| includePreviousMonth | bool | `false` | Indicates whether to collect and export previous month. |
| kubecost.aggregation | string | `"pod"` | The level of granularity to use when aggregating the cost data. Valid values are namespace, controller, or pod. |
| kubecost.aggregation | string | `"pod"` | The level of granularity to use when aggregating the cost data. Valid values are namespace, controller, node, or pod. |
| kubecost.apiPath | string | `"/model/"` | The base path for the Kubecost API endpoint. |
| kubecost.host | string | `"kubecost-cost-analyzer.kubecost.svc.cluster.local:9090"` | Default kubecost-cost-analyzer service host on the current cluster. For current cluster is serviceName.namespaceName.svc.cluster.local |
| kubecost.idle | bool | `true` | Indicates whether to include cost of idle resources. |
Expand Down
Binary file added helm-chart/cbi-oi-kubecost-exporter-1.15.0.tgz
Binary file not shown.
4 changes: 2 additions & 2 deletions helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
image:
repository: public.ecr.aws/flexera/cbi-oi-kubecost-exporter
pullPolicy: Always
tag: "1.14"
tag: "1.15"

imagePullSecrets: []

Expand Down Expand Up @@ -49,7 +49,7 @@ kubecost:
host: "kubecost-cost-analyzer.kubecost.svc.cluster.local:9090"
# -- The base path for the Kubecost API endpoint.
apiPath: "/model/"
# -- The level of granularity to use when aggregating the cost data. Valid values are namespace, controller, or pod.
# -- The level of granularity to use when aggregating the cost data. Valid values are namespace, controller, node, or pod.
aggregation: "pod"
# -- Comma-separated list of namespaces to share costs with the remaining non-idle, unshared allocations.
shareNamespaces: "kube-system,cadvisor"
Expand Down
48 changes: 29 additions & 19 deletions index.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
apiVersion: v1
entries:
cbi-oi-kubecost-exporter:
- apiVersion: v2
appVersion: "1.15"
created: "2024-06-03T14:25:49.58983-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 1a717c15b88f6e6fb9d4fe083ca6517eb78258b160c064c13e7804e7f659e530
name: cbi-oi-kubecost-exporter
type: application
urls:
- helm-chart/cbi-oi-kubecost-exporter-1.15.0.tgz
version: 1.15.0
- apiVersion: v2
appVersion: "1.14"
created: "2024-03-12T10:20:16.137358-06:00"
created: "2024-06-03T14:25:49.589597-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 781f81b9f708f8b86cb215bd5bd5ddf7a5782195b4f0e4b85a0265b0cb35c862
name: cbi-oi-kubecost-exporter
Expand All @@ -13,7 +23,7 @@ entries:
version: 1.14.0
- apiVersion: v2
appVersion: "1.13"
created: "2024-03-12T10:20:16.137097-06:00"
created: "2024-06-03T14:25:49.589296-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: bd1994ff4b3b30c623efb05b784f3851f7cb4583479b7c670dd19316cd8a4c02
name: cbi-oi-kubecost-exporter
Expand All @@ -23,7 +33,7 @@ entries:
version: 1.13.0
- apiVersion: v2
appVersion: "1.12"
created: "2024-03-12T10:20:16.136644-06:00"
created: "2024-06-03T14:25:49.588948-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: d1bfa13ac76037b1cc9c2223826056f1da801e59d4d54348504469f4760c458e
name: cbi-oi-kubecost-exporter
Expand All @@ -33,7 +43,7 @@ entries:
version: 1.12.0
- apiVersion: v2
appVersion: "1.11"
created: "2024-03-12T10:20:16.136215-06:00"
created: "2024-06-03T14:25:49.588585-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: f12e36c016cb0b3bca7d75efd69414004c4a0f238e550f74fd13daf015305370
name: cbi-oi-kubecost-exporter
Expand All @@ -43,7 +53,7 @@ entries:
version: 1.11.1
- apiVersion: v2
appVersion: "1.11"
created: "2024-03-12T10:20:16.135787-06:00"
created: "2024-06-03T14:25:49.588199-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: a079003a1bcc3207e1c4f93653caca2234212e2bebafae7acde25a9a2d185bc5
name: cbi-oi-kubecost-exporter
Expand All @@ -53,7 +63,7 @@ entries:
version: 1.11.0
- apiVersion: v2
appVersion: "1.10"
created: "2024-03-12T10:20:16.13534-06:00"
created: "2024-06-03T14:25:49.587819-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: e7f8ac15bb87b78cc14aa3a63a2e37af9db427ad1a059621958430b8121156cd
name: cbi-oi-kubecost-exporter
Expand All @@ -63,7 +73,7 @@ entries:
version: 1.10.0
- apiVersion: v2
appVersion: 1.9.1
created: "2024-03-12T10:20:16.14318-06:00"
created: "2024-06-03T14:25:49.594359-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 773cc828783dd12211cccf149cda5b3c95e5d5bf7bf507d73559ef5f0f66f13a
name: cbi-oi-kubecost-exporter
Expand All @@ -73,7 +83,7 @@ entries:
version: 1.9.1
- apiVersion: v2
appVersion: "1.9"
created: "2024-03-12T10:20:16.142643-06:00"
created: "2024-06-03T14:25:49.594044-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 312f1c8f469adbed664530059526b69c023c017f71cc6c7b8bd9aed523ef22d6
name: cbi-oi-kubecost-exporter
Expand All @@ -83,7 +93,7 @@ entries:
version: 1.9.0
- apiVersion: v2
appVersion: "1.8"
created: "2024-03-12T10:20:16.142377-06:00"
created: "2024-06-03T14:25:49.593688-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 3fc398d0ae6d2c44c9196d262042394763fc7df49f05bd97764637a9becaad11
name: cbi-oi-kubecost-exporter
Expand All @@ -93,7 +103,7 @@ entries:
version: 1.8.0
- apiVersion: v2
appVersion: "1.7"
created: "2024-03-12T10:20:16.142129-06:00"
created: "2024-06-03T14:25:49.593292-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 90fbd649c651fa2ad66d0705aced6cbecd908206c59c135ee585ce12188cd287
name: cbi-oi-kubecost-exporter
Expand All @@ -103,7 +113,7 @@ entries:
version: 1.7.0
- apiVersion: v2
appVersion: "1.6"
created: "2024-03-12T10:20:16.141877-06:00"
created: "2024-06-03T14:25:49.592798-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: f998790d9229fce36398ef487edf6685a9a29e359dd2c78191c4d16344d47acd
name: cbi-oi-kubecost-exporter
Expand All @@ -113,7 +123,7 @@ entries:
version: 1.6.0
- apiVersion: v2
appVersion: "1.5"
created: "2024-03-12T10:20:16.141557-06:00"
created: "2024-06-03T14:25:49.592378-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: a0503a1af7b86a8f0769009de5a71a3613e8503a5f59cf86874d483f0f5f2abb
name: cbi-oi-kubecost-exporter
Expand All @@ -123,7 +133,7 @@ entries:
version: 1.5.0
- apiVersion: v2
appVersion: "1.4"
created: "2024-03-12T10:20:16.141103-06:00"
created: "2024-06-03T14:25:49.591942-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 5b296e921178d84717345be19b92a4eea0c9ca1c65410128dec596692220c8e2
name: cbi-oi-kubecost-exporter
Expand All @@ -133,7 +143,7 @@ entries:
version: 1.4.2
- apiVersion: v2
appVersion: "1.4"
created: "2024-03-12T10:20:16.140704-06:00"
created: "2024-06-03T14:25:49.591678-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: ab6992a0af9f24d5c090db71679b7f274f3576b1cfbe91325e0d6e9af317657e
name: cbi-oi-kubecost-exporter
Expand All @@ -143,7 +153,7 @@ entries:
version: 1.4.1
- apiVersion: v2
appVersion: "1.4"
created: "2024-03-12T10:20:16.140222-06:00"
created: "2024-06-03T14:25:49.591337-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 870030e989ba274f8b0f9d122a4ada24a4d29ef2c071408bf46d86e18942effd
name: cbi-oi-kubecost-exporter
Expand All @@ -153,7 +163,7 @@ entries:
version: 1.4.0
- apiVersion: v2
appVersion: "1.3"
created: "2024-03-12T10:20:16.1398-06:00"
created: "2024-06-03T14:25:49.591004-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: 0d967927bfab5f4bb6d40ce062710679e98b145c4b3f38709c0bf5d216ad8606
name: cbi-oi-kubecost-exporter
Expand All @@ -163,7 +173,7 @@ entries:
version: 1.3.0
- apiVersion: v2
appVersion: "1.2"
created: "2024-03-12T10:20:16.137729-06:00"
created: "2024-06-03T14:25:49.590189-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: d0c724c7bb085a1801e27f60ff748bc69aba14425cfd27fd132f99966692ed80
name: cbi-oi-kubecost-exporter
Expand All @@ -173,12 +183,12 @@ entries:
version: 1.2.0
- apiVersion: v2
appVersion: "1.1"
created: "2024-03-12T10:20:16.134759-06:00"
created: "2024-06-03T14:25:49.587279-06:00"
description: Kubecost exporter helm chart for Kubernetes
digest: c6f2681575b704b5934efea2357921896d55c4ad5e09692f31ab92b9e614cfea
name: cbi-oi-kubecost-exporter
type: application
urls:
- helm-chart/cbi-oi-kubecost-exporter-1.1.0.tgz
version: 1.1.0
generated: "2024-03-12T10:20:16.133587-06:00"
generated: "2024-06-03T14:25:49.586652-06:00"
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,12 @@ func newApp() *App {
switch a.Aggregation {
case "namespace":
a.aggregation = "cluster," + a.Aggregation
case "controller", "pod":
a.aggregation = "cluster,namespace," + a.Aggregation
case "controller":
a.aggregation = "cluster,namespace,controllerKind," + a.Aggregation
case "node":
a.aggregation = "cluster,namespace,controllerKind,controller," + a.Aggregation
case "pod":
a.aggregation = "cluster,namespace,controllerKind,controller,node," + a.Aggregation
default:
log.Fatal("Aggregation type is wrong")
}
Expand Down
2 changes: 1 addition & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func Test_newApp(t *testing.T) {
t.Error("aggregation is not initialized")
}

expectedAggregation := "cluster,namespace,controller"
expectedAggregation := "cluster,namespace,controllerKind,controller"
if a.aggregation != expectedAggregation {
t.Errorf("Aggregation is %s, expected %s", a.aggregation, expectedAggregation)
}
Expand Down

0 comments on commit 9081115

Please sign in to comment.