コード例 #1
0
ファイル: master.go プロジェクト: nyaxt/kubernetes
func minionRegistryMaker(c *Config) registry.MinionRegistry {
	var minionRegistry registry.MinionRegistry
	if c.Cloud != nil && len(c.MinionRegexp) > 0 {
		var err error
		minionRegistry, err = registry.MakeCloudMinionRegistry(c.Cloud, c.MinionRegexp)
		if err != nil {
			glog.Errorf("Failed to initalize cloud minion registry reverting to static registry (%#v)", err)
		}
	}
	if minionRegistry == nil {
		minionRegistry = registry.MakeMinionRegistry(c.Minions)
	}
	if c.HealthCheckMinions {
		minionRegistry = registry.NewHealthyMinionRegistry(minionRegistry, &http.Client{})
	}
	if c.MinionCacheTTL > 0 {
		cachingMinionRegistry, err := registry.NewCachingMinionRegistry(minionRegistry, c.MinionCacheTTL)
		if err != nil {
			glog.Errorf("Failed to initialize caching layer, ignoring cache.")
		} else {
			minionRegistry = cachingMinionRegistry
		}
	}
	return minionRegistry
}
コード例 #2
0
ファイル: master.go プロジェクト: RubanDeventhiran/kubernetes
func minionRegistryMaker(minions []string, cloud cloudprovider.Interface, minionRegexp string, healthCheck bool, cacheTTL time.Duration) registry.MinionRegistry {
	var minionRegistry registry.MinionRegistry
	if cloud != nil && len(minionRegexp) > 0 {
		var err error
		minionRegistry, err = registry.MakeCloudMinionRegistry(cloud, minionRegexp)
		if err != nil {
			glog.Errorf("Failed to initalize cloud minion registry reverting to static registry (%#v)", err)
		}
	}
	if minionRegistry == nil {
		minionRegistry = registry.MakeMinionRegistry(minions)
	}
	if healthCheck {
		minionRegistry = registry.NewHealthyMinionRegistry(minionRegistry, &http.Client{})
	}
	if cacheTTL > 0 {
		cachingMinionRegistry, err := registry.NewCachingMinionRegistry(minionRegistry, cacheTTL)
		if err != nil {
			glog.Errorf("Failed to initialize caching layer, ignoring cache.")
		} else {
			minionRegistry = cachingMinionRegistry
		}
	}
	return minionRegistry
}
コード例 #3
0
ファイル: master.go プロジェクト: j3ffhu/kubernetes
func minionRegistryMaker(minions []string, cloud cloudprovider.Interface, minionRegexp string) registry.MinionRegistry {
	if cloud != nil && len(minionRegexp) > 0 {
		minionRegistry, err := registry.MakeCloudMinionRegistry(cloud, minionRegexp)
		if err != nil {
			glog.Errorf("Failed to initalize cloud minion registry reverting to static registry (%#v)", err)
		}
		return minionRegistry
	}
	return registry.MakeMinionRegistry(minions)
}
コード例 #4
0
ファイル: master.go プロジェクト: jjhuff/kubernetes
// Returns a new apiserver.
func New(etcdServers, minions []string, cloud cloudprovider.Interface, minionRegexp string) *Master {
	etcdClient := etcd.NewClient(etcdServers)
	var minionRegistry registry.MinionRegistry
	if cloud != nil && len(minionRegexp) > 0 {
		var err error
		minionRegistry, err = registry.MakeCloudMinionRegistry(cloud, minionRegexp)
		if err != nil {
			glog.Errorf("Failed to initalize cloud minion registry reverting to static registry (%#v)", err)
			minionRegistry = registry.MakeMinionRegistry(minions)
		}
	} else {
		minionRegistry = registry.MakeMinionRegistry(minions)
	}
	m := &Master{
		podRegistry:        registry.MakeEtcdRegistry(etcdClient, minionRegistry),
		controllerRegistry: registry.MakeEtcdRegistry(etcdClient, minionRegistry),
		serviceRegistry:    registry.MakeEtcdRegistry(etcdClient, minionRegistry),
		minionRegistry:     minionRegistry,
	}
	m.init(cloud)
	return m
}