diff --git a/configs/helm/templates/service.yaml b/configs/helm/templates/service.yaml index f4af801..1e463a5 100644 --- a/configs/helm/templates/service.yaml +++ b/configs/helm/templates/service.yaml @@ -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: diff --git a/configs/helm/tests/service_test.yaml b/configs/helm/tests/service_test.yaml new file mode 100644 index 0000000..9c6a261 --- /dev/null +++ b/configs/helm/tests/service_test.yaml @@ -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" diff --git a/configs/helm/tests/values/with_service.yaml b/configs/helm/tests/values/with_service.yaml new file mode 100644 index 0000000..99185be --- /dev/null +++ b/configs/helm/tests/values/with_service.yaml @@ -0,0 +1,4 @@ +--- +service: + annotations: + "prometheus.io/scrape": "true" diff --git a/configs/helm/values.yaml b/configs/helm/values.yaml index a6820d6..7bd2ccb 100644 --- a/configs/helm/values.yaml +++ b/configs/helm/values.yaml @@ -48,6 +48,8 @@ securityContext: service: type: ClusterIP port: 9043 + # Additional annotations for the service + annotations: {} ingress: enabled: false