feat(volume): add "exchange volumes"

This volumes are "emptyDir" and can have init command. For example, in a
"same-pod", it allow the user to copy data from image to a directory
that is mounted on others pods.
This commit is contained in:
2024-11-22 14:54:36 +01:00
parent 3b51f41716
commit 95f3abfa74
7 changed files with 184 additions and 28 deletions

View File

@@ -284,4 +284,40 @@
{{ .KatenaryPrefix }}/env-from: |-
- myservice1
"exchange-volumes":
short: Add exchange volumes (empty directory on the node) to share data
type: "list of objects"
long: |-
This label allows sharing data between containres. The volume is created in
the node and mounted in the pod. It is useful to share data between containers
in a "same pod" logic. For example to let PHP-FPM and Nginx share the same direcotory.
This will create:
- an `emptyDir` volume in the deployment
- a `voumeMount` in the pod for **each container**
- a `initContainer` for each definition
Fields:
- name: the name of the volume (manadatory)
- mountPath: the path where the volume is mounted in the pod (optional, default is `/opt`)
- init: a command to run to initialize the volume with data (optional)
!!! Warning
This is highly experimental. This is mainly useful when using the "same-pod" label.
example: |-
nginx:
# ...
labels;
{{ .KatenaryPrefix }}/exchange-volumes: |-
- name: php-fpm
mountPath: /var/www/html
php:
# ...
labels:
{{ .KatenaryPrefix }}/exchange-volumes: |-
- name: php-fpm
mountPath: /opt
init: cp -ra /var/www/html/* /opt
# vim: ft=gotmpl.yaml