sysbox icon indicating copy to clipboard operation
sysbox copied to clipboard

Sysbox installer: Add debconf variable to disable changing daemon.json completely

Open nudgegoonies opened this issue 4 years ago • 3 comments

The variable docker_userns_remap_autoconfig controls only one option that is changed in the docker daemon.json.

For automated deployments like puppet does it would be great to have a debconf variable that allows the user to disable any changes to the daemon.json within the debian package scripts because this file is often handled by puppet completely and comes preconfigured with suitable network and other options.

nudgegoonies avatar Apr 12 '21 15:04 nudgegoonies

Makes sense, thanks for filing the issue. We are also working on supporting Sysbox on K8s clusters, and I think this will also help installing Sysbox in K8s nodes.

ctalledo avatar Apr 12 '21 16:04 ctalledo

Yes @nudgegoonies, we can definitely add a new debconf variable so that users can explicitly set the desired behavior (manual vs automatic) through the debconf-set-selections interface.

As Cesar mentioned above, our installer will need to growth to cover all the new higher-level runtimes that we are about to support (Cri-o/K8s, Podman, etc), so this option will probably be needed to cover those cases anyways.

rodnymolina avatar Apr 17 '21 04:04 rodnymolina

This is how we patched the debian package:

diff -Naur CONTROL/config CONTROL/config
--- CONTROL/config	2022-03-23 06:16:52.000000000 +0100
+++ CONTROL/config	2022-03-30 14:35:40.799610746 +0200
@@ -100,6 +100,9 @@
 # Main
 #
 
+db_get sysbox/configure_docker_daemon
+if [ "$RET" = "true" ]; then
+
 # If a docker-restart is required in this setup, and there are existing docker
 # containers, alert user of the need to stop containers and exit installation
 # process.
@@ -122,4 +125,6 @@
         " installation documentation for details.\n"
 fi
 
+fi
+
 
diff -Naur CONTROL/postinst CONTROL/postinst
--- CONTROL/postinst	2022-03-23 06:16:52.000000000 +0100
+++ CONTROL/postinst	2022-03-30 15:15:57.320054067 +0200
@@ -348,11 +348,16 @@
     # in the docker configuration file.
     add_sysbox_user
 
+    db_get sysbox/configure_docker_daemon
+    if [ "$RET" = "true" ]; then
+
     # Adjust dockerd configuration (if necessary)
     if docker_installed; then
         adjust_docker_config
     fi
 
+    fi
+
     # Check for kernel-headers.
     check_kernel_headers
 }
diff -Naur CONTROL/postrm CONTROL/postrm
--- CONTROL/postrm	2022-03-23 06:16:52.000000000 +0100
+++ CONTROL/postrm	2022-03-30 14:43:01.755770222 +0200
@@ -90,7 +90,13 @@
 purge)
     # Adjust docker config to eliminate entries added by Sysbox's
     # installation process.
+
+    db_get sysbox/configure_docker_daemon
+    if [ "$RET" = "true" ]; then
+
     adjust_docker_config
+
+    fi
     ;;
 
 remove | upgrade | failed-upgrade | abort-install | abort-upgrade | disappear) ;;
diff -Naur CONTROL/templates CONTROL/templates
--- CONTROL/templates	1970-01-01 01:00:00.000000000 +0100
+++ CONTROL/templates	2022-03-30 14:31:29.979528268 +0200
@@ -0,0 +1,5 @@
+Template: sysbox/configure_docker_daemon
+Type: boolean
+Default: "true"
+Description: Configure Docker daemon?
+ Configure docker daemon with suitable sysbox config.

nudgegoonies avatar Apr 04 '22 13:04 nudgegoonies