Skip to content

Commit

Permalink
Merge pull request #169 from grycap/esparig-dev
Browse files Browse the repository at this point in the history
Add support to cri-o Container Runtime
  • Loading branch information
esparig authored May 30, 2023
2 parents 3c1d565 + 55f00a3 commit f8edc10
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 8 deletions.
47 changes: 43 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: sudo apt update && sudo apt install -y python3 python3-pip python3-setuptools

- name: Remove pre-installed kubectl to avoid errors
run: sudo apt remove buildah podman docker -y
run: sudo apt remove buildah podman -y

- name: Install Ansible
run: sudo pip3 install dnspython ansible==2.9.22
Expand All @@ -31,7 +31,7 @@ jobs:
run: sudo printf '[defaults]\nhost_key_checking = False\nroles_path=../' > ansible.cfg

- name: Install geerlingguy.ntp
run: sudo ansible-galaxy install geerlingguy.ntp grycap.docker
run: sudo ansible-galaxy install geerlingguy.ntp grycap.docker grycap.cri_o

- name: Basic role syntax check
run: sudo ansible-playbook tests/test.yml -i tests/inventory --syntax-check
Expand All @@ -58,7 +58,7 @@ jobs:
run: sudo apt update && sudo apt install -y python3 python3-pip python3-setuptools

- name: Remove pre-installed kubectl to avoid errors
run: sudo apt remove buildah podman docker -y
run: sudo apt remove buildah podman -y

- name: Install Ansible
run: sudo pip3 install ansible==2.9.22
Expand All @@ -67,7 +67,7 @@ jobs:
run: sudo printf '[defaults]\nhost_key_checking = False\nroles_path=../' > ansible.cfg

- name: Install geerlingguy.ntp
run: sudo ansible-galaxy install geerlingguy.ntp grycap.docker
run: sudo ansible-galaxy install geerlingguy.ntp grycap.docker grycap.cri_o

- name: Basic role syntax check
run: sudo ansible-playbook tests/test.yml -i tests/inventory --syntax-check
Expand All @@ -80,3 +80,42 @@ jobs:

- name: Test nodes
run: sudo kubectl -s https://localhost:6443 --insecure-skip-tls-verify --kubeconfig /etc/rancher/k3s/k3s.yaml get nodes


test-crio:

runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v3

- name: Install python
run: sudo apt update && sudo apt install -y python3 python3-pip python3-setuptools

- name: Remove pre-installed kubectl to avoid errors
run: sudo apt remove buildah podman -y

- name: Stop containerd
run: sudo systemctl stop containerd; sudo rm -f /var/run/containerd/containerd.sock

- name: Install Ansible
run: sudo pip3 install ansible==2.9.22

- name: Create ansible.cfg with correct roles_path
run: sudo printf '[defaults]\nhost_key_checking = False\nroles_path=../' > ansible.cfg

- name: Install geerlingguy.ntp
run: sudo ansible-galaxy install geerlingguy.ntp grycap.docker grycap.cri_o

- name: Basic role syntax check
run: sudo ansible-playbook tests/test-crio.yml -i tests/inventory --syntax-check

- name: Basic role check in front
run: sudo ansible-playbook tests/test-crio.yml -i tests/inventory

- name: Basic role check in wn
run: sudo ansible-playbook tests/test-crio.yml -i tests/inventory -e kube_type_of_node=wn -e kube_server=localhost

- name: Test nodes
run: sudo kubectl -s https://localhost:6443 --insecure-skip-tls-verify --kubeconfig /etc/kubernetes/admin.conf get nodes
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ kubelet_extra_args: ''
# Kube API server options
kube_apiserver_options: []
# CRI runtime
kube_cri_runtime: docker # docker or containerd
kube_cri_runtime: docker # docker, containerd or crio
# Flag to set HELM to be installed
kube_install_helm: true
# Helm version
Expand Down
7 changes: 5 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies:
docker_compose_version: ""
docker_containerd_only: "{{ (kube_cri_runtime == 'containerd') | bool }}"
docker_nvidia_driver_version: "{{ kube_nvidia_driver_version }}"
when: ansible_os_family == "RedHat" and kube_install_method == 'kubeadm'
when: ansible_os_family == "RedHat" and kube_install_method == 'kubeadm' and kube_cri_runtime != 'crio'
- role: 'grycap.docker'
docker_version: "{{ kube_docker_version | default('5:19.03.11~3-0~' + (ansible_distribution | lower) + '-' + ansible_distribution_release, true) }}"
docker_compatible_versions: "{{kube_docker_compatible_versions}}"
Expand All @@ -40,4 +40,7 @@ dependencies:
docker_compose_version: ""
docker_containerd_only: "{{ (kube_cri_runtime == 'containerd') | bool }}"
docker_nvidia_driver_version: "{{ kube_nvidia_driver_version }}"
when: ansible_os_family == "Debian" and kube_install_method == 'kubeadm'
when: ansible_os_family == "Debian" and kube_install_method == 'kubeadm' and kube_cri_runtime != 'crio'
- role: 'grycap.cri_o'
when: ansible_os_family == "Debian" and kube_install_method == 'kubeadm' and kube_cri_runtime == 'crio'

2 changes: 1 addition & 1 deletion tasks/kubeadm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
command: sysctl --system
when: containerd_sysctl is changed

when: kube_cri_runtime == "containerd"
when: kube_cri_runtime in ["containerd", "crio"]

- name: Include "{{ansible_os_family}}" Kubernetes recipe
include_tasks: "{{ansible_os_family}}.yaml"
14 changes: 14 additions & 0 deletions tests/test-crio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- hosts: localhost
roles:
- role: ansible-role-kubernetes
kube_install_metrics: true
kube_cert_manager: true
kube_install_kubeapps: false
kube_install_kyverno: false
kube_deploy_dashboard: true
kube_install_ingress: true
kube_public_dns_name: test.domain.com
kube_version: 1.25.3
kube_cri_runtime: crio
kubelet_extra_args: '-node-labels=somelabel'

0 comments on commit f8edc10

Please sign in to comment.