コード例 #1
0
ファイル: server.go プロジェクト: ConnorDoyle/kubernetes
func NewKubeDNSServerDefault(config *options.KubeDNSConfig) *KubeDNSServer {
	kubeClient, err := newKubeClient(config)
	if err != nil {
		glog.Fatalf("Failed to create a kubernetes client: %v", err)
	}

	var configSync dnsconfig.Sync
	if config.ConfigMap == "" {
		glog.V(0).Infof("ConfigMap not configured, using values from command line flags")
		configSync = dnsconfig.NewNopSync(
			&dnsconfig.Config{Federations: config.Federations})
	} else {
		glog.V(0).Infof("Using configuration read from ConfigMap: %v:%v",
			config.ConfigMapNs, config.ConfigMap)
		configSync = dnsconfig.NewSync(
			kubeClient, config.ConfigMapNs, config.ConfigMap)
	}

	return &KubeDNSServer{
		domain:         config.ClusterDomain,
		healthzPort:    config.HealthzPort,
		dnsBindAddress: config.DNSBindAddress,
		dnsPort:        config.DNSPort,
		kd:             kdns.NewKubeDNS(kubeClient, config.ClusterDomain, config.InitialSyncTimeout, configSync),
	}
}
コード例 #2
0
ファイル: server.go プロジェクト: ipbabble/kubernetes
func NewKubeDNSServerDefault(config *options.KubeDNSConfig) *KubeDNSServer {
	ks := KubeDNSServer{
		domain: config.ClusterDomain,
	}

	kubeClient, err := newKubeClient(config)
	if err != nil {
		glog.Fatalf("Failed to create a kubernetes client: %v", err)
	}
	ks.healthzPort = config.HealthzPort
	ks.kd = kdns.NewKubeDNS(kubeClient, config.ClusterDomain, config.Federations)
	return &ks
}