Skip to content

Commit

Permalink
Merge pull request #73 from VLZZZ/improve-helm-chart
Browse files Browse the repository at this point in the history
  • Loading branch information
djeebus authored Oct 24, 2023
2 parents 5047e63 + 4e8dfc9 commit d6cf85c
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ helm repo update
helm search repo pag -l
```

### Helm Chart Unit Tests

Helm plugin [quintush/helm-unittest](https://github.com/quintush/helm-unittest) is used for unit-testing.
After installing the plugin run `helm unittest <chart_dir>`. For Helm 3 support use `--helm3` flag.
More information on writing tests might be found in the plugin's project repo.

## Contributing
To run the server you can run:

Expand Down
2 changes: 1 addition & 1 deletion charts/prom-aggregation-gateway/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: prom-aggregation-gateway
version: 0.5.4
version: 0.6.0
home: https://github.com/zapier/prom-aggregation-gateway
maintainers:
- name: djeebus
Expand Down
4 changes: 4 additions & 0 deletions charts/prom-aggregation-gateway/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ .Release.Name }}-metrics
{{- with .Values.podMonitor.additionalLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
Expand Down
4 changes: 4 additions & 0 deletions charts/prom-aggregation-gateway/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ .Release.Name }}
{{- with .Values.serviceMonitor.additionalLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
Expand Down
21 changes: 21 additions & 0 deletions charts/prom-aggregation-gateway/tests/podmonitor_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
suite: PodMonitor tests

templates: [podmonitor.yaml]

tests:
- it: empty podmonitor labels by default
asserts:
- isEmpty:
path: metadata.labels
- it: can render podmonitor labels
set:
podMonitor:
additionalLabels:
hello: world
goodbye: moon
asserts:
- equal:
path: metadata.labels
value:
hello: world
goodbye: moon
21 changes: 21 additions & 0 deletions charts/prom-aggregation-gateway/tests/servicemonitor_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
suite: ServiceMonitor tests

templates: [servicemonitor.yaml]

tests:
- it: empty servicemonitor labels by default
asserts:
- isEmpty:
path: metadata.labels
- it: can render servicemonitor labels
set:
serviceMonitor:
additionalLabels:
hello: world
goodbye: moon
asserts:
- equal:
path: metadata.labels
value:
hello: world
goodbye: moon
8 changes: 8 additions & 0 deletions charts/prom-aggregation-gateway/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
"properties": {
"create": {
"type": "boolean"
},
"additionalLabels": {
"type": "object",
"additionalProperties": true
}
}
},
Expand All @@ -100,6 +104,10 @@
"properties": {
"create": {
"type": "boolean"
},
"additionalLabels": {
"type": "object",
"additionalProperties": true
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions charts/prom-aggregation-gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ controller:

podMonitor:
create: true
additionalLabels: {}

service:
create: true
Expand All @@ -29,3 +30,4 @@ service:

serviceMonitor:
create: true
additionalLabels: {}

0 comments on commit d6cf85c

Please sign in to comment.