> Don't reload nginx when L4 service pods changed
Since we use lua upstream for L4 service balancer. We don't need reload nginx when L4 service pod changed.
This commit is contained in:
parent
bd74dce19c
commit
b03049c0af
1 changed files with 31 additions and 0 deletions
|
@ -751,6 +751,33 @@ func clearCertificates(config *ingress.Configuration) {
|
||||||
config.Servers = clearedServers
|
config.Servers = clearedServers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper function to clear endpoints from the ingress configuration since they should be ignored when
|
||||||
|
// checking if the new configuration changes can be applied dynamically.
|
||||||
|
func clearL4serviceEndpoints(config *ingress.Configuration) {
|
||||||
|
var clearedTCPL4Services []ingress.L4Service
|
||||||
|
var clearedUDPL4Services []ingress.L4Service
|
||||||
|
for _, service := range config.TCPEndpoints {
|
||||||
|
copyofService := ingress.L4Service{
|
||||||
|
Port: service.Port,
|
||||||
|
Backend: service.Backend,
|
||||||
|
Endpoints: []ingress.Endpoint{},
|
||||||
|
Service: nil,
|
||||||
|
}
|
||||||
|
clearedTCPL4Services = append(clearedTCPL4Services, copyofService)
|
||||||
|
}
|
||||||
|
for _, service := range config.UDPEndpoints {
|
||||||
|
copyofService := ingress.L4Service{
|
||||||
|
Port: service.Port,
|
||||||
|
Backend: service.Backend,
|
||||||
|
Endpoints: []ingress.Endpoint{},
|
||||||
|
Service: nil,
|
||||||
|
}
|
||||||
|
clearedUDPL4Services = append(clearedUDPL4Services, copyofService)
|
||||||
|
}
|
||||||
|
config.TCPEndpoints = clearedTCPL4Services
|
||||||
|
config.UDPEndpoints = clearedUDPL4Services
|
||||||
|
}
|
||||||
|
|
||||||
// IsDynamicConfigurationEnough returns whether a Configuration can be
|
// IsDynamicConfigurationEnough returns whether a Configuration can be
|
||||||
// dynamically applied, without reloading the backend.
|
// dynamically applied, without reloading the backend.
|
||||||
func (n *NGINXController) IsDynamicConfigurationEnough(pcfg *ingress.Configuration) bool {
|
func (n *NGINXController) IsDynamicConfigurationEnough(pcfg *ingress.Configuration) bool {
|
||||||
|
@ -759,6 +786,10 @@ func (n *NGINXController) IsDynamicConfigurationEnough(pcfg *ingress.Configurati
|
||||||
|
|
||||||
copyOfRunningConfig.Backends = []*ingress.Backend{}
|
copyOfRunningConfig.Backends = []*ingress.Backend{}
|
||||||
copyOfPcfg.Backends = []*ingress.Backend{}
|
copyOfPcfg.Backends = []*ingress.Backend{}
|
||||||
|
|
||||||
|
clearL4serviceEndpoints(©OfRunningConfig)
|
||||||
|
clearL4serviceEndpoints(©OfPcfg)
|
||||||
|
|
||||||
copyOfRunningConfig.ControllerPodsCount = 0
|
copyOfRunningConfig.ControllerPodsCount = 0
|
||||||
copyOfPcfg.ControllerPodsCount = 0
|
copyOfPcfg.ControllerPodsCount = 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue