Puppet Class: network::constants

Defined in:
modules/network/manifests/constants.pp

Overview



1
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'modules/network/manifests/constants.pp', line 1

class network::constants {
    $module_path = get_module_path($module_name)
    $network_data = loadyaml("${module_path}/data/data.yaml")
    $all_network_subnets = $network_data['network::subnets']

    # Note this name (external_networks) is misleading.  Most of these are "external" networks,
    # but some subnets of the IPv6 space are not externally routed, even if
    # they're externally route-able (the ones used for private vlans).
    $external_networks = $network_data['network::external']

    $network_infra = $network_data['network::infrastructure']

    $mgmt_networks_bydc = $network_data['network::management']
    $mgmt_networks = $mgmt_networks_bydc.values.flatten

    # Per realm aggregate networks
    $aggregate_networks = flatten($network_data['network::aggregate_networks'][$::realm])

    # $domain_networks is a set of all networks belonging to a domain.
    # a domain is a realm currently, but the notion is more generic than that on
    # purpose.
    # TODO: Figure out a way this can be per-project networks in labs
    $domain_networks = slice_network_constants($::realm)
    # $production_networks will always contain just the production networks
    $production_networks = slice_network_constants('production')
    # $labs_networks will always contain just the labs networks
    $labs_networks = slice_network_constants('labs')
    # $cloud_networks_public contains basically general egress NAT and floating IP addresses
    $cloud_networks_public = slice_network_constants('labs', { 'sphere' => 'public' })
    # $frack_networks will always contain just the fundraising networks
    $frack_networks = slice_network_constants('frack')

    # cloud nova hosts ranges per region
    $cloud_nova_hosts_ranges = {
        'eqiad1-r' => slice_network_constants('production', {
            site        => $::site,
            description => 'cloud-hosts',
        }),
        'codfw1dev-r' => slice_network_constants('production', {
            site        => 'codfw',
            description => 'cloud-hosts',
        }),
    }

    # Networks hosting MediaWiki application servers
    # These are:
    #  - public hosts in eqiad/codfw
    #  - all private networks in eqiad/codfw
    if $::realm == 'production' {
        $mw_appserver_networks = flatten([
            slice_network_constants('production', {
                'site'   => 'eqiad',
                'sphere' => 'public',
                }),
            slice_network_constants('production', {
                'site'   => 'codfw',
                'sphere' => 'public',
                }),
            slice_network_constants('production', {
                'site'        => 'eqiad',
                'sphere'      => 'private',
                'description' => 'private',
                }),
            slice_network_constants('production', {
                'site'        => 'codfw',
                'sphere'      => 'private',
                'description' => 'private',
                }),
            slice_network_constants('production', {
                'site'        => 'eqiad',
                'sphere'      => 'private',
                'description' => 'labs-support',
                }),
            ])
    } elsif $::realm == 'labs' {
        # rely on security groups in labs to restrict this
        $mw_appserver_networks = flatten([
            slice_network_constants('labs'),
            '127.0.0.1'])
    }

    # Analytics subnets
    $analytics_networks = slice_network_constants('production', { 'description' => 'analytics'})

    # Kubernetes pods subnets. We could revisit in the future if we makes sense to have
    # this at a global level or not (effie).
    $services_kubepods_networks = flatten([
        slice_network_constants('production', {
            'site'        => 'eqiad',
            'sphere'      => 'private',
            'description' => 'services-kubepods',
            }),
        slice_network_constants('production', {
            'site'        => 'codfw',
            'sphere'      => 'private',
            'description' => 'services-kubepods',
            }),
        ])
    $staging_kubepods_networks = flatten([
        slice_network_constants('production', {
            'site'        => 'eqiad',
            'sphere'      => 'private',
            'description' => 'staging-kubepods',
            }),
        slice_network_constants('production', {
            'site'        => 'codfw',
            'sphere'      => 'private',
            'description' => 'staging-kubepods',
            }),
        ])
    $mlserve_kubepods_networks = flatten([
        slice_network_constants('production', {
            'site'        => 'eqiad',
            'sphere'      => 'private',
            'description' => 'mlserve-kubepods',
            }),
        slice_network_constants('production', {
            'site'        => 'codfw',
            'sphere'      => 'private',
            'description' => 'mlserve-kubepods',
            }),
        ])
    $mlstage_kubepods_networks = flatten([
        slice_network_constants('production', {
            'site'        => 'codfw',
            'sphere'      => 'private',
            'description' => 'mlstage-kubepods',
            }),
        ])

    # Networks that Scap will be able to deploy to.
    # (Puppet does array concatenation
    # by declaring array of other arrays! (?!)
    # See: http://weblog.etherized.com/posts/175)
    $deployable_networks = [
        $mw_appserver_networks,
        $analytics_networks,
    ]
}