Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify custom annotations for the service helm template #190

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions configs/helm/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ metadata:
name: {{ include "prometheus-rds-exporter.fullname" . }}
labels:
{{- include "prometheus-rds-exporter.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
Expand Down
21 changes: 21 additions & 0 deletions configs/helm/tests/service_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
---
suite: service tests
templates:
- service.yaml
tests:
- it: render default service
asserts:
- isKind:
of: Service
- equal:
path: metadata.name
value: RELEASE-NAME-prometheus-rds-exporter-chart
- it: render service with annotations
values:
- ./values/with_service.yaml
asserts:
- equal:
path: metadata.annotations
value:
"prometheus.io/scrape": "true"
4 changes: 4 additions & 0 deletions configs/helm/tests/values/with_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
service:
annotations:
"prometheus.io/scrape": "true"
2 changes: 2 additions & 0 deletions configs/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ securityContext:
service:
type: ClusterIP
port: 9043
# Additional annotations for the service
annotations: {}

ingress:
enabled: false
Expand Down