Skip to content

Commit

Permalink
Add missing location id during deletes (#23)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Auerbeck <[email protected]>
Co-authored-by: Tyler Auerbeck <[email protected]>
  • Loading branch information
tylerauerbeck and tylerauerbeck authored Sep 11, 2023
1 parent 15cd12d commit f78273a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions internal/server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ func (s *Server) ProcessChange(messages <-chan events.Message[events.ChangeMessa
continue
}
} else {
loc := s.GetLocation(m.AdditionalSubjectIDs)

lb = &loadbalancer.LoadBalancer{
LoadBalancerID: m.SubjectID,
LbType: loadbalancer.TypeLB,
LbData: &lbapi.LoadBalancer{
Location: lbapi.LocationNode{
ID: loc.String(),
},
},
}
}

Expand Down Expand Up @@ -98,3 +105,13 @@ func (s *Server) LocationCheck(i gidx.PrefixedID) bool {

return false
}

func (s *Server) GetLocation(subjs []gidx.PrefixedID) gidx.PrefixedID {
for _, subj := range subjs {
if s.LocationCheck(subj) {
return subj
}
}

return gidx.PrefixedID("")
}
Binary file removed loadbalancer-provider-haproxy
Binary file not shown.

0 comments on commit f78273a

Please sign in to comment.