summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Morie <pmorie@gmail.com>2015-11-19 23:19:46 -0500
committerPaul Morie <pmorie@gmail.com>2015-11-19 23:20:26 -0500
commit9a95bb33a27abc8fc1bb25fd7ba4bd9e38bd32f3 (patch)
treec62fe016ef18dabefe58dda19d7f6f4f96e03049
parenta38708307b586f96acd615baabc23c1b7944eb72 (diff)
Proposal: config data volume source
-rw-r--r--config_data.md70
1 files changed, 69 insertions, 1 deletions
diff --git a/config_data.md b/config_data.md
index d06d3b43..253f961e 100644
--- a/config_data.md
+++ b/config_data.md
@@ -173,7 +173,36 @@ type ConfigDataSelector struct {
### Volume Source
-The volume source will be addressed in a follow-up PR.
+A new `ConfigDataVolumeSource` type of volume source containing the `ConfigData` object will be
+added to the `VolumeSource` struct in the API:
+
+```go
+package api
+
+type VolumeSource struct {
+ // other fields omitted
+ ConfigData *ConfigDataVolumeSource `json:"configData,omitempty"`
+}
+
+// ConfigDataVolumeSource represents a volume that holds configuration data
+type ConfigDataVolumeSource struct {
+ // A list of config data keys to project into the volume in files
+ Files []ConfigDataVolumeFile `json:"files"`
+}
+
+// ConfigDataVolumeFile represents a single file containing config data
+type ConfigDataVolumeFile struct {
+ ConfigDataSelector `json:",inline"`
+
+ // The relative path name of the file to be created.
+ // Must not be absolute or contain the '..' path. Must be utf-8 encoded.
+ // The first item of the relative path must not start with '..'
+ Path string `json:"path"`
+}
+```
+
+**Note:** The update logic used in the downward API volume plug-in will be extracted and re-used in
+the volume plug-in for `ConfigData`.
## Examples
@@ -237,6 +266,45 @@ spec:
key: etcdctl_peers
```
+### Consuming `ConfigData` as Volumes
+
+`redis-volume-config` is intended to be used as a volume containing a config file:
+
+```yaml
+apiVersion: extensions/v1beta1
+kind: ConfigData
+metadata:
+ name: redis-volume-config
+data:
+ redis.conf: "pidfile /var/run/redis.pid\nport6379\ntcp-backlog 511\n databases 1\ntimeout 0\n"
+```
+
+The following pod consumes the `redis-volume-config` in a volume:
+
+```yaml
+apiVersion: v1
+kind: Pod
+metadata:
+ name: config-volume-example
+spec:
+ containers:
+ - name: redis
+ image: kubernetes/redis
+ command: "redis-server /mnt/config-data/etc/redis.conf"
+ ports:
+ - containerPort: 6379
+ volumeMounts:
+ - name: config-data-volume
+ mountPath: /mnt/config-data
+ volumes:
+ - name: config-data-volume
+ configData:
+ files:
+ - path: "etc/redis.conf"
+ configDataName: redis-volume-config
+ key: redis.conf
+```
+
### Future Improvements
In the future, we may add the ability to specify an init-container that can watch the volume