Skip to content

Commit 0566645

Browse files
authored
Merge branch 'grafana:main' into SRE-SYM
2 parents 23ebc43 + 2d1fdea commit 0566645

27 files changed

+475
-6
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
/charts/tempo-vulture/ @grafana/tempo @Whyeasy @dgzlopes
1919
/charts/synthetic-monitoring-agent/ @torstenwalter @zanhsieh
2020
/charts/agent-operator/ @grafana/grafana-agent-maintainers
21+
/charts/cloudcost-exporter/ @grafana/platform-monitoring

.github/workflows/lint-test.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,8 @@ jobs:
9898
elif [[ "$changed" == "charts/snyk-exporter" ]]; then
9999
# Do not run `ct install` for snyk-exporter as it requires Snyk API token
100100
exit 0
101+
elif [[ "$changed" == "charts/cloudcost-exporter" ]]; then
102+
# Do not run `ct install` for cloudcost-exporter as it requires IRSA
103+
exit 0
101104
fi
102105
ct install --config "${CT_CONFIGFILE}"

charts/cloudcost-exporter/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/cloudcost-exporter/Chart.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v2
2+
name: cloudcost-exporter
3+
description: Cloud Cost Exporter exports cloud provider agnostic cost metrics to Prometheus.
4+
type: application
5+
6+
# This is the chart version. This version number should be incremented each time you make changes
7+
# to the chart and its templates, including the app version.
8+
version: 1.0.0
9+
10+
# This is the version of cloudcost-exporter to be deployed, which should be incremented
11+
# with each release.
12+
appVersion: "0.7.12"
13+
14+
home: https://github.com/grafana/cloudcost-exporter

