Skip to content

Commit

Permalink
feat(chart): add Prometheus monitors
Browse files Browse the repository at this point in the history
  • Loading branch information
awlayton committed Jul 20, 2022
1 parent effa395 commit 5cd7f67
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions charts/oada/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ maintainers:
- name: awlayton
email: alex@layton.in
type: application
version: 1.2.4
appVersion: '3.4.1'
version: 1.3.0
appVersion: '3.4.4'
annotations:
artifacthub.io/recommendations: |
- url: https://artifacthub.io/packages/helm/cert-manager/cert-manager
Expand Down
5 changes: 5 additions & 0 deletions charts/oada/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ app.kubernetes.io/part-of: oada
{{ .Values.kafka.brokers | join "," | default $brokers }}
{{- end -}}

{{/* Whether add Prometheus monitors */}}
{{- define "oada.prometheus" -}}
{{ .Values.prometheus | default (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
{{- end -}}

{{/* TLS secret */}}
{{- define "oada.tls" -}}
tls-{{ .Release.Name }}
Expand Down
19 changes: 19 additions & 0 deletions charts/oada/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,24 @@ spec:
targetAverageUtilization: {{ $.Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
{{- if eq (include "oada.prometheus" $) "true" }}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
namespace: {{ $.Release.Namespace }}
name: {{ $name }}
labels:
app.kubernetes.io/name: {{ $k }}
app.kubernetes.io/instance: {{ $.Release.Name }}
{{- include "oada.chart.labels" $ | nindent 4 }}
spec:
selector:
matchLabels:
app.kubernetes.io/name: {{ $k }}
app.kubernetes.io/instance: {{ $.Release.Name }}
podMetricsEndpoints:
- port: prometheus
{{- end }}
---
{{ end -}}
3 changes: 3 additions & 0 deletions charts/oada/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ k8sWaitFor:
image: groundnuty/k8s-wait-for
tag: v1.6

# prometheus is whether to add prometheus monitors for oada
prometheus: ~

global:
# global.development is whether to enable development/debug features not meant for production use
development: false

0 comments on commit 5cd7f67

Please sign in to comment.