Page MenuHomeDevCentral

D1771.id4495.diff
No OneTemporary

D1771.id4495.diff

diff --git a/pillar/paas/docker.sls b/pillar/paas/docker.sls
--- a/pillar/paas/docker.sls
+++ b/pillar/paas/docker.sls
@@ -52,6 +52,22 @@
subnet: 172.18.1.0/24
# -------------------------------------------------------------
+# Docker engine configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+docker_daemon:
+ equatower:
+ storage-driver: devicemapper
+ storage-opts:
+ - "dm.thinpooldev=/dev/mapper/wharf-thinpool"
+ - "dm.use_deferred_removal=true"
+ - "dm.use_deferred_deletion=true"
+
+docker_devicemapper:
+ equatower:
+ thinpool: wharf-thinpool
+
+# -------------------------------------------------------------
# Containers
#
# The docker_containers entry allow to declare
diff --git a/roles/paas-docker/docker/config.sls b/roles/paas-docker/docker/config.sls
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/docker/config.sls
@@ -0,0 +1,27 @@
+# -------------------------------------------------------------
+# Salt — Provision Docker engine
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2018-09-18
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+
+# -------------------------------------------------------------
+# Configure lvm profile
+# -------------------------------------------------------------
+
+{% if grains['id'] in pillar['docker_daemon'] %}
+
+{% set daemon = pillar['docker_daemon'][grains['id']] %}
+
+{{ dirs.etc }}/docker/daemon.json:
+ file.managed:
+ - source: salt://roles/paas-docker/docker/files/daemon.json.jinja
+ - template: jinja
+ - mode: 644
+ - context:
+ daemon: {{ daemon }}
+
+{% endif %}
diff --git a/roles/paas-docker/docker/files/daemon.json.jinja b/roles/paas-docker/docker/files/daemon.json.jinja
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/docker/files/daemon.json.jinja
@@ -0,0 +1 @@
+{{ daemon | json }}
diff --git a/roles/paas-docker/docker/files/thinpool.profile b/roles/paas-docker/docker/files/thinpool.profile
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/docker/files/thinpool.profile
@@ -0,0 +1,26 @@
+# -------------------------------------------------------------
+# PaaS Docker
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2018-09-18
+# License: Trivial work, not eligible to copyright
+# Source file: roles/paas-docker/docker/files/thinpool.profile
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# -------------------------------------------------------------
+# Auto extend
+#
+# Reference: https://docs.docker.com/storage/storagedriver/device-mapper-driver/
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+activation {
+ thin_pool_autoextend_threshold=80
+ thin_pool_autoextend_percent=20
+}
diff --git a/roles/paas-docker/docker/init.sls b/roles/paas-docker/docker/init.sls
--- a/roles/paas-docker/docker/init.sls
+++ b/roles/paas-docker/docker/init.sls
@@ -8,4 +8,6 @@
include:
- .software
+ - .storage
+ - .config
- .networks
diff --git a/roles/paas-docker/docker/storage.sls b/roles/paas-docker/docker/storage.sls
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/docker/storage.sls
@@ -0,0 +1,34 @@
+# -------------------------------------------------------------
+# Salt — Provision Docker engine
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2018-09-18
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+
+# -------------------------------------------------------------
+# Configure lvm profile
+# -------------------------------------------------------------
+
+{% if grains['id'] in pillar['docker_devicemapper'] %}
+
+{% set dm = pillar['docker_devicemapper'][grains['id']] %}
+{% set volume = dm['thinpool'].replace('-', '/') %}
+
+lvm_thinpool_profile:
+ file.managed:
+ - source: salt://roles/paas-docker/docker/files/thinpool.profile
+ - name: {{ dirs.etc }}/lvm/profile/{{ dm['thinpool'] }}.profile
+ - mode: 644
+
+lvm_apply_thinpool_profile:
+ cmd.run:
+ - name: |
+ lvchange --metadataprofile {{ dm['thinpool'] }} {{ volume }}
+ lvs -o+seg_monitor
+ - onchanges:
+ - file: lvm_thinpool_profile
+
+{% endif %}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 23:46 (6 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2248104
Default Alt Text
D1771.id4495.diff (4 KB)

Event Timeline