From 65a3a8245b27530d77200b72ebc7b8bc4662d293 Mon Sep 17 00:00:00 2001
From: Mohammed Naser <mnaser@vexxhost.com>
Date: Thu, 24 Mar 2022 19:28:39 -0400
Subject: [PATCH] ensure-kubernetes: fix missing 02-crio.conf

There was some recent changes to Minikube that added a hard
dependency on that file being there which are not caught by
upstream testing since they don't test with the "none" VM
driver.

This adds the file to workaround the issue so that it can
complete the bootstrap of the cluster.

Change-Id: I3869350ae620721ea4e755e50facd0291a7772d3
---
 roles/ensure-kubernetes/tasks/minikube.yaml | 25 +++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/roles/ensure-kubernetes/tasks/minikube.yaml b/roles/ensure-kubernetes/tasks/minikube.yaml
index 26207ebe9..682256f46 100644
--- a/roles/ensure-kubernetes/tasks/minikube.yaml
+++ b/roles/ensure-kubernetes/tasks/minikube.yaml
@@ -25,6 +25,31 @@
   loop_control:
     loop_var: zj_distro_os
 
+- name: Workaround missing 02-crio.conf
+  # See: https://github.com/kubernetes/minikube/issues/13816
+  when: kubernetes_runtime == 'cri-o'
+  block:
+    - name: Add misisng crio.conf.d folder
+      file:
+        path: /etc/crio/crio.conf.d
+        state: directory
+        mode: 0755
+      become: true
+    - name: Fix missing 02-crio.conf
+      copy:
+        content: |
+          [crio.image]
+          # pause_image = ""
+
+          [crio.network]
+          # cni_default_network = ""
+
+          [crio.runtime]
+          # cgroup_manager = ""
+        dest: /etc/crio/crio.conf.d/02-crio.conf
+        mode: 0644
+      become: true
+
 - name: Create .kube directory
   file:
     path: "{{ ansible_user_dir }}/.kube"