Skip to content

Commit 2851387

Browse files
authored
Merge pull request #322 from younsl/feat/add-httproute
feat(opencost): add Gateway API HTTPRoute support
2 parents 3b3a07c + 346408d commit 2851387

File tree

4 files changed

+266
-17
lines changed

4 files changed

+266
-17
lines changed

charts/opencost/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ keywords:
99
- finops
1010
- monitoring
1111
- opencost
12-
version: 2.5.3
12+
version: 2.5.4
1313
maintainers:
1414
- name: jessegoodier
1515
- name: toscott

charts/opencost/README.md

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
OpenCost and OpenCost UI
44

5-
![Version: 2.1.5](https://img.shields.io/badge/Version-2.1.5-informational?style=flat-square)
5+
![Version: 2.5.0](https://img.shields.io/badge/Version-2.5.0-informational?style=flat-square)
66
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
7-
![AppVersion: 1.115.0](https://img.shields.io/badge/AppVersion-1.115.0-informational?style=flat-square)
7+
![AppVersion: 1.118.0](https://img.shields.io/badge/AppVersion-1.118.0-informational?style=flat-square)
88
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/opencost)](https://artifacthub.io/packages/search?repo=opencost)
99
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/opencost-oci)](https://artifacthub.io/packages/search?repo=opencost-oci)
1010

@@ -57,7 +57,13 @@ $ helm install opencost opencost/opencost
5757
| opencost.customPricing.createConfigmap | bool | `true` | Configures the pricing model provided in the values file. |
5858
| opencost.customPricing.enabled | bool | `false` | Enables custom pricing configuration |
5959
| opencost.customPricing.provider | string | `"custom"` | Sets the provider type for the custom pricing file. |
60-
| opencost.dataRetention.dailyResolutionDays | int | `15` | |
60+
| opencost.exporter.apiHttpRoute | object | `{"annotations":{},"enabled":false,"hostnames":[],"labels":{},"parentRefs":[{"name":"","namespace":"","sectionName":""}],"rules":[{"backendRefs":[{"name":"","port":9003}],"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}]}` | HTTPRoute for OpenCost API (Gateway API) |
61+
| opencost.exporter.apiHttpRoute.annotations | object | `{}` | Annotations for HTTPRoute resource |
62+
| opencost.exporter.apiHttpRoute.enabled | bool | `false` | Enable HTTPRoute resource |
63+
| opencost.exporter.apiHttpRoute.hostnames | list | `[]` | Hostnames for the HTTPRoute |
64+
| opencost.exporter.apiHttpRoute.labels | object | `{}` | Labels for HTTPRoute resource |
65+
| opencost.exporter.apiHttpRoute.parentRefs | list | See [values.yaml](values.yaml) | Gateway API parent references |
66+
| opencost.exporter.apiHttpRoute.rules | list | See [values.yaml](values.yaml) | HTTPRoute rules |
6167
| opencost.exporter.apiIngress.annotations | object | `{}` | Annotations for Ingress resource |
6268
| opencost.exporter.apiIngress.enabled | bool | `false` | Ingress for OpenCost API |
6369
| opencost.exporter.apiIngress.hosts | list | See [values.yaml](values.yaml) | A list of host rules used to configure the Ingress |
@@ -70,21 +76,23 @@ $ helm install opencost opencost/opencost
7076
| opencost.exporter.cloudProviderApiKey | string | `""` | The GCP Pricing API requires a key. This is supplied just for evaluation. |
7177
| opencost.exporter.collectorDataSource.enabled | bool | `false` | |
7278
| opencost.exporter.collectorDataSource.networkPort | int | `3001` | The port at which network pods are open to egress |
73-
| opencost.exporter.collectorDataSource.retentionResolution10m | int | `36` | The number of 10m intervals the Collector DataSource should maintain |
74-
| opencost.exporter.collectorDataSource.retentionResolution1d | int | `15` | The number of 1d intervals the Collector DataSource should maintain |
75-
| opencost.exporter.collectorDataSource.retentionResolution1h | int | `49` | The number of 1h intervals the Collector DataSource should maintain |
79+
| opencost.exporter.collectorDataSource.retention10m | int | `36` | The number of 10m intervals the Collector DataSource should maintain |
80+
| opencost.exporter.collectorDataSource.retention1d | int | `15` | The number of 1d intervals the Collector DataSource should maintain |
81+
| opencost.exporter.collectorDataSource.retention1h | int | `49` | The number of 1h intervals the Collector DataSource should maintain |
7682
| opencost.exporter.collectorDataSource.scrapeInterval | string | `"30s"` | define the interval at which the collector scrapes for data points (10s, 15s, 1m) |
83+
| opencost.exporter.command | list | `[]` | Optional command to override the default container command |
7784
| opencost.exporter.csv_path | string | `""` | |
7885
| opencost.exporter.defaultClusterId | string | `"default-cluster"` | Default cluster ID to use if cluster_id is not set in Prometheus metrics. |
7986
| opencost.exporter.env | list | `[]` | List of additional environment variables to set in the container |
8087
| opencost.exporter.extraArgs | list | `[]` | List of extra arguments for the command, e.g.: log-format=json |
8188
| opencost.exporter.extraEnv | object | `{}` | Any extra environment variables you would like to pass on to the pod |
8289
| opencost.exporter.extraVolumeMounts | list | `[]` | A list of volume mounts to be added to the pod |
90+
| opencost.exporter.image | object | `{"fullImageName":null,"pullPolicy":"IfNotPresent","registry":"ghcr.io","repository":"opencost/opencost","tag":"1.118.0@sha256:c1a08767fe3c3b2964a75885c145bae0cba32225c0b4c1e0382a77566aef93e9"}` | This overrides the above defaultClusterId. Ensure the ConfigMap exists and contains the required CLUSTER_ID key. clusterIdConfigmap: cluster-id-configmap |
8391
| opencost.exporter.image.fullImageName | string | `nil` | Override the full image name for development purposes |
8492
| opencost.exporter.image.pullPolicy | string | `"IfNotPresent"` | Exporter container image pull policy |
8593
| opencost.exporter.image.registry | string | `"ghcr.io"` | Exporter container image registry |
8694
| opencost.exporter.image.repository | string | `"opencost/opencost"` | Exporter container image name |
87-
| opencost.exporter.image.tag | string | `"1.115.0@sha256:fb6468a1ef45dbd4a9e521122c8d306f882bb33d1657d28d21aeaef79412e9e1"` | Exporter container image tag |
95+
| opencost.exporter.image.tag | string | `"1.118.0@sha256:c1a08767fe3c3b2964a75885c145bae0cba32225c0b4c1e0382a77566aef93e9"` | Exporter container image tag |
8896
| opencost.exporter.livenessProbe.enabled | bool | `true` | Whether probe is enabled |
8997
| opencost.exporter.livenessProbe.failureThreshold | int | `3` | Number of failures for probe to be considered failed |
9098
| opencost.exporter.livenessProbe.initialDelaySeconds | int | `10` | Number of seconds before probe is initiated |
@@ -96,6 +104,7 @@ $ helm install opencost opencost/opencost
96104
| opencost.exporter.persistence.mountPath | string | `"/mnt/export"` | The path that the PV will be mounted to the exporter at |
97105
| opencost.exporter.persistence.size | string | `""` | Size for persistent volume |
98106
| opencost.exporter.persistence.storageClass | string | `""` | Storage class for persistent volume |
107+
| opencost.exporter.prometheusDataSource.queryResolutionSeconds | int | `300` | |
99108
| opencost.exporter.readinessProbe.enabled | bool | `true` | Whether probe is enabled |
100109
| opencost.exporter.readinessProbe.failureThreshold | int | `3` | Number of failures for probe to be considered failed |
101110
| opencost.exporter.readinessProbe.initialDelaySeconds | int | `10` | Number of seconds before probe is initiated |
@@ -111,6 +120,21 @@ $ helm install opencost opencost/opencost
111120
| opencost.exporter.startupProbe.path | string | `"/healthz"` | Probe path |
112121
| opencost.exporter.startupProbe.periodSeconds | int | `5` | Probe frequency in seconds |
113122
| opencost.extraContainers | list | `[]` | extra sidecars to add to the pod. Useful for things like oauth-proxy for the UI |
123+
| opencost.mcp | object | `{"enabled":true,"httpRoute":{"annotations":{},"enabled":false,"hostnames":[],"labels":{},"parentRefs":[{"name":"","namespace":"","sectionName":""}],"rules":[{"backendRefs":[{"name":"","port":8081}],"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}]},"ingress":{"annotations":{},"enabled":false,"hosts":[{"host":"example.local","paths":[{"path":"/","pathType":"Prefix"}]}],"ingressClassName":"","tls":[]},"port":8081}` | MCP (Model Context Protocol) Server Configuration The MCP server provides AI agents with access to cost allocation and asset data |
124+
| opencost.mcp.enabled | bool | `true` | Enable MCP server for AI agent integration (default: true) Set to false to disable MCP server completely |
125+
| opencost.mcp.httpRoute | object | `{"annotations":{},"enabled":false,"hostnames":[],"labels":{},"parentRefs":[{"name":"","namespace":"","sectionName":""}],"rules":[{"backendRefs":[{"name":"","port":8081}],"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}]}` | HTTPRoute for MCP server (Gateway API) |
126+
| opencost.mcp.httpRoute.annotations | object | `{}` | Annotations for HTTPRoute resource |
127+
| opencost.mcp.httpRoute.enabled | bool | `false` | Enable HTTPRoute resource |
128+
| opencost.mcp.httpRoute.hostnames | list | `[]` | Hostnames for the HTTPRoute |
129+
| opencost.mcp.httpRoute.labels | object | `{}` | Labels for HTTPRoute resource |
130+
| opencost.mcp.httpRoute.parentRefs | list | See [values.yaml](values.yaml) | Gateway API parent references |
131+
| opencost.mcp.httpRoute.rules | list | See [values.yaml](values.yaml) | HTTPRoute rules |
132+
| opencost.mcp.ingress.annotations | object | `{}` | Annotations for Ingress resource |
133+
| opencost.mcp.ingress.enabled | bool | `false` | Ingress for MCP server |
134+
| opencost.mcp.ingress.hosts | list | See [values.yaml](values.yaml) | A list of host rules used to configure the Ingress |
135+
| opencost.mcp.ingress.ingressClassName | string | `""` | Ingress controller which implements the resource |
136+
| opencost.mcp.ingress.tls | list | `[]` | Ingress TLS configuration |
137+
| opencost.mcp.port | int | `8081` | HTTP port for MCP server (default: 8081) Change this if port 8081 conflicts with other services |
114138
| opencost.metrics.config.configmapName | string | `"custom-metrics"` | Customize the configmap name used for metrics |
115139
| opencost.metrics.config.disabledMetrics | list | `[]` | List of metrics to be disabled |
116140
| opencost.metrics.config.enabled | bool | `false` | Enables creating the metrics.json configuration as a ConfigMap |
@@ -147,10 +171,10 @@ $ helm install opencost opencost/opencost
147171
| opencost.prometheus.insecureSkipVerify | bool | `false` | Whether to disable SSL certificate verification |
148172
| opencost.prometheus.internal.enabled | bool | `true` | Use in-cluster Prometheus |
149173
| opencost.prometheus.internal.namespaceName | string | `"prometheus-system"` | Namespace of in-cluster Prometheus |
174+
| opencost.prometheus.internal.path | string | `""` | Path to access the Prometheus API, this is neccesary if the Prometheus server is behind a reverse proxy(mimir) or has a different path. |
150175
| opencost.prometheus.internal.port | int | `80` | Service port of in-cluster Prometheus |
151176
| opencost.prometheus.internal.scheme | string | `"http"` | Scheme to use for in-cluster Prometheus |
152177
| opencost.prometheus.internal.serviceName | string | `"prometheus-server"` | Service name of in-cluster Prometheus |
153-
| opencost.prometheus.internal.path | string | `""` | Set path to prometheus if behind reverse proxy(mimir) |
154178
| opencost.prometheus.kubeRBACProxy | bool | `false` | If true, opencost will use kube-rbac-proxy to authenticate with in cluster Prometheus for openshift |
155179
| opencost.prometheus.password | string | `""` | Prometheus Basic auth password |
156180
| opencost.prometheus.password_key | string | `"DB_BASIC_AUTH_PW"` | Key in the secret that references the password |
@@ -167,6 +191,8 @@ $ helm install opencost opencost/opencost
167191
| opencost.prometheus.thanos.queryOffset | string | `""` | |
168192
| opencost.prometheus.username | string | `""` | Prometheus Basic auth username |
169193
| opencost.prometheus.username_key | string | `"DB_BASIC_AUTH_USERNAME"` | Key in the secret that references the username |
194+
| opencost.retention1d | int | `15` | |
195+
| opencost.retention1h | int | `49` | |
170196
| opencost.sigV4Proxy.extraEnv | string | `nil` | |
171197
| opencost.sigV4Proxy.host | string | `"aps-workspaces.us-west-2.amazonaws.com"` | |
172198
| opencost.sigV4Proxy.image | string | `"public.ecr.aws/aws-observability/aws-sigv4-proxy:latest"` | |
@@ -181,6 +207,13 @@ $ helm install opencost opencost/opencost
181207
| opencost.ui.enabled | bool | `true` | Enable OpenCost UI |
182208
| opencost.ui.extraEnv | list | `[]` | A list of environment variables to be added to the pod |
183209
| opencost.ui.extraVolumeMounts | list | `[]` | A list of volume mounts to be added to the pod |
210+
| opencost.ui.httpRoute | object | `{"annotations":{},"enabled":false,"hostnames":[],"labels":{},"parentRefs":[{"name":"","namespace":"","sectionName":""}],"rules":[{"backendRefs":[{"name":"","port":9090}],"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}]}` | HTTPRoute for OpenCost UI (Gateway API) |
211+
| opencost.ui.httpRoute.annotations | object | `{}` | Annotations for HTTPRoute resource |
212+
| opencost.ui.httpRoute.enabled | bool | `false` | Enable HTTPRoute resource |
213+
| opencost.ui.httpRoute.hostnames | list | `[]` | Hostnames for the HTTPRoute |
214+
| opencost.ui.httpRoute.labels | object | `{}` | Labels for HTTPRoute resource |
215+
| opencost.ui.httpRoute.parentRefs | list | See [values.yaml](values.yaml) | Gateway API parent references |
216+
| opencost.ui.httpRoute.rules | list | See [values.yaml](values.yaml) | HTTPRoute rules |
184217
| opencost.ui.image.fullImageName | string | `nil` | Override the full image name for development purposes |
185218
| opencost.ui.image.pullPolicy | string | `"IfNotPresent"` | UI container image pull policy |
186219
| opencost.ui.image.registry | string | `"ghcr.io"` | UI container image registry |
@@ -211,18 +244,22 @@ $ helm install opencost opencost/opencost
211244
| opencost.ui.route.targetPort | string | `"http-ui"` | Redirect ingress to an extraPort defined on the service such as oauth-proxy |
212245
| opencost.ui.route.tls | list | `[]` | Ingress TLS configuration |
213246
| opencost.ui.securityContext | object | `{}` | The security options the container should be run with |
247+
| opencost.ui.uiPath | string | `"/"` | |
214248
| opencost.ui.uiPort | int | `9090` | |
215-
| opencost.ui.uiPath | string | `/` | Base path for serving the UI. Requires building a custom image using the build argument "ui_path". |
216249
| opencost.ui.useDefaultFqdn | bool | `false` | |
217250
| opencost.ui.useIPv6 | bool | `true` | |
218-
| opencost.updateCaTrust.enabled | bool | `false` | Enable update of CA trust(Mount custom CA certificates to the opencost container) |
219-
| opencost.updateCaTrust.securityContext | object | `{}` | Security context for the init container that mounts the custom CA certificates |
220-
| opencost.updateCaTrust.caCertsSecret | string | `"ca-certs-secret"` | Name of the Secret containing custom CA certificates to mount to the opencost container |
221-
| opencost.updateCaTrust.caCertsConfig | string | `"ca-certs-config"` | Name of the ConfigMap containing CA certificates to mount to the opencost container |
222-
| opencost.updateCaTrust.resources | object | `{}` | Resources for the init container |
251+
| opencost.updateCaTrust.caCertsSecret | string | `"ca-certs-secret"` | |
252+
| opencost.updateCaTrust.enabled | bool | `false` | |
253+
| opencost.updateCaTrust.resources | object | `{}` | |
254+
| opencost.updateCaTrust.securityContext.allowPrivilegeEscalation | bool | `false` | |
255+
| opencost.updateCaTrust.securityContext.readOnlyRootFilesystem | bool | `true` | |
256+
| opencost.updateCaTrust.securityContext.runAsGroup | int | `0` | |
257+
| opencost.updateCaTrust.securityContext.runAsNonRoot | bool | `false` | |
258+
| opencost.updateCaTrust.securityContext.runAsUser | int | `0` | |
259+
| opencost.updateCaTrust.securityContext.seccompProfile.type | string | `"RuntimeDefault"` | |
223260
| pdb.enabled | bool | `false` | |
224-
| pdb.minAvailable | int | `nil` | Minimum number of pods that must be available after the eviction |
225-
| pdb.maxUnavailable | int | `nil` | Maximum number of pods that can be unavailable after the eviction |
261+
| pdb.maxUnavailable | string | `nil` | Maximum number of pods that can be unavailable after the eviction |
262+
| pdb.minAvailable | string | `nil` | Minimum number of pods that must be available after the eviction |
226263
| plugins.configs | string | `nil` | |
227264
| plugins.enabled | bool | `false` | |
228265
| plugins.folder | string | `"/opt/opencost/plugin"` | |
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
{{- if and .Values.opencost.ui.enabled .Values.opencost.ui.httpRoute.enabled }}
2+
apiVersion: gateway.networking.k8s.io/v1
3+
kind: HTTPRoute
4+
metadata:
5+
name: {{ include "opencost.fullname" . }}-ui
6+
namespace: {{ include "opencost.namespace" . }}
7+
labels: {{- include "opencost.labels" . | nindent 4 }}
8+
{{- with .Values.opencost.ui.httpRoute.labels }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
{{- with .Values.opencost.ui.httpRoute.annotations }}
12+
annotations: {{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
parentRefs:
16+
{{- range .Values.opencost.ui.httpRoute.parentRefs }}
17+
- name: {{ .name }}
18+
{{- if .namespace }}
19+
namespace: {{ .namespace }}
20+
{{- end }}
21+
{{- if .sectionName }}
22+
sectionName: {{ .sectionName }}
23+
{{- end }}
24+
{{- end }}
25+
{{- with .Values.opencost.ui.httpRoute.hostnames }}
26+
hostnames:
27+
{{- toYaml . | nindent 4 }}
28+
{{- end }}
29+
rules:
30+
{{- range .Values.opencost.ui.httpRoute.rules }}
31+
- matches:
32+
{{- range .matches }}
33+
- path:
34+
type: {{ .path.type }}
35+
value: {{ .path.value }}
36+
{{- end }}
37+
backendRefs:
38+
{{- range .backendRefs }}
39+
- name: {{ default (include "opencost.fullname" $) .name }}
40+
port: {{ default $.Values.opencost.ui.uiPort .port }}
41+
{{- end }}
42+
{{- end }}
43+
{{- end }}
44+
---
45+
{{- if .Values.opencost.exporter.apiHttpRoute.enabled }}
46+
apiVersion: gateway.networking.k8s.io/v1
47+
kind: HTTPRoute
48+
metadata:
49+
name: {{ include "opencost.fullname" . }}-api
50+
namespace: {{ include "opencost.namespace" . }}
51+
labels: {{- include "opencost.labels" . | nindent 4 }}
52+
{{- with .Values.opencost.exporter.apiHttpRoute.labels }}
53+
{{- toYaml . | nindent 4 }}
54+
{{- end }}
55+
{{- with .Values.opencost.exporter.apiHttpRoute.annotations }}
56+
annotations: {{- toYaml . | nindent 4 }}
57+
{{- end }}
58+
spec:
59+
parentRefs:
60+
{{- range .Values.opencost.exporter.apiHttpRoute.parentRefs }}
61+
- name: {{ .name }}
62+
{{- if .namespace }}
63+
namespace: {{ .namespace }}
64+
{{- end }}
65+
{{- if .sectionName }}
66+
sectionName: {{ .sectionName }}
67+
{{- end }}
68+
{{- end }}
69+
{{- with .Values.opencost.exporter.apiHttpRoute.hostnames }}
70+
hostnames:
71+
{{- toYaml . | nindent 4 }}
72+
{{- end }}
73+
rules:
74+
{{- range .Values.opencost.exporter.apiHttpRoute.rules }}
75+
- matches:
76+
{{- range .matches }}
77+
- path:
78+
type: {{ .path.type }}
79+
value: {{ .path.value }}
80+
{{- end }}
81+
backendRefs:
82+
{{- range .backendRefs }}
83+
- name: {{ default (include "opencost.fullname" $) .name }}
84+
port: {{ default $.Values.opencost.exporter.apiPort .port }}
85+
{{- end }}
86+
{{- end }}
87+
{{- end }}
88+
---
89+
{{- if and .Values.opencost.mcp.enabled .Values.opencost.mcp.httpRoute.enabled }}
90+
apiVersion: gateway.networking.k8s.io/v1
91+
kind: HTTPRoute
92+
metadata:
93+
name: {{ include "opencost.fullname" . }}-mcp
94+
namespace: {{ include "opencost.namespace" . }}
95+
labels: {{- include "opencost.labels" . | nindent 4 }}
96+
{{- with .Values.opencost.mcp.httpRoute.labels }}
97+
{{- toYaml . | nindent 4 }}
98+
{{- end }}
99+
{{- with .Values.opencost.mcp.httpRoute.annotations }}
100+
annotations: {{- toYaml . | nindent 4 }}
101+
{{- end }}
102+
spec:
103+
parentRefs:
104+
{{- range .Values.opencost.mcp.httpRoute.parentRefs }}
105+
- name: {{ .name }}
106+
{{- if .namespace }}
107+
namespace: {{ .namespace }}
108+
{{- end }}
109+
{{- if .sectionName }}
110+
sectionName: {{ .sectionName }}
111+
{{- end }}
112+
{{- end }}
113+
{{- with .Values.opencost.mcp.httpRoute.hostnames }}
114+
hostnames:
115+
{{- toYaml . | nindent 4 }}
116+
{{- end }}
117+
rules:
118+
{{- range .Values.opencost.mcp.httpRoute.rules }}
119+
- matches:
120+
{{- range .matches }}
121+
- path:
122+
type: {{ .path.type }}
123+
value: {{ .path.value }}
124+
{{- end }}
125+
backendRefs:
126+
{{- range .backendRefs }}
127+
- name: {{ default (include "opencost.fullname" $) .name }}
128+
port: {{ default $.Values.opencost.mcp.port .port }}
129+
{{- end }}
130+
{{- end }}
131+
{{- end }}

0 commit comments

Comments
 (0)