Puppet Class: profile::dragonfly::supernode

Defined in:
modules/profile/manifests/dragonfly/supernode.pp

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • listen_port (Stdlib::Port::Unprivileged) (defaults to: lookup('profile::dragonfly::supernode::listen_port'))
  • download_port (Stdlib::Port::Unprivileged) (defaults to: lookup('profile::dragonfly::supernode::download_port'))
  • cdn_pattern (Enum['local', 'source']) (defaults to: lookup('profile::dragonfly::supernode::cdn_pattern'))


2
3
4
5
6
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
# File 'modules/profile/manifests/dragonfly/supernode.pp', line 2

class profile::dragonfly::supernode (
  Stdlib::Port::Unprivileged $listen_port = lookup('profile::dragonfly::supernode::listen_port'),
  Stdlib::Port::Unprivileged $download_port = lookup('profile::dragonfly::supernode::download_port'),
  Enum['local', 'source']    $cdn_pattern = lookup('profile::dragonfly::supernode::cdn_pattern'),
) {
  class {'dragonfly::supernode':
    listen_port   => $listen_port,
    download_port => $download_port,
    cdn_pattern   => $cdn_pattern,
  }

  # This is the port the supernode is listening on for dfget clients to connect
  # Prometheus metrics are served here as well (/metrics)
  firewall::service { 'dragonfly_supernode':
      proto    => 'tcp',
      port     => $listen_port,
      src_sets => ['DOMAIN_NETWORKS'],
  }

  if ($download_port != $listen_port) and ($cdn_pattern == 'local') {
    $ensure_download_port = 'present'
  } else {
    $ensure_download_port = 'absent'
  }
  firewall::service { 'dragonfly_supernode_cdn':
      ensure   => $ensure_download_port,
      proto    => 'tcp',
      port     => $download_port,
      src_sets => ['DOMAIN_NETWORKS'],
  }

  # TODO: Add icinga monitoring
}