Puppet Function: profile::services_proxy::envoy::svc_name

Defined in:
modules/profile/manifests/services_proxy/envoy.pp
Function type:
Puppet Language

Overview

profile::services_proxy::envoy::svc_name(Profile::Service_listener $listener)String

Service name is:

  • foo if upstream is foo.discovery.wmnet

  • $listener_eqiad if upstream is foo.eqiad.wikimedia.org or foo.svc.eqiad.wmnet

  • $listener otherwise

Parameters:

  • listener (Profile::Service_listener)

Returns:



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'modules/profile/manifests/services_proxy/envoy.pp', line 116

function profile::services_proxy::envoy::svc_name( Profile::Service_listener $listener ) >> String {
    if $listener['upstream'] {
        $address = $listener['upstream']
        if $address =~ /^([^.]+)\.discovery\.wmnet$/ {
            return $1
        }
        elsif $address =~ /^[^.]+\.svc\.([^.]+)\.wmnet$/ {
            return "${listener['service']}_${1}"
        }
        elsif $address =~ /^[^.]+\.([^.]+)\.wikimedia\.org$/ {
            return "${listener['service']}_${1}"
        }
        else {
            return $listener['service']
        }
    } else {
        return $listener['service']
    }
}