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 fb4cb9efda)
changes/25/680125/4
Rabi Mishra 5 months ago
parent
commit
a3419f060e

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

@@ -415,8 +415,9 @@ COPY start.sh /usr/local/bin/kolla_start
415 415
 COPY sudoers /etc/sudoers
416 416
 COPY curlrc /root/.curlrc
417 417
 
418
-{% block dumb_init_installation %}
418
+{% if use_dumb_init %}
419 419
 
420
+{% block dumb_init_installation %}
420 421
 {% if base_arch == 'x86_64' %}
421 422
 
422 423
 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 \
@@ -435,9 +436,10 @@ RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
435 436
 {% endif %}
436 437
 
437 438
 ENTRYPOINT ["dumb-init", "--single-child", "--"]
438
-
439 439
 {% endblock %}
440 440
 
441
+{% endif %}
442
+
441 443
 RUN touch /usr/local/bin/kolla_extend_start \
442 444
     && chmod 755 /usr/local/bin/kolla_start /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_set_configs \
443 445
     && chmod 440 /etc/sudoers \

+ 4
- 1
docker/mariadb/Dockerfile.j2 View File

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

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

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

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

@@ -663,6 +663,7 @@ class KollaWorker(object):
663 663
         else:
664 664
             self.namespace = conf.namespace
665 665
         self.base = conf.base
666
+        self.use_dumb_init = conf.use_dumb_init
666 667
         self.base_tag = conf.base_tag
667 668
         self.install_type = conf.install_type
668 669
         self.tag = conf.tag
@@ -866,6 +867,7 @@ class KollaWorker(object):
866 867
                       'base_image': self.conf.base_image,
867 868
                       'base_distro_tag': self.base_tag,
868 869
                       'base_arch': self.base_arch,
870
+                      'use_dumb_init': self.use_dumb_init,
869 871
                       'supported_distro_release': supported_distro_release,
870 872
                       'install_metatype': self.install_metatype,
871 873
                       '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