Browse Source

Add config option use_dumb_init to add it to container images

Usage of dumb-init can also be disabled from cli with
`--nouse-dumb-init` when building images.

Change-Id: Id32d54fc9913b83cf121ede5a5e265e0772062ae
Related-Bug: #1821970
(cherry picked from commit 767219dee8)
changes/26/680126/4
Rabi Mishra 5 months ago
parent
commit
30142a2094

+ 4
- 2
docker/base/Dockerfile.j2 View File

@@ -401,8 +401,9 @@ COPY start.sh /usr/local/bin/kolla_start
401 401
 COPY sudoers /etc/sudoers
402 402
 COPY curlrc /root/.curlrc
403 403
 
404
-{% block dumb_init_installation %}
404
+{% if use_dumb_init %}
405 405
 
406
+{% block dumb_init_installation %}
406 407
 {% if base_arch == 'x86_64' %}
407 408
 
408 409
 RUN curl -sSL https://github.com/Yelp/dumb-init/releases/download/v1.1.3/dumb-init_1.1.3_amd64 -o /usr/local/bin/dumb-init \
@@ -421,9 +422,10 @@ RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
421 422
 {% endif %}
422 423
 
423 424
 ENTRYPOINT ["dumb-init", "--single-child", "--"]
424
-
425 425
 {% endblock %}
426 426
 
427
+{% endif %}
428
+
427 429
 RUN touch /usr/local/bin/kolla_extend_start \
428 430
     && chmod 755 /usr/local/bin/kolla_start /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_set_configs \
429 431
     && chmod 440 /etc/sudoers \

+ 14
- 0
docker/mariadb/Dockerfile.j2 View File

@@ -57,6 +57,20 @@ RUN chmod 755 /usr/local/bin/kolla_extend_start \
57 57
 {% if base_distro in ['debian', 'ubuntu'] %}
58 58
 RUN mkdir -p /var/run/mysqld && chown mysql /var/run/mysqld && chmod 755 /var/run/mysqld
59 59
 {% endif %}
60
+
61
+{% if use_dumb_init %}
62
+{% block mariadb_entrypoint %}
63
+# NOTE(mgoddard): Override the dumb-init arguments to avoid passing
64
+# --single-child. This does not play well with mysqld_safe, which ignores
65
+# SIGTERM, meaning Docker needs to forcibly kill the container to stop it.
66
+# Without --single-child, the TERM signal is sent to all subprocesses,
67
+# including mysqld.
68
+
69
+ENTRYPOINT ["dumb-init", "--"]
70
+CMD ["kolla_start"]
71
+{% endblock %}
72
+{% endif %}
73
+
60 74
 {% block mariadb_footer %}{% endblock %}
61 75
 {% block footer %}{% endblock %}
62 76
 

+ 2
- 0
kolla/common/config.py View File

@@ -188,6 +188,8 @@ _CLI_OPTS = [
188 188
     cfg.StrOpt('base-arch', default=hostarch,
189 189
                choices=BASE_ARCH,
190 190
                help='The base architecture. Default is same as host'),
191
+    cfg.BoolOpt('use-dumb-init', default=True,
192
+                help='Use dumb-init as init system in containers'),
191 193
     cfg.BoolOpt('debug', short='d', default=False,
192 194
                 help='Turn on debugging log level'),
193 195
     cfg.BoolOpt('skip-parents', default=False,

+ 2
- 0
kolla/image/build.py View File

@@ -665,6 +665,7 @@ class KollaWorker(object):
665 665
         else:
666 666
             self.namespace = conf.namespace
667 667
         self.base = conf.base
668
+        self.use_dumb_init = conf.use_dumb_init
668 669
         self.base_tag = conf.base_tag
669 670
         self.install_type = conf.install_type
670 671
         self.tag = conf.tag
@@ -868,6 +869,7 @@ class KollaWorker(object):
868 869
                       'base_image': self.conf.base_image,
869 870
                       'base_distro_tag': self.base_tag,
870 871
                       'base_arch': self.base_arch,
872
+                      'use_dumb_init': self.use_dumb_init,
871 873
                       'supported_distro_release': supported_distro_release,
872 874
                       'install_metatype': self.install_metatype,
873 875
                       'image_prefix': self.image_prefix,

+ 7
- 0
releasenotes/notes/add-use-dumb-init-config-option-26b47f6d97d7585c.yaml View File

@@ -0,0 +1,7 @@
1
+---
2
+features:
3
+  - |
4
+    Adds configration option ``use_dumb_init``, with default value of ``True``.
5
+    This can be use to avoid the of ``dumb-init`` as the container entrypoint,
6
+    using ``kolla_start`` directly instead. This option can also be disabled
7
+    via the ``kolla-build --nouse-dumb-init`` CLI argument.

Loading…
Cancel
Save