Browse Source

Add CRI-O CI (#5460)

pull/6003/head
Maxime Guyot 4 years ago
committed by GitHub
parent
commit
09bccc97ba
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 109 additions and 10 deletions
  1. 5
      .gitlab-ci/packet.yml
  2. 2
      roles/container-engine/cri-o/defaults/main.yml
  3. 1
      roles/container-engine/cri-o/handlers/main.yml
  4. 31
      roles/container-engine/cri-o/molecule/default/molecule.yml
  5. 7
      roles/container-engine/cri-o/molecule/default/playbook.yml
  6. 6
      roles/container-engine/cri-o/molecule/default/prepare.yml
  7. 20
      roles/container-engine/cri-o/molecule/default/tests/test_default.py
  8. 14
      roles/container-engine/cri-o/tasks/crictl.yml
  9. 10
      roles/container-engine/cri-o/tasks/main.yaml
  10. 2
      roles/container-engine/cri-o/templates/crio.conf.j2
  11. 3
      roles/container-engine/cri-o/vars/fedora.yml
  12. 4
      roles/container-engine/cri-o/vars/ubuntu.yml
  13. 14
      tests/files/packet_ubuntu18-crio.yml

5
.gitlab-ci/packet.yml

@ -27,6 +27,11 @@ packet_centos7-flannel-containerd-addons-ha:
stage: deploy-part2
when: on_success
packet_ubuntu18-crio:
extends: .packet
stage: deploy-part2
when: on_success
# ### MANUAL JOBS
packet_centos7-weave-upgrade-ha:

2
roles/container-engine/cri-o/defaults/main.yml

@ -5,4 +5,4 @@ crio_seccomp_profile: "/etc/crio/seccomp.json"
crio_cgroup_manager: "{{ kubelet_cgroup_driver | default('cgroupfs') }}"
crio_runc_path: "/usr/sbin/runc"
crio_runc_path: "/usr/sbin/runc"

1
roles/container-engine/cri-o/handlers/main.yml

@ -13,3 +13,4 @@
service:
name: crio
state: restarted
enabled: yes

31
roles/container-engine/cri-o/molecule/default/molecule.yml

@ -0,0 +1,31 @@
---
driver:
name: vagrant
provider:
name: libvirt
lint:
name: yamllint
options:
config-file: ../../../.yamllint
platforms:
- name: kubespray-crio
box: generic/ubuntu1804
cpus: 2
memory: 1024
groups:
- kube-master
provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../
config_options:
defaults:
callback_whitelist: profile_tasks
lint:
name: ansible-lint
options:
c: ../../../.ansible-lint
verifier:
name: testinfra
lint:
name: flake8

7
roles/container-engine/cri-o/molecule/default/playbook.yml

@ -0,0 +1,7 @@
---
- name: Converge
hosts: all
become: true
roles:
- role: kubespray-defaults
- role: cri-o

6
roles/container-engine/cri-o/molecule/default/prepare.yml

@ -0,0 +1,6 @@
---
- name: Prepare
hosts: all
gather_facts: False
roles:
- role: bootstrap-os

20
roles/container-engine/cri-o/molecule/default/tests/test_default.py

@ -0,0 +1,20 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_service(host):
svc = host.service("crio")
assert svc.is_running
assert svc.is_enabled
def test_run(host):
path = "unix:///var/run/crio/crio.sock"
with host.sudo():
cmd = host.command("crictl --runtime-endpoint " + path + " version")
assert cmd.rc == 0
assert "RuntimeName: cri-o" in cmd.stdout

14
roles/container-engine/cri-o/tasks/crictl.yml

@ -21,7 +21,15 @@
group: no
delegate_to: "{{ inventory_hostname }}"
- name: Install crictl completion
shell: "{{ bin_dir }}/crictl completion >/etc/bash_completion.d/crictl"
ignore_errors: True
- name: Get crictl completion
shell: "{{ bin_dir }}/crictl completion"
when: ansible_distribution in ["CentOS","RedHat", "Ubuntu", "Debian"]
changed_when: False
register: cri_completion
- name: Install crictl completion
copy:
dest: /etc/bash_completion.d/crictl
content: "{{ cri_completion.stdout }}"
become: True
when: cri_completion is defined

10
roles/container-engine/cri-o/tasks/main.yaml

@ -101,6 +101,14 @@
- is_ostree
- not need_bootstrap_crio.stat.exists
- name: Remove example CNI configs
file:
path: "/etc/cni/net.d/{{ item }}"
state: absent
loop:
- 100-crio-bridge.conf
- 200-loopback.conf
- name: Install cri-o config
template:
src: crio.conf.j2
@ -126,4 +134,4 @@
src: http-proxy.conf.j2
dest: /etc/systemd/system/crio.service.d/http-proxy.conf
notify: restart crio
when: http_proxy is defined or https_proxy is defined
when: http_proxy is defined or https_proxy is defined

2
roles/container-engine/cri-o/templates/crio.conf.j2

@ -281,7 +281,5 @@ network_dir = "/etc/cni/net.d/"
# Paths to directories where CNI plugin binaries are located.
plugin_dirs = [
"/usr/libexec/cni",
{% if ansible_os_family == "ClearLinux" or is_ostree %}
"/opt/cni/bin/",
{% endif %}
]

3
roles/container-engine/cri-o/vars/fedora.yml

@ -4,4 +4,5 @@ crio_packages:
- cri-tools
crio_conmon: /usr/libexec/crio/conmon
crio_seccomp_profile: ""
crio_runc_path: "/usr/bin/runc"
crio_seccomp_profile: ""

4
roles/container-engine/cri-o/vars/ubuntu.yml

@ -1,7 +1,7 @@
---
crio_packages:
- "cri-o-{{ kube_version | regex_replace('^v(?P<major>\\d+).(?P<minor>\\d+).(?P<patch>\\d+)$', '\\g<major>.\\g<minor>') }}"
- "cri-o-1.15"
crio_conmon: /usr/libexec/podman/conmon
crio_conmon: /usr/bin/conmon
crio_seccomp_profile: ""
crio_runc_path: /usr/lib/cri-o-runc/sbin/runc

14
tests/files/packet_ubuntu18-crio.yml

@ -0,0 +1,14 @@
---
# Instance settings
cloud_image: ubuntu-1804
mode: default
# Kubespray settings
deploy_netchecker: true
dns_min_replicas: 1
container_manager: crio
# CRI-O requirements
download_container: false
etcd_deployment_type: host
kubelet_deployment_type: host
Loading…
Cancel
Save