Signed-off-by: Victor Vieux <vieux@docker.com>
| ... | ... |
@@ -1213,7 +1213,7 @@ definitions: |
| 1213 | 1213 |
Plugin: |
| 1214 | 1214 |
description: "A plugin for the Remote API" |
| 1215 | 1215 |
type: "object" |
| 1216 |
- required: [Config, Enabled, Manifest, Name, Tag] |
|
| 1216 |
+ required: [Settings, Enabled, Config, Name, Tag] |
|
| 1217 | 1217 |
properties: |
| 1218 | 1218 |
Id: |
| 1219 | 1219 |
type: "string" |
| ... | ... |
@@ -1227,7 +1227,7 @@ definitions: |
| 1227 | 1227 |
description: "True when the plugin is running. False when the plugin is not running, only installed." |
| 1228 | 1228 |
type: "boolean" |
| 1229 | 1229 |
x-nullable: false |
| 1230 |
- Config: |
|
| 1230 |
+ Settings: |
|
| 1231 | 1231 |
description: "Settings that can be modified by users." |
| 1232 | 1232 |
type: "object" |
| 1233 | 1233 |
x-nullable: false |
| ... | ... |
@@ -1249,12 +1249,11 @@ definitions: |
| 1249 | 1249 |
type: "array" |
| 1250 | 1250 |
items: |
| 1251 | 1251 |
$ref: "#/definitions/PluginDevice" |
| 1252 |
- Manifest: |
|
| 1253 |
- description: "The manifest of a plugin." |
|
| 1252 |
+ Config: |
|
| 1253 |
+ description: "The config of a plugin." |
|
| 1254 | 1254 |
type: "object" |
| 1255 | 1255 |
x-nullable: false |
| 1256 | 1256 |
required: |
| 1257 |
- - ManifestVersion |
|
| 1258 | 1257 |
- Description |
| 1259 | 1258 |
- Documentation |
| 1260 | 1259 |
- Interface |
| ... | ... |
@@ -1267,9 +1266,6 @@ definitions: |
| 1267 | 1267 |
- Env |
| 1268 | 1268 |
- Args |
| 1269 | 1269 |
properties: |
| 1270 |
- ManifestVersion: |
|
| 1271 |
- type: "string" |
|
| 1272 |
- x-nullable: false |
|
| 1273 | 1270 |
Description: |
| 1274 | 1271 |
type: "string" |
| 1275 | 1272 |
x-nullable: false |
| ... | ... |
@@ -18,47 +18,26 @@ type Plugin struct {
|
| 18 | 18 |
// Id |
| 19 | 19 |
ID string `json:"Id,omitempty"` |
| 20 | 20 |
|
| 21 |
- // manifest |
|
| 22 |
- // Required: true |
|
| 23 |
- Manifest PluginManifest `json:"Manifest"` |
|
| 24 |
- |
|
| 25 | 21 |
// name |
| 26 | 22 |
// Required: true |
| 27 | 23 |
Name string `json:"Name"` |
| 28 | 24 |
|
| 25 |
+ // settings |
|
| 26 |
+ // Required: true |
|
| 27 |
+ Settings PluginSettings `json:"Settings"` |
|
| 28 |
+ |
|
| 29 | 29 |
// tag |
| 30 | 30 |
// Required: true |
| 31 | 31 |
Tag string `json:"Tag"` |
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 |
-// PluginConfig Settings that can be modified by users. |
|
| 34 |
+// PluginConfig The config of a plugin. |
|
| 35 | 35 |
// swagger:model PluginConfig |
| 36 | 36 |
type PluginConfig struct {
|
| 37 | 37 |
|
| 38 | 38 |
// args |
| 39 | 39 |
// Required: true |
| 40 |
- Args []string `json:"Args"` |
|
| 41 |
- |
|
| 42 |
- // devices |
|
| 43 |
- // Required: true |
|
| 44 |
- Devices []PluginDevice `json:"Devices"` |
|
| 45 |
- |
|
| 46 |
- // env |
|
| 47 |
- // Required: true |
|
| 48 |
- Env []string `json:"Env"` |
|
| 49 |
- |
|
| 50 |
- // mounts |
|
| 51 |
- // Required: true |
|
| 52 |
- Mounts []PluginMount `json:"Mounts"` |
|
| 53 |
-} |
|
| 54 |
- |
|
| 55 |
-// PluginManifest The manifest of a plugin. |
|
| 56 |
-// swagger:model PluginManifest |
|
| 57 |
-type PluginManifest struct {
|
|
| 58 |
- |
|
| 59 |
- // args |
|
| 60 |
- // Required: true |
|
| 61 |
- Args PluginManifestArgs `json:"Args"` |
|
| 40 |
+ Args PluginConfigArgs `json:"Args"` |
|
| 62 | 41 |
|
| 63 | 42 |
// capabilities |
| 64 | 43 |
// Required: true |
| ... | ... |
@@ -86,11 +65,7 @@ type PluginManifest struct {
|
| 86 | 86 |
|
| 87 | 87 |
// interface |
| 88 | 88 |
// Required: true |
| 89 |
- Interface PluginManifestInterface `json:"Interface"` |
|
| 90 |
- |
|
| 91 |
- // manifest version |
|
| 92 |
- // Required: true |
|
| 93 |
- ManifestVersion string `json:"ManifestVersion"` |
|
| 89 |
+ Interface PluginConfigInterface `json:"Interface"` |
|
| 94 | 90 |
|
| 95 | 91 |
// mounts |
| 96 | 92 |
// Required: true |
| ... | ... |
@@ -98,19 +73,19 @@ type PluginManifest struct {
|
| 98 | 98 |
|
| 99 | 99 |
// network |
| 100 | 100 |
// Required: true |
| 101 |
- Network PluginManifestNetwork `json:"Network"` |
|
| 101 |
+ Network PluginConfigNetwork `json:"Network"` |
|
| 102 | 102 |
|
| 103 | 103 |
// user |
| 104 |
- User PluginManifestUser `json:"User,omitempty"` |
|
| 104 |
+ User PluginConfigUser `json:"User,omitempty"` |
|
| 105 | 105 |
|
| 106 | 106 |
// workdir |
| 107 | 107 |
// Required: true |
| 108 | 108 |
Workdir string `json:"Workdir"` |
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 |
-// PluginManifestArgs plugin manifest args |
|
| 112 |
-// swagger:model PluginManifestArgs |
|
| 113 |
-type PluginManifestArgs struct {
|
|
| 111 |
+// PluginConfigArgs plugin config args |
|
| 112 |
+// swagger:model PluginConfigArgs |
|
| 113 |
+type PluginConfigArgs struct {
|
|
| 114 | 114 |
|
| 115 | 115 |
// description |
| 116 | 116 |
// Required: true |
| ... | ... |
@@ -129,9 +104,9 @@ type PluginManifestArgs struct {
|
| 129 | 129 |
Value []string `json:"Value"` |
| 130 | 130 |
} |
| 131 | 131 |
|
| 132 |
-// PluginManifestInterface The interface between Docker and the plugin |
|
| 133 |
-// swagger:model PluginManifestInterface |
|
| 134 |
-type PluginManifestInterface struct {
|
|
| 132 |
+// PluginConfigInterface The interface between Docker and the plugin |
|
| 133 |
+// swagger:model PluginConfigInterface |
|
| 134 |
+type PluginConfigInterface struct {
|
|
| 135 | 135 |
|
| 136 | 136 |
// socket |
| 137 | 137 |
// Required: true |
| ... | ... |
@@ -142,18 +117,18 @@ type PluginManifestInterface struct {
|
| 142 | 142 |
Types []PluginInterfaceType `json:"Types"` |
| 143 | 143 |
} |
| 144 | 144 |
|
| 145 |
-// PluginManifestNetwork plugin manifest network |
|
| 146 |
-// swagger:model PluginManifestNetwork |
|
| 147 |
-type PluginManifestNetwork struct {
|
|
| 145 |
+// PluginConfigNetwork plugin config network |
|
| 146 |
+// swagger:model PluginConfigNetwork |
|
| 147 |
+type PluginConfigNetwork struct {
|
|
| 148 | 148 |
|
| 149 | 149 |
// type |
| 150 | 150 |
// Required: true |
| 151 | 151 |
Type string `json:"Type"` |
| 152 | 152 |
} |
| 153 | 153 |
|
| 154 |
-// PluginManifestUser plugin manifest user |
|
| 155 |
-// swagger:model PluginManifestUser |
|
| 156 |
-type PluginManifestUser struct {
|
|
| 154 |
+// PluginConfigUser plugin config user |
|
| 155 |
+// swagger:model PluginConfigUser |
|
| 156 |
+type PluginConfigUser struct {
|
|
| 157 | 157 |
|
| 158 | 158 |
// g ID |
| 159 | 159 |
GID uint32 `json:"GID,omitempty"` |
| ... | ... |
@@ -161,3 +136,24 @@ type PluginManifestUser struct {
|
| 161 | 161 |
// UID |
| 162 | 162 |
UID uint32 `json:"UID,omitempty"` |
| 163 | 163 |
} |
| 164 |
+ |
|
| 165 |
+// PluginSettings Settings that can be modified by users. |
|
| 166 |
+// swagger:model PluginSettings |
|
| 167 |
+type PluginSettings struct {
|
|
| 168 |
+ |
|
| 169 |
+ // args |
|
| 170 |
+ // Required: true |
|
| 171 |
+ Args []string `json:"Args"` |
|
| 172 |
+ |
|
| 173 |
+ // devices |
|
| 174 |
+ // Required: true |
|
| 175 |
+ Devices []PluginDevice `json:"Devices"` |
|
| 176 |
+ |
|
| 177 |
+ // env |
|
| 178 |
+ // Required: true |
|
| 179 |
+ Env []string `json:"Env"` |
|
| 180 |
+ |
|
| 181 |
+ // mounts |
|
| 182 |
+ // Required: true |
|
| 183 |
+ Mounts []PluginMount `json:"Mounts"` |
|
| 184 |
+} |
| ... | ... |
@@ -24,14 +24,14 @@ func validateTag(rawRepo string) error {
|
| 24 | 24 |
return err |
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 |
-// validateManifest ensures that a valid manifest.json is available in the given path |
|
| 28 |
-func validateManifest(path string) error {
|
|
| 29 |
- dt, err := os.Open(filepath.Join(path, "manifest.json")) |
|
| 27 |
+// validateConfig ensures that a valid config.json is available in the given path |
|
| 28 |
+func validateConfig(path string) error {
|
|
| 29 |
+ dt, err := os.Open(filepath.Join(path, "config.json")) |
|
| 30 | 30 |
if err != nil {
|
| 31 | 31 |
return err |
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 |
- m := types.PluginManifest{}
|
|
| 34 |
+ m := types.PluginConfig{}
|
|
| 35 | 35 |
err = json.NewDecoder(dt).Decode(&m) |
| 36 | 36 |
dt.Close() |
| 37 | 37 |
|
| ... | ... |
@@ -64,8 +64,8 @@ func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
|
| 64 | 64 |
options := pluginCreateOptions{}
|
| 65 | 65 |
|
| 66 | 66 |
cmd := &cobra.Command{
|
| 67 |
- Use: "create [OPTIONS] reponame[:tag] PATH-TO-ROOTFS (rootfs + manifest.json)", |
|
| 68 |
- Short: "Create a plugin from a rootfs and manifest", |
|
| 67 |
+ Use: "create [OPTIONS] reponame[:tag] PATH-TO-ROOTFS (rootfs + config.json)", |
|
| 68 |
+ Short: "Create a plugin from a rootfs and config", |
|
| 69 | 69 |
Args: cli.RequiresMinArgs(2), |
| 70 | 70 |
RunE: func(cmd *cobra.Command, args []string) error {
|
| 71 | 71 |
options.repoName = args[0] |
| ... | ... |
@@ -96,7 +96,7 @@ func runCreate(dockerCli *command.DockerCli, options pluginCreateOptions) error |
| 96 | 96 |
return err |
| 97 | 97 |
} |
| 98 | 98 |
|
| 99 |
- if err := validateManifest(options.context); err != nil {
|
|
| 99 |
+ if err := validateConfig(options.context); err != nil {
|
|
| 100 | 100 |
return err |
| 101 | 101 |
} |
| 102 | 102 |
|
| ... | ... |
@@ -47,7 +47,7 @@ func runList(dockerCli *command.DockerCli, opts listOptions) error {
|
| 47 | 47 |
fmt.Fprintf(w, "\n") |
| 48 | 48 |
|
| 49 | 49 |
for _, p := range plugins {
|
| 50 |
- desc := strings.Replace(p.Manifest.Description, "\n", " ", -1) |
|
| 50 |
+ desc := strings.Replace(p.Config.Description, "\n", " ", -1) |
|
| 51 | 51 |
desc = strings.Replace(desc, "\r", " ", -1) |
| 52 | 52 |
if !opts.noTrunc {
|
| 53 | 53 |
desc = stringutils.Ellipsis(desc, 45) |
| 54 | 54 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,222 @@ |
| 0 |
+--- |
|
| 1 |
+aliases: [ |
|
| 2 |
+"/engine/extend/" |
|
| 3 |
+] |
|
| 4 |
+title: "Plugin config" |
|
| 5 |
+description: "How develop and use a plugin with the managed plugin system" |
|
| 6 |
+keywords: "API, Usage, plugins, documentation, developer" |
|
| 7 |
+advisory: "experimental" |
|
| 8 |
+--- |
|
| 9 |
+ |
|
| 10 |
+<!-- This file is maintained within the docker/docker Github |
|
| 11 |
+ repository at https://github.com/docker/docker/. Make all |
|
| 12 |
+ pull requests against that repo. If you see this file in |
|
| 13 |
+ another repository, consider it read-only there, as it will |
|
| 14 |
+ periodically be overwritten by the definitive file. Pull |
|
| 15 |
+ requests which include edits to this file in other repositories |
|
| 16 |
+ will be rejected. |
|
| 17 |
+--> |
|
| 18 |
+ |
|
| 19 |
+# Plugin Config Version 0 of Plugin V2 |
|
| 20 |
+ |
|
| 21 |
+This document outlines the format of the V0 plugin config. The plugin |
|
| 22 |
+config described herein was introduced in the Docker daemon (experimental version) in the [v1.12.0 |
|
| 23 |
+release](https://github.com/docker/docker/commit/f37117045c5398fd3dca8016ea8ca0cb47e7312b). |
|
| 24 |
+ |
|
| 25 |
+Plugin configs describe the various constituents of a docker plugin. Plugin |
|
| 26 |
+configs can be serialized to JSON format with the following media types: |
|
| 27 |
+ |
|
| 28 |
+Config Type | Media Type |
|
| 29 |
+------------- | ------------- |
|
| 30 |
+config | "application/vnd.docker.plugin.v0+json" |
|
| 31 |
+ |
|
| 32 |
+ |
|
| 33 |
+## *Config* Field Descriptions |
|
| 34 |
+ |
|
| 35 |
+Config provides the base accessible fields for working with V0 plugin format |
|
| 36 |
+ in the registry. |
|
| 37 |
+ |
|
| 38 |
+- **`description`** *string* |
|
| 39 |
+ |
|
| 40 |
+ description of the plugin |
|
| 41 |
+ |
|
| 42 |
+- **`documentation`** *string* |
|
| 43 |
+ |
|
| 44 |
+ link to the documentation about the plugin |
|
| 45 |
+ |
|
| 46 |
+- **`interface`** *PluginInterface* |
|
| 47 |
+ |
|
| 48 |
+ interface implemented by the plugins, struct consisting of the following fields |
|
| 49 |
+ |
|
| 50 |
+ - **`types`** *string array* |
|
| 51 |
+ |
|
| 52 |
+ types indicate what interface(s) the plugin currently implements. |
|
| 53 |
+ |
|
| 54 |
+ currently supported: |
|
| 55 |
+ |
|
| 56 |
+ - **docker.volumedriver/1.0** |
|
| 57 |
+ |
|
| 58 |
+ - **`socket`** *string* |
|
| 59 |
+ |
|
| 60 |
+ socket is the name of the socket the engine should use to communicate with the plugins. |
|
| 61 |
+ the socket will be created in `/run/docker/plugins`. |
|
| 62 |
+ |
|
| 63 |
+ |
|
| 64 |
+- **`entrypoint`** *string array* |
|
| 65 |
+ |
|
| 66 |
+ entrypoint of the plugin, see [`ENTRYPOINT`](../reference/builder.md#entrypoint) |
|
| 67 |
+ |
|
| 68 |
+- **`workdir`** *string* |
|
| 69 |
+ |
|
| 70 |
+ workdir of the plugin, see [`WORKDIR`](../reference/builder.md#workdir) |
|
| 71 |
+ |
|
| 72 |
+- **`network`** *PluginNetwork* |
|
| 73 |
+ |
|
| 74 |
+ network of the plugin, struct consisting of the following fields |
|
| 75 |
+ |
|
| 76 |
+ - **`type`** *string* |
|
| 77 |
+ |
|
| 78 |
+ network type. |
|
| 79 |
+ |
|
| 80 |
+ currently supported: |
|
| 81 |
+ |
|
| 82 |
+ - **bridge** |
|
| 83 |
+ - **host** |
|
| 84 |
+ - **none** |
|
| 85 |
+ |
|
| 86 |
+- **`capabilities`** *array* |
|
| 87 |
+ |
|
| 88 |
+ capabilities of the plugin (*Linux only*), see list [`here`](https://github.com/opencontainers/runc/blob/master/libcontainer/SPEC.md#security) |
|
| 89 |
+ |
|
| 90 |
+- **`mounts`** *PluginMount array* |
|
| 91 |
+ |
|
| 92 |
+ mount of the plugin, struct consisting of the following fields, see [`MOUNTS`](https://github.com/opencontainers/runtime-spec/blob/master/config.md#mounts) |
|
| 93 |
+ |
|
| 94 |
+ - **`name`** *string* |
|
| 95 |
+ |
|
| 96 |
+ name of the mount. |
|
| 97 |
+ |
|
| 98 |
+ - **`description`** *string* |
|
| 99 |
+ |
|
| 100 |
+ description of the mount. |
|
| 101 |
+ |
|
| 102 |
+ - **`source`** *string* |
|
| 103 |
+ |
|
| 104 |
+ source of the mount. |
|
| 105 |
+ |
|
| 106 |
+ - **`destination`** *string* |
|
| 107 |
+ |
|
| 108 |
+ destination of the mount. |
|
| 109 |
+ |
|
| 110 |
+ - **`type`** *string* |
|
| 111 |
+ |
|
| 112 |
+ mount type. |
|
| 113 |
+ |
|
| 114 |
+ - **`options`** *string array* |
|
| 115 |
+ |
|
| 116 |
+ options of the mount. |
|
| 117 |
+ |
|
| 118 |
+- **`devices`** *PluginDevice array* |
|
| 119 |
+ |
|
| 120 |
+ device of the plugin, (*Linux only*), struct consisting of the following fields, see [`DEVICES`](https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#devices) |
|
| 121 |
+ |
|
| 122 |
+ - **`name`** *string* |
|
| 123 |
+ |
|
| 124 |
+ name of the device. |
|
| 125 |
+ |
|
| 126 |
+ - **`description`** *string* |
|
| 127 |
+ |
|
| 128 |
+ description of the device. |
|
| 129 |
+ |
|
| 130 |
+ - **`path`** *string* |
|
| 131 |
+ |
|
| 132 |
+ path of the device. |
|
| 133 |
+ |
|
| 134 |
+- **`env`** *PluginEnv array* |
|
| 135 |
+ |
|
| 136 |
+ env of the plugin, struct consisting of the following fields |
|
| 137 |
+ |
|
| 138 |
+ - **`name`** *string* |
|
| 139 |
+ |
|
| 140 |
+ name of the env. |
|
| 141 |
+ |
|
| 142 |
+ - **`description`** *string* |
|
| 143 |
+ |
|
| 144 |
+ description of the env. |
|
| 145 |
+ |
|
| 146 |
+ - **`value`** *string* |
|
| 147 |
+ |
|
| 148 |
+ value of the env. |
|
| 149 |
+ |
|
| 150 |
+- **`args`** *PluginArgs* |
|
| 151 |
+ |
|
| 152 |
+ args of the plugin, struct consisting of the following fields |
|
| 153 |
+ |
|
| 154 |
+ - **`name`** *string* |
|
| 155 |
+ |
|
| 156 |
+ name of the env. |
|
| 157 |
+ |
|
| 158 |
+ - **`description`** *string* |
|
| 159 |
+ |
|
| 160 |
+ description of the env. |
|
| 161 |
+ |
|
| 162 |
+ - **`value`** *string array* |
|
| 163 |
+ |
|
| 164 |
+ values of the args. |
|
| 165 |
+ |
|
| 166 |
+ |
|
| 167 |
+## Example Config |
|
| 168 |
+ |
|
| 169 |
+*Example showing the 'tiborvass/no-remove' plugin config.* |
|
| 170 |
+ |
|
| 171 |
+``` |
|
| 172 |
+{
|
|
| 173 |
+ "configVersion": "v0", |
|
| 174 |
+ "description": "A test plugin for Docker", |
|
| 175 |
+ "documentation": "https://docs.docker.com/engine/extend/plugins/", |
|
| 176 |
+ "entrypoint": ["plugin-no-remove", "/data"], |
|
| 177 |
+ "interface" : {
|
|
| 178 |
+ "types": ["docker.volumedriver/1.0"], |
|
| 179 |
+ "socket": "plugins.sock" |
|
| 180 |
+ }, |
|
| 181 |
+ "network": {
|
|
| 182 |
+ "type": "host" |
|
| 183 |
+ }, |
|
| 184 |
+ |
|
| 185 |
+ "mounts": [ |
|
| 186 |
+ {
|
|
| 187 |
+ "source": "/data", |
|
| 188 |
+ "destination": "/data", |
|
| 189 |
+ "type": "bind", |
|
| 190 |
+ "options": ["shared", "rbind"] |
|
| 191 |
+ }, |
|
| 192 |
+ {
|
|
| 193 |
+ "destination": "/foobar", |
|
| 194 |
+ "type": "tmpfs" |
|
| 195 |
+ } |
|
| 196 |
+ ], |
|
| 197 |
+ |
|
| 198 |
+ "args": {
|
|
| 199 |
+ "name": "args", |
|
| 200 |
+ "description": "command line arguments", |
|
| 201 |
+ "value": [] |
|
| 202 |
+ }, |
|
| 203 |
+ |
|
| 204 |
+ "env": [ |
|
| 205 |
+ {
|
|
| 206 |
+ "name": "DEBUG", |
|
| 207 |
+ "description": "If set, prints debug messages", |
|
| 208 |
+ "value": "1" |
|
| 209 |
+ } |
|
| 210 |
+ ], |
|
| 211 |
+ |
|
| 212 |
+ "devices": [ |
|
| 213 |
+ {
|
|
| 214 |
+ "name": "device", |
|
| 215 |
+ "description": "a host device to mount", |
|
| 216 |
+ "path": "/dev/cpu_dma_latency" |
|
| 217 |
+ } |
|
| 218 |
+ ] |
|
| 219 |
+} |
|
| 220 |
+ |
|
| 221 |
+``` |
| ... | ... |
@@ -141,7 +141,7 @@ a `plugins.json` with a single plugin installed. |
| 141 | 141 |
{
|
| 142 | 142 |
"cd851ce43a403": {
|
| 143 | 143 |
"plugin": {
|
| 144 |
- "Manifest": {
|
|
| 144 |
+ "Config": {
|
|
| 145 | 145 |
"Args": {
|
| 146 | 146 |
"Value": null, |
| 147 | 147 |
"Settable": null, |
| ... | ... |
@@ -154,7 +154,6 @@ a `plugins.json` with a single plugin installed. |
| 154 | 154 |
"Capabilities": [ |
| 155 | 155 |
"CAP_SYS_ADMIN" |
| 156 | 156 |
], |
| 157 |
- "ManifestVersion": "v0", |
|
| 158 | 157 |
"Description": "sshFS plugin for Docker", |
| 159 | 158 |
"Documentation": "https://docs.docker.com/engine/extend/plugins/", |
| 160 | 159 |
"Interface": {
|
| ... | ... |
@@ -196,8 +195,8 @@ and two JSON files. |
| 196 | 196 |
# ls -la /var/lib/docker/plugins/cd851ce43a403 |
| 197 | 197 |
total 12 |
| 198 | 198 |
drwx------ 19 root root 4096 Aug 8 17:56 rootfs |
| 199 |
--rw-r--r-- 1 root root 50 Aug 8 17:56 plugin-config.json |
|
| 200 |
--rw------- 1 root root 347 Aug 8 17:56 manifest.json |
|
| 199 |
+-rw-r--r-- 1 root root 50 Aug 8 17:56 plugin-settings.json |
|
| 200 |
+-rw------- 1 root root 347 Aug 8 17:56 config.json |
|
| 201 | 201 |
``` |
| 202 | 202 |
|
| 203 | 203 |
#### The rootfs directory |
| ... | ... |
@@ -219,17 +218,16 @@ $ docker rm -vf "$id" |
| 219 | 219 |
$ docker rmi rootfs |
| 220 | 220 |
``` |
| 221 | 221 |
|
| 222 |
-#### The manifest.json and plugin-config.json files |
|
| 222 |
+#### The config.json and plugin-settings.json files |
|
| 223 | 223 |
|
| 224 |
-The `manifest.json` file describes the plugin. The `plugin-config.json` file |
|
| 224 |
+The `config.json` file describes the plugin. The `plugin-settings.json` file |
|
| 225 | 225 |
contains runtime parameters and is only required if your plugin has runtime |
| 226 |
-parameters. [See the Plugins Manifest reference](manifest.md). |
|
| 226 |
+parameters. [See the Plugins Config reference](config.md). |
|
| 227 | 227 |
|
| 228 |
-Consider the following `manifest.json` file. |
|
| 228 |
+Consider the following `config.json` file. |
|
| 229 | 229 |
|
| 230 | 230 |
```json |
| 231 | 231 |
{
|
| 232 |
- "manifestVersion": "v0", |
|
| 233 | 232 |
"description": "sshFS plugin for Docker", |
| 234 | 233 |
"documentation": "https://docs.docker.com/engine/extend/plugins/", |
| 235 | 234 |
"entrypoint": ["/go/bin/docker-volume-sshfs"], |
| ... | ... |
@@ -250,7 +248,7 @@ entrypoint and uses the `/run/docker/plugins/sshfs.sock` socket to communicate |
| 250 | 250 |
with Docker Engine. |
| 251 | 251 |
|
| 252 | 252 |
|
| 253 |
-Consider the following `plugin-config.json` file. |
|
| 253 |
+Consider the following `plugin-settings.json` file. |
|
| 254 | 254 |
|
| 255 | 255 |
```json |
| 256 | 256 |
{
|
| ... | ... |
@@ -264,8 +262,8 @@ Consider the following `plugin-config.json` file. |
| 264 | 264 |
This plugin has no runtime parameters. |
| 265 | 265 |
|
| 266 | 266 |
Each of these JSON files is included as part of `plugins.json`, as you can see |
| 267 |
-by looking back at the example above. After a plugin is installed, `manifest.json` |
|
| 268 |
-is read-only, but `plugin-config.json` is read-write, and includes all runtime |
|
| 267 |
+by looking back at the example above. After a plugin is installed, `config.json` |
|
| 268 |
+is read-only, but `plugin-settings.json` is read-write, and includes all runtime |
|
| 269 | 269 |
configuration options for the plugin. |
| 270 | 270 |
|
| 271 | 271 |
### Creating the plugin |
| ... | ... |
@@ -279,9 +277,9 @@ Follow these steps to create a plugin: |
| 279 | 279 |
using `docker export`. See [The rootfs directory](#the-rootfs-directory) for |
| 280 | 280 |
an example of creating a `rootfs`. |
| 281 | 281 |
|
| 282 |
-3. Create a `manifest.json` file in `/var/lib/docker/plugins/$id/`. |
|
| 282 |
+3. Create a `config.json` file in `/var/lib/docker/plugins/$id/`. |
|
| 283 | 283 |
|
| 284 |
-4. Create a `plugin-config.json` file if needed. |
|
| 284 |
+4. Create a `plugin-settings.json` file if needed. |
|
| 285 | 285 |
|
| 286 | 286 |
5. Create or add a section to `/var/lib/docker/plugins/plugins.json`. Use |
| 287 | 287 |
`<user>/<name>` as “Name” and `$id` as “Id”. |
| 288 | 288 |
deleted file mode 100644 |
| ... | ... |
@@ -1,226 +0,0 @@ |
| 1 |
-aliases: [ |
|
| 2 |
-"/engine/extend/" |
|
| 3 |
-] |
|
| 4 |
-title: "Plugin manifest" |
|
| 5 |
-description: "How develop and use a plugin with the managed plugin system" |
|
| 6 |
-keywords: "API, Usage, plugins, documentation, developer" |
|
| 7 |
-advisory: "experimental" |
|
| 8 |
- |
|
| 9 |
-<!-- This file is maintained within the docker/docker Github |
|
| 10 |
- repository at https://github.com/docker/docker/. Make all |
|
| 11 |
- pull requests against that repo. If you see this file in |
|
| 12 |
- another repository, consider it read-only there, as it will |
|
| 13 |
- periodically be overwritten by the definitive file. Pull |
|
| 14 |
- requests which include edits to this file in other repositories |
|
| 15 |
- will be rejected. |
|
| 16 |
- |
|
| 17 |
-# Plugin Manifest Version 0 of Plugin V2 |
|
| 18 |
- |
|
| 19 |
-This document outlines the format of the V0 plugin manifest. The plugin |
|
| 20 |
-manifest described herein was introduced in the Docker daemon (experimental version) in the [v1.12.0 |
|
| 21 |
-release](https://github.com/docker/docker/commit/f37117045c5398fd3dca8016ea8ca0cb47e7312b). |
|
| 22 |
- |
|
| 23 |
-Plugin manifests describe the various constituents of a docker plugin. Plugin |
|
| 24 |
-manifests can be serialized to JSON format with the following media types: |
|
| 25 |
- |
|
| 26 |
-Manifest Type | Media Type |
|
| 27 |
-manifest | "application/vnd.docker.plugin.v0+json" |
|
| 28 |
- |
|
| 29 |
- |
|
| 30 |
-## *Manifest* Field Descriptions |
|
| 31 |
- |
|
| 32 |
-Manifest provides the base accessible fields for working with V0 plugin format |
|
| 33 |
- in the registry. |
|
| 34 |
- |
|
| 35 |
-- **`manifestVersion`** *string* |
|
| 36 |
- |
|
| 37 |
- version of the plugin manifest (This version uses V0) |
|
| 38 |
- |
|
| 39 |
-- **`description`** *string* |
|
| 40 |
- |
|
| 41 |
- description of the plugin |
|
| 42 |
- |
|
| 43 |
-- **`documentation`** *string* |
|
| 44 |
- |
|
| 45 |
- link to the documentation about the plugin |
|
| 46 |
- |
|
| 47 |
-- **`interface`** *PluginInterface* |
|
| 48 |
- |
|
| 49 |
- interface implemented by the plugins, struct consisting of the following fields |
|
| 50 |
- |
|
| 51 |
- - **`types`** *string array* |
|
| 52 |
- |
|
| 53 |
- types indicate what interface(s) the plugin currently implements. |
|
| 54 |
- |
|
| 55 |
- currently supported: |
|
| 56 |
- |
|
| 57 |
- - **docker.volumedriver/1.0** |
|
| 58 |
- |
|
| 59 |
- - **`socket`** *string* |
|
| 60 |
- |
|
| 61 |
- socket is the name of the socket the engine should use to communicate with the plugins. |
|
| 62 |
- the socket will be created in `/run/docker/plugins`. |
|
| 63 |
- |
|
| 64 |
- |
|
| 65 |
-- **`entrypoint`** *string array* |
|
| 66 |
- |
|
| 67 |
- entrypoint of the plugin, see [`ENTRYPOINT`](../reference/builder.md#entrypoint) |
|
| 68 |
- |
|
| 69 |
-- **`workdir`** *string* |
|
| 70 |
- |
|
| 71 |
- workdir of the plugin, see [`WORKDIR`](../reference/builder.md#workdir) |
|
| 72 |
- |
|
| 73 |
-- **`network`** *PluginNetwork* |
|
| 74 |
- |
|
| 75 |
- network of the plugin, struct consisting of the following fields |
|
| 76 |
- |
|
| 77 |
- - **`type`** *string* |
|
| 78 |
- |
|
| 79 |
- network type. |
|
| 80 |
- |
|
| 81 |
- currently supported: |
|
| 82 |
- |
|
| 83 |
- - **bridge** |
|
| 84 |
- - **host** |
|
| 85 |
- - **none** |
|
| 86 |
- |
|
| 87 |
-- **`capabilities`** *array* |
|
| 88 |
- |
|
| 89 |
- capabilities of the plugin (*Linux only*), see list [`here`](https://github.com/opencontainers/runc/blob/master/libcontainer/SPEC.md#security) |
|
| 90 |
- |
|
| 91 |
-- **`mounts`** *PluginMount array* |
|
| 92 |
- |
|
| 93 |
- mount of the plugin, struct consisting of the following fields, see [`MOUNTS`](https://github.com/opencontainers/runtime-spec/blob/master/config.md#mounts) |
|
| 94 |
- |
|
| 95 |
- - **`name`** *string* |
|
| 96 |
- |
|
| 97 |
- name of the mount. |
|
| 98 |
- |
|
| 99 |
- - **`description`** *string* |
|
| 100 |
- |
|
| 101 |
- description of the mount. |
|
| 102 |
- |
|
| 103 |
- - **`source`** *string* |
|
| 104 |
- |
|
| 105 |
- source of the mount. |
|
| 106 |
- |
|
| 107 |
- - **`destination`** *string* |
|
| 108 |
- |
|
| 109 |
- destination of the mount. |
|
| 110 |
- |
|
| 111 |
- - **`type`** *string* |
|
| 112 |
- |
|
| 113 |
- mount type. |
|
| 114 |
- |
|
| 115 |
- - **`options`** *string array* |
|
| 116 |
- |
|
| 117 |
- options of the mount. |
|
| 118 |
- |
|
| 119 |
-- **`devices`** *PluginDevice array* |
|
| 120 |
- |
|
| 121 |
- device of the plugin, (*Linux only*), struct consisting of the following fields, see [`DEVICES`](https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#devices) |
|
| 122 |
- |
|
| 123 |
- - **`name`** *string* |
|
| 124 |
- |
|
| 125 |
- name of the device. |
|
| 126 |
- |
|
| 127 |
- - **`description`** *string* |
|
| 128 |
- |
|
| 129 |
- description of the device. |
|
| 130 |
- |
|
| 131 |
- - **`path`** *string* |
|
| 132 |
- |
|
| 133 |
- path of the device. |
|
| 134 |
- |
|
| 135 |
-- **`env`** *PluginEnv array* |
|
| 136 |
- |
|
| 137 |
- env of the plugin, struct consisting of the following fields |
|
| 138 |
- |
|
| 139 |
- - **`name`** *string* |
|
| 140 |
- |
|
| 141 |
- name of the env. |
|
| 142 |
- |
|
| 143 |
- - **`description`** *string* |
|
| 144 |
- |
|
| 145 |
- description of the env. |
|
| 146 |
- |
|
| 147 |
- - **`value`** *string* |
|
| 148 |
- |
|
| 149 |
- value of the env. |
|
| 150 |
- |
|
| 151 |
-- **`args`** *PluginArgs* |
|
| 152 |
- |
|
| 153 |
- args of the plugin, struct consisting of the following fields |
|
| 154 |
- |
|
| 155 |
- - **`name`** *string* |
|
| 156 |
- |
|
| 157 |
- name of the env. |
|
| 158 |
- |
|
| 159 |
- - **`description`** *string* |
|
| 160 |
- |
|
| 161 |
- description of the env. |
|
| 162 |
- |
|
| 163 |
- - **`value`** *string array* |
|
| 164 |
- |
|
| 165 |
- values of the args. |
|
| 166 |
- |
|
| 167 |
- |
|
| 168 |
-## Example Manifest |
|
| 169 |
- |
|
| 170 |
-*Example showing the 'tiborvass/no-remove' plugin manifest.* |
|
| 171 |
- |
|
| 172 |
-``` |
|
| 173 |
-{
|
|
| 174 |
- "manifestVersion": "v0", |
|
| 175 |
- "description": "A test plugin for Docker", |
|
| 176 |
- "documentation": "https://docs.docker.com/engine/extend/plugins/", |
|
| 177 |
- "entrypoint": ["plugin-no-remove", "/data"], |
|
| 178 |
- "interface" : {
|
|
| 179 |
- "types": ["docker.volumedriver/1.0"], |
|
| 180 |
- "socket": "plugins.sock" |
|
| 181 |
- }, |
|
| 182 |
- "network": {
|
|
| 183 |
- "type": "host" |
|
| 184 |
- }, |
|
| 185 |
- |
|
| 186 |
- "mounts": [ |
|
| 187 |
- {
|
|
| 188 |
- "source": "/data", |
|
| 189 |
- "destination": "/data", |
|
| 190 |
- "type": "bind", |
|
| 191 |
- "options": ["shared", "rbind"] |
|
| 192 |
- }, |
|
| 193 |
- {
|
|
| 194 |
- "destination": "/foobar", |
|
| 195 |
- "type": "tmpfs" |
|
| 196 |
- } |
|
| 197 |
- ], |
|
| 198 |
- |
|
| 199 |
- "args": {
|
|
| 200 |
- "name": "args", |
|
| 201 |
- "description": "command line arguments", |
|
| 202 |
- "value": [] |
|
| 203 |
- }, |
|
| 204 |
- |
|
| 205 |
- "env": [ |
|
| 206 |
- {
|
|
| 207 |
- "name": "DEBUG", |
|
| 208 |
- "description": "If set, prints debug messages", |
|
| 209 |
- "value": "1" |
|
| 210 |
- } |
|
| 211 |
- ], |
|
| 212 |
- |
|
| 213 |
- "devices": [ |
|
| 214 |
- {
|
|
| 215 |
- "name": "device", |
|
| 216 |
- "description": "a host device to mount", |
|
| 217 |
- "path": "/dev/cpu_dma_latency" |
|
| 218 |
- } |
|
| 219 |
- ] |
|
| 220 |
-} |
|
| 221 |
- |
|
| 222 |
-``` |
| ... | ... |
@@ -17,7 +17,7 @@ advisory: "experimental" |
| 17 | 17 |
```markdown |
| 18 | 18 |
Usage: docker plugin create [OPTIONS] reponame[:tag] PATH-TO-ROOTFS |
| 19 | 19 |
|
| 20 |
-create a plugin from the given PATH-TO-ROOTFS, which contains the plugin's root filesystem and the manifest file, manifest.json |
|
| 20 |
+create a plugin from the given PATH-TO-ROOTFS, which contains the plugin's root filesystem and the config file, config.json |
|
| 21 | 21 |
|
| 22 | 22 |
Options: |
| 23 | 23 |
--compress Compress the context using gzip |
| ... | ... |
@@ -25,7 +25,7 @@ Options: |
| 25 | 25 |
``` |
| 26 | 26 |
|
| 27 | 27 |
Creates a plugin. Before creating the plugin, prepare the plugin's root filesystem as well as |
| 28 |
-the manifest.json (https://github.com/docker/docker/blob/master/docs/extend/manifest.md) |
|
| 28 |
+the config.json (https://github.com/docker/docker/blob/master/docs/extend/config.md) |
|
| 29 | 29 |
|
| 30 | 30 |
|
| 31 | 31 |
The following example shows how to create a sample `plugin`. |
| ... | ... |
@@ -34,7 +34,7 @@ The following example shows how to create a sample `plugin`. |
| 34 | 34 |
|
| 35 | 35 |
$ ls -ls /home/pluginDir |
| 36 | 36 |
|
| 37 |
-4 -rw-r--r-- 1 root root 431 Nov 7 01:40 manifest.json |
|
| 37 |
+4 -rw-r--r-- 1 root root 431 Nov 7 01:40 config.json |
|
| 38 | 38 |
0 drwxr-xr-x 19 root root 420 Nov 7 01:40 rootfs |
| 39 | 39 |
|
| 40 | 40 |
$ docker plugin create plugin /home/pluginDir |
| ... | ... |
@@ -123,12 +123,12 @@ func (s *DockerSuite) TestPluginSet(c *check.C) {
|
| 123 | 123 |
out, _ := dockerCmd(c, "plugin", "install", "--grant-all-permissions", "--disable", pName) |
| 124 | 124 |
c.Assert(strings.TrimSpace(out), checker.Contains, pName) |
| 125 | 125 |
|
| 126 |
- env, _ := dockerCmd(c, "plugin", "inspect", "-f", "{{.Config.Env}}", pName)
|
|
| 126 |
+ env, _ := dockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", pName)
|
|
| 127 | 127 |
c.Assert(strings.TrimSpace(env), checker.Equals, "[DEBUG=0]") |
| 128 | 128 |
|
| 129 | 129 |
dockerCmd(c, "plugin", "set", pName, "DEBUG=1") |
| 130 | 130 |
|
| 131 |
- env, _ = dockerCmd(c, "plugin", "inspect", "-f", "{{.Config.Env}}", pName)
|
|
| 131 |
+ env, _ = dockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", pName)
|
|
| 132 | 132 |
c.Assert(strings.TrimSpace(env), checker.Equals, "[DEBUG=1]") |
| 133 | 133 |
} |
| 134 | 134 |
|
| ... | ... |
@@ -137,7 +137,7 @@ func (s *DockerSuite) TestPluginInstallArgs(c *check.C) {
|
| 137 | 137 |
out, _ := dockerCmd(c, "plugin", "install", "--grant-all-permissions", "--disable", pName, "DEBUG=1") |
| 138 | 138 |
c.Assert(strings.TrimSpace(out), checker.Contains, pName) |
| 139 | 139 |
|
| 140 |
- env, _ := dockerCmd(c, "plugin", "inspect", "-f", "{{.Config.Env}}", pName)
|
|
| 140 |
+ env, _ := dockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", pName)
|
|
| 141 | 141 |
c.Assert(strings.TrimSpace(env), checker.Equals, "[DEBUG=1]") |
| 142 | 142 |
} |
| 143 | 143 |
|
| ... | ... |
@@ -46,7 +46,7 @@ func (pm *Manager) Enable(name string) error {
|
| 46 | 46 |
return nil |
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 |
-// Inspect examines a plugin manifest |
|
| 49 |
+// Inspect examines a plugin config |
|
| 50 | 50 |
func (pm *Manager) Inspect(name string) (tp types.Plugin, err error) {
|
| 51 | 51 |
p, err := pm.pluginStore.GetByName(name) |
| 52 | 52 |
if err != nil {
|
| ... | ... |
@@ -115,7 +115,7 @@ func (pm *Manager) Push(name string, metaHeader http.Header, authConfig *types.A |
| 115 | 115 |
return err |
| 116 | 116 |
} |
| 117 | 117 |
dest := filepath.Join(pm.libRoot, p.GetID()) |
| 118 |
- config, err := ioutil.ReadFile(filepath.Join(dest, "manifest.json")) |
|
| 118 |
+ config, err := ioutil.ReadFile(filepath.Join(dest, "config.json")) |
|
| 119 | 119 |
if err != nil {
|
| 120 | 120 |
return err |
| 121 | 121 |
} |
| ... | ... |
@@ -180,7 +180,7 @@ func (pm *Manager) Set(name string, args []string) error {
|
| 180 | 180 |
} |
| 181 | 181 |
|
| 182 | 182 |
// CreateFromContext creates a plugin from the given pluginDir which contains |
| 183 |
-// both the rootfs and the manifest.json and a repoName with optional tag. |
|
| 183 |
+// both the rootfs and the config.json and a repoName with optional tag. |
|
| 184 | 184 |
func (pm *Manager) CreateFromContext(ctx context.Context, tarCtx io.Reader, options *types.PluginCreateOptions) error {
|
| 185 | 185 |
pluginID := stringid.GenerateNonCryptoID() |
| 186 | 186 |
|
| ... | ... |
@@ -20,7 +20,7 @@ import ( |
| 20 | 20 |
"golang.org/x/net/context" |
| 21 | 21 |
) |
| 22 | 22 |
|
| 23 |
-// PullData is the plugin manifest and the rootfs |
|
| 23 |
+// PullData is the plugin config and the rootfs |
|
| 24 | 24 |
type PullData interface {
|
| 25 | 25 |
Config() ([]byte, error) |
| 26 | 26 |
Layer() (io.ReadCloser, error) |
| ... | ... |
@@ -183,7 +183,7 @@ func WritePullData(pd PullData, dest string, extract bool) error {
|
| 183 | 183 |
} |
| 184 | 184 |
|
| 185 | 185 |
if extract {
|
| 186 |
- if err := ioutil.WriteFile(filepath.Join(dest, "manifest.json"), config, 0600); err != nil {
|
|
| 186 |
+ if err := ioutil.WriteFile(filepath.Join(dest, "config.json"), config, 0600); err != nil {
|
|
| 187 | 187 |
return err |
| 188 | 188 |
} |
| 189 | 189 |
|
| ... | ... |
@@ -11,8 +11,8 @@ func TestFilterByCapNeg(t *testing.T) {
|
| 11 | 11 |
p := v2.NewPlugin("test", "1234567890", "/run/docker", "/var/lib/docker/plugins", "latest")
|
| 12 | 12 |
|
| 13 | 13 |
iType := types.PluginInterfaceType{"volumedriver", "docker", "1.0"}
|
| 14 |
- i := types.PluginManifestInterface{"plugins.sock", []types.PluginInterfaceType{iType}}
|
|
| 15 |
- p.PluginObj.Manifest.Interface = i |
|
| 14 |
+ i := types.PluginConfigInterface{"plugins.sock", []types.PluginInterfaceType{iType}}
|
|
| 15 |
+ p.PluginObj.Config.Interface = i |
|
| 16 | 16 |
|
| 17 | 17 |
_, err := p.FilterByCap("foobar")
|
| 18 | 18 |
if err == nil {
|
| ... | ... |
@@ -24,8 +24,8 @@ func TestFilterByCapPos(t *testing.T) {
|
| 24 | 24 |
p := v2.NewPlugin("test", "1234567890", "/run/docker", "/var/lib/docker/plugins", "latest")
|
| 25 | 25 |
|
| 26 | 26 |
iType := types.PluginInterfaceType{"volumedriver", "docker", "1.0"}
|
| 27 |
- i := types.PluginManifestInterface{"plugins.sock", []types.PluginInterfaceType{iType}}
|
|
| 28 |
- p.PluginObj.Manifest.Interface = i |
|
| 27 |
+ i := types.PluginConfigInterface{"plugins.sock", []types.PluginInterfaceType{iType}}
|
|
| 28 |
+ p.PluginObj.Config.Interface = i |
|
| 29 | 29 |
|
| 30 | 30 |
_, err := p.FilterByCap("volumedriver")
|
| 31 | 31 |
if err != nil {
|
| ... | ... |
@@ -73,7 +73,7 @@ func (p *Plugin) Name() string {
|
| 73 | 73 |
// FilterByCap query the plugin for a given capability. |
| 74 | 74 |
func (p *Plugin) FilterByCap(capability string) (*Plugin, error) {
|
| 75 | 75 |
capability = strings.ToLower(capability) |
| 76 |
- for _, typ := range p.PluginObj.Manifest.Interface.Types {
|
|
| 76 |
+ for _, typ := range p.PluginObj.Config.Interface.Types {
|
|
| 77 | 77 |
if typ.Capability == capability && typ.Prefix == "docker" {
|
| 78 | 78 |
return p, nil |
| 79 | 79 |
} |
| ... | ... |
@@ -86,39 +86,39 @@ func (p *Plugin) RemoveFromDisk() error {
|
| 86 | 86 |
return os.RemoveAll(p.RuntimeSourcePath) |
| 87 | 87 |
} |
| 88 | 88 |
|
| 89 |
-// InitPlugin populates the plugin object from the plugin manifest file. |
|
| 89 |
+// InitPlugin populates the plugin object from the plugin config file. |
|
| 90 | 90 |
func (p *Plugin) InitPlugin() error {
|
| 91 |
- dt, err := os.Open(filepath.Join(p.LibRoot, p.PluginObj.ID, "manifest.json")) |
|
| 91 |
+ dt, err := os.Open(filepath.Join(p.LibRoot, p.PluginObj.ID, "config.json")) |
|
| 92 | 92 |
if err != nil {
|
| 93 | 93 |
return err |
| 94 | 94 |
} |
| 95 |
- err = json.NewDecoder(dt).Decode(&p.PluginObj.Manifest) |
|
| 95 |
+ err = json.NewDecoder(dt).Decode(&p.PluginObj.Config) |
|
| 96 | 96 |
dt.Close() |
| 97 | 97 |
if err != nil {
|
| 98 | 98 |
return err |
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 |
- p.PluginObj.Config.Mounts = make([]types.PluginMount, len(p.PluginObj.Manifest.Mounts)) |
|
| 102 |
- for i, mount := range p.PluginObj.Manifest.Mounts {
|
|
| 103 |
- p.PluginObj.Config.Mounts[i] = mount |
|
| 101 |
+ p.PluginObj.Settings.Mounts = make([]types.PluginMount, len(p.PluginObj.Config.Mounts)) |
|
| 102 |
+ for i, mount := range p.PluginObj.Config.Mounts {
|
|
| 103 |
+ p.PluginObj.Settings.Mounts[i] = mount |
|
| 104 | 104 |
} |
| 105 |
- p.PluginObj.Config.Env = make([]string, 0, len(p.PluginObj.Manifest.Env)) |
|
| 106 |
- for _, env := range p.PluginObj.Manifest.Env {
|
|
| 105 |
+ p.PluginObj.Settings.Env = make([]string, 0, len(p.PluginObj.Config.Env)) |
|
| 106 |
+ for _, env := range p.PluginObj.Config.Env {
|
|
| 107 | 107 |
if env.Value != nil {
|
| 108 |
- p.PluginObj.Config.Env = append(p.PluginObj.Config.Env, fmt.Sprintf("%s=%s", env.Name, *env.Value))
|
|
| 108 |
+ p.PluginObj.Settings.Env = append(p.PluginObj.Settings.Env, fmt.Sprintf("%s=%s", env.Name, *env.Value))
|
|
| 109 | 109 |
} |
| 110 | 110 |
} |
| 111 |
- copy(p.PluginObj.Config.Args, p.PluginObj.Manifest.Args.Value) |
|
| 111 |
+ copy(p.PluginObj.Settings.Args, p.PluginObj.Config.Args.Value) |
|
| 112 | 112 |
|
| 113 |
- return p.writeConfig() |
|
| 113 |
+ return p.writeSettings() |
|
| 114 | 114 |
} |
| 115 | 115 |
|
| 116 |
-func (p *Plugin) writeConfig() error {
|
|
| 117 |
- f, err := os.Create(filepath.Join(p.LibRoot, p.PluginObj.ID, "plugin-config.json")) |
|
| 116 |
+func (p *Plugin) writeSettings() error {
|
|
| 117 |
+ f, err := os.Create(filepath.Join(p.LibRoot, p.PluginObj.ID, "plugin-settings.json")) |
|
| 118 | 118 |
if err != nil {
|
| 119 | 119 |
return err |
| 120 | 120 |
} |
| 121 |
- err = json.NewEncoder(f).Encode(&p.PluginObj.Config) |
|
| 121 |
+ err = json.NewEncoder(f).Encode(&p.PluginObj.Settings) |
|
| 122 | 122 |
f.Close() |
| 123 | 123 |
return err |
| 124 | 124 |
} |
| ... | ... |
@@ -139,9 +139,9 @@ func (p *Plugin) Set(args []string) error {
|
| 139 | 139 |
|
| 140 | 140 |
next: |
| 141 | 141 |
for _, s := range sets {
|
| 142 |
- // range over all the envs in the manifest |
|
| 143 |
- for _, env := range p.PluginObj.Manifest.Env {
|
|
| 144 |
- // found the env in the manifest |
|
| 142 |
+ // range over all the envs in the config |
|
| 143 |
+ for _, env := range p.PluginObj.Config.Env {
|
|
| 144 |
+ // found the env in the config |
|
| 145 | 145 |
if env.Name == s.name {
|
| 146 | 146 |
// is it settable ? |
| 147 | 147 |
if ok, err := s.isSettable(allowedSettableFieldsEnv, env.Settable); err != nil {
|
| ... | ... |
@@ -149,8 +149,8 @@ next: |
| 149 | 149 |
} else if !ok {
|
| 150 | 150 |
return fmt.Errorf("%q is not settable", s.prettyName())
|
| 151 | 151 |
} |
| 152 |
- // is it, so lets update the config in memory |
|
| 153 |
- updateConfigEnv(&p.PluginObj.Config.Env, &s) |
|
| 152 |
+ // is it, so lets update the settings in memory |
|
| 153 |
+ updateConfigEnv(&p.PluginObj.Settings.Env, &s) |
|
| 154 | 154 |
continue next |
| 155 | 155 |
} |
| 156 | 156 |
} |
| ... | ... |
@@ -160,14 +160,14 @@ next: |
| 160 | 160 |
return fmt.Errorf("setting %q not found in the plugin configuration", s.name)
|
| 161 | 161 |
} |
| 162 | 162 |
|
| 163 |
- // update the config on disk |
|
| 164 |
- return p.writeConfig() |
|
| 163 |
+ // update the settings on disk |
|
| 164 |
+ return p.writeSettings() |
|
| 165 | 165 |
} |
| 166 | 166 |
|
| 167 |
-// ComputePrivileges takes the manifest file and computes the list of access necessary |
|
| 167 |
+// ComputePrivileges takes the config file and computes the list of access necessary |
|
| 168 | 168 |
// for the plugin on the host. |
| 169 | 169 |
func (p *Plugin) ComputePrivileges() types.PluginPrivileges {
|
| 170 |
- m := p.PluginObj.Manifest |
|
| 170 |
+ m := p.PluginObj.Config |
|
| 171 | 171 |
var privileges types.PluginPrivileges |
| 172 | 172 |
if m.Network.Type != "null" && m.Network.Type != "bridge" {
|
| 173 | 173 |
privileges = append(privileges, types.PluginPrivilege{
|
| ... | ... |
@@ -225,7 +225,7 @@ func (p *Plugin) GetSocket() string {
|
| 225 | 225 |
p.RLock() |
| 226 | 226 |
defer p.RUnlock() |
| 227 | 227 |
|
| 228 |
- return p.PluginObj.Manifest.Interface.Socket |
|
| 228 |
+ return p.PluginObj.Config.Interface.Socket |
|
| 229 | 229 |
} |
| 230 | 230 |
|
| 231 | 231 |
// GetTypes returns the interface types of a plugin. |
| ... | ... |
@@ -233,7 +233,7 @@ func (p *Plugin) GetTypes() []types.PluginInterfaceType {
|
| 233 | 233 |
p.RLock() |
| 234 | 234 |
defer p.RUnlock() |
| 235 | 235 |
|
| 236 |
- return p.PluginObj.Manifest.Interface.Types |
|
| 236 |
+ return p.PluginObj.Config.Interface.Types |
|
| 237 | 237 |
} |
| 238 | 238 |
|
| 239 | 239 |
// InitSpec creates an OCI spec from the plugin's config. |
| ... | ... |
@@ -241,10 +241,10 @@ func (p *Plugin) InitSpec(s specs.Spec, libRoot string) (*specs.Spec, error) {
|
| 241 | 241 |
rootfs := filepath.Join(libRoot, p.PluginObj.ID, "rootfs") |
| 242 | 242 |
s.Root = specs.Root{
|
| 243 | 243 |
Path: rootfs, |
| 244 |
- Readonly: false, // TODO: all plugins should be readonly? settable in manifest? |
|
| 244 |
+ Readonly: false, // TODO: all plugins should be readonly? settable in config? |
|
| 245 | 245 |
} |
| 246 | 246 |
|
| 247 |
- mounts := append(p.PluginObj.Config.Mounts, types.PluginMount{
|
|
| 247 |
+ mounts := append(p.PluginObj.Settings.Mounts, types.PluginMount{
|
|
| 248 | 248 |
Source: &p.RuntimeSourcePath, |
| 249 | 249 |
Destination: defaultPluginRuntimeDestination, |
| 250 | 250 |
Type: "bind", |
| ... | ... |
@@ -274,12 +274,12 @@ func (p *Plugin) InitSpec(s specs.Spec, libRoot string) (*specs.Spec, error) {
|
| 274 | 274 |
s.Mounts = append(s.Mounts, m) |
| 275 | 275 |
} |
| 276 | 276 |
|
| 277 |
- envs := make([]string, 1, len(p.PluginObj.Config.Env)+1) |
|
| 277 |
+ envs := make([]string, 1, len(p.PluginObj.Settings.Env)+1) |
|
| 278 | 278 |
envs[0] = "PATH=" + system.DefaultPathEnv |
| 279 |
- envs = append(envs, p.PluginObj.Config.Env...) |
|
| 279 |
+ envs = append(envs, p.PluginObj.Settings.Env...) |
|
| 280 | 280 |
|
| 281 |
- args := append(p.PluginObj.Manifest.Entrypoint, p.PluginObj.Config.Args...) |
|
| 282 |
- cwd := p.PluginObj.Manifest.Workdir |
|
| 281 |
+ args := append(p.PluginObj.Config.Entrypoint, p.PluginObj.Settings.Args...) |
|
| 282 |
+ cwd := p.PluginObj.Config.Workdir |
|
| 283 | 283 |
if len(cwd) == 0 {
|
| 284 | 284 |
cwd = "/" |
| 285 | 285 |
} |