Add maglev_backend_info variable that correlates backend/address/healthcheck/source_tag
This commit is contained in:
@@ -123,6 +123,7 @@ type TCPParams struct {
|
||||
type Backend struct {
|
||||
Address net.IP
|
||||
HealthCheck string // name reference into Config.HealthChecks; "" = no probing, assume healthy
|
||||
SourceTag string // nginx source tag; defaults to the backend name if omitted from config
|
||||
Enabled bool // default true; false = exclude from serving entirely
|
||||
}
|
||||
|
||||
@@ -218,7 +219,8 @@ type rawParams struct {
|
||||
type rawBackend struct {
|
||||
Address string `yaml:"address"`
|
||||
HealthCheck string `yaml:"healthcheck"`
|
||||
Enabled *bool `yaml:"enabled"` // nil → default true
|
||||
SourceTag string `yaml:"source-tag"` // defaults to backend name if omitted
|
||||
Enabled *bool `yaml:"enabled"` // nil → default true
|
||||
}
|
||||
|
||||
type rawPoolBackend struct {
|
||||
@@ -588,9 +590,14 @@ func convertBackend(name string, r *rawBackend, hcs map[string]HealthCheck) (Bac
|
||||
return Backend{}, fmt.Errorf("invalid address %q", r.Address)
|
||||
}
|
||||
|
||||
sourceTag := r.SourceTag
|
||||
if sourceTag == "" {
|
||||
sourceTag = name
|
||||
}
|
||||
b := Backend{
|
||||
Address: ip,
|
||||
HealthCheck: r.HealthCheck,
|
||||
SourceTag: sourceTag,
|
||||
Enabled: boolDefault(r.Enabled, true),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user