apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: kafka-exporter
  namespace: kafka-exporter
spec:
  dependsOn:
    - name: prometheus-stack
      namespace: prometheus-stack
  interval: 5m
  timeout: 10m
  postRenderers:
    - kustomize:
        patches:
          - target:
              group: apps
              version: v1
              kind: Deployment
              name: kafka-exporter-kafka-exporter-prod
            patch: |-
              - op: add
                path: /spec/template/spec/imagePullSecrets
                value:
                  - name: regcred
          - target:
              group: monitoring.coreos.com
              version: v1
              kind: ServiceMonitor
              name: kafka-exporter-kafka-exporter-prod
            patch: |-
              - op: add
                path: /spec/selector/matchLabels/app.kubernetes.io~1instance
                value: kafka-exporter
  values:
    image:
      repository: danielqsj/kafka-exporter
      tag: latest
      pullPolicy: IfNotPresent
    kafkaExporter:
      kafka:
        servers:
          - brusnika-prod-kafka-bootstrap.kafka.svc.cluster.local:9092
      sasl:
        enabled: false
      tls:
        enabled: false
    prometheus:
      serviceMonitor:
        enabled: true
        namespace: kafka-exporter
        interval: 30s
