This commit is contained in:
Manuel de Brito Fontes 2016-09-23 10:13:02 -03:00
parent 6e0944eb98
commit 8e6257c51f
3 changed files with 20 additions and 62 deletions

View file

@ -159,7 +159,7 @@ func (k *Kubernetes) Records(name string, exact bool) ([]msg.Service, error) {
}
// TODO: assemble name from parts found in k8s data based on name template rather than reusing query string
func (k *Kubernetes) getRecordsForServiceItems(serviceItems []api.Service, values nametemplate.NameValues) []msg.Service {
func (k *Kubernetes) getRecordsForServiceItems(serviceItems []*api.Service, values nametemplate.NameValues) []msg.Service {
var records []msg.Service
for _, item := range serviceItems {
@ -182,12 +182,12 @@ func (k *Kubernetes) getRecordsForServiceItems(serviceItems []api.Service, value
}
// Get performs the call to the Kubernetes http API.
func (k *Kubernetes) Get(namespace string, nsWildcard bool, servicename string, serviceWildcard bool) ([]api.Service, error) {
func (k *Kubernetes) Get(namespace string, nsWildcard bool, servicename string, serviceWildcard bool) ([]*api.Service, error) {
serviceList := k.APIConn.GetServiceList()
var resultItems []api.Service
var resultItems []*api.Service
for _, item := range serviceList.Items {
for _, item := range serviceList {
if symbolMatches(namespace, item.Namespace, nsWildcard) && symbolMatches(servicename, item.Name, serviceWildcard) {
// If namespace has a wildcard, filter results against Corefile namespace list.
// (Namespaces without a wildcard were filtered before the call to this function.)
@ -220,11 +220,11 @@ func isKubernetesNameError(err error) bool {
}
func (k *Kubernetes) getServiceRecordForIP(ip, name string) []msg.Service {
svcList, err := k.APIConn.svcLister.List()
svcList, err := k.APIConn.svcLister.List(labels.Everything())
if err != nil {
return nil
}
for _, service := range svcList.Items {
for _, service := range svcList {
if service.Spec.ClusterIP == ip {
return []msg.Service{msg.Service{Host: ip}}
}