dsk-dev kubespray 이동
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
become: true
|
||||
vars:
|
||||
container_manager: containerd
|
||||
roles:
|
||||
- role: kubespray-defaults
|
||||
- role: container-engine/containerd
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
driver:
|
||||
name: vagrant
|
||||
provider:
|
||||
name: libvirt
|
||||
lint: |
|
||||
set -e
|
||||
yamllint -c ../../../.yamllint .
|
||||
platforms:
|
||||
- name: ubuntu20
|
||||
box: generic/ubuntu2004
|
||||
cpus: 1
|
||||
memory: 1024
|
||||
groups:
|
||||
- kube_control_plane
|
||||
- kube_node
|
||||
- k8s_cluster
|
||||
- name: debian11
|
||||
box: generic/debian11
|
||||
cpus: 1
|
||||
memory: 1024
|
||||
groups:
|
||||
- kube_control_plane
|
||||
- kube_node
|
||||
- k8s_cluster
|
||||
- name: almalinux8
|
||||
box: almalinux/8
|
||||
cpus: 1
|
||||
memory: 1024
|
||||
groups:
|
||||
- kube_control_plane
|
||||
- kube_node
|
||||
- k8s_cluster
|
||||
provisioner:
|
||||
name: ansible
|
||||
env:
|
||||
ANSIBLE_ROLES_PATH: ../../../../
|
||||
config_options:
|
||||
defaults:
|
||||
callbacks_enabled: profile_tasks
|
||||
timeout: 120
|
||||
lint:
|
||||
name: ansible-lint
|
||||
options:
|
||||
c: ../../../.ansible-lint
|
||||
verifier:
|
||||
name: testinfra
|
||||
lint:
|
||||
name: flake8
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: Prepare
|
||||
hosts: all
|
||||
gather_facts: False
|
||||
become: true
|
||||
vars:
|
||||
ignore_assert_errors: true
|
||||
roles:
|
||||
- role: kubespray-defaults
|
||||
- role: bootstrap-os
|
||||
- role: kubernetes/preinstall
|
||||
- role: adduser
|
||||
user: "{{ addusers.kube }}"
|
||||
tasks:
|
||||
- include_tasks: "../../../../download/tasks/download_file.yml"
|
||||
vars:
|
||||
download: "{{ download_defaults | combine(downloads.cni) }}"
|
||||
|
||||
- name: Prepare CNI
|
||||
hosts: all
|
||||
gather_facts: False
|
||||
become: true
|
||||
vars:
|
||||
ignore_assert_errors: true
|
||||
kube_network_plugin: cni
|
||||
roles:
|
||||
- role: kubespray-defaults
|
||||
- role: network_plugin/cni
|
||||
@@ -0,0 +1,55 @@
|
||||
import os
|
||||
import pytest
|
||||
|
||||
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("containerd")
|
||||
assert svc.is_running
|
||||
assert svc.is_enabled
|
||||
|
||||
|
||||
def test_version(host):
|
||||
crictl = "/usr/local/bin/crictl"
|
||||
path = "unix:///var/run/containerd/containerd.sock"
|
||||
with host.sudo():
|
||||
cmd = host.command(crictl + " --runtime-endpoint " + path + " version")
|
||||
assert cmd.rc == 0
|
||||
assert "RuntimeName: containerd" in cmd.stdout
|
||||
|
||||
|
||||
@pytest.mark.parametrize('image, dest', [
|
||||
('quay.io/kubespray/hello-world:latest', '/tmp/hello-world.tar')
|
||||
])
|
||||
def test_image_pull_save_load(host, image, dest):
|
||||
nerdctl = "/usr/local/bin/nerdctl"
|
||||
dest_file = host.file(dest)
|
||||
|
||||
with host.sudo():
|
||||
pull_cmd = host.command(nerdctl + " pull " + image)
|
||||
assert pull_cmd.rc ==0
|
||||
|
||||
with host.sudo():
|
||||
save_cmd = host.command(nerdctl + " save -o " + dest + " " + image)
|
||||
assert save_cmd.rc == 0
|
||||
assert dest_file.exists
|
||||
|
||||
with host.sudo():
|
||||
load_cmd = host.command(nerdctl + " load < " + dest)
|
||||
assert load_cmd.rc == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize('image', [
|
||||
('quay.io/kubespray/hello-world:latest')
|
||||
])
|
||||
def test_run(host, image):
|
||||
nerdctl = "/usr/local/bin/nerdctl"
|
||||
|
||||
with host.sudo():
|
||||
cmd = host.command(nerdctl + " -n k8s.io run " + image)
|
||||
assert cmd.rc == 0
|
||||
assert "Hello from Docker" in cmd.stdout
|
||||
Reference in New Issue
Block a user