---
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: alertmanager
  labels:
    app.kubernetes.io/name: alertmanager
spec:
  route:
    routes:
      - continue: false
        receiver: slack-notifications
        matchers:
          - matchType: "="
            name: severity
            value: critical
    receiver: 'null'
  receivers:
  - name: 'null'
  - name: 'slack-notifications'
    slackConfigs:
    - channel: '#kube-prod'
      sendResolved: true
      apiURL:
        name: slack-secrets
        key: webhook-url

---
apiVersion: monitoring.coreos.com/v1
kind: Alertmanager
metadata:
  name: alertmanager
spec:
  alertmanagerConfigMatcherStrategy:
    type: None
  alertmanagerConfigNamespaceSelector: {}
  alertmanagerConfigSelector: {}
  alertmanagerConfiguration:
    name: alertmanager
  secrets:
    - slack-secrets
  nodeSelector:
    dedicated: monitoring
  tolerations:
    - key: dedicated
      operator: Equal
      value: monitoring
      effect: NoSchedule
  replicas: 3
  serviceAccountName: alertmanager
  externalUrl: http://am.k-space.ee/
  routePrefix: "/"
  securityContext:
    fsGroup: 2000
    runAsGroup: 2000
    runAsNonRoot: true
    runAsUser: 1000
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: alertmanager