Documentation
¶
Overview ¶
Package state manages traefik dynamic configurations per environment, merging local files and agent submissions into a single master config.
Index ¶
- type Agent
- type Collision
- type Config
- type SharedService
- type Snapshot
- type State
- func (s *State) AgentConnected(env, name, addr string)
- func (s *State) AgentDisconnected(env, name string)
- func (s *State) EnvNames() []string
- func (s *State) Snapshot(env string) *Snapshot
- func (s *State) Subscribe(env string) chan *Snapshot
- func (s *State) Unsubscribe(env string, ch chan *Snapshot)
- func (s *State) UpdateAgent(env, name string, cfg Config)
- func (s *State) WatchUpstream(ctx context.Context, name, url string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶ added in v0.4.0
type Agent struct {
Name string `json:"name"`
Addr string `json:"addr"`
Connected bool `json:"connected"`
Since time.Time `json:"since"`
Updated time.Time `json:"updated"`
Routers int `json:"routers"`
Services int `json:"services"`
// contains filtered or unexported fields
}
Agent is a tetherd instance pushing its container config.
type Collision ¶ added in v0.4.0
type Collision struct {
Kind string `json:"kind"`
Name string `json:"name"`
Source string `json:"source"`
Owner string `json:"owner"`
}
Collision is an entry skipped because an earlier source already defined it differently.
type Config ¶ added in v0.4.0
Config is a traefik dynamic configuration as plain JSON values. Tether only reads the layout (sections, entry maps, router services, load balancer servers), everything else passes through untouched, so it works with any traefik version.
type SharedService ¶ added in v0.4.0
type SharedService struct {
}
SharedService is an HTTP service load balanced across several agents.
type Snapshot ¶ added in v0.4.0
type Snapshot struct {
Config Config `json:"config"`
Agents []Agent `json:"agents"`
Collisions []Collision `json:"collisions"`
}
Snapshot is the merged view of one environment. Never mutated after creation.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State holds traefik configurations grouped by environment.
func (*State) AgentConnected ¶ added in v0.4.0
AgentConnected registers a new connection for the agent.
func (*State) AgentDisconnected ¶ added in v0.4.0
AgentDisconnected drops a connection. Once the agent has no connections left its routes are kept for expireAfter, then removed unless it reconnects.
func (*State) Snapshot ¶ added in v0.4.0
Snapshot returns the current merged view of the environment.
func (*State) Unsubscribe ¶
Unsubscribe removes a subscription channel.
func (*State) UpdateAgent ¶
UpdateAgent replaces an agent's config and rebuilds the environment.