Skip to content

Commit ee1701a

Browse files
author
Peter Matulis
committed
add section
1 parent b2aaaef commit ee1701a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/en/tutorial-k8s-charms.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,33 @@ def config_mariadb():
337337
Using this final configuration, Juju creates a Kubernetes pod for each
338338
application unit.
339339

340+
#### Unit pod ConfigMaps
341+
342+
A Kubernetes [ConfigMap][upstream-kubernetes-configmap] "allows you to decouple
343+
configuration artifacts from image content to keep containerized applications
344+
portable".
345+
346+
A ConfigMap is set up within the final pod configuration file by specifying a
347+
file set that is mounted within the Docker image. Juju internally creates a
348+
"config-map" volume source to do that. Its name is based on the charm name, the
349+
fileset name, and the string '-config': `<appname>-<filesetname>-config`
350+
351+
For instance, the 'myapp' charm may produce a pod configuration file
352+
containing:
353+
354+
```yaml
355+
files:
356+
- name: foocfg
357+
mountPath: /var/lib/foo
358+
files:
359+
file1: |
360+
[config]
361+
foo: bar
362+
```
363+
364+
This would yield a config map called `myapp-foocfg-config` created to back the
365+
volume mounted into the pod.
366+
340367
## Charm Store
341368

342369
Push the built charm to the Charm Store:
@@ -447,3 +474,4 @@ Also consider the following tutorials:
447474
[github-wallyworld-mariadb]: https://github.com/wallyworld/caas/tree/master/charms/mariadb
448475
[github-layer-index]: https://github.com/juju/layer-index
449476
[charms-reactive]: https://charmsreactive.readthedocs.io/en/latest/index.html
477+
[upstream-kubernetes-configmap]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/

0 commit comments

Comments
 (0)