Skip to content

Commit 54e324a

Browse files
committed
fix: Allow adding extra service selector labels in ServiceMonitor (#673)
Signed-off-by: Erhhung Yuan <[email protected]>
1 parent 4443ee3 commit 54e324a

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

charts/opensearch/CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
### Fixed
1515
### Security
1616
---
17+
## [3.1.0]
18+
### Added
19+
### Changed
20+
### Deprecated
21+
### Removed
22+
### Fixed
23+
- Allow adding extra selector labels in ServiceMonitor. See: [Issue #673](https://github.com/opensearch-project/helm-charts/issues/673)
24+
### Security
25+
---
1726
## [3.0.0]
1827
### Added
1928
### Changed
@@ -23,5 +32,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2332
### Fixed
2433
### Security
2534

26-
[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-3.0.0...HEAD
35+
[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-3.1.0...HEAD
36+
[3.1.0]: https://github.com/opensearch-project/helm-charts/compare/opensearch-3.0.0...opensearch-3.1.0
2737
[3.0.0]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.33.0...opensearch-3.0.0

charts/opensearch/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 3.0.0
18+
version: 3.1.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/opensearch/templates/serviceMonitor.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ spec:
1313
selector:
1414
matchLabels:
1515
{{- include "opensearch.selectorLabels" . | nindent 6 }}
16+
{{- with .Values.serviceMonitor.selectorLabels }}
17+
{{- toYaml . | nindent 6 }}
18+
{{- end }}
1619
endpoints:
1720
- port: {{ .Values.service.httpPortName | default "http" }}
1821
interval: {{ .Values.serviceMonitor.interval }}

charts/opensearch/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,13 @@ serviceMonitor:
562562
# k8s.example.com/prometheus: kube-prometheus
563563
labels: {}
564564

565+
# additional service selector labels to be added to the ServiceMonitor
566+
# (these could match extra .service.labels or .service.labelsHeadless
567+
# to prevent Prometheus from unnecessarily scraping each target twice)
568+
# selectorLabels:
569+
# prometheus.io/scrape: "true"
570+
selectorLabels: {}
571+
565572
# additional tlsConfig to be added to the ServiceMonitor
566573
tlsConfig: {}
567574

0 commit comments

Comments
 (0)