diff --git a/templates/prometheus-postgres-exporter/serviceMonitorHTTP.yaml b/templates/prometheus-postgres-exporter/serviceMonitorHTTP.yaml index 82c09b5..e213e44 100644 --- a/templates/prometheus-postgres-exporter/serviceMonitorHTTP.yaml +++ b/templates/prometheus-postgres-exporter/serviceMonitorHTTP.yaml @@ -26,7 +26,7 @@ spec: {{- end }} scrapeTimeout: {{ required "The scrape timeout of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.scrapeTimeout }} scheme: {{ required "The scheme of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.scheme}} - targetPort: {{ required "The port of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.port }} + targetPort: {{ required "The port of the service is not defined!" .Values.services.http.port }} {{- with .Values.prometheus.metrics.serviceMonitor.tlsConfig }} tlsConfig: {{- toYaml . | nindent 6 }} diff --git a/unittests/serviceMonitors/serviceMonitorHTTP.yaml b/unittests/serviceMonitors/serviceMonitorHTTP.yaml index 3f481b7..3bb42ae 100644 --- a/unittests/serviceMonitors/serviceMonitorHTTP.yaml +++ b/unittests/serviceMonitors/serviceMonitorHTTP.yaml @@ -134,7 +134,6 @@ tests: action: "drop" prometheus.metrics.serviceMonitor.scrapeTimeout: "5s" prometheus.metrics.serviceMonitor.scheme: "http" - prometheus.metrics.serviceMonitor.port: 10443 asserts: - hasDocuments: count: 1 @@ -166,7 +165,4 @@ tests: value: 5s - equal: path: spec.endpoints[0].scheme - value: http - - equal: - path: spec.endpoints[0].targetPort - value: 10443 \ No newline at end of file + value: http \ No newline at end of file diff --git a/values.yaml b/values.yaml index 36606df..0c8ea2e 100644 --- a/values.yaml +++ b/values.yaml @@ -332,7 +332,6 @@ prometheus: ## @param prometheus.metrics.serviceMonitor.honorLabels Honor labels. ## @param prometheus.metrics.serviceMonitor.interval Interval at which metrics should be scraped. If not specified Prometheus' global scrape interval is used. ## @param prometheus.metrics.serviceMonitor.path HTTP path for scraping prometheus metrics. - ## @param prometheus.metrics.serviceMonitor.port HTTP port for scraping prometheus metrics. ## @param prometheus.metrics.serviceMonitor.relabelings RelabelConfigs to apply to samples before scraping. Prometheus Operator automatically adds relabelings for a few standard Kubernetes fields. ## @param prometheus.metrics.serviceMonitor.scrapeTimeout Timeout after which the scrape is ended. If not specified, global Prometheus scrape timeout is used. ## @param prometheus.metrics.serviceMonitor.scheme HTTP scheme to use for scraping. For example `http` or `https`. @@ -347,7 +346,6 @@ prometheus: honorLabels: false interval: "60s" path: "/metrics" - port: 9187 relabelings: [] scrapeTimeout: "30s" scheme: "http"