apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-pgmon-alertmanager
  namespace: pgmon
  labels:
    k8s-app: alertmanager
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
    version: v0.15.3
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: alertmanager
      version: v0.15.3
  template:
    metadata:
      labels:
        k8s-app: alertmanager
        version: v0.15.3
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ''
    spec:
      containers:
        - name: alertmanager
          image: "prom/alertmanager:v0.15.3"
          imagePullPolicy: "IfNotPresent"
          args:
            - --config.file=/etc/config/alertmanager.yml
            - --storage.path=/data
            - --web.external-url=/
          ports:
            - containerPort: 9093
          readinessProbe:
            httpGet:
              path: /#/status
              port: 9093
            initialDelaySeconds: 30
            timeoutSeconds: 30
          volumeMounts:
            - name: k8s-pgmon-alertmanager-config
              mountPath: /etc/config
            - name: storage-volume
              mountPath: "/data"
              subPath: ""
            - name: k8s-pgmon-alertmanager-wechattmpl
              mountPath: "/etc/config/alert"
              readOnly: true
            - name: timezone
              mountPath: /etc/localtime
          resources:
            limits:
              cpu: 10m
              memory: 50Mi
            requests:
              cpu: 10m
              memory: 50Mi
        - name: prometheus-alertmanager-configmap-reload
          image: "jimmidyson/configmap-reload:v0.1"
          imagePullPolicy: "IfNotPresent"
          args:
            - --volume-dir=/etc/config
            - --webhook-url=http://localhost:9093/-/reload
          volumeMounts:
            - name: k8s-pgmon-alertmanager-config
              mountPath: /etc/config
              readOnly: true
          resources:
            limits:
              cpu: 10m
              memory: 10Mi
            requests:
              cpu: 10m
              memory: 10Mi
      dnsPolicy: "None"
      dnsConfig:
        nameservers:
          - 10.10.100.100
      volumes:
        - emptyDir: {}
          name: storage-volume
        - name: k8s-pgmon-alertmanager-config
          configMap:
            name: k8s-pgmon-alertmanager-config-wechat
        - name: k8s-pgmon-alertmanager-wechattmpl
          secret:
            secretName: k8s-pgmon-alertmanager-wechattmpl
        - name: timezone
          hostPath:
            path: /usr/share/zoneinfo/Asia/Shanghai
