Browse code

Move swarm runtime plugin storage type to internal

Signed-off-by: Derek McGowan <derek@mcg.dev>

Derek McGowan authored on 2025/07/29 09:36:01
Showing 15 changed files
... ...
@@ -8,13 +8,14 @@ import (
8 8
 	cerrdefs "github.com/containerd/errdefs"
9 9
 	"github.com/containerd/log"
10 10
 	"github.com/distribution/reference"
11
+	"github.com/docker/docker/daemon/cluster/internal/runtime"
11 12
 	"github.com/docker/docker/daemon/pkg/plugin"
12 13
 	v2 "github.com/docker/docker/daemon/pkg/plugin/v2"
13 14
 	"github.com/docker/docker/daemon/server/backend"
14 15
 	"github.com/gogo/protobuf/proto"
15 16
 	"github.com/moby/moby/api/types"
16 17
 	"github.com/moby/moby/api/types/registry"
17
-	"github.com/moby/moby/api/types/swarm/runtime"
18
+	"github.com/moby/moby/api/types/swarm"
18 19
 	"github.com/moby/swarmkit/v2/api"
19 20
 	"github.com/pkg/errors"
20 21
 )
... ...
@@ -30,7 +31,7 @@ import (
30 30
 // the right way to pass registry credentials via secrets.
31 31
 type Controller struct {
32 32
 	backend Backend
33
-	spec    runtime.PluginSpec
33
+	spec    swarm.RuntimeSpec
34 34
 	logger  *log.Entry
35 35
 
36 36
 	pluginID  string
... ...
@@ -70,14 +71,15 @@ func NewController(backend Backend, t *api.Task) (*Controller, error) {
70 70
 	}, nil
71 71
 }
72 72
 
73
-func readSpec(t *api.Task) (runtime.PluginSpec, error) {
73
+func readSpec(t *api.Task) (swarm.RuntimeSpec, error) {
74 74
 	var cfg runtime.PluginSpec
75 75
 
76 76
 	generic := t.Spec.GetGeneric()
77 77
 	if err := proto.Unmarshal(generic.Payload.Value, &cfg); err != nil {
78
-		return cfg, errors.Wrap(err, "error reading plugin spec")
78
+		return swarm.RuntimeSpec{}, errors.Wrap(err, "error reading plugin spec")
79 79
 	}
80
-	return cfg, nil
80
+
81
+	return runtime.ToAPI(cfg), nil
81 82
 }
82 83
 
83 84
 // Update is the update phase from swarmkit
... ...
@@ -248,7 +250,7 @@ func (p *Controller) Close() error {
248 248
 	return nil
249 249
 }
250 250
 
251
-func convertPrivileges(ls []*runtime.PluginPrivilege) types.PluginPrivileges {
251
+func convertPrivileges(ls []*swarm.RuntimePrivilege) types.PluginPrivileges {
252 252
 	var out types.PluginPrivileges
253 253
 	for _, p := range ls {
254 254
 		pp := types.PluginPrivilege{
... ...
@@ -16,7 +16,7 @@ import (
16 16
 	"github.com/docker/docker/daemon/server/backend"
17 17
 	"github.com/moby/moby/api/types"
18 18
 	"github.com/moby/moby/api/types/registry"
19
-	"github.com/moby/moby/api/types/swarm/runtime"
19
+	"github.com/moby/moby/api/types/swarm"
20 20
 	"github.com/moby/pubsub"
21 21
 	"github.com/sirupsen/logrus"
22 22
 )
... ...
@@ -325,7 +325,7 @@ func newTestController(b Backend, disabled bool) *Controller {
325 325
 	return &Controller{
326 326
 		logger:  &log.Entry{Logger: &logrus.Logger{Out: io.Discard}},
327 327
 		backend: b,
328
-		spec: runtime.PluginSpec{
328
+		spec: swarm.RuntimeSpec{
329 329
 			Name:     pluginTestName,
330 330
 			Remote:   pluginTestRemote,
331 331
 			Disabled: disabled,
... ...
@@ -4,11 +4,11 @@ import (
4 4
 	"fmt"
5 5
 	"strings"
6 6
 
7
+	"github.com/docker/docker/daemon/cluster/internal/runtime"
7 8
 	"github.com/docker/docker/pkg/namesgenerator"
8 9
 	"github.com/gogo/protobuf/proto"
9 10
 	gogotypes "github.com/gogo/protobuf/types"
10 11
 	types "github.com/moby/moby/api/types/swarm"
11
-	"github.com/moby/moby/api/types/swarm/runtime"
12 12
 	swarmapi "github.com/moby/swarmkit/v2/api"
13 13
 	"github.com/moby/swarmkit/v2/api/genericresource"
14 14
 	"github.com/pkg/errors"
... ...
@@ -210,7 +210,8 @@ func ServiceSpecToGRPC(s types.ServiceSpec) (swarmapi.ServiceSpec, error) {
210 210
 
211 211
 			s.Mode.Global = &types.GlobalService{} // must always be global
212 212
 
213
-			pluginSpec, err := proto.Marshal(s.TaskTemplate.PluginSpec)
213
+			ps := runtime.FromAPI(*s.TaskTemplate.PluginSpec)
214
+			pluginSpec, err := proto.Marshal(&ps)
214 215
 			if err != nil {
215 216
 				return swarmapi.ServiceSpec{}, err
216 217
 			}
... ...
@@ -699,7 +700,8 @@ func taskSpecFromGRPC(taskSpec swarmapi.TaskSpec) (types.TaskSpec, error) {
699 699
 				if err := proto.Unmarshal(g.Payload.Value, &p); err != nil {
700 700
 					return t, errors.Wrap(err, "error unmarshalling plugin spec")
701 701
 				}
702
-				t.PluginSpec = &p
702
+				ap := runtime.ToAPI(p)
703
+				t.PluginSpec = &ap
703 704
 			}
704 705
 		}
705 706
 	case *swarmapi.TaskSpec_Attachment:
... ...
@@ -8,7 +8,6 @@ import (
8 8
 	containertypes "github.com/moby/moby/api/types/container"
9 9
 	"github.com/moby/moby/api/types/mount"
10 10
 	swarmtypes "github.com/moby/moby/api/types/swarm"
11
-	"github.com/moby/moby/api/types/swarm/runtime"
12 11
 	swarmapi "github.com/moby/swarmkit/v2/api"
13 12
 	"gotest.tools/v3/assert"
14 13
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -89,7 +88,7 @@ func TestServiceConvertToGRPCGenericRuntimePlugin(t *testing.T) {
89 89
 	s := swarmtypes.ServiceSpec{
90 90
 		TaskTemplate: swarmtypes.TaskSpec{
91 91
 			Runtime:    swarmtypes.RuntimePlugin,
92
-			PluginSpec: &runtime.PluginSpec{},
92
+			PluginSpec: &swarmtypes.RuntimeSpec{},
93 93
 		},
94 94
 		Mode: swarmtypes.ServiceMode{
95 95
 			Global: &swarmtypes.GlobalService{},
... ...
@@ -425,7 +424,7 @@ func TestServiceConvertToGRPCMismatchedRuntime(t *testing.T) {
425 425
 	} {
426 426
 		for j, spec := range []swarmtypes.TaskSpec{
427 427
 			{ContainerSpec: &swarmtypes.ContainerSpec{}},
428
-			{PluginSpec: &runtime.PluginSpec{}},
428
+			{PluginSpec: &swarmtypes.RuntimeSpec{}},
429 429
 		} {
430 430
 			// skip the cases, where the indices match, which would not error
431 431
 			if i == j {
432 432
new file mode 100644
... ...
@@ -0,0 +1,49 @@
0
+package runtime
1
+
2
+import "github.com/moby/moby/api/types/swarm"
3
+
4
+func privilegesFromAPI(privs []*swarm.RuntimePrivilege) []*PluginPrivilege {
5
+	var out []*PluginPrivilege
6
+	for _, p := range privs {
7
+		out = append(out, &PluginPrivilege{
8
+			Name:        p.Name,
9
+			Description: p.Description,
10
+			Value:       p.Value,
11
+		})
12
+	}
13
+	return out
14
+}
15
+
16
+// FromAPI converts an API RuntimeSpec to a PluginSpec,
17
+// which can be proto encoded.
18
+func FromAPI(spec swarm.RuntimeSpec) PluginSpec {
19
+	return PluginSpec{
20
+		Name:       spec.Name,
21
+		Remote:     spec.Remote,
22
+		Privileges: privilegesFromAPI(spec.Privileges),
23
+		Disabled:   spec.Disabled,
24
+		Env:        spec.Env,
25
+	}
26
+}
27
+
28
+func privilegesToAPI(privs []*PluginPrivilege) []*swarm.RuntimePrivilege {
29
+	var out []*swarm.RuntimePrivilege
30
+	for _, p := range privs {
31
+		out = append(out, &swarm.RuntimePrivilege{
32
+			Name:        p.Name,
33
+			Description: p.Description,
34
+			Value:       p.Value,
35
+		})
36
+	}
37
+	return out
38
+}
39
+
40
+func ToAPI(spec PluginSpec) swarm.RuntimeSpec {
41
+	return swarm.RuntimeSpec{
42
+		Name:       spec.Name,
43
+		Remote:     spec.Remote,
44
+		Privileges: privilegesToAPI(spec.Privileges),
45
+		Disabled:   spec.Disabled,
46
+		Env:        spec.Env,
47
+	}
48
+}
0 49
new file mode 100644
... ...
@@ -0,0 +1,3 @@
0
+//go:generate protoc --gogofaster_out=import_path=runtime:. plugin.proto
1
+
2
+package runtime
0 3
new file mode 100644
... ...
@@ -0,0 +1,808 @@
0
+// Code generated by protoc-gen-gogo. DO NOT EDIT.
1
+// source: plugin.proto
2
+
3
+package runtime
4
+
5
+import (
6
+	fmt "fmt"
7
+	proto "github.com/gogo/protobuf/proto"
8
+	io "io"
9
+	math "math"
10
+	math_bits "math/bits"
11
+)
12
+
13
+// Reference imports to suppress errors if they are not otherwise used.
14
+var _ = proto.Marshal
15
+var _ = fmt.Errorf
16
+var _ = math.Inf
17
+
18
+// This is a compile-time assertion to ensure that this generated file
19
+// is compatible with the proto package it is being compiled against.
20
+// A compilation error at this line likely means your copy of the
21
+// proto package needs to be updated.
22
+const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
23
+
24
+// PluginSpec defines the base payload which clients can specify for creating
25
+// a service with the plugin runtime.
26
+type PluginSpec struct {
27
+	Name       string             `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
28
+	Remote     string             `protobuf:"bytes,2,opt,name=remote,proto3" json:"remote,omitempty"`
29
+	Privileges []*PluginPrivilege `protobuf:"bytes,3,rep,name=privileges,proto3" json:"privileges,omitempty"`
30
+	Disabled   bool               `protobuf:"varint,4,opt,name=disabled,proto3" json:"disabled,omitempty"`
31
+	Env        []string           `protobuf:"bytes,5,rep,name=env,proto3" json:"env,omitempty"`
32
+}
33
+
34
+func (m *PluginSpec) Reset()         { *m = PluginSpec{} }
35
+func (m *PluginSpec) String() string { return proto.CompactTextString(m) }
36
+func (*PluginSpec) ProtoMessage()    {}
37
+func (*PluginSpec) Descriptor() ([]byte, []int) {
38
+	return fileDescriptor_22a625af4bc1cc87, []int{0}
39
+}
40
+func (m *PluginSpec) XXX_Unmarshal(b []byte) error {
41
+	return m.Unmarshal(b)
42
+}
43
+func (m *PluginSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
44
+	if deterministic {
45
+		return xxx_messageInfo_PluginSpec.Marshal(b, m, deterministic)
46
+	} else {
47
+		b = b[:cap(b)]
48
+		n, err := m.MarshalToSizedBuffer(b)
49
+		if err != nil {
50
+			return nil, err
51
+		}
52
+		return b[:n], nil
53
+	}
54
+}
55
+func (m *PluginSpec) XXX_Merge(src proto.Message) {
56
+	xxx_messageInfo_PluginSpec.Merge(m, src)
57
+}
58
+func (m *PluginSpec) XXX_Size() int {
59
+	return m.Size()
60
+}
61
+func (m *PluginSpec) XXX_DiscardUnknown() {
62
+	xxx_messageInfo_PluginSpec.DiscardUnknown(m)
63
+}
64
+
65
+var xxx_messageInfo_PluginSpec proto.InternalMessageInfo
66
+
67
+func (m *PluginSpec) GetName() string {
68
+	if m != nil {
69
+		return m.Name
70
+	}
71
+	return ""
72
+}
73
+
74
+func (m *PluginSpec) GetRemote() string {
75
+	if m != nil {
76
+		return m.Remote
77
+	}
78
+	return ""
79
+}
80
+
81
+func (m *PluginSpec) GetPrivileges() []*PluginPrivilege {
82
+	if m != nil {
83
+		return m.Privileges
84
+	}
85
+	return nil
86
+}
87
+
88
+func (m *PluginSpec) GetDisabled() bool {
89
+	if m != nil {
90
+		return m.Disabled
91
+	}
92
+	return false
93
+}
94
+
95
+func (m *PluginSpec) GetEnv() []string {
96
+	if m != nil {
97
+		return m.Env
98
+	}
99
+	return nil
100
+}
101
+
102
+// PluginPrivilege describes a permission the user has to accept
103
+// upon installing a plugin.
104
+type PluginPrivilege struct {
105
+	Name        string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
106
+	Description string   `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
107
+	Value       []string `protobuf:"bytes,3,rep,name=value,proto3" json:"value,omitempty"`
108
+}
109
+
110
+func (m *PluginPrivilege) Reset()         { *m = PluginPrivilege{} }
111
+func (m *PluginPrivilege) String() string { return proto.CompactTextString(m) }
112
+func (*PluginPrivilege) ProtoMessage()    {}
113
+func (*PluginPrivilege) Descriptor() ([]byte, []int) {
114
+	return fileDescriptor_22a625af4bc1cc87, []int{1}
115
+}
116
+func (m *PluginPrivilege) XXX_Unmarshal(b []byte) error {
117
+	return m.Unmarshal(b)
118
+}
119
+func (m *PluginPrivilege) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
120
+	if deterministic {
121
+		return xxx_messageInfo_PluginPrivilege.Marshal(b, m, deterministic)
122
+	} else {
123
+		b = b[:cap(b)]
124
+		n, err := m.MarshalToSizedBuffer(b)
125
+		if err != nil {
126
+			return nil, err
127
+		}
128
+		return b[:n], nil
129
+	}
130
+}
131
+func (m *PluginPrivilege) XXX_Merge(src proto.Message) {
132
+	xxx_messageInfo_PluginPrivilege.Merge(m, src)
133
+}
134
+func (m *PluginPrivilege) XXX_Size() int {
135
+	return m.Size()
136
+}
137
+func (m *PluginPrivilege) XXX_DiscardUnknown() {
138
+	xxx_messageInfo_PluginPrivilege.DiscardUnknown(m)
139
+}
140
+
141
+var xxx_messageInfo_PluginPrivilege proto.InternalMessageInfo
142
+
143
+func (m *PluginPrivilege) GetName() string {
144
+	if m != nil {
145
+		return m.Name
146
+	}
147
+	return ""
148
+}
149
+
150
+func (m *PluginPrivilege) GetDescription() string {
151
+	if m != nil {
152
+		return m.Description
153
+	}
154
+	return ""
155
+}
156
+
157
+func (m *PluginPrivilege) GetValue() []string {
158
+	if m != nil {
159
+		return m.Value
160
+	}
161
+	return nil
162
+}
163
+
164
+func init() {
165
+	proto.RegisterType((*PluginSpec)(nil), "PluginSpec")
166
+	proto.RegisterType((*PluginPrivilege)(nil), "PluginPrivilege")
167
+}
168
+
169
+func init() { proto.RegisterFile("plugin.proto", fileDescriptor_22a625af4bc1cc87) }
170
+
171
+var fileDescriptor_22a625af4bc1cc87 = []byte{
172
+	// 225 bytes of a gzipped FileDescriptorProto
173
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0xc8, 0x29, 0x4d,
174
+	0xcf, 0xcc, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57, 0x9a, 0xc1, 0xc8, 0xc5, 0x15, 0x00, 0x16,
175
+	0x08, 0x2e, 0x48, 0x4d, 0x16, 0x12, 0xe2, 0x62, 0xc9, 0x4b, 0xcc, 0x4d, 0x95, 0x60, 0x54, 0x60,
176
+	0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x85, 0xc4, 0xb8, 0xd8, 0x8a, 0x52, 0x73, 0xf3, 0x4b, 0x52, 0x25,
177
+	0x98, 0xc0, 0xa2, 0x50, 0x9e, 0x90, 0x01, 0x17, 0x57, 0x41, 0x51, 0x66, 0x59, 0x66, 0x4e, 0x6a,
178
+	0x7a, 0x6a, 0xb1, 0x04, 0xb3, 0x02, 0xb3, 0x06, 0xb7, 0x91, 0x80, 0x1e, 0xc4, 0xb0, 0x00, 0x98,
179
+	0x44, 0x10, 0x92, 0x1a, 0x21, 0x29, 0x2e, 0x8e, 0x94, 0xcc, 0xe2, 0xc4, 0xa4, 0x9c, 0xd4, 0x14,
180
+	0x09, 0x16, 0x05, 0x46, 0x0d, 0x8e, 0x20, 0x38, 0x5f, 0x48, 0x80, 0x8b, 0x39, 0x35, 0xaf, 0x4c,
181
+	0x82, 0x55, 0x81, 0x59, 0x83, 0x33, 0x08, 0xc4, 0x54, 0x8a, 0xe5, 0xe2, 0x47, 0x33, 0x0c, 0xab,
182
+	0xf3, 0x14, 0xb8, 0xb8, 0x53, 0x52, 0x8b, 0x93, 0x8b, 0x32, 0x0b, 0x4a, 0x32, 0xf3, 0xf3, 0xa0,
183
+	0x6e, 0x44, 0x16, 0x12, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x05, 0xbb, 0x91, 0x33,
184
+	0x08, 0xc2, 0x71, 0x92, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4,
185
+	0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x24, 0x36,
186
+	0x70, 0xd0, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x37, 0xea, 0xe2, 0xca, 0x2a, 0x01, 0x00,
187
+	0x00,
188
+}
189
+
190
+func (m *PluginSpec) Marshal() (dAtA []byte, err error) {
191
+	size := m.Size()
192
+	dAtA = make([]byte, size)
193
+	n, err := m.MarshalToSizedBuffer(dAtA[:size])
194
+	if err != nil {
195
+		return nil, err
196
+	}
197
+	return dAtA[:n], nil
198
+}
199
+
200
+func (m *PluginSpec) MarshalTo(dAtA []byte) (int, error) {
201
+	size := m.Size()
202
+	return m.MarshalToSizedBuffer(dAtA[:size])
203
+}
204
+
205
+func (m *PluginSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) {
206
+	i := len(dAtA)
207
+	_ = i
208
+	var l int
209
+	_ = l
210
+	if len(m.Env) > 0 {
211
+		for iNdEx := len(m.Env) - 1; iNdEx >= 0; iNdEx-- {
212
+			i -= len(m.Env[iNdEx])
213
+			copy(dAtA[i:], m.Env[iNdEx])
214
+			i = encodeVarintPlugin(dAtA, i, uint64(len(m.Env[iNdEx])))
215
+			i--
216
+			dAtA[i] = 0x2a
217
+		}
218
+	}
219
+	if m.Disabled {
220
+		i--
221
+		if m.Disabled {
222
+			dAtA[i] = 1
223
+		} else {
224
+			dAtA[i] = 0
225
+		}
226
+		i--
227
+		dAtA[i] = 0x20
228
+	}
229
+	if len(m.Privileges) > 0 {
230
+		for iNdEx := len(m.Privileges) - 1; iNdEx >= 0; iNdEx-- {
231
+			{
232
+				size, err := m.Privileges[iNdEx].MarshalToSizedBuffer(dAtA[:i])
233
+				if err != nil {
234
+					return 0, err
235
+				}
236
+				i -= size
237
+				i = encodeVarintPlugin(dAtA, i, uint64(size))
238
+			}
239
+			i--
240
+			dAtA[i] = 0x1a
241
+		}
242
+	}
243
+	if len(m.Remote) > 0 {
244
+		i -= len(m.Remote)
245
+		copy(dAtA[i:], m.Remote)
246
+		i = encodeVarintPlugin(dAtA, i, uint64(len(m.Remote)))
247
+		i--
248
+		dAtA[i] = 0x12
249
+	}
250
+	if len(m.Name) > 0 {
251
+		i -= len(m.Name)
252
+		copy(dAtA[i:], m.Name)
253
+		i = encodeVarintPlugin(dAtA, i, uint64(len(m.Name)))
254
+		i--
255
+		dAtA[i] = 0xa
256
+	}
257
+	return len(dAtA) - i, nil
258
+}
259
+
260
+func (m *PluginPrivilege) Marshal() (dAtA []byte, err error) {
261
+	size := m.Size()
262
+	dAtA = make([]byte, size)
263
+	n, err := m.MarshalToSizedBuffer(dAtA[:size])
264
+	if err != nil {
265
+		return nil, err
266
+	}
267
+	return dAtA[:n], nil
268
+}
269
+
270
+func (m *PluginPrivilege) MarshalTo(dAtA []byte) (int, error) {
271
+	size := m.Size()
272
+	return m.MarshalToSizedBuffer(dAtA[:size])
273
+}
274
+
275
+func (m *PluginPrivilege) MarshalToSizedBuffer(dAtA []byte) (int, error) {
276
+	i := len(dAtA)
277
+	_ = i
278
+	var l int
279
+	_ = l
280
+	if len(m.Value) > 0 {
281
+		for iNdEx := len(m.Value) - 1; iNdEx >= 0; iNdEx-- {
282
+			i -= len(m.Value[iNdEx])
283
+			copy(dAtA[i:], m.Value[iNdEx])
284
+			i = encodeVarintPlugin(dAtA, i, uint64(len(m.Value[iNdEx])))
285
+			i--
286
+			dAtA[i] = 0x1a
287
+		}
288
+	}
289
+	if len(m.Description) > 0 {
290
+		i -= len(m.Description)
291
+		copy(dAtA[i:], m.Description)
292
+		i = encodeVarintPlugin(dAtA, i, uint64(len(m.Description)))
293
+		i--
294
+		dAtA[i] = 0x12
295
+	}
296
+	if len(m.Name) > 0 {
297
+		i -= len(m.Name)
298
+		copy(dAtA[i:], m.Name)
299
+		i = encodeVarintPlugin(dAtA, i, uint64(len(m.Name)))
300
+		i--
301
+		dAtA[i] = 0xa
302
+	}
303
+	return len(dAtA) - i, nil
304
+}
305
+
306
+func encodeVarintPlugin(dAtA []byte, offset int, v uint64) int {
307
+	offset -= sovPlugin(v)
308
+	base := offset
309
+	for v >= 1<<7 {
310
+		dAtA[offset] = uint8(v&0x7f | 0x80)
311
+		v >>= 7
312
+		offset++
313
+	}
314
+	dAtA[offset] = uint8(v)
315
+	return base
316
+}
317
+func (m *PluginSpec) Size() (n int) {
318
+	if m == nil {
319
+		return 0
320
+	}
321
+	var l int
322
+	_ = l
323
+	l = len(m.Name)
324
+	if l > 0 {
325
+		n += 1 + l + sovPlugin(uint64(l))
326
+	}
327
+	l = len(m.Remote)
328
+	if l > 0 {
329
+		n += 1 + l + sovPlugin(uint64(l))
330
+	}
331
+	if len(m.Privileges) > 0 {
332
+		for _, e := range m.Privileges {
333
+			l = e.Size()
334
+			n += 1 + l + sovPlugin(uint64(l))
335
+		}
336
+	}
337
+	if m.Disabled {
338
+		n += 2
339
+	}
340
+	if len(m.Env) > 0 {
341
+		for _, s := range m.Env {
342
+			l = len(s)
343
+			n += 1 + l + sovPlugin(uint64(l))
344
+		}
345
+	}
346
+	return n
347
+}
348
+
349
+func (m *PluginPrivilege) Size() (n int) {
350
+	if m == nil {
351
+		return 0
352
+	}
353
+	var l int
354
+	_ = l
355
+	l = len(m.Name)
356
+	if l > 0 {
357
+		n += 1 + l + sovPlugin(uint64(l))
358
+	}
359
+	l = len(m.Description)
360
+	if l > 0 {
361
+		n += 1 + l + sovPlugin(uint64(l))
362
+	}
363
+	if len(m.Value) > 0 {
364
+		for _, s := range m.Value {
365
+			l = len(s)
366
+			n += 1 + l + sovPlugin(uint64(l))
367
+		}
368
+	}
369
+	return n
370
+}
371
+
372
+func sovPlugin(x uint64) (n int) {
373
+	return (math_bits.Len64(x|1) + 6) / 7
374
+}
375
+func sozPlugin(x uint64) (n int) {
376
+	return sovPlugin(uint64((x << 1) ^ uint64((int64(x) >> 63))))
377
+}
378
+func (m *PluginSpec) Unmarshal(dAtA []byte) error {
379
+	l := len(dAtA)
380
+	iNdEx := 0
381
+	for iNdEx < l {
382
+		preIndex := iNdEx
383
+		var wire uint64
384
+		for shift := uint(0); ; shift += 7 {
385
+			if shift >= 64 {
386
+				return ErrIntOverflowPlugin
387
+			}
388
+			if iNdEx >= l {
389
+				return io.ErrUnexpectedEOF
390
+			}
391
+			b := dAtA[iNdEx]
392
+			iNdEx++
393
+			wire |= uint64(b&0x7F) << shift
394
+			if b < 0x80 {
395
+				break
396
+			}
397
+		}
398
+		fieldNum := int32(wire >> 3)
399
+		wireType := int(wire & 0x7)
400
+		if wireType == 4 {
401
+			return fmt.Errorf("proto: PluginSpec: wiretype end group for non-group")
402
+		}
403
+		if fieldNum <= 0 {
404
+			return fmt.Errorf("proto: PluginSpec: illegal tag %d (wire type %d)", fieldNum, wire)
405
+		}
406
+		switch fieldNum {
407
+		case 1:
408
+			if wireType != 2 {
409
+				return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
410
+			}
411
+			var stringLen uint64
412
+			for shift := uint(0); ; shift += 7 {
413
+				if shift >= 64 {
414
+					return ErrIntOverflowPlugin
415
+				}
416
+				if iNdEx >= l {
417
+					return io.ErrUnexpectedEOF
418
+				}
419
+				b := dAtA[iNdEx]
420
+				iNdEx++
421
+				stringLen |= uint64(b&0x7F) << shift
422
+				if b < 0x80 {
423
+					break
424
+				}
425
+			}
426
+			intStringLen := int(stringLen)
427
+			if intStringLen < 0 {
428
+				return ErrInvalidLengthPlugin
429
+			}
430
+			postIndex := iNdEx + intStringLen
431
+			if postIndex < 0 {
432
+				return ErrInvalidLengthPlugin
433
+			}
434
+			if postIndex > l {
435
+				return io.ErrUnexpectedEOF
436
+			}
437
+			m.Name = string(dAtA[iNdEx:postIndex])
438
+			iNdEx = postIndex
439
+		case 2:
440
+			if wireType != 2 {
441
+				return fmt.Errorf("proto: wrong wireType = %d for field Remote", wireType)
442
+			}
443
+			var stringLen uint64
444
+			for shift := uint(0); ; shift += 7 {
445
+				if shift >= 64 {
446
+					return ErrIntOverflowPlugin
447
+				}
448
+				if iNdEx >= l {
449
+					return io.ErrUnexpectedEOF
450
+				}
451
+				b := dAtA[iNdEx]
452
+				iNdEx++
453
+				stringLen |= uint64(b&0x7F) << shift
454
+				if b < 0x80 {
455
+					break
456
+				}
457
+			}
458
+			intStringLen := int(stringLen)
459
+			if intStringLen < 0 {
460
+				return ErrInvalidLengthPlugin
461
+			}
462
+			postIndex := iNdEx + intStringLen
463
+			if postIndex < 0 {
464
+				return ErrInvalidLengthPlugin
465
+			}
466
+			if postIndex > l {
467
+				return io.ErrUnexpectedEOF
468
+			}
469
+			m.Remote = string(dAtA[iNdEx:postIndex])
470
+			iNdEx = postIndex
471
+		case 3:
472
+			if wireType != 2 {
473
+				return fmt.Errorf("proto: wrong wireType = %d for field Privileges", wireType)
474
+			}
475
+			var msglen int
476
+			for shift := uint(0); ; shift += 7 {
477
+				if shift >= 64 {
478
+					return ErrIntOverflowPlugin
479
+				}
480
+				if iNdEx >= l {
481
+					return io.ErrUnexpectedEOF
482
+				}
483
+				b := dAtA[iNdEx]
484
+				iNdEx++
485
+				msglen |= int(b&0x7F) << shift
486
+				if b < 0x80 {
487
+					break
488
+				}
489
+			}
490
+			if msglen < 0 {
491
+				return ErrInvalidLengthPlugin
492
+			}
493
+			postIndex := iNdEx + msglen
494
+			if postIndex < 0 {
495
+				return ErrInvalidLengthPlugin
496
+			}
497
+			if postIndex > l {
498
+				return io.ErrUnexpectedEOF
499
+			}
500
+			m.Privileges = append(m.Privileges, &PluginPrivilege{})
501
+			if err := m.Privileges[len(m.Privileges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
502
+				return err
503
+			}
504
+			iNdEx = postIndex
505
+		case 4:
506
+			if wireType != 0 {
507
+				return fmt.Errorf("proto: wrong wireType = %d for field Disabled", wireType)
508
+			}
509
+			var v int
510
+			for shift := uint(0); ; shift += 7 {
511
+				if shift >= 64 {
512
+					return ErrIntOverflowPlugin
513
+				}
514
+				if iNdEx >= l {
515
+					return io.ErrUnexpectedEOF
516
+				}
517
+				b := dAtA[iNdEx]
518
+				iNdEx++
519
+				v |= int(b&0x7F) << shift
520
+				if b < 0x80 {
521
+					break
522
+				}
523
+			}
524
+			m.Disabled = bool(v != 0)
525
+		case 5:
526
+			if wireType != 2 {
527
+				return fmt.Errorf("proto: wrong wireType = %d for field Env", wireType)
528
+			}
529
+			var stringLen uint64
530
+			for shift := uint(0); ; shift += 7 {
531
+				if shift >= 64 {
532
+					return ErrIntOverflowPlugin
533
+				}
534
+				if iNdEx >= l {
535
+					return io.ErrUnexpectedEOF
536
+				}
537
+				b := dAtA[iNdEx]
538
+				iNdEx++
539
+				stringLen |= uint64(b&0x7F) << shift
540
+				if b < 0x80 {
541
+					break
542
+				}
543
+			}
544
+			intStringLen := int(stringLen)
545
+			if intStringLen < 0 {
546
+				return ErrInvalidLengthPlugin
547
+			}
548
+			postIndex := iNdEx + intStringLen
549
+			if postIndex < 0 {
550
+				return ErrInvalidLengthPlugin
551
+			}
552
+			if postIndex > l {
553
+				return io.ErrUnexpectedEOF
554
+			}
555
+			m.Env = append(m.Env, string(dAtA[iNdEx:postIndex]))
556
+			iNdEx = postIndex
557
+		default:
558
+			iNdEx = preIndex
559
+			skippy, err := skipPlugin(dAtA[iNdEx:])
560
+			if err != nil {
561
+				return err
562
+			}
563
+			if (skippy < 0) || (iNdEx+skippy) < 0 {
564
+				return ErrInvalidLengthPlugin
565
+			}
566
+			if (iNdEx + skippy) > l {
567
+				return io.ErrUnexpectedEOF
568
+			}
569
+			iNdEx += skippy
570
+		}
571
+	}
572
+
573
+	if iNdEx > l {
574
+		return io.ErrUnexpectedEOF
575
+	}
576
+	return nil
577
+}
578
+func (m *PluginPrivilege) Unmarshal(dAtA []byte) error {
579
+	l := len(dAtA)
580
+	iNdEx := 0
581
+	for iNdEx < l {
582
+		preIndex := iNdEx
583
+		var wire uint64
584
+		for shift := uint(0); ; shift += 7 {
585
+			if shift >= 64 {
586
+				return ErrIntOverflowPlugin
587
+			}
588
+			if iNdEx >= l {
589
+				return io.ErrUnexpectedEOF
590
+			}
591
+			b := dAtA[iNdEx]
592
+			iNdEx++
593
+			wire |= uint64(b&0x7F) << shift
594
+			if b < 0x80 {
595
+				break
596
+			}
597
+		}
598
+		fieldNum := int32(wire >> 3)
599
+		wireType := int(wire & 0x7)
600
+		if wireType == 4 {
601
+			return fmt.Errorf("proto: PluginPrivilege: wiretype end group for non-group")
602
+		}
603
+		if fieldNum <= 0 {
604
+			return fmt.Errorf("proto: PluginPrivilege: illegal tag %d (wire type %d)", fieldNum, wire)
605
+		}
606
+		switch fieldNum {
607
+		case 1:
608
+			if wireType != 2 {
609
+				return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
610
+			}
611
+			var stringLen uint64
612
+			for shift := uint(0); ; shift += 7 {
613
+				if shift >= 64 {
614
+					return ErrIntOverflowPlugin
615
+				}
616
+				if iNdEx >= l {
617
+					return io.ErrUnexpectedEOF
618
+				}
619
+				b := dAtA[iNdEx]
620
+				iNdEx++
621
+				stringLen |= uint64(b&0x7F) << shift
622
+				if b < 0x80 {
623
+					break
624
+				}
625
+			}
626
+			intStringLen := int(stringLen)
627
+			if intStringLen < 0 {
628
+				return ErrInvalidLengthPlugin
629
+			}
630
+			postIndex := iNdEx + intStringLen
631
+			if postIndex < 0 {
632
+				return ErrInvalidLengthPlugin
633
+			}
634
+			if postIndex > l {
635
+				return io.ErrUnexpectedEOF
636
+			}
637
+			m.Name = string(dAtA[iNdEx:postIndex])
638
+			iNdEx = postIndex
639
+		case 2:
640
+			if wireType != 2 {
641
+				return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
642
+			}
643
+			var stringLen uint64
644
+			for shift := uint(0); ; shift += 7 {
645
+				if shift >= 64 {
646
+					return ErrIntOverflowPlugin
647
+				}
648
+				if iNdEx >= l {
649
+					return io.ErrUnexpectedEOF
650
+				}
651
+				b := dAtA[iNdEx]
652
+				iNdEx++
653
+				stringLen |= uint64(b&0x7F) << shift
654
+				if b < 0x80 {
655
+					break
656
+				}
657
+			}
658
+			intStringLen := int(stringLen)
659
+			if intStringLen < 0 {
660
+				return ErrInvalidLengthPlugin
661
+			}
662
+			postIndex := iNdEx + intStringLen
663
+			if postIndex < 0 {
664
+				return ErrInvalidLengthPlugin
665
+			}
666
+			if postIndex > l {
667
+				return io.ErrUnexpectedEOF
668
+			}
669
+			m.Description = string(dAtA[iNdEx:postIndex])
670
+			iNdEx = postIndex
671
+		case 3:
672
+			if wireType != 2 {
673
+				return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
674
+			}
675
+			var stringLen uint64
676
+			for shift := uint(0); ; shift += 7 {
677
+				if shift >= 64 {
678
+					return ErrIntOverflowPlugin
679
+				}
680
+				if iNdEx >= l {
681
+					return io.ErrUnexpectedEOF
682
+				}
683
+				b := dAtA[iNdEx]
684
+				iNdEx++
685
+				stringLen |= uint64(b&0x7F) << shift
686
+				if b < 0x80 {
687
+					break
688
+				}
689
+			}
690
+			intStringLen := int(stringLen)
691
+			if intStringLen < 0 {
692
+				return ErrInvalidLengthPlugin
693
+			}
694
+			postIndex := iNdEx + intStringLen
695
+			if postIndex < 0 {
696
+				return ErrInvalidLengthPlugin
697
+			}
698
+			if postIndex > l {
699
+				return io.ErrUnexpectedEOF
700
+			}
701
+			m.Value = append(m.Value, string(dAtA[iNdEx:postIndex]))
702
+			iNdEx = postIndex
703
+		default:
704
+			iNdEx = preIndex
705
+			skippy, err := skipPlugin(dAtA[iNdEx:])
706
+			if err != nil {
707
+				return err
708
+			}
709
+			if (skippy < 0) || (iNdEx+skippy) < 0 {
710
+				return ErrInvalidLengthPlugin
711
+			}
712
+			if (iNdEx + skippy) > l {
713
+				return io.ErrUnexpectedEOF
714
+			}
715
+			iNdEx += skippy
716
+		}
717
+	}
718
+
719
+	if iNdEx > l {
720
+		return io.ErrUnexpectedEOF
721
+	}
722
+	return nil
723
+}
724
+func skipPlugin(dAtA []byte) (n int, err error) {
725
+	l := len(dAtA)
726
+	iNdEx := 0
727
+	depth := 0
728
+	for iNdEx < l {
729
+		var wire uint64
730
+		for shift := uint(0); ; shift += 7 {
731
+			if shift >= 64 {
732
+				return 0, ErrIntOverflowPlugin
733
+			}
734
+			if iNdEx >= l {
735
+				return 0, io.ErrUnexpectedEOF
736
+			}
737
+			b := dAtA[iNdEx]
738
+			iNdEx++
739
+			wire |= (uint64(b) & 0x7F) << shift
740
+			if b < 0x80 {
741
+				break
742
+			}
743
+		}
744
+		wireType := int(wire & 0x7)
745
+		switch wireType {
746
+		case 0:
747
+			for shift := uint(0); ; shift += 7 {
748
+				if shift >= 64 {
749
+					return 0, ErrIntOverflowPlugin
750
+				}
751
+				if iNdEx >= l {
752
+					return 0, io.ErrUnexpectedEOF
753
+				}
754
+				iNdEx++
755
+				if dAtA[iNdEx-1] < 0x80 {
756
+					break
757
+				}
758
+			}
759
+		case 1:
760
+			iNdEx += 8
761
+		case 2:
762
+			var length int
763
+			for shift := uint(0); ; shift += 7 {
764
+				if shift >= 64 {
765
+					return 0, ErrIntOverflowPlugin
766
+				}
767
+				if iNdEx >= l {
768
+					return 0, io.ErrUnexpectedEOF
769
+				}
770
+				b := dAtA[iNdEx]
771
+				iNdEx++
772
+				length |= (int(b) & 0x7F) << shift
773
+				if b < 0x80 {
774
+					break
775
+				}
776
+			}
777
+			if length < 0 {
778
+				return 0, ErrInvalidLengthPlugin
779
+			}
780
+			iNdEx += length
781
+		case 3:
782
+			depth++
783
+		case 4:
784
+			if depth == 0 {
785
+				return 0, ErrUnexpectedEndOfGroupPlugin
786
+			}
787
+			depth--
788
+		case 5:
789
+			iNdEx += 4
790
+		default:
791
+			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
792
+		}
793
+		if iNdEx < 0 {
794
+			return 0, ErrInvalidLengthPlugin
795
+		}
796
+		if depth == 0 {
797
+			return iNdEx, nil
798
+		}
799
+	}
800
+	return 0, io.ErrUnexpectedEOF
801
+}
802
+
803
+var (
804
+	ErrInvalidLengthPlugin        = fmt.Errorf("proto: negative length found during unmarshaling")
805
+	ErrIntOverflowPlugin          = fmt.Errorf("proto: integer overflow")
806
+	ErrUnexpectedEndOfGroupPlugin = fmt.Errorf("proto: unexpected end of group")
807
+)
0 808
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+syntax = "proto3";
1
+
2
+// PluginSpec defines the base payload which clients can specify for creating
3
+// a service with the plugin runtime.
4
+message PluginSpec {
5
+	string name = 1;
6
+	string remote = 2;
7
+	repeated PluginPrivilege privileges = 3;
8
+	bool disabled = 4;
9
+	repeated string env = 5;
10
+}
11
+
12
+// PluginPrivilege describes a permission the user has to accept
13
+// upon installing a plugin.
14
+message PluginPrivilege {
15
+	string name = 1;
16
+	string description = 2;
17
+	repeated string value = 3;
18
+}
... ...
@@ -12,7 +12,6 @@ import (
12 12
 	"github.com/docker/docker/testutil/registry"
13 13
 	"github.com/moby/moby/api/types/filters"
14 14
 	swarmtypes "github.com/moby/moby/api/types/swarm"
15
-	"github.com/moby/moby/api/types/swarm/runtime"
16 15
 	"github.com/moby/moby/client"
17 16
 	"gotest.tools/v3/assert"
18 17
 	"gotest.tools/v3/poll"
... ...
@@ -125,7 +124,7 @@ func TestServicePlugin(t *testing.T) {
125 125
 func makePlugin(repo, name string, constraints []string) func(*swarmtypes.Service) {
126 126
 	return func(s *swarmtypes.Service) {
127 127
 		s.Spec.TaskTemplate.Runtime = swarmtypes.RuntimePlugin
128
-		s.Spec.TaskTemplate.PluginSpec = &runtime.PluginSpec{
128
+		s.Spec.TaskTemplate.PluginSpec = &swarmtypes.RuntimeSpec{
129 129
 			Name:   name,
130 130
 			Remote: repo,
131 131
 			Env: []string{
... ...
@@ -25,3 +25,21 @@ const (
25 25
 type NetworkAttachmentSpec struct {
26 26
 	ContainerID string
27 27
 }
28
+
29
+// RuntimeSpec defines the base payload which clients can specify for creating
30
+// a service with the plugin runtime.
31
+type RuntimeSpec struct {
32
+	Name       string              `json:"name,omitempty"`
33
+	Remote     string              `json:"remote,omitempty"`
34
+	Privileges []*RuntimePrivilege `json:"privileges,omitempty"`
35
+	Disabled   bool                `json:"disabled,omitempty"`
36
+	Env        []string            `json:"env,omitempty"`
37
+}
38
+
39
+// RuntimePrivilege describes a permission the user has to accept
40
+// upon installing a plugin.
41
+type RuntimePrivilege struct {
42
+	Name        string   `json:"name,omitempty"`
43
+	Description string   `json:"description,omitempty"`
44
+	Value       []string `json:"value,omitempty"`
45
+}
28 46
deleted file mode 100644
... ...
@@ -1,3 +0,0 @@
1
-//go:generate protoc --gogofaster_out=import_path=runtime:. plugin.proto
2
-
3
-package runtime
4 1
deleted file mode 100644
... ...
@@ -1,808 +0,0 @@
1
-// Code generated by protoc-gen-gogo. DO NOT EDIT.
2
-// source: plugin.proto
3
-
4
-package runtime
5
-
6
-import (
7
-	fmt "fmt"
8
-	proto "github.com/gogo/protobuf/proto"
9
-	io "io"
10
-	math "math"
11
-	math_bits "math/bits"
12
-)
13
-
14
-// Reference imports to suppress errors if they are not otherwise used.
15
-var _ = proto.Marshal
16
-var _ = fmt.Errorf
17
-var _ = math.Inf
18
-
19
-// This is a compile-time assertion to ensure that this generated file
20
-// is compatible with the proto package it is being compiled against.
21
-// A compilation error at this line likely means your copy of the
22
-// proto package needs to be updated.
23
-const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
24
-
25
-// PluginSpec defines the base payload which clients can specify for creating
26
-// a service with the plugin runtime.
27
-type PluginSpec struct {
28
-	Name       string             `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
29
-	Remote     string             `protobuf:"bytes,2,opt,name=remote,proto3" json:"remote,omitempty"`
30
-	Privileges []*PluginPrivilege `protobuf:"bytes,3,rep,name=privileges,proto3" json:"privileges,omitempty"`
31
-	Disabled   bool               `protobuf:"varint,4,opt,name=disabled,proto3" json:"disabled,omitempty"`
32
-	Env        []string           `protobuf:"bytes,5,rep,name=env,proto3" json:"env,omitempty"`
33
-}
34
-
35
-func (m *PluginSpec) Reset()         { *m = PluginSpec{} }
36
-func (m *PluginSpec) String() string { return proto.CompactTextString(m) }
37
-func (*PluginSpec) ProtoMessage()    {}
38
-func (*PluginSpec) Descriptor() ([]byte, []int) {
39
-	return fileDescriptor_22a625af4bc1cc87, []int{0}
40
-}
41
-func (m *PluginSpec) XXX_Unmarshal(b []byte) error {
42
-	return m.Unmarshal(b)
43
-}
44
-func (m *PluginSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
45
-	if deterministic {
46
-		return xxx_messageInfo_PluginSpec.Marshal(b, m, deterministic)
47
-	} else {
48
-		b = b[:cap(b)]
49
-		n, err := m.MarshalToSizedBuffer(b)
50
-		if err != nil {
51
-			return nil, err
52
-		}
53
-		return b[:n], nil
54
-	}
55
-}
56
-func (m *PluginSpec) XXX_Merge(src proto.Message) {
57
-	xxx_messageInfo_PluginSpec.Merge(m, src)
58
-}
59
-func (m *PluginSpec) XXX_Size() int {
60
-	return m.Size()
61
-}
62
-func (m *PluginSpec) XXX_DiscardUnknown() {
63
-	xxx_messageInfo_PluginSpec.DiscardUnknown(m)
64
-}
65
-
66
-var xxx_messageInfo_PluginSpec proto.InternalMessageInfo
67
-
68
-func (m *PluginSpec) GetName() string {
69
-	if m != nil {
70
-		return m.Name
71
-	}
72
-	return ""
73
-}
74
-
75
-func (m *PluginSpec) GetRemote() string {
76
-	if m != nil {
77
-		return m.Remote
78
-	}
79
-	return ""
80
-}
81
-
82
-func (m *PluginSpec) GetPrivileges() []*PluginPrivilege {
83
-	if m != nil {
84
-		return m.Privileges
85
-	}
86
-	return nil
87
-}
88
-
89
-func (m *PluginSpec) GetDisabled() bool {
90
-	if m != nil {
91
-		return m.Disabled
92
-	}
93
-	return false
94
-}
95
-
96
-func (m *PluginSpec) GetEnv() []string {
97
-	if m != nil {
98
-		return m.Env
99
-	}
100
-	return nil
101
-}
102
-
103
-// PluginPrivilege describes a permission the user has to accept
104
-// upon installing a plugin.
105
-type PluginPrivilege struct {
106
-	Name        string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
107
-	Description string   `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
108
-	Value       []string `protobuf:"bytes,3,rep,name=value,proto3" json:"value,omitempty"`
109
-}
110
-
111
-func (m *PluginPrivilege) Reset()         { *m = PluginPrivilege{} }
112
-func (m *PluginPrivilege) String() string { return proto.CompactTextString(m) }
113
-func (*PluginPrivilege) ProtoMessage()    {}
114
-func (*PluginPrivilege) Descriptor() ([]byte, []int) {
115
-	return fileDescriptor_22a625af4bc1cc87, []int{1}
116
-}
117
-func (m *PluginPrivilege) XXX_Unmarshal(b []byte) error {
118
-	return m.Unmarshal(b)
119
-}
120
-func (m *PluginPrivilege) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
121
-	if deterministic {
122
-		return xxx_messageInfo_PluginPrivilege.Marshal(b, m, deterministic)
123
-	} else {
124
-		b = b[:cap(b)]
125
-		n, err := m.MarshalToSizedBuffer(b)
126
-		if err != nil {
127
-			return nil, err
128
-		}
129
-		return b[:n], nil
130
-	}
131
-}
132
-func (m *PluginPrivilege) XXX_Merge(src proto.Message) {
133
-	xxx_messageInfo_PluginPrivilege.Merge(m, src)
134
-}
135
-func (m *PluginPrivilege) XXX_Size() int {
136
-	return m.Size()
137
-}
138
-func (m *PluginPrivilege) XXX_DiscardUnknown() {
139
-	xxx_messageInfo_PluginPrivilege.DiscardUnknown(m)
140
-}
141
-
142
-var xxx_messageInfo_PluginPrivilege proto.InternalMessageInfo
143
-
144
-func (m *PluginPrivilege) GetName() string {
145
-	if m != nil {
146
-		return m.Name
147
-	}
148
-	return ""
149
-}
150
-
151
-func (m *PluginPrivilege) GetDescription() string {
152
-	if m != nil {
153
-		return m.Description
154
-	}
155
-	return ""
156
-}
157
-
158
-func (m *PluginPrivilege) GetValue() []string {
159
-	if m != nil {
160
-		return m.Value
161
-	}
162
-	return nil
163
-}
164
-
165
-func init() {
166
-	proto.RegisterType((*PluginSpec)(nil), "PluginSpec")
167
-	proto.RegisterType((*PluginPrivilege)(nil), "PluginPrivilege")
168
-}
169
-
170
-func init() { proto.RegisterFile("plugin.proto", fileDescriptor_22a625af4bc1cc87) }
171
-
172
-var fileDescriptor_22a625af4bc1cc87 = []byte{
173
-	// 225 bytes of a gzipped FileDescriptorProto
174
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0xc8, 0x29, 0x4d,
175
-	0xcf, 0xcc, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57, 0x9a, 0xc1, 0xc8, 0xc5, 0x15, 0x00, 0x16,
176
-	0x08, 0x2e, 0x48, 0x4d, 0x16, 0x12, 0xe2, 0x62, 0xc9, 0x4b, 0xcc, 0x4d, 0x95, 0x60, 0x54, 0x60,
177
-	0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x85, 0xc4, 0xb8, 0xd8, 0x8a, 0x52, 0x73, 0xf3, 0x4b, 0x52, 0x25,
178
-	0x98, 0xc0, 0xa2, 0x50, 0x9e, 0x90, 0x01, 0x17, 0x57, 0x41, 0x51, 0x66, 0x59, 0x66, 0x4e, 0x6a,
179
-	0x7a, 0x6a, 0xb1, 0x04, 0xb3, 0x02, 0xb3, 0x06, 0xb7, 0x91, 0x80, 0x1e, 0xc4, 0xb0, 0x00, 0x98,
180
-	0x44, 0x10, 0x92, 0x1a, 0x21, 0x29, 0x2e, 0x8e, 0x94, 0xcc, 0xe2, 0xc4, 0xa4, 0x9c, 0xd4, 0x14,
181
-	0x09, 0x16, 0x05, 0x46, 0x0d, 0x8e, 0x20, 0x38, 0x5f, 0x48, 0x80, 0x8b, 0x39, 0x35, 0xaf, 0x4c,
182
-	0x82, 0x55, 0x81, 0x59, 0x83, 0x33, 0x08, 0xc4, 0x54, 0x8a, 0xe5, 0xe2, 0x47, 0x33, 0x0c, 0xab,
183
-	0xf3, 0x14, 0xb8, 0xb8, 0x53, 0x52, 0x8b, 0x93, 0x8b, 0x32, 0x0b, 0x4a, 0x32, 0xf3, 0xf3, 0xa0,
184
-	0x6e, 0x44, 0x16, 0x12, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x05, 0xbb, 0x91, 0x33,
185
-	0x08, 0xc2, 0x71, 0x92, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4,
186
-	0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x24, 0x36,
187
-	0x70, 0xd0, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x37, 0xea, 0xe2, 0xca, 0x2a, 0x01, 0x00,
188
-	0x00,
189
-}
190
-
191
-func (m *PluginSpec) Marshal() (dAtA []byte, err error) {
192
-	size := m.Size()
193
-	dAtA = make([]byte, size)
194
-	n, err := m.MarshalToSizedBuffer(dAtA[:size])
195
-	if err != nil {
196
-		return nil, err
197
-	}
198
-	return dAtA[:n], nil
199
-}
200
-
201
-func (m *PluginSpec) MarshalTo(dAtA []byte) (int, error) {
202
-	size := m.Size()
203
-	return m.MarshalToSizedBuffer(dAtA[:size])
204
-}
205
-
206
-func (m *PluginSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) {
207
-	i := len(dAtA)
208
-	_ = i
209
-	var l int
210
-	_ = l
211
-	if len(m.Env) > 0 {
212
-		for iNdEx := len(m.Env) - 1; iNdEx >= 0; iNdEx-- {
213
-			i -= len(m.Env[iNdEx])
214
-			copy(dAtA[i:], m.Env[iNdEx])
215
-			i = encodeVarintPlugin(dAtA, i, uint64(len(m.Env[iNdEx])))
216
-			i--
217
-			dAtA[i] = 0x2a
218
-		}
219
-	}
220
-	if m.Disabled {
221
-		i--
222
-		if m.Disabled {
223
-			dAtA[i] = 1
224
-		} else {
225
-			dAtA[i] = 0
226
-		}
227
-		i--
228
-		dAtA[i] = 0x20
229
-	}
230
-	if len(m.Privileges) > 0 {
231
-		for iNdEx := len(m.Privileges) - 1; iNdEx >= 0; iNdEx-- {
232
-			{
233
-				size, err := m.Privileges[iNdEx].MarshalToSizedBuffer(dAtA[:i])
234
-				if err != nil {
235
-					return 0, err
236
-				}
237
-				i -= size
238
-				i = encodeVarintPlugin(dAtA, i, uint64(size))
239
-			}
240
-			i--
241
-			dAtA[i] = 0x1a
242
-		}
243
-	}
244
-	if len(m.Remote) > 0 {
245
-		i -= len(m.Remote)
246
-		copy(dAtA[i:], m.Remote)
247
-		i = encodeVarintPlugin(dAtA, i, uint64(len(m.Remote)))
248
-		i--
249
-		dAtA[i] = 0x12
250
-	}
251
-	if len(m.Name) > 0 {
252
-		i -= len(m.Name)
253
-		copy(dAtA[i:], m.Name)
254
-		i = encodeVarintPlugin(dAtA, i, uint64(len(m.Name)))
255
-		i--
256
-		dAtA[i] = 0xa
257
-	}
258
-	return len(dAtA) - i, nil
259
-}
260
-
261
-func (m *PluginPrivilege) Marshal() (dAtA []byte, err error) {
262
-	size := m.Size()
263
-	dAtA = make([]byte, size)
264
-	n, err := m.MarshalToSizedBuffer(dAtA[:size])
265
-	if err != nil {
266
-		return nil, err
267
-	}
268
-	return dAtA[:n], nil
269
-}
270
-
271
-func (m *PluginPrivilege) MarshalTo(dAtA []byte) (int, error) {
272
-	size := m.Size()
273
-	return m.MarshalToSizedBuffer(dAtA[:size])
274
-}
275
-
276
-func (m *PluginPrivilege) MarshalToSizedBuffer(dAtA []byte) (int, error) {
277
-	i := len(dAtA)
278
-	_ = i
279
-	var l int
280
-	_ = l
281
-	if len(m.Value) > 0 {
282
-		for iNdEx := len(m.Value) - 1; iNdEx >= 0; iNdEx-- {
283
-			i -= len(m.Value[iNdEx])
284
-			copy(dAtA[i:], m.Value[iNdEx])
285
-			i = encodeVarintPlugin(dAtA, i, uint64(len(m.Value[iNdEx])))
286
-			i--
287
-			dAtA[i] = 0x1a
288
-		}
289
-	}
290
-	if len(m.Description) > 0 {
291
-		i -= len(m.Description)
292
-		copy(dAtA[i:], m.Description)
293
-		i = encodeVarintPlugin(dAtA, i, uint64(len(m.Description)))
294
-		i--
295
-		dAtA[i] = 0x12
296
-	}
297
-	if len(m.Name) > 0 {
298
-		i -= len(m.Name)
299
-		copy(dAtA[i:], m.Name)
300
-		i = encodeVarintPlugin(dAtA, i, uint64(len(m.Name)))
301
-		i--
302
-		dAtA[i] = 0xa
303
-	}
304
-	return len(dAtA) - i, nil
305
-}
306
-
307
-func encodeVarintPlugin(dAtA []byte, offset int, v uint64) int {
308
-	offset -= sovPlugin(v)
309
-	base := offset
310
-	for v >= 1<<7 {
311
-		dAtA[offset] = uint8(v&0x7f | 0x80)
312
-		v >>= 7
313
-		offset++
314
-	}
315
-	dAtA[offset] = uint8(v)
316
-	return base
317
-}
318
-func (m *PluginSpec) Size() (n int) {
319
-	if m == nil {
320
-		return 0
321
-	}
322
-	var l int
323
-	_ = l
324
-	l = len(m.Name)
325
-	if l > 0 {
326
-		n += 1 + l + sovPlugin(uint64(l))
327
-	}
328
-	l = len(m.Remote)
329
-	if l > 0 {
330
-		n += 1 + l + sovPlugin(uint64(l))
331
-	}
332
-	if len(m.Privileges) > 0 {
333
-		for _, e := range m.Privileges {
334
-			l = e.Size()
335
-			n += 1 + l + sovPlugin(uint64(l))
336
-		}
337
-	}
338
-	if m.Disabled {
339
-		n += 2
340
-	}
341
-	if len(m.Env) > 0 {
342
-		for _, s := range m.Env {
343
-			l = len(s)
344
-			n += 1 + l + sovPlugin(uint64(l))
345
-		}
346
-	}
347
-	return n
348
-}
349
-
350
-func (m *PluginPrivilege) Size() (n int) {
351
-	if m == nil {
352
-		return 0
353
-	}
354
-	var l int
355
-	_ = l
356
-	l = len(m.Name)
357
-	if l > 0 {
358
-		n += 1 + l + sovPlugin(uint64(l))
359
-	}
360
-	l = len(m.Description)
361
-	if l > 0 {
362
-		n += 1 + l + sovPlugin(uint64(l))
363
-	}
364
-	if len(m.Value) > 0 {
365
-		for _, s := range m.Value {
366
-			l = len(s)
367
-			n += 1 + l + sovPlugin(uint64(l))
368
-		}
369
-	}
370
-	return n
371
-}
372
-
373
-func sovPlugin(x uint64) (n int) {
374
-	return (math_bits.Len64(x|1) + 6) / 7
375
-}
376
-func sozPlugin(x uint64) (n int) {
377
-	return sovPlugin(uint64((x << 1) ^ uint64((int64(x) >> 63))))
378
-}
379
-func (m *PluginSpec) Unmarshal(dAtA []byte) error {
380
-	l := len(dAtA)
381
-	iNdEx := 0
382
-	for iNdEx < l {
383
-		preIndex := iNdEx
384
-		var wire uint64
385
-		for shift := uint(0); ; shift += 7 {
386
-			if shift >= 64 {
387
-				return ErrIntOverflowPlugin
388
-			}
389
-			if iNdEx >= l {
390
-				return io.ErrUnexpectedEOF
391
-			}
392
-			b := dAtA[iNdEx]
393
-			iNdEx++
394
-			wire |= uint64(b&0x7F) << shift
395
-			if b < 0x80 {
396
-				break
397
-			}
398
-		}
399
-		fieldNum := int32(wire >> 3)
400
-		wireType := int(wire & 0x7)
401
-		if wireType == 4 {
402
-			return fmt.Errorf("proto: PluginSpec: wiretype end group for non-group")
403
-		}
404
-		if fieldNum <= 0 {
405
-			return fmt.Errorf("proto: PluginSpec: illegal tag %d (wire type %d)", fieldNum, wire)
406
-		}
407
-		switch fieldNum {
408
-		case 1:
409
-			if wireType != 2 {
410
-				return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
411
-			}
412
-			var stringLen uint64
413
-			for shift := uint(0); ; shift += 7 {
414
-				if shift >= 64 {
415
-					return ErrIntOverflowPlugin
416
-				}
417
-				if iNdEx >= l {
418
-					return io.ErrUnexpectedEOF
419
-				}
420
-				b := dAtA[iNdEx]
421
-				iNdEx++
422
-				stringLen |= uint64(b&0x7F) << shift
423
-				if b < 0x80 {
424
-					break
425
-				}
426
-			}
427
-			intStringLen := int(stringLen)
428
-			if intStringLen < 0 {
429
-				return ErrInvalidLengthPlugin
430
-			}
431
-			postIndex := iNdEx + intStringLen
432
-			if postIndex < 0 {
433
-				return ErrInvalidLengthPlugin
434
-			}
435
-			if postIndex > l {
436
-				return io.ErrUnexpectedEOF
437
-			}
438
-			m.Name = string(dAtA[iNdEx:postIndex])
439
-			iNdEx = postIndex
440
-		case 2:
441
-			if wireType != 2 {
442
-				return fmt.Errorf("proto: wrong wireType = %d for field Remote", wireType)
443
-			}
444
-			var stringLen uint64
445
-			for shift := uint(0); ; shift += 7 {
446
-				if shift >= 64 {
447
-					return ErrIntOverflowPlugin
448
-				}
449
-				if iNdEx >= l {
450
-					return io.ErrUnexpectedEOF
451
-				}
452
-				b := dAtA[iNdEx]
453
-				iNdEx++
454
-				stringLen |= uint64(b&0x7F) << shift
455
-				if b < 0x80 {
456
-					break
457
-				}
458
-			}
459
-			intStringLen := int(stringLen)
460
-			if intStringLen < 0 {
461
-				return ErrInvalidLengthPlugin
462
-			}
463
-			postIndex := iNdEx + intStringLen
464
-			if postIndex < 0 {
465
-				return ErrInvalidLengthPlugin
466
-			}
467
-			if postIndex > l {
468
-				return io.ErrUnexpectedEOF
469
-			}
470
-			m.Remote = string(dAtA[iNdEx:postIndex])
471
-			iNdEx = postIndex
472
-		case 3:
473
-			if wireType != 2 {
474
-				return fmt.Errorf("proto: wrong wireType = %d for field Privileges", wireType)
475
-			}
476
-			var msglen int
477
-			for shift := uint(0); ; shift += 7 {
478
-				if shift >= 64 {
479
-					return ErrIntOverflowPlugin
480
-				}
481
-				if iNdEx >= l {
482
-					return io.ErrUnexpectedEOF
483
-				}
484
-				b := dAtA[iNdEx]
485
-				iNdEx++
486
-				msglen |= int(b&0x7F) << shift
487
-				if b < 0x80 {
488
-					break
489
-				}
490
-			}
491
-			if msglen < 0 {
492
-				return ErrInvalidLengthPlugin
493
-			}
494
-			postIndex := iNdEx + msglen
495
-			if postIndex < 0 {
496
-				return ErrInvalidLengthPlugin
497
-			}
498
-			if postIndex > l {
499
-				return io.ErrUnexpectedEOF
500
-			}
501
-			m.Privileges = append(m.Privileges, &PluginPrivilege{})
502
-			if err := m.Privileges[len(m.Privileges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
503
-				return err
504
-			}
505
-			iNdEx = postIndex
506
-		case 4:
507
-			if wireType != 0 {
508
-				return fmt.Errorf("proto: wrong wireType = %d for field Disabled", wireType)
509
-			}
510
-			var v int
511
-			for shift := uint(0); ; shift += 7 {
512
-				if shift >= 64 {
513
-					return ErrIntOverflowPlugin
514
-				}
515
-				if iNdEx >= l {
516
-					return io.ErrUnexpectedEOF
517
-				}
518
-				b := dAtA[iNdEx]
519
-				iNdEx++
520
-				v |= int(b&0x7F) << shift
521
-				if b < 0x80 {
522
-					break
523
-				}
524
-			}
525
-			m.Disabled = bool(v != 0)
526
-		case 5:
527
-			if wireType != 2 {
528
-				return fmt.Errorf("proto: wrong wireType = %d for field Env", wireType)
529
-			}
530
-			var stringLen uint64
531
-			for shift := uint(0); ; shift += 7 {
532
-				if shift >= 64 {
533
-					return ErrIntOverflowPlugin
534
-				}
535
-				if iNdEx >= l {
536
-					return io.ErrUnexpectedEOF
537
-				}
538
-				b := dAtA[iNdEx]
539
-				iNdEx++
540
-				stringLen |= uint64(b&0x7F) << shift
541
-				if b < 0x80 {
542
-					break
543
-				}
544
-			}
545
-			intStringLen := int(stringLen)
546
-			if intStringLen < 0 {
547
-				return ErrInvalidLengthPlugin
548
-			}
549
-			postIndex := iNdEx + intStringLen
550
-			if postIndex < 0 {
551
-				return ErrInvalidLengthPlugin
552
-			}
553
-			if postIndex > l {
554
-				return io.ErrUnexpectedEOF
555
-			}
556
-			m.Env = append(m.Env, string(dAtA[iNdEx:postIndex]))
557
-			iNdEx = postIndex
558
-		default:
559
-			iNdEx = preIndex
560
-			skippy, err := skipPlugin(dAtA[iNdEx:])
561
-			if err != nil {
562
-				return err
563
-			}
564
-			if (skippy < 0) || (iNdEx+skippy) < 0 {
565
-				return ErrInvalidLengthPlugin
566
-			}
567
-			if (iNdEx + skippy) > l {
568
-				return io.ErrUnexpectedEOF
569
-			}
570
-			iNdEx += skippy
571
-		}
572
-	}
573
-
574
-	if iNdEx > l {
575
-		return io.ErrUnexpectedEOF
576
-	}
577
-	return nil
578
-}
579
-func (m *PluginPrivilege) Unmarshal(dAtA []byte) error {
580
-	l := len(dAtA)
581
-	iNdEx := 0
582
-	for iNdEx < l {
583
-		preIndex := iNdEx
584
-		var wire uint64
585
-		for shift := uint(0); ; shift += 7 {
586
-			if shift >= 64 {
587
-				return ErrIntOverflowPlugin
588
-			}
589
-			if iNdEx >= l {
590
-				return io.ErrUnexpectedEOF
591
-			}
592
-			b := dAtA[iNdEx]
593
-			iNdEx++
594
-			wire |= uint64(b&0x7F) << shift
595
-			if b < 0x80 {
596
-				break
597
-			}
598
-		}
599
-		fieldNum := int32(wire >> 3)
600
-		wireType := int(wire & 0x7)
601
-		if wireType == 4 {
602
-			return fmt.Errorf("proto: PluginPrivilege: wiretype end group for non-group")
603
-		}
604
-		if fieldNum <= 0 {
605
-			return fmt.Errorf("proto: PluginPrivilege: illegal tag %d (wire type %d)", fieldNum, wire)
606
-		}
607
-		switch fieldNum {
608
-		case 1:
609
-			if wireType != 2 {
610
-				return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
611
-			}
612
-			var stringLen uint64
613
-			for shift := uint(0); ; shift += 7 {
614
-				if shift >= 64 {
615
-					return ErrIntOverflowPlugin
616
-				}
617
-				if iNdEx >= l {
618
-					return io.ErrUnexpectedEOF
619
-				}
620
-				b := dAtA[iNdEx]
621
-				iNdEx++
622
-				stringLen |= uint64(b&0x7F) << shift
623
-				if b < 0x80 {
624
-					break
625
-				}
626
-			}
627
-			intStringLen := int(stringLen)
628
-			if intStringLen < 0 {
629
-				return ErrInvalidLengthPlugin
630
-			}
631
-			postIndex := iNdEx + intStringLen
632
-			if postIndex < 0 {
633
-				return ErrInvalidLengthPlugin
634
-			}
635
-			if postIndex > l {
636
-				return io.ErrUnexpectedEOF
637
-			}
638
-			m.Name = string(dAtA[iNdEx:postIndex])
639
-			iNdEx = postIndex
640
-		case 2:
641
-			if wireType != 2 {
642
-				return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
643
-			}
644
-			var stringLen uint64
645
-			for shift := uint(0); ; shift += 7 {
646
-				if shift >= 64 {
647
-					return ErrIntOverflowPlugin
648
-				}
649
-				if iNdEx >= l {
650
-					return io.ErrUnexpectedEOF
651
-				}
652
-				b := dAtA[iNdEx]
653
-				iNdEx++
654
-				stringLen |= uint64(b&0x7F) << shift
655
-				if b < 0x80 {
656
-					break
657
-				}
658
-			}
659
-			intStringLen := int(stringLen)
660
-			if intStringLen < 0 {
661
-				return ErrInvalidLengthPlugin
662
-			}
663
-			postIndex := iNdEx + intStringLen
664
-			if postIndex < 0 {
665
-				return ErrInvalidLengthPlugin
666
-			}
667
-			if postIndex > l {
668
-				return io.ErrUnexpectedEOF
669
-			}
670
-			m.Description = string(dAtA[iNdEx:postIndex])
671
-			iNdEx = postIndex
672
-		case 3:
673
-			if wireType != 2 {
674
-				return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
675
-			}
676
-			var stringLen uint64
677
-			for shift := uint(0); ; shift += 7 {
678
-				if shift >= 64 {
679
-					return ErrIntOverflowPlugin
680
-				}
681
-				if iNdEx >= l {
682
-					return io.ErrUnexpectedEOF
683
-				}
684
-				b := dAtA[iNdEx]
685
-				iNdEx++
686
-				stringLen |= uint64(b&0x7F) << shift
687
-				if b < 0x80 {
688
-					break
689
-				}
690
-			}
691
-			intStringLen := int(stringLen)
692
-			if intStringLen < 0 {
693
-				return ErrInvalidLengthPlugin
694
-			}
695
-			postIndex := iNdEx + intStringLen
696
-			if postIndex < 0 {
697
-				return ErrInvalidLengthPlugin
698
-			}
699
-			if postIndex > l {
700
-				return io.ErrUnexpectedEOF
701
-			}
702
-			m.Value = append(m.Value, string(dAtA[iNdEx:postIndex]))
703
-			iNdEx = postIndex
704
-		default:
705
-			iNdEx = preIndex
706
-			skippy, err := skipPlugin(dAtA[iNdEx:])
707
-			if err != nil {
708
-				return err
709
-			}
710
-			if (skippy < 0) || (iNdEx+skippy) < 0 {
711
-				return ErrInvalidLengthPlugin
712
-			}
713
-			if (iNdEx + skippy) > l {
714
-				return io.ErrUnexpectedEOF
715
-			}
716
-			iNdEx += skippy
717
-		}
718
-	}
719
-
720
-	if iNdEx > l {
721
-		return io.ErrUnexpectedEOF
722
-	}
723
-	return nil
724
-}
725
-func skipPlugin(dAtA []byte) (n int, err error) {
726
-	l := len(dAtA)
727
-	iNdEx := 0
728
-	depth := 0
729
-	for iNdEx < l {
730
-		var wire uint64
731
-		for shift := uint(0); ; shift += 7 {
732
-			if shift >= 64 {
733
-				return 0, ErrIntOverflowPlugin
734
-			}
735
-			if iNdEx >= l {
736
-				return 0, io.ErrUnexpectedEOF
737
-			}
738
-			b := dAtA[iNdEx]
739
-			iNdEx++
740
-			wire |= (uint64(b) & 0x7F) << shift
741
-			if b < 0x80 {
742
-				break
743
-			}
744
-		}
745
-		wireType := int(wire & 0x7)
746
-		switch wireType {
747
-		case 0:
748
-			for shift := uint(0); ; shift += 7 {
749
-				if shift >= 64 {
750
-					return 0, ErrIntOverflowPlugin
751
-				}
752
-				if iNdEx >= l {
753
-					return 0, io.ErrUnexpectedEOF
754
-				}
755
-				iNdEx++
756
-				if dAtA[iNdEx-1] < 0x80 {
757
-					break
758
-				}
759
-			}
760
-		case 1:
761
-			iNdEx += 8
762
-		case 2:
763
-			var length int
764
-			for shift := uint(0); ; shift += 7 {
765
-				if shift >= 64 {
766
-					return 0, ErrIntOverflowPlugin
767
-				}
768
-				if iNdEx >= l {
769
-					return 0, io.ErrUnexpectedEOF
770
-				}
771
-				b := dAtA[iNdEx]
772
-				iNdEx++
773
-				length |= (int(b) & 0x7F) << shift
774
-				if b < 0x80 {
775
-					break
776
-				}
777
-			}
778
-			if length < 0 {
779
-				return 0, ErrInvalidLengthPlugin
780
-			}
781
-			iNdEx += length
782
-		case 3:
783
-			depth++
784
-		case 4:
785
-			if depth == 0 {
786
-				return 0, ErrUnexpectedEndOfGroupPlugin
787
-			}
788
-			depth--
789
-		case 5:
790
-			iNdEx += 4
791
-		default:
792
-			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
793
-		}
794
-		if iNdEx < 0 {
795
-			return 0, ErrInvalidLengthPlugin
796
-		}
797
-		if depth == 0 {
798
-			return iNdEx, nil
799
-		}
800
-	}
801
-	return 0, io.ErrUnexpectedEOF
802
-}
803
-
804
-var (
805
-	ErrInvalidLengthPlugin        = fmt.Errorf("proto: negative length found during unmarshaling")
806
-	ErrIntOverflowPlugin          = fmt.Errorf("proto: integer overflow")
807
-	ErrUnexpectedEndOfGroupPlugin = fmt.Errorf("proto: unexpected end of group")
808
-)
809 1
deleted file mode 100644
... ...
@@ -1,19 +0,0 @@
1
-syntax = "proto3";
2
-
3
-// PluginSpec defines the base payload which clients can specify for creating
4
-// a service with the plugin runtime.
5
-message PluginSpec {
6
-	string name = 1;
7
-	string remote = 2;
8
-	repeated PluginPrivilege privileges = 3;
9
-	bool disabled = 4;
10
-	repeated string env = 5;
11
-}
12
-
13
-// PluginPrivilege describes a permission the user has to accept
14
-// upon installing a plugin.
15
-message PluginPrivilege {
16
-	string name = 1;
17
-	string description = 2;
18
-	repeated string value = 3;
19
-}
... ...
@@ -4,7 +4,6 @@ import (
4 4
 	"time"
5 5
 
6 6
 	"github.com/moby/moby/api/types/filters"
7
-	"github.com/moby/moby/api/types/swarm/runtime"
8 7
 )
9 8
 
10 9
 // TaskState represents the state of a task.
... ...
@@ -77,7 +76,7 @@ type TaskSpec struct {
77 77
 	// NetworkAttachmentSpec is used if the `Runtime` field is set to
78 78
 	// `attachment`.
79 79
 	ContainerSpec         *ContainerSpec         `json:",omitempty"`
80
-	PluginSpec            *runtime.PluginSpec    `json:",omitempty"`
80
+	PluginSpec            *RuntimeSpec           `json:",omitempty"`
81 81
 	NetworkAttachmentSpec *NetworkAttachmentSpec `json:",omitempty"`
82 82
 
83 83
 	Resources     *ResourceRequirements     `json:",omitempty"`
... ...
@@ -957,7 +957,6 @@ github.com/moby/moby/api/types/registry
957 957
 github.com/moby/moby/api/types/storage
958 958
 github.com/moby/moby/api/types/strslice
959 959
 github.com/moby/moby/api/types/swarm
960
-github.com/moby/moby/api/types/swarm/runtime
961 960
 github.com/moby/moby/api/types/system
962 961
 github.com/moby/moby/api/types/time
963 962
 github.com/moby/moby/api/types/versions