Skip to content

Commit

Permalink
Merge pull request #190 from kuskoman/allow-to-specify-svc-annotations
Browse files Browse the repository at this point in the history
Allow to specify custom annotations for the service helm template
  • Loading branch information
victorboissiere authored Dec 5, 2024
2 parents c0ff03a + fec33d1 commit c85406d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
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

0 comments on commit c85406d

Please sign in to comment.