1
0
Fork 0
mirror of https://github.com/nginx-proxy/nginx-proxy synced 2024-05-19 22:16:07 +02:00

fix: Partially revert "chore: Remove support for legacy swarm"

This partially reverts commit 2494e20784
by ignoring any network named "ingress" when searching for a
container's IP address.

That commit was technically a backwards-incompatible change: Some
users use nginx-proxy with Swarm mode even though it is not fully
supported.  In such cases nginx-proxy should ignore the `ingress`
network, otherwise nginx will not be able to reach the
server (container-to-container traffic apparently doesn't work over
the Swarm `ingress` network).

The parts of that commit that examine the `SwarmNode` structure are
not reverted here because docker-gen does not currently populate that
structure -- not even when both docker-gen and the service task
container are running on the same manager node.
This commit is contained in:
Richard Hansen 2023-02-17 01:52:05 -05:00
parent 6f2a549ef1
commit 6207be5f8f

View File

@ -41,6 +41,14 @@
{{- $ip := "" }}
# networks:
{{- range sortObjectsByKeysAsc $.container.Networks "Name" }}
{{- /*
* TODO: Only ignore the "ingress" network for Swarm tasks (in case
* the user is not using Swarm mode and names a network "ingress").
*/}}
{{- if eq .Name "ingress" }}
# {{ .Name }} (ignored)
{{- continue }}
{{- end }}
{{- if and (not (index $.globals.networks .Name)) (not $.globals.networks.host) }}
# {{ .Name }} (unreachable)
{{- continue }}