Skip to content

Commit

Permalink
[cri-o]: support cri-o 1.29
Browse files Browse the repository at this point in the history
Use "crio status" instead of "crio-status" for cri-o >=1.29.0
  • Loading branch information
tmurakam committed Jan 25, 2024
1 parent eaad2f8 commit 99c6d5f
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 9 deletions.
7 changes: 0 additions & 7 deletions roles/container-engine/cri-o/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ crio_subuid_length: 16777216
crio_subgid_start: 2130706432
crio_subgid_length: 16777216

# cri-o binary files
crio_bin_files:
- conmon
- crio
- crio-status
- pinns

# cri-o manual files
crio_man_files:
5:
Expand Down
8 changes: 8 additions & 0 deletions roles/container-engine/cri-o/tasks/load_vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Cri-o | include vars/v1.28.yml
include_vars: v1.28.yml
when: crio_version is version("v1.29.0", operator="<")

- name: Cri-o | include vars/v1.29.yml
include_vars: v1.29.yml
when: crio_version is version("v1.29.0", operator=">=")
5 changes: 4 additions & 1 deletion roles/container-engine/cri-o/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
- name: Cri-o | load vars
import_tasks: load_vars.yml

- name: Cri-o | check if fedora coreos
stat:
path: /run/ostree-booted
Expand Down Expand Up @@ -203,7 +206,7 @@
- not service_start.changed

- name: Cri-o | verify that crio is running
command: "{{ bin_dir }}/crio-status info"
command: "{{ bin_dir }}/{{ crio_status_command }} info"
register: get_crio_info
until: get_crio_info is succeeded
changed_when: false
Expand Down
3 changes: 3 additions & 0 deletions roles/container-engine/cri-o/tasks/reset.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
- name: Cri-o | load vars
import_tasks: load_vars.yml

- name: CRI-O | Kubic repo name for debian os family
set_fact:
crio_kubic_debian_repo_name: "{{ ((ansible_distribution == 'Ubuntu') | ternary('x', '')) ~ ansible_distribution ~ '_' ~ ansible_distribution_version }}"
Expand Down
9 changes: 9 additions & 0 deletions roles/container-engine/cri-o/vars/v1.28.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# cri-o binary files
crio_bin_files:
- conmon
- crio
- crio-status
- pinns

crio_status_command: crio-status
9 changes: 9 additions & 0 deletions roles/container-engine/cri-o/vars/v1.29.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# cri-o binary files
crio_bin_files:
- conmon
- conmonrs
- crio
- pinns

crio_status_command: crio status
7 changes: 6 additions & 1 deletion roles/kubernetes/node/tasks/facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@
- name: Gather cgroups facts for crio
when: container_manager == 'crio'
block:
- name: Set crio_status_command for crio
set_fact:
crio_status_command: >-
{%- if crio_version is version("v1.29.0", operator=">=") -%}crio status{%- else -%}crio-status{%- endif -%}
- name: Look up crio cgroup driver
shell: "set -o pipefail && {{ bin_dir }}/crio-status info | grep 'cgroup driver' | awk -F': ' '{ print $2; }'"
shell: "set -o pipefail && {{ bin_dir }}/{{ crio_status_command }} info | grep 'cgroup driver' | awk -F': ' '{ print $2; }'"
args:
executable: /bin/bash
register: crio_cgroup_driver_result
Expand Down

0 comments on commit 99c6d5f

Please sign in to comment.