Skip to content

Commit

Permalink
Merge branch 'main' into sean/cloud-cost
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Holcomb <[email protected]>
  • Loading branch information
Sean-Holcomb authored Oct 30, 2023
2 parents bc339e0 + 2286bc5 commit 399b69f
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 10 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,32 @@ helm repo add opencost https://opencost.github.io/opencost-helm-chart

See the [Chart Documentation](https://github.com/opencost/opencost-helm-chart/blob/main/charts/opencost/README.md) for chart install instructions.

## Testing

[Testing](https://github.com/helm-unittest/helm-unittest) your chart (optional)

Presumes you've got Helm unittest installed: (i.e. `helm plugin install unittest`) and that your in the root directory of your cloned repo:

```console
helm unittest charts/opencost
```
Should produce a result like this:

```
### Chart [ opencost ] charts/opencost
PASS test deployment charts/opencost/tests/deployment_test.yaml
PASS test deployment snapshot charts/opencost/tests/opencost_test.yaml
Charts: 1 passed, 1 total
Test Suites: 2 passed, 2 total
Tests: 2 passed, 2 total
Snapshot: 1 passed, 1 total
Time: 31.011089ms
```

***

## OpenCost Links
* [OpenCost](https://github.com/opencost/opencost)
* [Documentation](https://www.opencost.io/docs/)
4 changes: 2 additions & 2 deletions charts/opencost/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 1.106.3
appVersion: 1.106.4
name: opencost
description: OpenCost and OpenCost UI
type: application
Expand All @@ -9,7 +9,7 @@ keywords:
- kubecost
- opencost
- monitoring
version: 1.22.0
version: 1.22.3
maintainers:
- name: mattray
url: https://mattray.dev
Expand Down
28 changes: 23 additions & 5 deletions charts/opencost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

OpenCost and OpenCost UI

![Version: 1.22.0](https://img.shields.io/badge/Version-1.22.0-informational?style=flat-square)
![Version: 1.22.3](https://img.shields.io/badge/Version-1.22.3-informational?style=flat-square)
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![AppVersion: 1.106.3](https://img.shields.io/badge/AppVersion-1.106.3-informational?style=flat-square)
![AppVersion: 1.106.4](https://img.shields.io/badge/AppVersion-1.106.4-informational?style=flat-square)

## Maintainers

Expand Down Expand Up @@ -32,16 +32,18 @@ $ helm install opencost opencost/opencost
| nameOverride | string | `""` | Overwrite the default name of the chart |
| opencost.affinity | object | `{}` | Affinity settings for pod assignment |
| opencost.customPricing.configPath | string | `"/tmp/custom-config"` | Path for the pricing configuration. |
| opencost.customPricing.configmapName | string | `"custom-pricing-model"` | |
| opencost.customPricing.costModel | object | `{"CPU":1.25,"GPU":0.95,"RAM":0.5,"description":"Modified prices based on your internal pricing","internetNetworkEgress":0.12,"regionNetworkEgress":0.01,"spotCPU":0.006655,"spotRAM":0.000892,"storage":0.25,"zoneNetworkEgress":0.01}` | More information about these values here: https://www.opencost.io/docs/configuration/on-prem#custom-pricing-using-the-opencost-helm-chart |
| opencost.customPricing.configmapName | string | `"custom-pricing-model"` | Customize the configmap name used for custom pricing |
| opencost.customPricing.costModel | object | `{"CPU":1.25,"GPU":0.95,"RAM":0.5,"description":"Modified pricing configuration.","internetNetworkEgress":0.12,"regionNetworkEgress":0.01,"spotCPU":0.006655,"spotRAM":0.000892,"storage":0.25,"zoneNetworkEgress":0.01}` | More information about these values here: https://www.opencost.io/docs/configuration/on-prem#custom-pricing-using-the-opencost-helm-chart |
| opencost.customPricing.createConfigmap | bool | `true` | Configures the pricing model provided in the values file. |
| opencost.customPricing.enabled | bool | `false` | Enables custom pricing for on-premise setup. |
| opencost.customPricing.enabled | bool | `false` | Enables custom pricing configuration |
| opencost.customPricing.provider | string | `"custom"` | Sets the provider type for the custom pricing file. |
| opencost.exporter.aws.access_key_id | string | `""` | AWS secret key id |
| opencost.exporter.aws.secret_access_key | string | `""` | AWS secret access key |
| opencost.exporter.cloudProviderApiKey | string | `""` | The GCP Pricing API requires a key. This is supplied just for evaluation. |
| opencost.exporter.csv_path | string | `""` | |
| opencost.exporter.defaultClusterId | string | `"default-cluster"` | Default cluster ID to use if cluster_id is not set in Prometheus metrics. |
| opencost.exporter.env | list | `[]` | List of additional environment variables to set in the container |
| opencost.exporter.extraArgs | list | `[]` | List of extra arguments for the command, e.g.: log-format=json |
| opencost.exporter.extraEnv | object | `{}` | Any extra environment variables you would like to pass on to the pod |
| opencost.exporter.extraVolumeMounts | list | `[]` | A list of volume mounts to be added to the pod |
| opencost.exporter.image.pullPolicy | string | `"IfNotPresent"` | Exporter container image pull policy |
Expand All @@ -65,8 +67,10 @@ $ helm install opencost opencost/opencost
| opencost.exporter.resources.limits | object | `{"cpu":"999m","memory":"1Gi"}` | CPU/Memory resource limits |
| opencost.exporter.resources.requests | object | `{"cpu":"10m","memory":"55Mi"}` | CPU/Memory resource requests |
| opencost.exporter.securityContext | object | `{}` | The security options the container should be run with |
| opencost.extraContainers | list | `[]` | extra sidecars to add to the pod. Useful for things like oauth-proxy for the UI |
| opencost.metrics.serviceMonitor.additionalLabels | object | `{}` | Additional labels to add to the ServiceMonitor |
| opencost.metrics.serviceMonitor.enabled | bool | `false` | Create ServiceMonitor resource for scraping metrics using PrometheusOperator |
| opencost.metrics.serviceMonitor.extraEndpoints | list | `[]` | extra Endpoints to add to the ServiceMonitor. Useful for scraping sidecars |
| opencost.metrics.serviceMonitor.honorLabels | bool | `true` | HonorLabels chooses the metric's labels on collisions with target labels |
| opencost.metrics.serviceMonitor.metricRelabelings | list | `[]` | MetricRelabelConfigs to apply to samples before ingestion |
| opencost.metrics.serviceMonitor.namespace | string | `""` | Specify if the ServiceMonitor will be deployed into a different namespace (blank deploys into same namespace as chart) |
Expand All @@ -76,6 +80,8 @@ $ helm install opencost opencost/opencost
| opencost.metrics.serviceMonitor.scrapeTimeout | string | `"10s"` | Timeout after which the scrape is ended |
| opencost.metrics.serviceMonitor.tlsConfig | object | `{}` | TLS configuration for scraping metrics |
| opencost.nodeSelector | object | `{}` | Node labels for pod assignment |
| opencost.prometheus.amp.enabled | bool | `false` | Use Amazon Managed Service for Prometheus (AMP) |
| opencost.prometheus.amp.workspaceId | string | `""` | Workspace ID for AMP |
| opencost.prometheus.bearer_token | string | `""` | Prometheus Bearer token |
| opencost.prometheus.bearer_token_key | string | `"DB_BEARER_TOKEN"` | |
| opencost.prometheus.external.enabled | bool | `false` | Use external Prometheus (eg. Grafana Cloud) |
Expand All @@ -98,6 +104,15 @@ $ helm install opencost opencost/opencost
| opencost.prometheus.thanos.queryOffset | string | `""` | |
| opencost.prometheus.username | string | `""` | Prometheus Basic auth username |
| opencost.prometheus.username_key | string | `"DB_BASIC_AUTH_USERNAME"` | Key in the secret that references the username |
| opencost.sigV4Proxy.extraEnv | string | `nil` | |
| opencost.sigV4Proxy.host | string | `"aps-workspaces.us-west-2.amazonaws.com"` | |
| opencost.sigV4Proxy.image | string | `"public.ecr.aws/aws-observability/aws-sigv4-proxy:latest"` | |
| opencost.sigV4Proxy.imagePullPolicy | string | `"IfNotPresent"` | |
| opencost.sigV4Proxy.name | string | `"aps"` | |
| opencost.sigV4Proxy.port | int | `8005` | |
| opencost.sigV4Proxy.region | string | `"us-west-2"` | |
| opencost.sigV4Proxy.resources | object | `{}` | |
| opencost.sigV4Proxy.securityContext | object | `{}` | |
| opencost.tolerations | list | `[]` | Toleration labels for pod assignment |
| opencost.topologySpreadConstraints | list | `[]` | Assign custom TopologySpreadConstraints rules |
| opencost.ui.enabled | bool | `true` | Enable OpenCost UI |
Expand All @@ -110,6 +125,7 @@ $ helm install opencost opencost/opencost
| opencost.ui.ingress.enabled | bool | `false` | Ingress for OpenCost UI |
| opencost.ui.ingress.hosts | list | See [values.yaml](values.yaml) | A list of host rules used to configure the Ingress |
| opencost.ui.ingress.ingressClassName | string | `""` | Ingress controller which implements the resource |
| opencost.ui.ingress.servicePort | string | `"http-ui"` | Redirect ingress to an extraPort defined on the service such as oauth-proxy |
| opencost.ui.ingress.tls | list | `[]` | Ingress TLS configuration |
| opencost.ui.livenessProbe.enabled | bool | `true` | Whether probe is enabled |
| opencost.ui.livenessProbe.failureThreshold | int | `3` | Number of failures for probe to be considered failed |
Expand All @@ -130,12 +146,14 @@ $ helm install opencost opencost/opencost
| secretAnnotations | object | `{}` | Annotations to add to the Secret |
| service.annotations | object | `{}` | Annotations to add to the service |
| service.enabled | bool | `true` | |
| service.extraPorts | list | `[]` | extra ports. Useful for sidecar pods such as oauth-proxy |
| service.labels | object | `{}` | Labels to add to the service account |
| service.type | string | `"ClusterIP"` | Kubernetes Service type |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.automountServiceAccountToken | bool | `true` | Whether pods running as this service account should have an API token automatically mounted |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | |
| updateStrategy | object | `{"rollingUpdate":{"maxSurge":1,"maxUnavailable":1},"type":"RollingUpdate"}` | Strategy to be used for the Deployment |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
2 changes: 1 addition & 1 deletion charts/opencost/templates/configmap-custom-pricing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ data:
{{- range $key, $val := .Values.opencost.customPricing.costModel }}
{{ $key | quote | indent 6}}: {{ $val | quote }},
{{- end}}
"provider" : "custom"
"provider" : {{ .Values.opencost.customPricing.provider | quote }}
}
{{- end }}
16 changes: 16 additions & 0 deletions charts/opencost/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
suite: test deployment
templates:
- templates/deployment.yaml
tests:
- it: should work
set:
image.tag: latest
asserts:
- isKind:
of: Deployment
- matchRegex:
path: metadata.name
pattern: -opencost$
- matchRegex:
path: spec.template.spec.containers[0].image
pattern: quay\.io\/kubecost1\/kubecost-cost-model:prod-[0-9]*\.[0-9]*\.[0-9]*
7 changes: 7 additions & 0 deletions charts/opencost/tests/opencost_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
suite: test deployment snapshot
templates:
- templates/deployment.yaml
tests:
- it: pod spec should match snapshot
asserts:
- matchSnapshot: {}
7 changes: 5 additions & 2 deletions charts/opencost/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,19 @@ opencost:
extraEnv: {}
# FOO: BAR
customPricing:
# -- Enables custom pricing for on-premise setup.
# -- Enables custom pricing configuration
enabled: false
# -- Customize the configmap name used for custom pricing
configmapName: custom-pricing-model
# -- Path for the pricing configuration.
configPath: /tmp/custom-config
# -- Configures the pricing model provided in the values file.
createConfigmap: true
# -- Sets the provider type for the custom pricing file.
provider: custom
# -- More information about these values here: https://www.opencost.io/docs/configuration/on-prem#custom-pricing-using-the-opencost-helm-chart
costModel:
description: Modified prices based on your internal pricing
description: Modified pricing configuration.
CPU: 1.25
spotCPU: 0.006655
RAM: 0.50
Expand Down

0 comments on commit 399b69f

Please sign in to comment.