apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: alertmanager
  namespace: prometheus
  labels:
    k8s-app: alertmanager
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
    version: v0.14.0
spec:
  serviceName: "alertmanager"
  replicas: 1
  selector:
    matchLabels:
      k8s-app: alertmanager
      version: v0.14.0
  template:
    metadata:
      labels:
        k8s-app: alertmanager
        version: v0.14.0
    spec:
      priorityClassName: system-cluster-critical
      containers:
        - name: alertmanager
          image: "harbor.freedom.org/prom/alertmanager:master"
          imagePullPolicy: "Always"
          env:
            - name: TZ
              value: Asia/Shanghai
          # 终端调试
          # command:
          #   - /bin/sh
          # stdin: true
          # tty: true
          args:
            - --config.file=/etc/config/alertmanager.yml
            - --web.config.file=/etc/config/web.yml
            - --storage.path=/alertmanager
          ports:
            - containerPort: 9093
          # readinessProbe:
          #   httpGet:
          #     path: /#/status
          #     port: 9093
          #   initialDelaySeconds: 30
          #   timeoutSeconds: 30
          volumeMounts:
            - name: alertmanager-config
              mountPath: /etc/config/alertmanager.yml
              subPath: alertmanager.yml
            - name: alertmanager-web-config
              mountPath: /etc/config/web.yml
              subPath: web.yml
            - name: alertmanager-data
              mountPath: "/alertmanager"
          resources:
            limits:
              cpu: 1000m
              memory: 2048Mi
            requests:
              cpu: 10m
              memory: 50Mi
      volumes:
        - name: alertmanager-config
          configMap:
            name: alertmanager-config
        - name: alertmanager-web-config
          configMap:
            name: alertmanager-web-config
  volumeClaimTemplates:
    - metadata:
        name: alertmanager-data
        annotations:
          volume.beta.kubernetes.io/storage-class: storageclass-nfs-infra
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: "1Gi"