Skip to content

Commit

Permalink
use drop in configuration files for crio
Browse files Browse the repository at this point in the history
  • Loading branch information
spowelljr committed Feb 8, 2022
1 parent 6189742 commit 9218167
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
8 changes: 8 additions & 0 deletions deploy/iso/minikube-iso/package/crio-bin/02-crio.conf
@@ -0,0 +1,8 @@
[crio.image]
# pause_image = ""

[crio.network]
# cni_default_network = ""

[crio.runtime]
# cgroup_manager = ""
4 changes: 4 additions & 0 deletions deploy/iso/minikube-iso/package/crio-bin/crio-bin.mk
Expand Up @@ -39,6 +39,7 @@ endef
define CRIO_BIN_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)/usr/share/containers/oci/hooks.d
mkdir -p $(TARGET_DIR)/etc/containers/oci/hooks.d
mkdir -p $(TARGET_DIR)/etc/crio/crio.conf.d

$(INSTALL) -Dm755 \
$(@D)/bin/crio \
Expand All @@ -55,6 +56,9 @@ define CRIO_BIN_INSTALL_TARGET_CMDS
$(INSTALL) -Dm644 \
$(CRIO_BIN_PKGDIR)/registries.conf \
$(TARGET_DIR)/etc/containers/registries.conf
$(INSTALL) -Dm644 \
$(CRIO_BIN_PKGDIR)/02-crio.conf \
$(TARGET_DIR)/etc/crio/crio.conf.d/02-crio.conf

mkdir -p $(TARGET_DIR)/etc/sysconfig
echo 'CRIO_OPTIONS="--log-level=debug"' > $(TARGET_DIR)/etc/sysconfig/crio
Expand Down
8 changes: 8 additions & 0 deletions deploy/kicbase/02-crio.conf
@@ -0,0 +1,8 @@
[crio.image]
# pause_image = ""

[crio.network]
# cni_default_network = ""

[crio.runtime]
# cgroup_manager = ""
1 change: 1 addition & 0 deletions deploy/kicbase/Dockerfile
Expand Up @@ -43,6 +43,7 @@ ARG CRIO_VERSION="1.22"
# copy in static files (configs, scripts)
COPY deploy/kicbase/10-network-security.conf /etc/sysctl.d/10-network-security.conf
COPY deploy/kicbase/11-tcp-mtu-probing.conf /etc/sysctl.d/11-tcp-mtu-probing.conf
COPY deploy/kicbase/02-crio.conf /etc/crio/crio.conf.d/02-crio.conf
COPY deploy/kicbase/clean-install /usr/local/bin/clean-install
COPY deploy/kicbase/entrypoint /usr/local/bin/entrypoint
COPY --from=0 /src/cmd/auto-pause/auto-pause /bin/auto-pause
Expand Down
7 changes: 3 additions & 4 deletions pkg/minikube/cruntime/crio.go
Expand Up @@ -41,7 +41,7 @@ import (

const (
// CRIOConfFile is the path to the CRI-O configuration
crioConfigFile = "/etc/crio/crio.conf"
crioConfigFile = "/etc/crio/crio.conf.d/02-crio.conf"
)

// CRIO contains CRIO runtime state
Expand All @@ -57,7 +57,7 @@ type CRIO struct {
func generateCRIOConfig(cr CommandRunner, imageRepository string, kv semver.Version) error {
pauseImage := images.Pause(kv, imageRepository)

c := exec.Command("/bin/bash", "-c", fmt.Sprintf("sudo sed -e 's|^pause_image = .*$|pause_image = \"%s\"|' -i %s", pauseImage, crioConfigFile))
c := exec.Command("/bin/bash", "-c", fmt.Sprintf("sudo sed -e 's|^.*pause_image = .*$|pause_image = \"%s\"|' -i %s", pauseImage, crioConfigFile))
if _, err := cr.RunCmd(c); err != nil {
return errors.Wrap(err, "generateCRIOConfig")
}
Expand All @@ -73,8 +73,7 @@ func generateCRIOConfig(cr CommandRunner, imageRepository string, kv semver.Vers
}

func (r *CRIO) forceSystemd() error {
// remove `cgroup_manager` since cri-o defaults to `systemd` if nothing set
c := exec.Command("/bin/bash", "-c", fmt.Sprintf("sudo sed -e 's|^cgroup_manager = .*$||' -i %s", crioConfigFile))
c := exec.Command("/bin/bash", "-c", fmt.Sprintf("sudo sed -e 's|^.*cgroup_manager = .*$|cgroup_manager = \"systemd\"|' -i %s", crioConfigFile))
if _, err := r.Runner.RunCmd(c); err != nil {
return errors.Wrap(err, "force systemd")
}
Expand Down

0 comments on commit 9218167

Please sign in to comment.