mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
50 lines
1.8 KiB
Plaintext
50 lines
1.8 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// storage/persistent_storage/persistent-storage-flexvolume.adoc
|
|
|
|
[id="flexvolume-driver-example_{context}"]
|
|
= FlexVolume driver example
|
|
|
|
The first command-line argument of the FlexVolume driver is always an operation name. Other parameters are specific to each operation. Most of the operations take a JavaScript Object Notation (JSON) string as a parameter. This parameter is a complete JSON string, and not the name of a file with the JSON data.
|
|
|
|
The FlexVolume driver contains:
|
|
|
|
* All `flexVolume.options`.
|
|
* Some options from `flexVolume` prefixed by `kubernetes.io/`, such as `fsType` and `readwrite`.
|
|
* The content of the referenced secret, if specified, prefixed by `kubernetes.io/secret/`.
|
|
|
|
.FlexVolume driver JSON input example
|
|
|
|
[source,json]
|
|
----
|
|
{
|
|
"fooServer": "192.168.0.1:1234", <1>
|
|
"fooVolumeName": "bar",
|
|
"kubernetes.io/fsType": "ext4", <2>
|
|
"kubernetes.io/readwrite": "ro", <3>
|
|
"kubernetes.io/secret/<key name>": "<key value>", <4>
|
|
"kubernetes.io/secret/<another key name>": "<another key value>",
|
|
}
|
|
----
|
|
<1> All options from `flexVolume.options`.
|
|
<2> The value of `flexVolume.fsType`.
|
|
<3> `ro`/`rw` based on `flexVolume.readOnly`.
|
|
<4> All keys and their values from the secret referenced by `flexVolume.secretRef`.
|
|
|
|
{product-title} expects JSON data on standard output of the driver. When not
|
|
specified, the output describes the result of the operation.
|
|
|
|
.FlexVolume driver default output example
|
|
|
|
[source,json]
|
|
----
|
|
{
|
|
"status": "<Success/Failure/Not supported>",
|
|
"message": "<Reason for success/failure>"
|
|
}
|
|
----
|
|
|
|
Exit code of the driver should be `0` for success and `1` for error.
|
|
|
|
Operations should be idempotent, which means that the mounting of an already mounted volume should result in a successful operation.
|