apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
  labels:
    prometheus: '{{ meta.name }}'
  name: '{{ meta.name }}'
  namespace: '{{ meta.namespace }}'
spec:
  replicas: {{ servicetelemetry_vars.backends.metrics.prometheus.deployment_size }}
  ruleSelector: {}
  securityContext: {}
  serviceAccountName: prometheus-k8s
  serviceMonitorSelector:
    matchLabels:
      app: smart-gateway
{% if servicetelemetry_vars.alerting.enabled %}
  alerting:
    alertmanagers:
    - name: alertmanager-operated
      namespace: '{{ meta.namespace }}'
      port: web
{% endif %}
  retention: {{ servicetelemetry_vars.backends.metrics.prometheus.storage.retention }}
{% if servicetelemetry_vars.backends.metrics.prometheus.storage.strategy == "persistent" %}
  storage:
    volumeClaimTemplate:
      spec:
        resources:
          requests:
            storage: {{ servicetelemetry_vars.backends.metrics.prometheus.storage.persistent.pvc_storage_request }}
{% if servicetelemetry_vars.backends.metrics.prometheus.storage.persistent.storage_selector %}
        selector: {{ servicetelemetry_vars.backends.metrics.prometheus.storage.persistent.storage_selector }}
{% endif %}
{% if servicetelemetry_vars.backends.metrics.prometheus.storage.persistent.storage_class | length %}
        storageClassName: {{ servicetelemetry_vars.backends.metrics.prometheus.storage.persistent.storage_class }}
{% endif %}
{% endif %}
