Puppet Class: profile::mjolnir::kafka_msearch_daemon

Defined in:
modules/profile/manifests/mjolnir/kafka_msearch_daemon.pp

Overview

Class: profile::mjolnir::kafka_daemon

This class sets up the MjoLniR kafka daemon which facilitates running elasticsearch queries against relforge from the analytics network by using kafka as a middleman.

Parameters:

  • es_cluster_endpoint (Any) (defaults to: lookup('profile::mjolnir::kafka_msearch_daemon::es_cluster_nedpoint', { 'default_value' => 'localhost:9200' }))
  • kafka_cluster (Any) (defaults to: lookup('profile::mjolnir::kafka_msearch_daemon::kafka_cluster'))
  • input_topic (String) (defaults to: lookup('profile::mjolnir::kafka_msearch_daemon::input_topic'))
  • output_topic (String) (defaults to: lookup('profile::mjolnir::kafka_msearch_daemon::output_topic'))
  • num_workers (Integer) (defaults to: lookup('profile::mjolnir::kafka_msearch_daemon::num_workers'))
  • max_concurrent_searches (Integer) (defaults to: lookup('profile::mjolnir::kafka_msearch_daemon::max_concurrent_searches'))
  • num_running_daemons (Integer) (defaults to: lookup('profile::mjolnir::kafka_msearch_daemon::num_running_daemons'))
  • prometheus_nodes (Array[String]) (defaults to: lookup('prometheus_nodes', {'default_value' => []}))
  • ensure (Wmflib::Ensure) (defaults to: lookup('profile::mjolnir::kafka_msearch_daemon::ensure', { 'default_value' => 'present' }))


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'modules/profile/manifests/mjolnir/kafka_msearch_daemon.pp', line 7

class profile::mjolnir::kafka_msearch_daemon(
  $es_cluster_endpoint = lookup('profile::mjolnir::kafka_msearch_daemon::es_cluster_nedpoint', { 'default_value' => 'localhost:9200' }),
  $kafka_cluster = lookup('profile::mjolnir::kafka_msearch_daemon::kafka_cluster'),
  String $input_topic = lookup('profile::mjolnir::kafka_msearch_daemon::input_topic'),
  String $output_topic = lookup('profile::mjolnir::kafka_msearch_daemon::output_topic'),
  Integer $num_workers = lookup('profile::mjolnir::kafka_msearch_daemon::num_workers'),
  Integer $max_concurrent_searches = lookup('profile::mjolnir::kafka_msearch_daemon::max_concurrent_searches'),
  Integer $num_running_daemons = lookup('profile::mjolnir::kafka_msearch_daemon::num_running_daemons'),
  Array[String] $prometheus_nodes = lookup('prometheus_nodes',  {'default_value' => []}),
  Wmflib::Ensure $ensure = lookup('profile::mjolnir::kafka_msearch_daemon::ensure', { 'default_value' => 'present' }),
) {

    require ::profile::mjolnir

    $kafka_config = kafka_config($kafka_cluster)
    $prometheus_port = 9171
    $prometheus_nodes_ferm = join($prometheus_nodes, ' ')

    systemd::unit { 'mjolnir-kafka-msearch-daemon@.service':
      ensure  => $ensure,
      content => template('profile/mjolnir/kafka-msearch-daemon@.service.erb'),
    }

    range('0', $num_running_daemons - 1).each |$i| {
      $title = String($i)
      profile::mjolnir::kafka_msearch_daemon_instance { $title:
        ensure                => $ensure,
        prometheus_port       => $prometheus_port + $i,
        prometheus_nodes_ferm => $prometheus_nodes_ferm,
      }
    }
}