Commit add480e4 authored by Geoff Simmons's avatar Geoff Simmons

Get the current status of a haproxy instance before updating.

This gives us an accurate view of the configuration before running
the update, and the correct current configuration version.
parent 25533de4
......@@ -424,12 +424,7 @@ func (hc *Controller) updateInstance(inst *haproxyInst, spec *Spec) error {
}
}
for svcName, onld := range spec.Onload {
var onldMap onldSvcMap
if inst.spec != nil {
onldMap = onldSvcMap(inst.spec.Onload)
}
if tx.Version <= 1 || inst.spec == nil ||
!onldMap.hasOnldSvc(svcName) {
if !inst.status.onLoaded {
hc.log.Debugf("Onloader instance %s: "+
"adding TLS config %+v for svc %s",
inst.name, onld, svcName)
......@@ -609,7 +604,13 @@ func (hc *Controller) removeOffldrInstances(
"the instance is already deleted", inst.name)
continue
}
version := inst.status.version + 1
hc.log.Debugf("haproxy svc %s: get current status", inst.name)
if err := hc.getOffldStatus(inst); err != nil {
offldrErr := inst.mkError(err)
errs = append(errs, offldrErr)
continue
}
version := inst.status.version
hc.log.Debugf("haproxy instance %s: starting tx for version "+
"%d", inst.name, version)
tx, err := inst.dplane.StartTx(version)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment