diff --git a/provider/rancher.go b/provider/rancher.go index 3b2b95e8b..6863293e6 100644 --- a/provider/rancher.go +++ b/provider/rancher.go @@ -25,6 +25,10 @@ const ( RancherDefaultWatchTime = 15 * time.Second ) +var ( + withoutPagination *rancher.ListOpts +) + var _ Provider = (*Rancher)(nil) // Rancher holds configurations of the Rancher provider. @@ -44,6 +48,12 @@ type rancherData struct { Health string } +func init() { + withoutPagination = &rancher.ListOpts{ + Filters: map[string]interface{}{"limit": 0}, + } +} + func (r rancherData) String() string { return fmt.Sprintf("{name:%s, labels:%v, containers: %v, health: %s}", r.Name, r.Labels, r.Containers, r.Health) } @@ -290,7 +300,7 @@ func listRancherEnvironments(client *rancher.RancherClient) []*rancher.Environme var environmentList = []*rancher.Environment{} - environments, err := client.Environment.List(nil) + environments, err := client.Environment.List(withoutPagination) if err != nil { log.Errorf("Cannot get Rancher Environments %+v", err) @@ -307,7 +317,7 @@ func listRancherServices(client *rancher.RancherClient) []*rancher.Service { var servicesList = []*rancher.Service{} - services, err := client.Service.List(nil) + services, err := client.Service.List(withoutPagination) if err != nil { log.Errorf("Cannot get Rancher Services %+v", err) @@ -324,7 +334,7 @@ func listRancherContainer(client *rancher.RancherClient) []*rancher.Container { containerList := []*rancher.Container{} - container, err := client.Container.List(nil) + container, err := client.Container.List(withoutPagination) log.Debugf("first container len: %i", len(container.Data))