apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus-exporter-home-assistant
  labels:
    app: prometheus-exporter-home-assistant
spec:
  selector:
    matchLabels:
      app: prometheus-exporter-home-assistant
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        prometheus.io/scrape: 'true'
        prometheus.io/path: /
        prometheus.io/port: '80'
        health.dsb.dev/scrape: 'true'
      labels:
        app: prometheus-exporter-home-assistant
    spec:
      imagePullSecrets:
      - name: registry
      containers:
      - image: ghcr.io/davidsbond/homelab:latest
        imagePullPolicy: IfNotPresent
        name: prometheus-exporter-home-assistant
        command:
        - /bin/prometheus-exporter-home-assistant
        env:
        - name: HOME_ASSISTANT_URL
          value: http://home-assistant.utilities.svc.cluster.local:8123
        - name: HOME_ASSISTANT_TOKEN
          valueFrom:
            secretKeyRef:
              key: home-assistant.token
              name: home-assistant
        - name: TRACER_DISABLED
          value: "true"
        - name: MONITORING_DSN
          valueFrom:
            secretKeyRef:
              key: sentry.dsn
              name: sentry
        readinessProbe:
          httpGet:
            path: /__/health
            port: 8081
          initialDelaySeconds: 5
