mirror of
https://github.com/coredns/coredns.git
synced 2025-10-29 17:24:20 -04:00
Lister refactor kubernetes/kubernetes#33269
This commit is contained in:
@@ -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}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user