Commit 6229de47 authored by Tim Leers's avatar Tim Leers

add current Obj for handling events

parent c648beef
......@@ -562,6 +562,7 @@ func (worker *NamespaceWorker) ings2VCLSpec(ings []*net_v1.Ingress) (
addrs, extName, extPort, status := worker.
ingBackend2Addrs(namespace, *backend)
if status.IsError() {
status.Obj = ing
allStatus = append(allStatus, status)
continue
}
......@@ -569,6 +570,7 @@ func (worker *NamespaceWorker) ings2VCLSpec(ings []*net_v1.Ingress) (
getVCLSvc(namespace, backend.Service.Name,
addrs, extName, extPort)
if status.IsError() {
status.Obj = ing
allStatus = append(allStatus, status)
return vclSpec, bcfgs, onlds, allStatus
}
......@@ -605,6 +607,7 @@ func (worker *NamespaceWorker) ings2VCLSpec(ings []*net_v1.Ingress) (
path.Backend)
if status.IsError() {
status.Obj = ing
allStatus = append(allStatus, status)
return vclSpec, bcfgs, onlds, allStatus
}
......@@ -619,6 +622,7 @@ func (worker *NamespaceWorker) ings2VCLSpec(ings []*net_v1.Ingress) (
path.Backend.Service.Name, addrs,
extName, extPort)
if status.IsError() {
status.Obj = ing
allStatus = append(allStatus, status)
return vclSpec, bcfgs, onlds, allStatus
}
......@@ -649,7 +653,9 @@ func (worker *NamespaceWorker) ings2VCLSpec(ings []*net_v1.Ingress) (
namespace, ing.Name,
pathKey.Path, *path.PathType,
rule.Host)
allStatus = append(allStatus, update.MakeFatal(msg))
status = update.MakeFatal(msg)
status.Obj = ing
allStatus = append(allStatus, status)
return vclSpec, bcfgs, onlds, allStatus
}
vclRule.PathMap[pathKey] = vclSvc
......@@ -675,7 +681,9 @@ func (worker *NamespaceWorker) ings2VCLSpec(ings []*net_v1.Ingress) (
}
vclSpec.Rules = append(vclSpec.Rules, vclRule)
}
allStatus = append(allStatus, update.MakeSuccess(""))
status := update.MakeSuccess("")
status.Obj = ing
allStatus = append(allStatus, status)
}
return vclSpec, bcfgs, onlds, allStatus
}
......
......@@ -284,13 +284,18 @@ func (worker *NamespaceWorker) next() {
name + ": "
}
}
if len(status) == 1 {
worker.handleStatus(status[0], msgPfx, obj)
return
}
// for loop over status
// maybe add field to status to indentify obj
for _, s := range status {
worker.handleStatus(s, msgPfx, obj)
statusObj := &SyncObj{Type: Update, Obj: s.Obj}
if statusObj.Obj == nil {
statusObj.Obj = obj
}
worker.handleStatus(s, msgPfx, statusObj)
}
}
......
......@@ -122,6 +122,7 @@ func (t StatusType) Reason() string {
type Status struct {
Msg string
Type StatusType
Obj interface{}
}
func (status Status) String() string {
......
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