kind: ConfigMap
apiVersion: v1
metadata:
    name: gitlab-gitlab-exporter
    namespace: gitlab
    selfLink: /api/v1/namespaces/gitlab/configmaps/gitlab-gitlab-exporter
    uid: 980d4d67-398b-11ea-b115-42010a8001d6
    resourceVersion: '2016129'
    creationTimestamp: '2020-01-18T00:43:50Z'
    labels:
        app: gitlab-exporter
        chart: gitlab-exporter-2.6.5
        heritage: Helm
        release: gitlab
data:
    configure: |
        set -e
        config_dir="/init-config"
        secret_dir="/init-secrets"

        for secret in postgres ; do
          mkdir -p "${secret_dir}/${secret}"
          cp -v -r -L "${config_dir}/${secret}/." "${secret_dir}/${secret}/"
        done
        for secret in redis ; do
          if [ -e "${config_dir}/${secret}" ]; then
            mkdir -p "${secret_dir}/${secret}"
            cp -v -r -L "${config_dir}/${secret}/." "${secret_dir}/${secret}/"
          fi
        done
    gitlab-exporter.yml.erb: |
        server:
          listen_address: 0.0.0.0
          listen_port: 9168

        probes:
          db_common: &db_common
            methods:
              - probe_db
            opts:
              connection_string: dbname=gitlabhq_production user=gitlab host=gitlab-postgresql port=5432 password='<%= File.read("/etc/gitlab/postgres/psql-password").strip.gsub(/[\'\\]/) { |esc| '\\' + esc } %>'
          database:
            multiple: true
            ci_builds:
              class_name: Database::CiBuildsProber
              <<: *db_common
            tuple_stats:
              class_name: Database::TuplesProber
              <<: *db_common
            rows_count:
              class_name: Database::RowCountProber
              <<: *db_common

          sidekiq: &sidekiq
            methods:
              - probe_queues
              - probe_workers
              - probe_retries
              - probe_stats
            opts:
              redis_url: redis://:<%= URI.escape(File.read("/etc/gitlab/redis/password").strip) %>@gitlab-redis:6379
              redis_enable_client: false

          metrics:
            multiple: true
            sidekiq:
              <<: *sidekiq
            ci_builds:
              class_name: Database::CiBuildsProber
              <<: *db_common
            tuple_stats:
              class_name: Database::TuplesProber
              <<: *db_common
            rows_count:
              class_name: Database::RowCountProber
              <<: *db_common

