瀏覽代碼

Merge pull request #38813 from cpuguy83/add_experimental_interface

Had `HasExperimental()` to cluster backend
Sebastiaan van Stijn 6 年之前
父節點
當前提交
8aca18d631
共有 3 個文件被更改,包括 3 次插入4 次删除
  1. 1 0
      daemon/cluster/executor/backend.go
  2. 1 2
      daemon/cluster/executor/container/executor.go
  3. 1 2
      daemon/cluster/services.go

+ 1 - 0
daemon/cluster/executor/backend.go

@@ -61,6 +61,7 @@ type Backend interface {
 	PluginManager() *plugin.Manager
 	PluginGetter() *plugin.Store
 	GetAttachmentStore() *networkSettings.AttachmentStore
+	HasExperimental() bool
 }
 
 // VolumeBackend is used by an executor to perform volume operations

+ 1 - 2
daemon/cluster/executor/container/executor.go

@@ -229,8 +229,7 @@ func (e *executor) Controller(t *api.Task) (exec.Controller, error) {
 		}
 		switch runtimeKind {
 		case string(swarmtypes.RuntimePlugin):
-			info, _ := e.backend.SystemInfo()
-			if !info.ExperimentalBuild {
+			if !e.backend.HasExperimental() {
 				return ctlr, fmt.Errorf("runtime type %q only supported in experimental", swarmtypes.RuntimePlugin)
 			}
 			c, err := plugin.NewController(e.pluginBackend, t)

+ 1 - 2
daemon/cluster/services.go

@@ -144,8 +144,7 @@ func (c *Cluster) CreateService(s types.ServiceSpec, encodedAuth string, queryRe
 		case *swarmapi.TaskSpec_Generic:
 			switch serviceSpec.Task.GetGeneric().Kind {
 			case string(types.RuntimePlugin):
-				info, _ := c.config.Backend.SystemInfo()
-				if !info.ExperimentalBuild {
+				if !c.config.Backend.HasExperimental() {
 					return fmt.Errorf("runtime type %q only supported in experimental", types.RuntimePlugin)
 				}
 				if s.TaskTemplate.PluginSpec == nil {