dcos storage plugin-configuration update

ENTERPRISE

BETA

Update a plugin configuration.

WARNING: Beta Software This software may contain bugs, incomplete features, incorrect documentation, or other discrepancies. Contact Mesosphere before deploying a beta candidate service. Product support is available to approved participants in the beta test program. Contact support@mesosphere.io for information about participation.

dcos storage plugin-configuration update

Update a plugin configuration.

Synopsis

Arguments:

<path>    A URL or local path to the plugin configuration JSON. If this is
          omitted the volume provider configuration JSON is read from STDIN.

Read more about plugin configurations and when you would use them by running dcos storage plugin-configuration --help. In what follows we’ll assume you are familiar with them and will describe how to add them with examples.

The plugin configuration is updated by passing a JSON document to this command. The JSON document may consist of the following fields: name, description, and spec.

The name field identifies the plugin configuration. The name field corresponds to the spec.plugin.name field when creating a new volume provider or volume profile. Currently, the only supported plugin names are “lvm” and "devices". This field is required.

The description field lets you specify a human-readable description for the plugin configuration to add some extra context. This is a string of up to 512 characters. This field is optional.

The spec field is itself a nested structure. It contains the csi-template field. This field is required.

The spec.csi-template field is quite complex. In most cases it will be easiest to view an existing plugin configuration using the ‘dcos storage plugin-configuration list’ command and then modify one as needed from there.

$ cat << EOF | dcos storage plugin-configuration update
{
    "name": "lvm",
    "description": "Default configuration for the lvm plugin shipped with DSS",
    "spec": {
        "csi-template": {
            "services": [
                "CONTROLLER_SERVICE",
                "NODE_SERVICE"
            ],
            "command": {
                "value": "{{.Cmdline | json }}",
                "shell": true,
                "environment": {
                    "CONTAINER_LOGGER_DESTINATION_TYPE": "journald+logrotate",
                    "CONTAINER_LOGGER_EXTRA_LABELS": "{\"CSI_PLUGIN\":\"csilvm\"}",
                    "LD_LIBRARY_PATH": "/opt/mesosphere/lib",
                    "PATH": "/opt/mesosphere/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                    "FOO": "bar"
                },
                "uris": [
                    {
                        "value": "http://storage-artifacts.marathon.l4lb.thisdcos.directory:10000/csilvm",
                        "cache": true,
                        "executable": true
                    }
                ]
            },
            "resources": [
                {
                    "name": "cpus",
                    "value": 0.1
                },
                {
                    "name": "mem",
                    "value": 128
                },
                {
                    "name": "disk",
                    "value": 10
                }
            ]
        }
    }
}
EOF
```bash

Again, writing these by hand is extremely challenging. It is far more likely
that you will want to modify an existing plugin configuration by viewing it (by
running 'dcos storage plugin-configuration list' or 'dcos storage
plugin-configuration generate'), edit the output by hand, and finally
submitting it to 'dcos storage provider update'. When using an existing plugin
configuration as a template, remember to remove the 'config-version' and
'created-at' fields before passing it to 'dcos storage plugin-configuration
update' as those fields are automatically populated by DSS and cannot be set
manually.

When a plugin configuration is updated, a new version of that plugin
configuration is created. The previous versions of the plugin configuration
still exist. A specific plugin configuration is uniquely identified by its
'name' and its 'config-version'. In most cases the intended value of the
'config-version' field is the latest version of the plugin configuration. To
avoid having to look up the plugin configuration 'config-version' you can pass
the string "latest" instead. DSS will replace the value "latest" with the
latest 'config-version' of the plugin configuration.

After a plugin configuration is updated, existing volume providers will still
use the version of the plugin configuration they were created with, even though
a newer one has been created. Existing providers need to be modified using the
'dcos storage provider modify' command in order to upgrade them to the new
plugin configuration version. Doing so is simple, as the example below shows.

```bash
# Show the list of existing providers. There is only one volume provider called 'lvm-ssds'.
$ dcos storage provider list --plugin=lvm --json
{
    "providers": [
        {
            "name": "lvm-ssds",
            "spec": {
                "plugin": {
                    "name": "lvm",
                    "config-version": 1,
                }
                ...
            }
        }
    ]
}

