Updates based on PR #972 feedback
* When installing low-level dependencies, ignore any errors as consequences will be revealed in the subsequent task. * Rename dir_stat -> crio_stat to better match usage. * Add comment regarding ControlPersist in ansible.cfg. * Simplify extra_storage_opts variable usage, consolidate definition. * Reduce duplication of base-paths in golang.yml directory-setup loop. * Clarify a few points and add a wrapper example to README.md Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
parent
8c4db4222a
commit
f1817ab2aa
7 changed files with 79 additions and 38 deletions
|
@ -4,6 +4,16 @@ This directory contains playbooks to set up for and run the integration and
|
||||||
end-to-end tests for CRI-O on RHEL and Fedora hosts. The expected entry-point
|
end-to-end tests for CRI-O on RHEL and Fedora hosts. The expected entry-point
|
||||||
is the ``main.yml`` Ansible playbook.
|
is the ``main.yml`` Ansible playbook.
|
||||||
|
|
||||||
|
##Definitions:
|
||||||
|
|
||||||
|
Control-host: The system from which the ``ansible-playbook`` or
|
||||||
|
``venv-ansible-playbook.sh`` command is executed.
|
||||||
|
|
||||||
|
Subject-host(s): The target systems, on which actual playbook tasks are
|
||||||
|
being carried out.
|
||||||
|
|
||||||
|
##Topology:
|
||||||
|
|
||||||
The control-host:
|
The control-host:
|
||||||
|
|
||||||
- May be the subject.
|
- May be the subject.
|
||||||
|
@ -11,13 +21,17 @@ The control-host:
|
||||||
- Runs ``main.yml`` from within the cri-o repository already in the
|
- Runs ``main.yml`` from within the cri-o repository already in the
|
||||||
desired state for testing.
|
desired state for testing.
|
||||||
|
|
||||||
The subject host(s):
|
The subject-host(s):
|
||||||
|
|
||||||
- May be the control-host.
|
- May be the control-host.
|
||||||
- May be executing the ``main.yml`` playbook against itself.
|
- May be executing the ``main.yml`` playbook against itself.
|
||||||
- If RHEL-like, has the ``server``, ``extras``, and ``EPEL`` repositories available
|
- If RHEL-like, has the ``server``, ``extras``, and ``EPEL`` repositories available
|
||||||
and enabled.
|
and enabled.
|
||||||
- Has remote password-less ssh configured for direct or sudo access to the root user.
|
- Has remote password-less ssh configured for access by the control-host.
|
||||||
|
- When ssh-access is for a regular user, that user has password-less
|
||||||
|
sudo access to root.
|
||||||
|
|
||||||
|
##Runtime Requirements:
|
||||||
|
|
||||||
Execution of the ``main.yml`` playbook:
|
Execution of the ``main.yml`` playbook:
|
||||||
|
|
||||||
|
@ -31,19 +45,34 @@ Execution of the ``main.yml`` playbook:
|
||||||
stage-caching).
|
stage-caching).
|
||||||
- ``integration``: Assumes 'setup' previously completed successfully.
|
- ``integration``: Assumes 'setup' previously completed successfully.
|
||||||
May be executed from cached-state of ``setup``.
|
May be executed from cached-state of ``setup``.
|
||||||
Not required to execute conicident with other tags.
|
Not required to execute coincident with other tags.
|
||||||
Must build CRI-O from source and run the
|
Must build CRI-O from source and run the
|
||||||
integration test suite.
|
integration test suite.
|
||||||
- ``e2e``: Assumes 'setup' previously completed successfully. May be executed
|
- ``e2e``: Assumes 'setup' previously completed successfully. May be executed
|
||||||
from cached-state of ``setup``. Not required to execute conicident with
|
from cached-state of ``setup``. Not required to execute coincident with
|
||||||
other tags. Must build CRI-O from source and run Kubernetes node
|
other tags. Must build CRI-O from source and run Kubernetes node
|
||||||
E2E tests.
|
E2E tests.
|
||||||
|
|
||||||
``cri-o/contrib/test/venv-ansible-playbook.sh`` Wrapper:
|
``cri-o/contrib/test/venv-ansible-playbook.sh`` Wrapper:
|
||||||
|
|
||||||
- Must accepts all of the valid Ansible command-line options.
|
- May be executed on the control-host to both hide and version-lock playbook
|
||||||
- Must use version-locked & hashed dependencies as written in ``requirements.txt``.
|
execution dependencies, ansible and otherwise.
|
||||||
- Must fully sandbox it's own execution environment except for the following
|
- Must accept all of the valid Ansible command-line options.
|
||||||
required packages (or equivalent): ``python2-virtualenv gcc openssl-devel
|
- Must sandbox dependencies under a python virtual environment ``.cri-o_venv``
|
||||||
|
with packages as specified in ``requirements.txt``.
|
||||||
|
- Requires the control-host has the following fundamental dependencies installed
|
||||||
|
(or equivalent): ``python2-virtualenv gcc openssl-devel
|
||||||
redhat-rpm-config libffi-devel python-devel libselinux-python rsync
|
redhat-rpm-config libffi-devel python-devel libselinux-python rsync
|
||||||
yum-utils python3-pycurl python-simplejson``.
|
yum-utils python3-pycurl python-simplejson``.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
Given a populated '/path/to/inventory' file, a control-host could run:
|
||||||
|
|
||||||
|
./venv-ansible-playbook.sh -i /path/to/inventory ./integration/main.yml
|
||||||
|
|
||||||
|
-or-
|
||||||
|
|
||||||
|
From a subject-host without an inventory:
|
||||||
|
|
||||||
|
./venv-ansible-playbook.sh -i localhost, ./integration/main.yml
|
||||||
|
|
|
@ -292,8 +292,16 @@ ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/de
|
||||||
# Example:
|
# Example:
|
||||||
# control_path = %(directory)s/%%h-%%r
|
# control_path = %(directory)s/%%h-%%r
|
||||||
#control_path = %(directory)s/ansible-ssh-%%h-%%p-%%r
|
#control_path = %(directory)s/ansible-ssh-%%h-%%p-%%r
|
||||||
|
# Using ssh's ControlPersist feature is desireable because of wide
|
||||||
|
# compatibility and not needing to mess with /etc/sudoers
|
||||||
|
# for pipelining (see below). Unfortunately, in cloud environments,
|
||||||
|
# auto-assigned VM hostnames tend to be rather longs. Worse, in a CI
|
||||||
|
# context, the default home-directory path may also be lengthy. Fix
|
||||||
|
# this to a short name, so Ansible doesn't fall back to opening new
|
||||||
|
# connections for every task.
|
||||||
control_path = /tmp/crio-%%n-%%p
|
control_path = /tmp/crio-%%n-%%p
|
||||||
|
|
||||||
|
|
||||||
# Enabling pipelining reduces the number of SSH operations required to
|
# Enabling pipelining reduces the number of SSH operations required to
|
||||||
# execute a module on the remote server. This can result in a significant
|
# execute a module on the remote server. This can result in a significant
|
||||||
# performance improvement when enabled, however when using "sudo:" you must
|
# performance improvement when enabled, however when using "sudo:" you must
|
||||||
|
@ -303,7 +311,6 @@ control_path = /tmp/crio-%%n-%%p
|
||||||
# sudoers configurations that have requiretty (the default on many distros).
|
# sudoers configurations that have requiretty (the default on many distros).
|
||||||
#
|
#
|
||||||
#pipelining = False
|
#pipelining = False
|
||||||
pipelining=True
|
|
||||||
|
|
||||||
# if True, make ansible use scp if the connection type is ssh
|
# if True, make ansible use scp if the connection type is ssh
|
||||||
# (default is sftp)
|
# (default is sftp)
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
- name: stat the expected cri-o directory and Makefile exists
|
- name: stat the expected cri-o directory and Makefile exists
|
||||||
stat:
|
stat:
|
||||||
path: "{{ cri_o_dest_path }}/Makefile"
|
path: "{{ cri_o_dest_path }}/Makefile"
|
||||||
register: dir_stat
|
register: crio_stat
|
||||||
|
|
||||||
- name: Verify cri-o Makefile exists in expected location
|
- name: Verify cri-o Makefile exists in expected location
|
||||||
fail:
|
fail:
|
||||||
msg: "Expected cri-o to be cloned at {{ cri_o_dest_path }} but it wasn't!"
|
msg: "Expected cri-o to be cloned at {{ cri_o_dest_path }}, but its 'Makefile' seems to be missing."
|
||||||
when: not dir_stat.stat.exists or not dir_stat.stat.isreg
|
when: not crio_stat.stat.exists or not crio_stat.stat.isreg
|
||||||
|
|
||||||
- name: install cri-o tools
|
- name: install cri-o tools
|
||||||
make:
|
make:
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
|
|
||||||
- name: set up directories
|
- name: set up directories
|
||||||
file:
|
file:
|
||||||
path: "{{ go_path }}/{{ item }}"
|
path: "{{ go_path }}/src/github.com/{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
with_items:
|
with_items:
|
||||||
- "src/github.com/containernetworking"
|
- "containernetworking"
|
||||||
- "src/github.com/kubernetes-incubator"
|
- "kubernetes-incubator"
|
||||||
- "src/github.com/k8s.io"
|
- "k8s.io"
|
||||||
- "src/github.com/sstephenson"
|
- "sstephenson"
|
||||||
- "src/github.com/opencontainers"
|
- "opencontainers"
|
||||||
|
|
||||||
- name: install Go tools and dependencies
|
- name: install Go tools and dependencies
|
||||||
shell: /usr/bin/go get -u "github.com/{{ item }}"
|
shell: /usr/bin/go get -u "github.com/{{ item }}"
|
||||||
|
|
|
@ -4,15 +4,35 @@
|
||||||
gather_facts: False # Requires low-level ansible-dependencies
|
gather_facts: False # Requires low-level ansible-dependencies
|
||||||
# Cannot use vars.yml - it references magic variables from setup module
|
# Cannot use vars.yml - it references magic variables from setup module
|
||||||
tags:
|
tags:
|
||||||
- setup
|
- always
|
||||||
tasks:
|
tasks:
|
||||||
- name: Ensure low-level ansible-dependencies are installed
|
- name: Ansible setup-module dependencies are installed, ignoring errors (setup runs next).
|
||||||
raw: $(type -P dnf || type -P yum) install -y python2 python2-dnf libselinux-python git rsync
|
raw: $(type -P dnf || type -P yum) install -y python2 python2-dnf libselinux-python
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
- name: Gather only networking facts for speed
|
- name: Gather only networking facts for speed
|
||||||
setup:
|
setup:
|
||||||
gather_subset: network
|
gather_subset: network
|
||||||
|
|
||||||
|
- name: Variables from vars.yml are hauled in after setup
|
||||||
|
include_vars: "{{ playbook_dir }}/vars.yml"
|
||||||
|
|
||||||
|
- name: Global environment are defined, but can be overriden on a task-by-task basis.
|
||||||
|
set_fact:
|
||||||
|
extra_storage_opts: >
|
||||||
|
{%- if ansible_distribution in ["RedHat", "CentOS"] -%}
|
||||||
|
"--storage-opt overlay.override_kernel_check=1"
|
||||||
|
{%- else -%}
|
||||||
|
""
|
||||||
|
{%- endif -%}
|
||||||
|
environment_variables:
|
||||||
|
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:{{ go_path }}/bin:/usr/local/go/bin"
|
||||||
|
GOPATH: "{{ go_path }}"
|
||||||
|
KUBERNETES_PROVIDER: "local"
|
||||||
|
KUBECONFIG: "/var/run/kubernetes/admin.kubeconfig"
|
||||||
|
CGROUP_MANAGER: "cgroupfs"
|
||||||
|
STORAGE_OPTS: '--storage-driver=overlay {{ extra_storage_opts | default("") | trim }}'
|
||||||
|
|
||||||
|
|
||||||
- hosts: '{{ subjects | default("none") }}'
|
- hosts: '{{ subjects | default("none") }}'
|
||||||
vars_files:
|
vars_files:
|
||||||
|
|
|
@ -10,11 +10,6 @@
|
||||||
regexp: ' go test \"\$'
|
regexp: ' go test \"\$'
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: set extra storage options
|
|
||||||
set_fact:
|
|
||||||
extra_storage_opts: " --storage-opt overlay.override_kernel_check=1"
|
|
||||||
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'
|
|
||||||
|
|
||||||
- name: ensure directory exists for integration results
|
- name: ensure directory exists for integration results
|
||||||
file:
|
file:
|
||||||
path: "{{ artifacts }}"
|
path: "{{ artifacts }}"
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
# When swap setup is necessary, make it this size
|
# When swap setup is necessary, make it this size
|
||||||
swapfileGB: 8
|
swapfileGB: 8
|
||||||
|
|
||||||
# When False, turn off all swapping on the system only during
|
# When False, turn off all swapping on the system during indicated test.
|
||||||
# particular tests.
|
|
||||||
integration_swap_enabled: False
|
integration_swap_enabled: False
|
||||||
e2e_swap_enabled: True
|
e2e_swap_enabled: True
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ e2e_swap_enabled: True
|
||||||
integration_selinux_enabled: True
|
integration_selinux_enabled: True
|
||||||
e2e_selinux_enabled: False
|
e2e_selinux_enabled: False
|
||||||
|
|
||||||
# Path to encode into /etc/environment on all hosts
|
# Base directory for all go-related source, build, and install.
|
||||||
go_path: "/go"
|
go_path: "/go"
|
||||||
|
|
||||||
# Absolute path on control-host where the cri-o source exists
|
# Absolute path on control-host where the cri-o source exists
|
||||||
|
@ -22,15 +21,6 @@ cri_o_src_path: "{{ playbook_dir }}/../../../"
|
||||||
# Absolute path on subjects where cri-o source is expected
|
# Absolute path on subjects where cri-o source is expected
|
||||||
cri_o_dest_path: "{{ go_path }}/src/github.com/kubernetes-incubator/cri-o"
|
cri_o_dest_path: "{{ go_path }}/src/github.com/kubernetes-incubator/cri-o"
|
||||||
|
|
||||||
# Global environment variables to use for all tasks
|
|
||||||
environment_variables:
|
|
||||||
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:{{ go_path }}/bin:/usr/local/go/bin"
|
|
||||||
GOPATH: "{{ go_path }}"
|
|
||||||
KUBERNETES_PROVIDER: "local"
|
|
||||||
KUBECONFIG: "/var/run/kubernetes/admin.kubeconfig"
|
|
||||||
CGROUP_MANAGER: "cgroupfs"
|
|
||||||
STORAGE_OPTS: '--storage-driver=overlay{{ extra_storage_opts | default("") }}'
|
|
||||||
|
|
||||||
# For results.yml Paths use rsync 'source' conventions
|
# For results.yml Paths use rsync 'source' conventions
|
||||||
artifacts: "/tmp/artifacts" # Base-directory for collection
|
artifacts: "/tmp/artifacts" # Base-directory for collection
|
||||||
crio_integration_filepath: "{{ artifacts }}/testout.txt"
|
crio_integration_filepath: "{{ artifacts }}/testout.txt"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue