mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-02 09:18:55 -03:30
Convert CRI-O molecule to ansible verifier
This commit is contained in:
17
roles/container-engine/molecule/files/10-mynet.conf
Normal file
17
roles/container-engine/molecule/files/10-mynet.conf
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"cniVersion": "0.2.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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
10
roles/container-engine/molecule/templates/container.json.j2
Normal file
10
roles/container-engine/molecule/templates/container.json.j2
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"metadata": {
|
||||
"name": "{{ container_runtime }}1"
|
||||
},
|
||||
"image": {
|
||||
"image": "quay.io/kubespray/hello-world:latest"
|
||||
},
|
||||
"log_path": "{{ container_runtime }}1.0.log",
|
||||
"linux": {}
|
||||
}
|
||||
10
roles/container-engine/molecule/templates/sandbox.json.j2
Normal file
10
roles/container-engine/molecule/templates/sandbox.json.j2
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"metadata": {
|
||||
"name": "{{ container_runtime }}1",
|
||||
"namespace": "default",
|
||||
"attempt": 1,
|
||||
"uid": "hdishd83djaidwnduwk28bcsb"
|
||||
},
|
||||
"linux": {},
|
||||
"log_directory": "/tmp"
|
||||
}
|
||||
42
roles/container-engine/molecule/test_runtime.yml
Normal file
42
roles/container-engine/molecule/test_runtime.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
- name: Test container runtime
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
become: true
|
||||
roles:
|
||||
- role: ../../kubespray_defaults
|
||||
tasks:
|
||||
- name: Copy test container files
|
||||
template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "/tmp/{{ item }}"
|
||||
owner: root
|
||||
mode: "0644"
|
||||
loop:
|
||||
- container.json
|
||||
- sandbox.json
|
||||
- name: Check running a container with runtime {{ container_runtime }}
|
||||
block:
|
||||
- name: Run container
|
||||
command:
|
||||
argv:
|
||||
- "{{ bin_dir }}/crictl"
|
||||
- run
|
||||
- --with-pull
|
||||
- --runtime
|
||||
- "{{ container_runtime }}"
|
||||
- /tmp/container.json
|
||||
- /tmp/sandbox.json
|
||||
- name: Check log file
|
||||
slurp:
|
||||
src: "/tmp/{{ container_runtime }}1.0.log"
|
||||
register: log_file
|
||||
failed_when: >
|
||||
log_file is failed or
|
||||
'Hello from Docker' not in (log_file.content | b64decode)
|
||||
rescue:
|
||||
- name: Display container manager config on error
|
||||
command: "{{ bin_dir }}/crictl info"
|
||||
- name: Check container manager logs
|
||||
command: journalctl -u {{ container_manager }}
|
||||
failed_when: true
|
||||
Reference in New Issue
Block a user