question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove "legacyPortMapping" from DefaultServiceEnricher

See original GitHub issue

Description

At the moment the DefaultServiceEnricher maps the first exposed port from the image which is either 8080 or 9090 to the port 80 of the generated service, whereas all other exposed ports are mapped to the same service port. This is dangerous e.g. when in the image configuration the order of the ports changes (the order actually doesn’t matter for the docker image), then a different port can be mapped to 80.

Also the selection of 8080 and especially 9090 is a bit random (why not also 8181, 8282, 8000, 8001, …?

I suggest to get rid of this implicit mapping and allow a mapping in the enricher configuration. This could be

<enricher>
  <config>
    <fmp-service>
       <ports>80=8080,81=9090</ports>
     ....

This could be shortened to <port>80</port> if only one port is exposed.

If there are no objections, I would implement it that way, and would add this mapping to all quickstarts / devops / … images which currently have used this implicit service mapping (I would scrap in the generated yaml files).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
rhusscommented, Mar 14, 2017

Update now to the DefaultServiceEnricher to allow to remove the legacy mapping 8080 / 9090 --> 80.

It’s still enabled because I don’t know what apps it is going to affect as it is not backwards compatible.

Two new config options has been added:

  • legacyPortMapping : Enable the old mapping 8080 / 9090 --> 80 (switched on by default but would like to turn if off soon)
  • port : Service port to use for the first pod port to map, that’s the first exposed port from the first configured image for a pod.

If a build relies on the old, implicit mapping, the fix is to add:

<configuration>
   <enricher>
      <config>
          <fmp-service>
              <legacyPortMapping>true</true>
               <!-- Alternatively: -->
               <port>80</port>
          </fmp-service>
      </config>
   </enricher>
</configuration>

as alternative, the property fabric8.enricher.fmp-service.legacyPortMapping=true can be set (that’s true btw for every generator / enricher config, and I plan to make it even more flexible to allow to use enricher.fmp-service.legacyPortMapping, fmp-service.legacyPortMapping and legacyPortMapping, too. at least as sytem properties when given from the outside.

The question is, when should we switch over the mapping ? I suggest to make at least a 3.3.0 release to indicate this change.

@davsclaus @jstrachan @rawlingsj @jimmidyson @kameshsampath Any opinions on this ?

1reaction
rhusscommented, Dec 3, 2016

@davsclaus Its not the purpose to add the sample configuration above by default, only that you are able to provide a mapping in 1% of the use cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error removing port mapping · Issue #355 · caprover ... - GitHub
Configure a port mapping and save it; Try to delete the port mapping. Expected result: Port mapping should be deleted successfully. Actual ...
Read more >
Couchbase Server Ports
Custom Port Mapping. Most, but not all, port numbers used by Couchbase Server can be remapped from their defaults to fit the requirements...
Read more >
Server Group Services and Ports | Imperva
Defines service and port numbers for applications running in the server group and subsequently ... SecureSphere comes with a default port mapping list....
Read more >
Configuring and managing networking Red Hat Enterprise ...
Legacy network scripts support in RHEL Expand section "13. Legacy network scripts ... Configuring port forwarding using nftables Expand section "47.8.
Read more >
Kubernetes Maven Plugin - JKube - Eclipse
Default Enrichers will create a default Service and Deployment ... image exposes port 8080 with a legacy mapping this mapped to a service...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found