Skip to content

Commit

Permalink
Merge pull request #216 from camptocamp/multiple-pod-monitor-endpoints
Browse files Browse the repository at this point in the history
Be able to have more that one PodMonitor endpoint on a pod
  • Loading branch information
sbrunner authored Aug 14, 2024
2 parents 91c0101 + d12f5e7 commit 22613a6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions templates/podmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ metadata:
spec:
selector:
matchLabels: {{- include "common.selectorLabels" ( dict "root" $ "service" $serviceDefinition "serviceName" $serviceName ) | nindent 6 }}
{{- with $serviceDefinition.podMonitor.endpoint }}
{{- with $serviceDefinition.podMonitor.podMetricsEndpoints }}
podMetricsEndpoints:
- {{ . | toYaml | nindent 6 }}
{{- include "common.dictToList" ( dict "keyName" "port" "contents" . ) | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
6 changes: 4 additions & 2 deletions tests/expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,9 @@ spec:
app.kubernetes.io/instance: custom
app.kubernetes.io/component: with-service-name
podMetricsEndpoints:
-
- port: config-prometheus
honorLabels: true
interval: 10s
- port: prometheus
honorLabels: true
interval: 10s
port: prometheus
11 changes: 7 additions & 4 deletions tests/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,13 @@ services:
path: /one
podMonitor:
enabled: true
endpoint:
port: prometheus
interval: 10s
honorLabels: true
podMetricsEndpoints:
prometheus:
interval: 10s
honorLabels: true
config-prometheus:
interval: 10s
honorLabels: true
replicaCount: 1
nodeSelector: {}
affinity:
Expand Down
3 changes: 2 additions & 1 deletion values.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@
- **`ports`** _(array)_
- **`podMonitor`** _(object)_: The Prometheus Pod monitor configuration. Cannot contain additional properties.
- **`enabled`** _(boolean)_: Enable the Pod monitor for this service.
- **`endpoint`** _(object)_: The endpoint of the Pod monitor.
- **`podMetricsEndpoints`** _(object)_: The endpoints of the Pod monitor by port. Can contain additional properties.
- **Additional properties** _(object)_: The endpoint of the Pod monitor.

## Definitions

Expand Down
8 changes: 6 additions & 2 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1083,9 +1083,13 @@
"type": "boolean",
"description": "Enable the Pod monitor for this service"
},
"endpoint": {
"podMetricsEndpoints": {
"type": "object",
"description": "The endpoint of the Pod monitor"
"description": "The endpoints of the Pod monitor by port",
"additionalProperties": {
"type": "object",
"description": "The endpoint of the Pod monitor"
}
}
}
}
Expand Down

0 comments on commit 22613a6

Please sign in to comment.