mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-04 02:01:04 -03:30
Add youki runtime support (#8411)
This commit is contained in:
@@ -73,6 +73,13 @@ crun_runtime:
|
||||
type: oci
|
||||
root: /run/crun
|
||||
|
||||
# youki is an implementation of the OCI runtime-spec in Rust, similar to runc.
|
||||
youki_runtime:
|
||||
name: youki
|
||||
path: "{{ youki_bin_dir }}/youki"
|
||||
type: oci
|
||||
root: /run/youki
|
||||
|
||||
# When this is true, CRI-O package repositories are added. Set this to false when using an
|
||||
# environment with preconfigured CRI-O package repositories.
|
||||
crio_add_repos: true
|
||||
|
||||
@@ -54,6 +54,12 @@
|
||||
when:
|
||||
- crun_enabled
|
||||
|
||||
- name: Build a list of crio runtimes with youki runtime
|
||||
set_fact:
|
||||
crio_runtimes: "{{ crio_runtimes + [youki_runtime] }}"
|
||||
when:
|
||||
- youki_enabled
|
||||
|
||||
- name: Make sure needed folders exist in the system
|
||||
with_items:
|
||||
- /etc/crio
|
||||
|
||||
@@ -23,6 +23,14 @@ dependencies:
|
||||
- container-engine
|
||||
- crun
|
||||
|
||||
- role: container-engine/youki
|
||||
when:
|
||||
- youki_enabled
|
||||
- container_manager == 'crio'
|
||||
tags:
|
||||
- container-engine
|
||||
- youki
|
||||
|
||||
- role: container-engine/cri-o
|
||||
when:
|
||||
- container_manager == 'crio'
|
||||
|
||||
3
roles/container-engine/youki/defaults/main.yml
Normal file
3
roles/container-engine/youki/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
|
||||
youki_bin_dir: "{{ bin_dir }}"
|
||||
11
roles/container-engine/youki/molecule/default/converge.yml
Normal file
11
roles/container-engine/youki/molecule/default/converge.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
become: true
|
||||
vars:
|
||||
youki_enabled: true
|
||||
container_manager: crio
|
||||
roles:
|
||||
- role: kubespray-defaults
|
||||
- role: container-engine/cri-o
|
||||
- role: container-engine/youki
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"cniVersion": "0.4.0",
|
||||
"name": "mynet",
|
||||
"type": "bridge",
|
||||
"bridge": "cni0",
|
||||
"isGateway": true,
|
||||
"ipMasq": true,
|
||||
"ipam": {
|
||||
"type": "host-local",
|
||||
"subnet": "172.19.0.0/24",
|
||||
"routes": [
|
||||
{
|
||||
"dst": "0.0.0.0/0"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"metadata": {
|
||||
"name": "youki1"
|
||||
},
|
||||
"image": {
|
||||
"image": "quay.io/kubespray/hello-world:latest"
|
||||
},
|
||||
"log_path": "youki1.0.log",
|
||||
"linux": {}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"metadata": {
|
||||
"name": "youki1",
|
||||
"namespace": "default",
|
||||
"attempt": 1,
|
||||
"uid": "hdishd83djaidwnduwk28bcsb"
|
||||
},
|
||||
"linux": {},
|
||||
"log_directory": "/tmp"
|
||||
}
|
||||
45
roles/container-engine/youki/molecule/default/molecule.yml
Normal file
45
roles/container-engine/youki/molecule/default/molecule.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
driver:
|
||||
name: vagrant
|
||||
provider:
|
||||
name: libvirt
|
||||
options:
|
||||
driver: kvm
|
||||
lint: |
|
||||
set -e
|
||||
yamllint -c ../../../.yamllint .
|
||||
platforms:
|
||||
- name: ubuntu20
|
||||
box: generic/ubuntu2004
|
||||
cpus: 1
|
||||
memory: 1024
|
||||
nested: true
|
||||
groups:
|
||||
- kube_control_plane
|
||||
- name: almalinux8
|
||||
box: almalinux/8
|
||||
cpus: 1
|
||||
memory: 1024
|
||||
nested: true
|
||||
groups:
|
||||
- kube_control_plane
|
||||
provisioner:
|
||||
name: ansible
|
||||
env:
|
||||
ANSIBLE_ROLES_PATH: ../../../../
|
||||
config_options:
|
||||
defaults:
|
||||
callback_whitelist: profile_tasks
|
||||
timeout: 120
|
||||
lint:
|
||||
name: ansible-lint
|
||||
options:
|
||||
c: ../../../.ansible-lint
|
||||
inventory:
|
||||
group_vars:
|
||||
all:
|
||||
become: true
|
||||
verifier:
|
||||
name: testinfra
|
||||
lint:
|
||||
name: flake8
|
||||
48
roles/container-engine/youki/molecule/default/prepare.yml
Normal file
48
roles/container-engine/youki/molecule/default/prepare.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
- name: Prepare generic
|
||||
hosts: all
|
||||
become: true
|
||||
roles:
|
||||
- role: kubespray-defaults
|
||||
- role: bootstrap-os
|
||||
- role: adduser
|
||||
user: "{{ addusers.kube }}"
|
||||
tasks:
|
||||
- include_tasks: "../../../../download/tasks/download_file.yml"
|
||||
vars:
|
||||
download: "{{ download_defaults | combine(downloads.cni) }}"
|
||||
|
||||
- name: Prepare container runtime
|
||||
hosts: all
|
||||
become: true
|
||||
vars:
|
||||
container_manager: crio
|
||||
kube_network_plugin: cni
|
||||
roles:
|
||||
- role: kubespray-defaults
|
||||
- role: network_plugin/cni
|
||||
- role: container-engine/crictl
|
||||
tasks:
|
||||
- name: Copy test container files
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/tmp/{{ item }}"
|
||||
owner: root
|
||||
mode: 0644
|
||||
with_items:
|
||||
- container.json
|
||||
- sandbox.json
|
||||
- name: Create /etc/cni/net.d directory
|
||||
file:
|
||||
path: /etc/cni/net.d
|
||||
state: directory
|
||||
owner: root
|
||||
mode: 0755
|
||||
- name: Setup CNI
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/etc/cni/net.d/{{ item }}"
|
||||
owner: root
|
||||
mode: 0644
|
||||
with_items:
|
||||
- 10-mynet.conf
|
||||
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
|
||||
import testinfra.utils.ansible_runner
|
||||
|
||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||
|
||||
|
||||
def test_run(host):
|
||||
youkiruntime = "/usr/local/bin/youki"
|
||||
with host.sudo():
|
||||
cmd = host.command(youkiruntime + " --version")
|
||||
assert cmd.rc == 0
|
||||
assert "youki" in cmd.stdout
|
||||
|
||||
|
||||
def test_run_pod(host):
|
||||
runtime = "youki"
|
||||
|
||||
run_command = "/usr/local/bin/crictl run --with-pull --runtime {} /tmp/container.json /tmp/sandbox.json".format(runtime)
|
||||
with host.sudo():
|
||||
cmd = host.command(run_command)
|
||||
assert cmd.rc == 0
|
||||
|
||||
with host.sudo():
|
||||
log_f = host.file("/tmp/youki1.0.log")
|
||||
|
||||
assert log_f.exists
|
||||
assert b"Hello from Docker" in log_f.content
|
||||
12
roles/container-engine/youki/tasks/main.yml
Normal file
12
roles/container-engine/youki/tasks/main.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: youki | Download youki
|
||||
include_tasks: "../../../download/tasks/download_file.yml"
|
||||
vars:
|
||||
download: "{{ download_defaults | combine(downloads.youki) }}"
|
||||
|
||||
- name: youki | Copy youki binary from download dir
|
||||
copy:
|
||||
src: "{{ local_release_dir }}/youki_v{{ youki_version | regex_replace('\\.', '_') }}_linux/youki-v{{ youki_version }}/youki"
|
||||
dest: "{{ youki_bin_dir }}/youki"
|
||||
mode: 0755
|
||||
remote_src: true
|
||||
Reference in New Issue
Block a user