Documentation
¶
Index ¶
Constants ¶
const ProxyContainerName = "falcon-proxy"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Syncer ¶
type Syncer struct {
Client *client.Client
Context context.Context
CancelFunc context.CancelFunc
EventChannel <-chan events.Message
ContainerId string
}
Syncer is the class responsible for ensuring that the Traefik container stays in sync with all Docker networks on the machine, joining them when they're created and leaving them when they're destroyed. Note that an empty Syncer will NOT work. You must call the `NewSyncer` function instead.
func NewSyncer ¶
Creates a new ProxySyncer struct for syncing a container with all Docker networks on a machine. Returns an empty struct and an error if it was unable to construct the Docker client.
func (Syncer) Sync ¶
Sync determines what networks the proxy container needs to join and which networks it needs to leave and joins and leaves those networks as appropriate. It does this by determining which networks the syncer container is already a part of and which networks are considered valid. If the syncer hasn't joined a valid network, it joins it. If the syncer is still part of an invalid network, then it leaves it.
While this is more expensive to compute than say, listening to all network connect/leave events and determining the action based on the network event, it is much more durable. If something goes wrong and one sync errors for some strange reason or if we miss an event, we can "catch up" on the next network event, rather than be stuck in an invalid state until the container is restarted.