Support for all services kinds (and sticky) in CRD

Co-authored-by: Jean-Baptiste Doumenjou <jb.doumenjou@gmail.com>
Co-authored-by: Julien Salleyron <julien.salleyron@gmail.com>
This commit is contained in:
mpl 2019-11-14 19:28:04 +01:00 committed by Traefiker Bot
parent 424e2a9439
commit f30a52c2dc
42 changed files with 3344 additions and 354 deletions

View file

@ -38,6 +38,7 @@ type clientMock struct {
ingressRouteTCPs []*v1alpha1.IngressRouteTCP
middlewares []*v1alpha1.Middleware
tlsOptions []*v1alpha1.TLSOption
traefikServices []*v1alpha1.TraefikService
watchChan chan interface{}
}
@ -64,6 +65,8 @@ func newClientMock(paths ...string) clientMock {
c.ingressRouteTCPs = append(c.ingressRouteTCPs, o)
case *v1alpha1.Middleware:
c.middlewares = append(c.middlewares, o)
case *v1alpha1.TraefikService:
c.traefikServices = append(c.traefikServices, o)
case *v1alpha1.TLSOption:
c.tlsOptions = append(c.tlsOptions, o)
case *v1beta12.Ingress:
@ -91,6 +94,20 @@ func (c clientMock) GetMiddlewares() []*v1alpha1.Middleware {
return c.middlewares
}
func (c clientMock) GetTraefikService(namespace, name string) (*v1alpha1.TraefikService, bool, error) {
for _, svc := range c.traefikServices {
if svc.Namespace == namespace && svc.Name == name {
return svc, true, nil
}
}
return nil, false, nil
}
func (c clientMock) GetTraefikServices() []*v1alpha1.TraefikService {
return c.traefikServices
}
func (c clientMock) GetTLSOptions() []*v1alpha1.TLSOption {
return c.tlsOptions
}