mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 01:15:43 +03:00
* create plugin author guide; remove concepts/plugins * style guide; update links * update cni redirect * move host-volume plugin to /plugins/. Add arch host volume content. * Apply Jeff's style guide updates Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com> * Create Base plugin API section, link to BasePlugin interface --------- Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
### `PluginInfo() (*PluginInfoResponse, error)`
|
|
|
|
A `PluginInfoResponse` contains meta data about the plugin.
|
|
|
|
```go
|
|
PluginInfoResponse{
|
|
// Type is the plugin type which is implemented
|
|
Type: PluginTypeDriver,
|
|
// Plugin API versions supported by the plugin
|
|
PluginApiVersions: []string{drivers.ApiVersion010},
|
|
// Version of the plugin
|
|
PluginVersion: "0.1.0",
|
|
// Name of the plugin
|
|
Name: "foodriver",
|
|
}
|
|
```
|
|
|
|
### `SetConfig(config *Config) error`
|
|
|
|
The `SetConfig` function is called when starting the plugin for the first
|
|
time. The `Config` given has two different configuration fields. The first,
|
|
`PluginConfig`, is an encoded configuration from the `plugin` block of the
|
|
client config. The second, `AgentConfig`, is the Nomad agent's configuration,
|
|
which is given to all plugins.
|
|
|
|
### `ConfigSchema() (*hclspec.Spec, error)`
|
|
|
|
The `ConfigSchema` function allows a plugin to tell Nomad the schema for its
|
|
configuration. This configuration is given in a [plugin block][pluginblock] of
|
|
the client configuration. The schema is defined with the [hclspec][hclspec]
|
|
package.
|
|
|
|
|
|
[hclspec]: https://godoc.org/github.com/hashicorp/nomad/plugins/shared/hclspec
|
|
[pluginblock]: /nomad/docs/configuration/plugin
|