mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			71 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			71 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
/*
 | 
						|
Copyright 2016 The Kubernetes Authors.
 | 
						|
 | 
						|
Licensed under the Apache License, Version 2.0 (the "License");
 | 
						|
you may not use this file except in compliance with the License.
 | 
						|
You may obtain a copy of the License at
 | 
						|
 | 
						|
    http://www.apache.org/licenses/LICENSE-2.0
 | 
						|
 | 
						|
Unless required by applicable law or agreed to in writing, software
 | 
						|
distributed under the License is distributed on an "AS IS" BASIS,
 | 
						|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
						|
See the License for the specific language governing permissions and
 | 
						|
limitations under the License.
 | 
						|
*/
 | 
						|
 | 
						|
package informers
 | 
						|
 | 
						|
import (
 | 
						|
	"reflect"
 | 
						|
 | 
						|
	"k8s.io/kubernetes/pkg/api"
 | 
						|
	"k8s.io/kubernetes/pkg/apis/extensions"
 | 
						|
	"k8s.io/kubernetes/pkg/client/cache"
 | 
						|
	"k8s.io/kubernetes/pkg/runtime"
 | 
						|
	"k8s.io/kubernetes/pkg/watch"
 | 
						|
)
 | 
						|
 | 
						|
// DaemonSetInformer is type of SharedIndexInformer which watches and lists all pods.
 | 
						|
// Interface provides constructor for informer and lister for pods
 | 
						|
type DaemonSetInformer interface {
 | 
						|
	Informer() cache.SharedIndexInformer
 | 
						|
	Lister() *cache.StoreToDaemonSetLister
 | 
						|
}
 | 
						|
 | 
						|
type daemonSetInformer struct {
 | 
						|
	*sharedInformerFactory
 | 
						|
}
 | 
						|
 | 
						|
func (f *daemonSetInformer) Informer() cache.SharedIndexInformer {
 | 
						|
	f.lock.Lock()
 | 
						|
	defer f.lock.Unlock()
 | 
						|
 | 
						|
	informerType := reflect.TypeOf(&extensions.DaemonSet{})
 | 
						|
	informer, exists := f.informers[informerType]
 | 
						|
	if exists {
 | 
						|
		return informer
 | 
						|
	}
 | 
						|
	informer = cache.NewSharedIndexInformer(
 | 
						|
		&cache.ListWatch{
 | 
						|
			ListFunc: func(options api.ListOptions) (runtime.Object, error) {
 | 
						|
				return f.client.Extensions().DaemonSets(api.NamespaceAll).List(options)
 | 
						|
			},
 | 
						|
			WatchFunc: func(options api.ListOptions) (watch.Interface, error) {
 | 
						|
				return f.client.Extensions().DaemonSets(api.NamespaceAll).Watch(options)
 | 
						|
			},
 | 
						|
		},
 | 
						|
		&extensions.DaemonSet{},
 | 
						|
		f.defaultResync,
 | 
						|
		cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
 | 
						|
	)
 | 
						|
	f.informers[informerType] = informer
 | 
						|
 | 
						|
	return informer
 | 
						|
}
 | 
						|
 | 
						|
func (f *daemonSetInformer) Lister() *cache.StoreToDaemonSetLister {
 | 
						|
	informer := f.Informer()
 | 
						|
	return &cache.StoreToDaemonSetLister{Store: informer.GetIndexer()}
 | 
						|
}
 |