Пример #1
0
// experimental returns the resources and codec for the experimental api
func (m *Master) experimental(c *Config) *apiserver.APIGroupVersion {
	controllerStorage := expcontrolleretcd.NewStorage(c.ExpDatabaseStorage)
	autoscalerStorage := horizontalpodautoscaleretcd.NewREST(c.ExpDatabaseStorage)
	thirdPartyResourceStorage := thirdpartyresourceetcd.NewREST(c.ExpDatabaseStorage)
	daemonSetStorage := daemonetcd.NewREST(c.ExpDatabaseStorage)
	deploymentStorage := deploymentetcd.NewREST(c.ExpDatabaseStorage)
	jobStorage := jobetcd.NewREST(c.ExpDatabaseStorage)

	thirdPartyControl := ThirdPartyController{
		master: m,
		thirdPartyResourceRegistry: thirdPartyResourceStorage,
	}
	go func() {
		util.Forever(func() {
			if err := thirdPartyControl.SyncResources(); err != nil {
				glog.Warningf("third party resource sync failed: %v", err)
			}
		}, 10*time.Second)
	}()
	storage := map[string]rest.Storage{
		strings.ToLower("replicationControllers"):       controllerStorage.ReplicationController,
		strings.ToLower("replicationControllers/scale"): controllerStorage.Scale,
		strings.ToLower("horizontalpodautoscalers"):     autoscalerStorage,
		strings.ToLower("thirdpartyresources"):          thirdPartyResourceStorage,
		strings.ToLower("daemonsets"):                   daemonSetStorage,
		strings.ToLower("deployments"):                  deploymentStorage,
		strings.ToLower("jobs"):                         jobStorage,
	}

	return &apiserver.APIGroupVersion{
		Root: m.apiGroupPrefix + "/" + latest.GroupOrDie("experimental").Group,

		Creater:   api.Scheme,
		Convertor: api.Scheme,
		Typer:     api.Scheme,

		Mapper:  latest.GroupOrDie("experimental").RESTMapper,
		Codec:   latest.GroupOrDie("experimental").Codec,
		Linker:  latest.GroupOrDie("experimental").SelfLinker,
		Storage: storage,
		Version: latest.GroupOrDie("experimental").Version,

		Admit:   m.admissionControl,
		Context: m.requestContextMapper,

		ProxyDialerFn:     m.dialer,
		MinRequestTimeout: m.minRequestTimeout,
	}
}
Пример #2
0
// experimental returns the resources and codec for the experimental api
func (m *Master) experimental(c *Config) *apiserver.APIGroupVersion {
	controllerStorage := expcontrolleretcd.NewStorage(c.ExpDatabaseStorage)
	autoscalerStorage := horizontalpodautoscaleretcd.NewREST(c.ExpDatabaseStorage)
	thirdPartyResourceStorage := thirdpartyresourceetcd.NewREST(c.ExpDatabaseStorage)
	daemonSetStorage := daemonetcd.NewREST(c.ExpDatabaseStorage)
	deploymentStorage := deploymentetcd.NewREST(c.ExpDatabaseStorage)
	jobStorage := jobetcd.NewREST(c.ExpDatabaseStorage)

	storage := map[string]rest.Storage{
		strings.ToLower("replicationControllers"):       controllerStorage.ReplicationController,
		strings.ToLower("replicationControllers/scale"): controllerStorage.Scale,
		strings.ToLower("horizontalpodautoscalers"):     autoscalerStorage,
		strings.ToLower("thirdpartyresources"):          thirdPartyResourceStorage,
		strings.ToLower("daemonsets"):                   daemonSetStorage,
		strings.ToLower("deployments"):                  deploymentStorage,
		strings.ToLower("jobs"):                         jobStorage,
	}

	return &apiserver.APIGroupVersion{
		Root: m.expAPIPrefix,

		Creater:   api.Scheme,
		Convertor: api.Scheme,
		Typer:     api.Scheme,

		Mapper:  latest.GroupOrDie("experimental").RESTMapper,
		Codec:   latest.GroupOrDie("experimental").Codec,
		Linker:  latest.GroupOrDie("experimental").SelfLinker,
		Storage: storage,
		Version: latest.GroupOrDie("experimental").Version,

		Admit:   m.admissionControl,
		Context: m.requestContextMapper,

		ProxyDialerFn:     m.dialer,
		MinRequestTimeout: m.minRequestTimeout,
	}
}