prometheusrule.yaml 1.2 KB

123456789101112131415161718192021222324252627
  1. {{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled .Values.metrics.prometheusRule.rules }}
  2. apiVersion: monitoring.coreos.com/v1
  3. kind: PrometheusRule
  4. metadata:
  5. name: {{ include "common.names.fullname" . }}
  6. {{- if .Values.metrics.prometheusRule.namespace }}
  7. namespace: {{ .Values.metrics.prometheusRule.namespace }}
  8. {{- else }}
  9. namespace: {{ .Release.Namespace }}
  10. {{- end }}
  11. labels: {{- include "common.labels.standard" . | nindent 4 }}
  12. app.kubernetes.io/component: metrics
  13. {{- if .Values.commonLabels }}
  14. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  15. {{- end }}
  16. {{- if .Values.metrics.prometheusRule.additionalLabels }}
  17. {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.prometheusRule.additionalLabels "context" $ ) | nindent 4 }}
  18. {{- end }}
  19. {{- if .Values.commonAnnotations }}
  20. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  21. {{- end }}
  22. spec:
  23. groups:
  24. - name: {{ include "common.names.fullname" . }}
  25. rules: {{- toYaml .Values.metrics.prometheusRule.rules | nindent 8 }}
  26. {{- end }}