apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: container-mom-operator
  namespace: {{ .Values.namespace | default .Release.Namespace }}
  labels:
    app.kubernetes.io/name: {{ .Chart.Name }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    container.mom/monitor: "true"
    {{- if .Values.commonLabels }}
    {{- toYaml .Values.commonLabels | nindent 4 }}
    {{- end }}
spec:
  selector:
    matchLabels:
      app: container-mom-operator
  namespaceSelector:
    matchNames:
      - container-mom
  endpoints:
    - port: metrics
      interval: 30s
      path: /metrics
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: container-mom-portal
  namespace: {{ .Values.namespace | default .Release.Namespace }}
  labels:
    app.kubernetes.io/name: {{ .Chart.Name }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    container.mom/monitor: "true"
    {{- if .Values.commonLabels }}
    {{- toYaml .Values.commonLabels | nindent 4 }}
    {{- end }}
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: backstage
  namespaceSelector:
    matchNames:
      - container-mom-portal
  endpoints:
    - port: backend
      interval: 30s
      path: /metrics