mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-04 03:03:14 -05:00 
			
		
		
		
	This was added, but didn't see any use. For a large, complex chunk of code we should have some users of it. Remove all watch functionally from plugins, servers and packages. Fixes: #2548 Signed-off-by: Miek Gieben <miek@miek.nl>
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package kubernetes
 | 
						|
 | 
						|
import (
 | 
						|
	meta "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
						|
	"k8s.io/apimachinery/pkg/labels"
 | 
						|
	"k8s.io/apimachinery/pkg/watch"
 | 
						|
	"k8s.io/client-go/kubernetes"
 | 
						|
)
 | 
						|
 | 
						|
func serviceWatchFunc(c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) {
 | 
						|
	return func(options meta.ListOptions) (watch.Interface, error) {
 | 
						|
		if s != nil {
 | 
						|
			options.LabelSelector = s.String()
 | 
						|
		}
 | 
						|
		w, err := c.CoreV1().Services(ns).Watch(options)
 | 
						|
		return w, err
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
func podWatchFunc(c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) {
 | 
						|
	return func(options meta.ListOptions) (watch.Interface, error) {
 | 
						|
		if s != nil {
 | 
						|
			options.LabelSelector = s.String()
 | 
						|
		}
 | 
						|
		w, err := c.CoreV1().Pods(ns).Watch(options)
 | 
						|
		return w, err
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
func endpointsWatchFunc(c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) {
 | 
						|
	return func(options meta.ListOptions) (watch.Interface, error) {
 | 
						|
		if s != nil {
 | 
						|
			options.LabelSelector = s.String()
 | 
						|
		}
 | 
						|
		w, err := c.CoreV1().Endpoints(ns).Watch(options)
 | 
						|
		return w, err
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
func namespaceWatchFunc(c kubernetes.Interface, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) {
 | 
						|
	return func(options meta.ListOptions) (watch.Interface, error) {
 | 
						|
		if s != nil {
 | 
						|
			options.LabelSelector = s.String()
 | 
						|
		}
 | 
						|
		w, err := c.CoreV1().Namespaces().Watch(options)
 | 
						|
		return w, err
 | 
						|
	}
 | 
						|
}
 |