Browse code

hide swarm plugins behind experimental flag

Signed-off-by: Victor Vieux <victorvieux@gmail.com>

Victor Vieux authored on 2017/08/09 10:33:25
Showing 4 changed files
... ...
@@ -2030,7 +2030,7 @@ definitions:
2030 2030
     properties:
2031 2031
       PluginSpec:
2032 2032
         type: "object"
2033
-        description: "Invalid when specified with `ContainerSpec`."
2033
+        description: "Invalid when specified with `ContainerSpec`. *(Experimental release only.)*"
2034 2034
         properties:
2035 2035
           Name:
2036 2036
             description: "The name or 'alias' to use for the plugin."
... ...
@@ -185,13 +185,17 @@ func (e *executor) Controller(t *api.Task) (exec.Controller, error) {
185 185
 		}
186 186
 		switch runtimeKind {
187 187
 		case string(swarmtypes.RuntimePlugin):
188
+			info, _ := e.backend.SystemInfo()
189
+			if !info.ExperimentalBuild {
190
+				return ctlr, fmt.Errorf("runtime type %q only supported in experimental", swarmtypes.RuntimePlugin)
191
+			}
188 192
 			c, err := plugin.NewController(e.pluginBackend, t)
189 193
 			if err != nil {
190 194
 				return ctlr, err
191 195
 			}
192 196
 			ctlr = c
193 197
 		default:
194
-			return ctlr, fmt.Errorf("unsupported runtime type: %q", r.Generic.Kind)
198
+			return ctlr, fmt.Errorf("unsupported runtime type: %q", runtimeKind)
195 199
 		}
196 200
 	case *api.TaskSpec_Container:
197 201
 		c, err := newController(e.backend, t, dependencyGetter)
... ...
@@ -139,9 +139,16 @@ func (c *Cluster) CreateService(s types.ServiceSpec, encodedAuth string, queryRe
139 139
 		case *swarmapi.TaskSpec_Generic:
140 140
 			switch serviceSpec.Task.GetGeneric().Kind {
141 141
 			case string(types.RuntimePlugin):
142
+				info, _ := c.config.Backend.SystemInfo()
143
+				if !info.ExperimentalBuild {
144
+					return fmt.Errorf("runtime type %q only supported in experimental", types.RuntimePlugin)
145
+				}
142 146
 				if s.TaskTemplate.PluginSpec == nil {
143 147
 					return errors.New("plugin spec must be set")
144 148
 				}
149
+
150
+			default:
151
+				return fmt.Errorf("unsupported runtime type: %q", serviceSpec.Task.GetGeneric().Kind)
145 152
 			}
146 153
 
147 154
 			r, err := state.controlClient.CreateService(ctx, &swarmapi.CreateServiceRequest{Spec: &serviceSpec})
... ...
@@ -603,7 +603,8 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesStateReporting(c *check.C) {
603 603
 
604 604
 // Test plugins deployed via swarm services
605 605
 func (s *DockerSwarmSuite) TestAPISwarmServicesPlugin(c *check.C) {
606
-	testRequires(c, DaemonIsLinux, IsAmd64)
606
+	testRequires(c, ExperimentalDaemon, DaemonIsLinux, IsAmd64)
607
+
607 608
 	reg := setupRegistry(c, false, "", "")
608 609
 	defer reg.Close()
609 610