charts/cloudcost-exporter/README.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# cloudcost-exporter
2+
3+
Cloud Cost Exporter exports cloud provider agnostic cost metrics to Prometheus.
4+
5+
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.12](https://img.shields.io/badge/AppVersion-0.7.12-informational?style=flat-square)
6+
7+
## Installing the Chart
8+
9+
To install the chart with the release name `my-release`:
10+
11+
```console
12+
helm repo add grafana https://grafana.github.io/helm-charts
13+
helm repo update
14+
helm install my-release grafana/cloudcost-exporter
15+
```
16+
17+
## Configuration per cloud service provider (CSP)
18+
19+
The Helm chart can be used with the general `values.yaml` manifest.
20+
The project includes CSP-specific configuration (e.g. `values.<csp>.yaml`) that can be used in combination with the general values.
21+
The deployment itself will depend on each deployment pipeline and tooling available.
22+
23+
Documentation per CSP will vary (especially when it comes to authentication). Below are links to docs to help with this:
24+
* [AWS](https://github.com/grafana/cloudcost-exporter/tree/main/docs/deploying/aws)
25+
26+
## Values
27+
28+
| Key | Type | Default | Description |
29+
|-----|------|---------|-------------|
30+
| affinity | object | `{}` | Node/pod affinities |
31+
| containerArgs | list | `[]` | Container arguments, usually to configure the deployment per CSP |
32+
| fullnameOverride | string | `""` | Override the full name of the chart and release |
33+
| image.pullPolicy | string | `"IfNotPresent"` | Pull policy for the image |
34+
| image.repository | string | `"grafana/cloudcost-exporter"` | Image to use for deploying |
35+
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
36+
| imagePullSecrets | list | `[]` | Secrets to use for pulling the image |
37+
| minReadySeconds | int | `10` | Seconds a pod should be ready to be considered available |
38+
| nameOverride | string | `""` | Override the name of the release |
39+
| nodeSelector | object | `{}` | Node selector |
40+
| podAnnotations | object | `{}` | Annotations to add to the pod |
41+
| replicaCount | int | `1` | Number of replicas |
42+
| resources.limits.cpu | string | `"2"` | CPU limit |
43+
| resources.limits.memory | string | `"2Gi"` | Memory limit |
44+
| resources.requests.cpu | string | `"1"` | CPU request |
45+
| resources.requests.memory | string | `"1Gi"` | Memory request |
46+
| revisionHistoryLimit | int | `10` | Number of old versions to retain to allow rollback |
47+
| securityContext.fsGroup | int | `10001` | Filesystem group to associate for each pod |
48+
| service.port | int | `8080` | Service port |
49+
| service.portName | string | `"http"` | Service port name |
50+
| service.protocol | string | `"TCP"` | Service protocol |
51+
| service.type | string | `"ClusterIP"` | Service type |
52+
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
53+
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
54+
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
55+
| tolerations | list | `[]` | List of node taints to tolerate |
56+
| volumeMounts | list | `[]` | List of volume mounts |
57+
| volumes | list | `[]` | List of volumes |
58+
59+
----------------------------------------------
60+
Autogenerated from chart metadata using [helm-docs v1.8.1](https://github.com/norwoodj/helm-docs/releases/v1.8.1)
61+
62+
## Contribute
63+
64+
Check out the [docs](https://github.com/grafana/cloudcost-exporter/tree/main//docs/contribute/releases.md#helm-chart)
65+
for more information on how to contribute to the `cloudcost-explorer`'s Helm chart.
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{ template "chart.header" . }}
2+
{{ template "chart.description" . }}
3+
4+
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
5+
6+
## Installing the Chart
7+
8+
To install the chart with the release name `my-release`:
9+
10+
```console
11+
helm repo add grafana https://grafana.github.io/helm-charts
12+
helm repo update
13+
helm install my-release grafana/{{ template "chart.name" . }}
14+
```
15+
16+
{{ template "chart.requirementsSection" . }}
17+
18+
## Configuration per cloud service provider (CSP)
19+
20+
The Helm chart can be used with the general `values.yaml` manifest.
21+
The project includes CSP-specific configuration (e.g. `values.<csp>.yaml`) that can be used in combination with the general values.
22+
The deployment itself will depend on each deployment pipeline and tooling available.
23+
24+
Documentation per CSP will vary (especially when it comes to authentication). Below are links to docs to help with this:
25+
* [AWS](https://github.com/grafana/cloudcost-exporter/tree/main/docs/deploying/aws)
26+
27+
{{ template "chart.valuesSection" . }}
28+
29+
{{ template "helm-docs.versionFooter" . }}
30+
31+
## Contribute
32+
33+
Check out the [docs](https://github.com/grafana/cloudcost-exporter/tree/main//docs/contribute/releases.md#helm-chart)
34+
for more information on how to contribute to the `cloudcost-explorer`'s Helm chart.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "cloudcost-exporter.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "cloudcost-exporter.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "cloudcost-exporter.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "cloudcost-exporter.labels" -}}
37+
helm.sh/chart: {{ include "cloudcost-exporter.chart" . }}
38+
{{ include "cloudcost-exporter.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "cloudcost-exporter.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "cloudcost-exporter.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
name: cloudcost-exporter
52+
{{- end }}
53+
54+
{{/*
55+
Create the name of the service account to use
56+
*/}}
57+
{{- define "cloudcost-exporter.serviceAccountName" -}}
58+
{{- if .Values.serviceAccount.create }}
59+
{{- default (include "cloudcost-exporter.fullname" .) .Values.serviceAccount.name }}
60+
{{- else }}
61+
{{- default "default" .Values.serviceAccount.name }}
62+
{{- end }}
63+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "cloudcost-exporter.fullname" . }}
5+
labels:
6+
{{- include "cloudcost-exporter.labels" . | nindent 4 }}
7+
spec:
8+
minReadySeconds: {{ .Values.minReadySeconds }}
9+
replicas: {{ .Values.replicaCount }}
10+
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
11+
selector:
12+
matchLabels:
13+
{{- include "cloudcost-exporter.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
{{- with .Values.podAnnotations }}
17+
annotations:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "cloudcost-exporter.selectorLabels" . | nindent 8 }}
22+
spec:
23+
{{- with .Values.imagePullSecrets }}
24+
imagePullSecrets:
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
27+
serviceAccountName: {{ include "cloudcost-exporter.serviceAccountName" . }}
28+
containers:
29+
- name: {{ .Chart.Name }}
30+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
31+
imagePullPolicy: {{ .Values.image.pullPolicy }}
32+
args:
33+
{{- range .Values.containerArgs }}
34+
- {{ . }}
35+
{{- end }}
36+
ports:
37+
- name: {{ .Values.service.portName }}
38+
containerPort: {{ .Values.service.port }}
39+
protocol: TCP
40+
livenessProbe:
41+
httpGet:
42+
path: /
43+
port: http
44+
readinessProbe:
45+
httpGet:
46+
path: /
47+
port: http
48+
resources:
49+
{{- toYaml .Values.resources | nindent 12 }}
50+
volumeMounts:
51+
{{- toYaml .Values.volumeMounts | nindent 12 }}
52+
{{- with .Values.nodeSelector }}
53+
nodeSelector:
54+
{{- toYaml . | nindent 8 }}
55+
{{- end }}
56+
{{- with .Values.securityContext }}
57+
securityContext:
58+
{{- toYaml . | nindent 8 }}
59+
{{- end }}
60+
{{- with .Values.affinity }}
61+
affinity:
62+
{{- toYaml . | nindent 8 }}
63+
{{- end }}
64+
{{- with .Values.tolerations }}
65+
tolerations:
66+
{{- toYaml . | nindent 8 }}
67+
{{- end }}
68+
{{- with .Values.volumes }}
69+
volumes:
70+
{{- toYaml . | nindent 8 }}
71+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "cloudcost-exporter.fullname" . }}
5+
labels:
6+
{{- include "cloudcost-exporter.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: {{ .Values.service.protocol }}
13+
name: http
14+
selector:
15+
{{- include "cloudcost-exporter.selectorLabels" . | nindent 4 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "cloudcost-exporter.serviceAccountName" . }}
6+
labels:
7+
{{- include "cloudcost-exporter.labels" . | nindent 4 }}
8+
{{- with .Values.serviceAccount.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- end }}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Custom values to deploy cloudcost-exporter on AWS.
2+
# This is a YAML-formatted file.
3+
# Declare additional variables to be passed into your templates.
4+
# Use this values file together with the default values file.
5+
6+
containerArgs:
7+
- "--provider=aws"
8+
- "--aws.region=us-east-1"
9+
- "--aws.services=s3,ec2"
10+
11+
serviceAccount:
12+
annotations:
13+
eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/CloudCostExporterRole

0 commit comments

Comments
 (0)