# We see that it currently lists the plugin as 'lvm' and the 'config-version' as 1.
# We will proceed to upgrade this volume provider from 'config-version: 1' to 'config-version: 3'.
$ cat <<EOF | dcos storage provider modify
{
    "name": "lvm-ssds",
    "spec": {
        "plugin": {
            "name": "lvm",
            "config-version": 3
        }
    }
}
EOF

# Upgrade this volume provider from 'config-version: 1' to 'config-version: latest'.
$ cat <<EOF | dcos storage provider modify
{
    "name": "lvm-ssds",
    "spec": {
        "plugin": {
            "name": "lvm",
            "config-version": "latest"
        }
    }
}
EOF

If the spec.plugin field is present in the volume provider configuration JSON the volume provider’s plugin configuration is updated. If the spec.plugin field is not present, the provider’s plugin configuration version is not modified.

dcos storage plugin-configuration update [<path>] [flags]

Examples

  1. Generate a plugin configuration for the LVM provider:
$ dcos storage plugin-configuration generate --name=lvm
{
    "name": "lvm",
    "description": "Default configuration for the lvm plugin shipped with DSS",
    "spec": {
        "csi-template": {
            "services": [
                "CONTROLLER_SERVICE",
                "NODE_SERVICE"
            ],
            "command": {
                "value": "{{.Cmdline | json }}",
                "shell": true,
                "environment": {
                    "CONTAINER_LOGGER_DESTINATION_TYPE": "journald+logrotate",
                    "CONTAINER_LOGGER_EXTRA_LABELS": "{\"CSI_PLUGIN\":\"csilvm\"}",
                    "LD_LIBRARY_PATH": "/opt/mesosphere/lib",
                    "PATH": "/opt/mesosphere/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
                },
                "uris": [
                    {
                        "value": "http://storage-artifacts.marathon.l4lb.thisdcos.directory:10000/csilvm",
                        "cache": true,
                        "executable": true
                    }
                ]
            },
            "resources": [
                {
                    "name": "cpus",
                    "value": 0.1
                },
                {
                    "name": "mem",
                    "value": 128
                },
                {
                    "name": "disk",
                    "value": 10
                }
            ]
        }
    }
}
  1. Update this configuration by adding an environment variable:
$ cat <<EOF | dcos storage plugin-configuration update
{
    "name": "lvm",
    "description": "Default configuration for the lvm plugin shipped with DSS",
    "spec": {
        "csi-template": {
            "services": [
                "CONTROLLER_SERVICE",
                "NODE_SERVICE"
            ],
            "command": {
                "value": "{{.Cmdline | json }}",
                "shell": true,
                "environment": {
                    "CONTAINER_LOGGER_DESTINATION_TYPE": "journald+logrotate",
                    "CONTAINER_LOGGER_EXTRA_LABELS": "{\"CSI_PLUGIN\":\"csilvm\"}",
                    "LD_LIBRARY_PATH": "/opt/mesosphere/lib",
                    "PATH": "/opt/mesosphere/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                    "FOO": "bar"
                },
                "uris": [
                    {
                        "value": "http://storage-artifacts.marathon.l4lb.thisdcos.directory:10000/csilvm",
                        "cache": true,
                        "executable": true
                    }
                ]
            },
            "resources": [
                {
                    "name": "cpus",
                    "value": 0.1
                },
                {
                    "name": "mem",
                    "value": 128
                },
                {
                    "name": "disk",
                    "value": 10
                }
            ]
        }
    }
}
EOF

Options inherited from parent commands

Name Description
-h,--help Help for this command.
--timeout duration Override the default request timeout. (default 55s)