puppet-nginx icon indicating copy to clipboard operation
puppet-nginx copied to clipboard

service upstream may not have port

Open hbog opened this issue 6 years ago • 1 comments

The service parameter of the nginx::resource::upstream::member enables port discovery via DNS SRV records. When it is used, a server port must not be specified. Currently the module adds port 80 by default resulting in nginx failing to start.

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet:all
  • Ruby:all
  • Distribution:all
  • Module version: v0.15.0

How to reproduce (e.g Puppet code you use)

nginx::resource::upstream { 'backend':
  zone    => $zone,
  ensure  => present,
  members => {
    'backend' => {
      'server'  => "upstream.endpoints.cluster.local",
      'service' => 'http',
      'resolve'  =>  true,
    }
  }
}

What are you seeing

nginx startup fails because the upstream .conf file specifies the default port 80

upstream backend {
  server upstream.endpoints.cluster.local:80 service=http resolve;
}

What behaviour did you expect instead

The resulting upstream .conf file should not define a port

upstream backend {
  server upstream.endpoints.cluster.local service=http resolve;
}

Output log

nginx: [emerg] service upstream may not have port

Any additional information you'd like to impart

hbog avatar Dec 10 '18 20:12 hbog

Fixed in PR 1283

hbog avatar Dec 10 '18 20:12 hbog