Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minikube supports injecting configuration files into the cluster nodes. This is very useful for solving 2 issues: - Regression in minikube 1.33 enabling DNSSEC by default. This breaks pulling images from some registries, breaking us badly. But minikube 1.33 have other improvements we would like to consume (such as faster cluster start) so this change work around this regression. - Random failures when starting kubevirt VM, failing to create inotify watch. This is caused by low fs.inotify limits, and can be fixed by increasing the limits. We use the default limits from OpenShift worker node. Creating the configuration files is not enough, since minikube inject the files to the VM too late. We need to reload daemons or run sysctl to apply the configuration changes when the cluster starts. This change adds new "setup" command, that should run once when setting up a development system. This calls minikube.setup_files(), creating the drenv configuration drop-in files under $MINIKUBE_HOME/.minikube/files/. New clusters created after that will use the new configuration. To ensure that the configuration is loaded we call minikube.load_files() when creating a new minikube cluster. This does the right thing for the configuration files created during setup_files(). Issues: - The setup and clear commands require an envfile but do not use it. We need to rework command line parsing to fix this. Example usage: $ tree $MINIKUBE_HOME/.minikube/files /data/tmp/.minikube/files $ drenv setup envs/regional-dr.yaml 2024-05-06 23:08:10,047 INFO Setting up minikube for drenv 2024-05-06 23:08:10,047 INFO Minikube was setup for drenv $ tree $MINIKUBE_HOME/.minikube/files /data/tmp/.minikube/files └── etc ├── sysctl.d │ └── 99-drenv.conf └── systemd └── resolved.conf.d └── 99-drenv.conf $ drenv start envs/kubevirt.yaml -v ... 2024-05-06 23:12:51,408 DEBUG [kubevirt] Running ['minikube', 'ssh', '--profile', 'kubevirt', 'sudo sysctl -p /etc/sysctl.d/99-drenv.conf'] 2024-05-06 23:12:51,594 DEBUG [kubevirt] fs.inotify.max_user_instances = 8192 2024-05-06 23:12:51,594 DEBUG [kubevirt] fs.inotify.max_user_watches = 65536 2024-05-06 23:12:51,600 DEBUG Applying drenv systemd-resolved configuration 2024-05-06 23:12:51,600 DEBUG [kubevirt] Running ['minikube', 'ssh', '--profile', 'kubevirt', 'sudo systemctl restart systemd-resolved.service'] ... $ minikube ssh -p kubevirt 'cat /etc/systemd/resolved.conf.d/99-drenv.conf' # Added by drenv setup [Resolve] DNSSEC=no $ minikube ssh -p kubevirt 'cat /etc/sysctl.d/99-drenv.conf' # Added by drenv setup fs.inotify.max_user_instances = 8192 fs.inotify.max_user_watches = 65536 $ minikube ssh -p kubevirt 'sysctl fs.inotify' fs.inotify.max_queued_events = 16384 fs.inotify.max_user_instances = 8192 fs.inotify.max_user_watches = 65536 Signed-off-by: Nir Soffer <nsoffer@redhat.com>
- Loading branch information