From b38382a68f29d57010f3d692489be8b29b755481 Mon Sep 17 00:00:00 2001
From: Florian Ruynat <16313165+floryut@users.noreply.github.com>
Date: Thu, 2 Dec 2021 15:21:34 +0100
Subject: [PATCH] Move cri-o default package to 1.22 (#8258)

---
 .gitlab-ci/packet.yml                                 |  5 +++++
 README.md                                             |  2 +-
 docs/ci.md                                            |  2 +-
 roles/container-engine/cri-o/defaults/main.yml        |  2 +-
 .../cri-o/molecule/default/molecule.yml               |  2 +-
 roles/container-engine/cri-o/vars/amazon.yml          |  2 ++
 roles/container-engine/cri-o/vars/centos-7.yml        |  2 ++
 roles/container-engine/cri-o/vars/centos-8.yml        |  2 ++
 roles/container-engine/cri-o/vars/debian.yml          |  3 +++
 roles/container-engine/cri-o/vars/fedora.yml          |  4 ++--
 roles/container-engine/cri-o/vars/ubuntu.yml          |  3 +++
 tests/files/packet_fedora35-crio.yml                  | 11 +++++++++++
 12 files changed, 34 insertions(+), 6 deletions(-)
 create mode 100644 tests/files/packet_fedora35-crio.yml

diff --git a/.gitlab-ci/packet.yml b/.gitlab-ci/packet.yml
index 6a6a573bc..2fe749e8e 100644
--- a/.gitlab-ci/packet.yml
+++ b/.gitlab-ci/packet.yml
@@ -69,6 +69,11 @@ packet_ubuntu18-crio:
   stage: deploy-part2
   when: manual
 
+packet_fedora35-crio:
+  extends: .packet_pr
+  stage: deploy-part2
+  when: manual
+
 packet_ubuntu16-canal-ha:
   stage: deploy-part2
   extends: .packet_periodic
diff --git a/README.md b/README.md
index 43d0fb185..0a541d472 100644
--- a/README.md
+++ b/README.md
@@ -135,7 +135,7 @@ Note: Upstart/SysV init based OS types are not supported.
   - [etcd](https://github.com/coreos/etcd) v3.5.0
   - [docker](https://www.docker.com/) v20.10 (see note)
   - [containerd](https://containerd.io/) v1.4.9
-  - [cri-o](http://cri-o.io/) v1.21 (experimental: see [CRI-O Note](docs/cri-o.md). Only on fedora, ubuntu and centos based OS)
+  - [cri-o](http://cri-o.io/) v1.22 (experimental: see [CRI-O Note](docs/cri-o.md). Only on fedora, ubuntu and centos based OS)
 - Network Plugin
   - [cni-plugins](https://github.com/containernetworking/plugins) v0.9.1
   - [calico](https://github.com/projectcalico/calico) v3.20.3
diff --git a/docs/ci.md b/docs/ci.md
index 7d959df08..55d6a7967 100644
--- a/docs/ci.md
+++ b/docs/ci.md
@@ -31,7 +31,7 @@ debian10 |  :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
 debian11 |  :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
 debian9 |  :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
 fedora34 |  :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
-fedora35 |  :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
+fedora35 |  :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
 opensuse |  :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
 oracle7 |  :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
 ubuntu16 |  :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
diff --git a/roles/container-engine/cri-o/defaults/main.yml b/roles/container-engine/cri-o/defaults/main.yml
index 5cec9df0a..f49e33073 100644
--- a/roles/container-engine/cri-o/defaults/main.yml
+++ b/roles/container-engine/cri-o/defaults/main.yml
@@ -45,7 +45,7 @@ crio_stream_port: "10010"
 crio_required_version: "{{ kube_version | regex_replace('^v(?P<major>\\d+).(?P<minor>\\d+).(?P<patch>\\d+)$', '\\g<major>.\\g<minor>') }}"
 
 crio_kubernetes_version_matrix:
-  "1.22": "1.21"
+  "1.22": "1.22"
   "1.21": "1.21"
   "1.20": "1.20"
 
diff --git a/roles/container-engine/cri-o/molecule/default/molecule.yml b/roles/container-engine/cri-o/molecule/default/molecule.yml
index da181f11e..2ca990c1d 100644
--- a/roles/container-engine/cri-o/molecule/default/molecule.yml
+++ b/roles/container-engine/cri-o/molecule/default/molecule.yml
@@ -26,7 +26,7 @@ platforms:
     groups:
       - kube_control_plane
   - name: fedora
-    box: fedora/34-cloud-base
+    box: fedora/35-cloud-base
     cpus: 2
     memory: 1024
     groups:
diff --git a/roles/container-engine/cri-o/vars/amazon.yml b/roles/container-engine/cri-o/vars/amazon.yml
index 87bdfa4d8..5b1a06ee6 100644
--- a/roles/container-engine/cri-o/vars/amazon.yml
+++ b/roles/container-engine/cri-o/vars/amazon.yml
@@ -3,6 +3,8 @@
 crio_storage_driver: "overlay"
 
 crio_versioned_pkg:
+  "1.22":
+    - "cri-o-1.22.*"
   "1.21":
     - "cri-o-1.21.*"
   "1.20":
diff --git a/roles/container-engine/cri-o/vars/centos-7.yml b/roles/container-engine/cri-o/vars/centos-7.yml
index 7fd038559..65d733fb6 100644
--- a/roles/container-engine/cri-o/vars/centos-7.yml
+++ b/roles/container-engine/cri-o/vars/centos-7.yml
@@ -1,5 +1,7 @@
 ---
 crio_versioned_pkg:
+  "1.22":
+    - "cri-o-1.22.*"
   "1.21":
     - "cri-o-1.21.*"
   "1.20":
diff --git a/roles/container-engine/cri-o/vars/centos-8.yml b/roles/container-engine/cri-o/vars/centos-8.yml
index 7fd038559..65d733fb6 100644
--- a/roles/container-engine/cri-o/vars/centos-8.yml
+++ b/roles/container-engine/cri-o/vars/centos-8.yml
@@ -1,5 +1,7 @@
 ---
 crio_versioned_pkg:
+  "1.22":
+    - "cri-o-1.22.*"
   "1.21":
     - "cri-o-1.21.*"
   "1.20":
diff --git a/roles/container-engine/cri-o/vars/debian.yml b/roles/container-engine/cri-o/vars/debian.yml
index 119630d3d..6684e7279 100644
--- a/roles/container-engine/cri-o/vars/debian.yml
+++ b/roles/container-engine/cri-o/vars/debian.yml
@@ -1,5 +1,8 @@
 ---
 crio_versioned_pkg:
+  "1.22":
+    - "cri-o=1.22*"
+    - cri-o-runc
   "1.21":
     - "cri-o=1.21*"
     - cri-o-runc
diff --git a/roles/container-engine/cri-o/vars/fedora.yml b/roles/container-engine/cri-o/vars/fedora.yml
index b8e4af7d4..4c517e815 100644
--- a/roles/container-engine/cri-o/vars/fedora.yml
+++ b/roles/container-engine/cri-o/vars/fedora.yml
@@ -3,8 +3,8 @@ crio_packages:
   - cri-o
   - cri-tools
 
-# Fedora doesn't have cri-o 1.21 packages
 crio_kubernetes_version_matrix:
-  "1.21": "1.20"
+  "1.22": "1.22"
+  "1.21": "1.21"
   "1.20": "1.20"
 crio_version: "{{ crio_kubernetes_version_matrix[crio_required_version] | default('1.20') }}"
diff --git a/roles/container-engine/cri-o/vars/ubuntu.yml b/roles/container-engine/cri-o/vars/ubuntu.yml
index eaf0973f2..e371962e7 100644
--- a/roles/container-engine/cri-o/vars/ubuntu.yml
+++ b/roles/container-engine/cri-o/vars/ubuntu.yml
@@ -1,5 +1,8 @@
 ---
 crio_versioned_pkg:
+  "1.22":
+    - "cri-o=1.22*"
+    - cri-o-runc
   "1.21":
     - "cri-o=1.21*"
     - cri-o-runc
diff --git a/tests/files/packet_fedora35-crio.yml b/tests/files/packet_fedora35-crio.yml
new file mode 100644
index 000000000..a1ec9374e
--- /dev/null
+++ b/tests/files/packet_fedora35-crio.yml
@@ -0,0 +1,11 @@
+---
+# Instance settings
+cloud_image: fedora-35
+mode: default
+
+# Kubespray settings
+container_manager: crio
+auto_renew_certificates: true
+
+# Test with SELinux in enforcing mode
+preinstall_selinux_state: enforcing
-- 
GitLab