apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: prometheus-adapter
  name: prometheus-adapter
  namespace: monitoring
spec:
  selector:
    matchLabels:
      name: prometheus-adapter
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        name: prometheus-adapter
    spec:
      containers:
      - args:
        # - --cert-dir=/var/run/serving-cert
        - --tls-cert-file=/var/run/serving-cert/serving.crt
        - --tls-private-key-file=/var/run/serving-cert/serving.key
        - --logtostderr=true
        - --prometheus-url=http://prometheus-k8s.monitoring.svc.cluster.local:9090/
        - --metrics-relist-interval=1m
        - --secure-port=6443
        - --config=/etc/adapter/config.yaml
        - --v=2
        env:
        - name: TZ
          value: Asia/Shanghai
        image: k8s-prometheus-adapter
        name: prometheus-adapter
        ports:
        - containerPort: 6443
        volumeMounts:
        - mountPath: /var/run/serving-cert
          name: volume-serving-cert
          readOnly: true
        - mountPath: /etc/adapter/
          name: config
          readOnly: true
        - mountPath: /tmp
          name: tmp-vol
          readOnly: false
      nodeSelector:
        kubernetes.io/os: linux
      serviceAccountName: prometheus-adapter
      volumes:
      # - name: volume-serving-cert
      #   emptyDir: {}
      - name: volume-serving-cert
        secret:
          secretName: cm-adapter-serving-certs
      - name: config
        configMap:
          name: adapter-config
      - name: tmp-vol
        emptyDir: {}
