Beispiel #1
0
func newKubeDNS() *KubeDNS {
	return &KubeDNS{
		domain:     testDomain,
		domainPath: util.ReverseArray(strings.Split(strings.TrimRight(testDomain, "."), ".")),

		endpointsStore: cache.NewStore(cache.MetaNamespaceKeyFunc),
		servicesStore:  cache.NewStore(cache.MetaNamespaceKeyFunc),
		nodesStore:     cache.NewStore(cache.MetaNamespaceKeyFunc),

		cache:               treecache.NewTreeCache(),
		reverseRecordMap:    make(map[string]*skymsg.Service),
		clusterIPServiceMap: make(map[string]*v1.Service),
		cacheLock:           sync.RWMutex{},

		config:     config.NewDefaultConfig(),
		configLock: sync.RWMutex{},
		configSync: config.NewNopSync(config.NewDefaultConfig()),
	}
}
Beispiel #2
0
func (kd *KubeDNS) startConfigMapSync() {
	initialConfig, err := kd.configSync.Once()
	if err != nil {
		glog.Errorf(
			"Error getting initial ConfigMap: %v, starting with default values", err)
		kd.config = config.NewDefaultConfig()
	} else {
		kd.config = initialConfig
	}

	go kd.syncConfigMap(kd.configSync.Periodic())
}