Skip to content

Commit

Permalink
fix(network-costs): Replace ServiceMonitor with PodMonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
RmMsr committed Feb 4, 2020
1 parent 97723cb commit 954100b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 60 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Parameter | Description | Default
`ingress.tls` | Ingress TLS configuration (YAML) | `[]`
`networkPolicy.enabled` | If true, create a NetworkPolicy to deny egress | `false`
`networkCosts.enabled` | If true, collect network allocation metrics [More info](http://docs.kubecost.com/network-allocation) | `false`
`networkCosts.serviceMonitor.enabled` | If true, a [ServiceMonitor](https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#servicemonitor) and a Service for the network-cost daemonset is created | `false`
`networkCosts.podMonitor.enabled` | If true, a [PodMonitor](https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#podmonitor) for the network-cost daemonset is created | `false`
`serviceMonitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false`
`serviceMonitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | `{}`
`prometheusRule.enabled` | Set this to `true` to create PrometheusRule for Prometheus operator | `false`
Expand Down
9 changes: 0 additions & 9 deletions cost-analyzer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,3 @@ app.kubernetes.io/name: {{ include "cost-analyzer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app: cost-analyzer
{{- end -}}

{{/*
Create the network costs selector labels.
*/}}
{{- define "cost-analyzer.networkCostsSelectorLabels" -}}
app.kubernetes.io/name: {{ include "cost-analyzer.networkCostsName" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app: cost-analyzer-network-costs
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if .Values.networkCosts.podMonitor }}
{{- if .Values.networkCosts.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "cost-analyzer.networkCostsName" . }}
labels:
{{ include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if .Values.networkCosts.podMonitor.additionalLabels }}
{{ toYaml .Values.networkCosts.e.additionalLabels | nindent 4 }}
{{- end }}
spec:
podMetricsEndpoints:
- port: http-server
honorLabels: true
interval: 1m
scrapeTimeout: 10s
path: /metrics
scheme: http
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app: {{ template "cost-analyzer.networkCostsName" . }}
{{- end }}
{{- end }}

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion cost-analyzer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ networkCosts:
priorityClassName: []

## Allows scraping of network metrics from a dedicated prometheus operator setup
serviceMonitor:
podMonitor:
enabled: false
additionalLabels: {}

Expand Down

0 comments on commit 954100b

Please sign in to comment.