Commit c30e9e7c authored by Geoff Simmons's avatar Geoff Simmons

Fix tracking whether the haproxy offloader frontend is configured.

parent cd79308d
...@@ -121,6 +121,7 @@ type configStatus struct { ...@@ -121,6 +121,7 @@ type configStatus struct {
dplaneState ReloadState dplaneState ReloadState
version int64 version int64
pemExists bool pemExists bool
loaded bool
} }
type haproxyInst struct { type haproxyInst struct {
...@@ -315,6 +316,7 @@ func (hc *Controller) updateInstance(inst *haproxyInst, spec *Spec) error { ...@@ -315,6 +316,7 @@ func (hc *Controller) updateInstance(inst *haproxyInst, spec *Spec) error {
hc.log.Infof("Offloader instance %s: TLS config %s sucessfully"+ hc.log.Infof("Offloader instance %s: TLS config %s sucessfully"+
"loaded at %s", inst.name, spec, "loaded at %s", inst.name, spec,
state.Timestamp.Format(time.RFC3339)) state.Timestamp.Format(time.RFC3339))
inst.status.loaded = true
return nil return nil
case Failed, Unknown: case Failed, Unknown:
return fmt.Errorf("Offloader instance %s: TLS config %s load "+ return fmt.Errorf("Offloader instance %s: TLS config %s load "+
...@@ -333,6 +335,7 @@ func (hc *Controller) updateInstance(inst *haproxyInst, spec *Spec) error { ...@@ -333,6 +335,7 @@ func (hc *Controller) updateInstance(inst *haproxyInst, spec *Spec) error {
hc.log.Infof("Offloader instance %s: TLS config %s "+ hc.log.Infof("Offloader instance %s: TLS config %s "+
"successfully loaded at %s", inst.name, spec, "successfully loaded at %s", inst.name, spec,
state.Timestamp.Format(time.RFC3339)) state.Timestamp.Format(time.RFC3339))
inst.status.loaded = true
return nil return nil
} }
// XXX SyncIncomplete // XXX SyncIncomplete
...@@ -377,7 +380,7 @@ func (hc *Controller) updateOffldSvc(svcKey string) error { ...@@ -377,7 +380,7 @@ func (hc *Controller) updateOffldSvc(svcKey string) error {
} }
// XXX metrics // XXX metrics
hc.log.Debugf("offloader svc %s: get current status", inst.name) hc.log.Debugf("offloader svc %s: get current status", inst.name)
if err := hc.getOffldStatus(*inst); err != nil { if err := hc.getOffldStatus(inst); err != nil {
offldrErr := inst.mkError(err) offldrErr := inst.mkError(err)
errs = append(errs, offldrErr) errs = append(errs, offldrErr)
continue continue
...@@ -579,7 +582,7 @@ func (hc *Controller) updateOffldrAddrs(key string, addrs []OffldAddr, ...@@ -579,7 +582,7 @@ func (hc *Controller) updateOffldrAddrs(key string, addrs []OffldAddr,
return errs return errs
} }
func (hc *Controller) getOffldStatus(inst haproxyInst) error { func (hc *Controller) getOffldStatus(inst *haproxyInst) error {
hc.log.Debugf("Offloader instance %s, checking offloader config", hc.log.Debugf("Offloader instance %s, checking offloader config",
inst.name) inst.name)
inst.admMtx.Lock() inst.admMtx.Lock()
...@@ -592,6 +595,7 @@ func (hc *Controller) getOffldStatus(inst haproxyInst) error { ...@@ -592,6 +595,7 @@ func (hc *Controller) getOffldStatus(inst haproxyInst) error {
return err return err
} }
inst.status.version = int64(version) inst.status.version = int64(version)
inst.status.loaded = loaded
if loaded { if loaded {
hc.log.Infof("Offloader instance %s: offloader configured, "+ hc.log.Infof("Offloader instance %s: offloader configured, "+
"version=%d", inst.name, version) "version=%d", inst.name, 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