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.
* 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:
Chris Evich 2017-10-31 09:22:56 -04:00
parent 5f80135d0e
commit 393a34a35a
6 changed files with 73 additions and 36 deletions

View file

@ -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
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:
- May be the subject.
@ -11,13 +21,17 @@ The control-host:
- Runs ``main.yml`` from within the cri-o repository already in the
desired state for testing.
The subject host(s):
The subject-host(s):
- May be the control-host.
- May be executing the ``main.yml`` playbook against itself.
- If RHEL-like, has the ``server``, ``extras``, and ``EPEL`` repositories available
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:
@ -31,19 +45,34 @@ Execution of the ``main.yml`` playbook:
stage-caching).
- ``integration``: Assumes 'setup' previously completed successfully.
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
integration test suite.
- ``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
E2E tests.
``cri-o/contrib/test/venv-ansible-playbook.sh`` Wrapper:
- Must accepts all of the valid Ansible command-line options.
- Must use version-locked & hashed dependencies as written in ``requirements.txt``.
- Must fully sandbox it's own execution environment except for the following
required packages (or equivalent): ``python2-virtualenv gcc openssl-devel
- May be executed on the control-host to both hide and version-lock playbook
execution dependencies, ansible and otherwise.
- Must accept all of the valid Ansible command-line options.
- 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
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

View file

@ -3,12 +3,12 @@
- name: stat the expected cri-o directory and Makefile exists
stat:
path: "{{ cri_o_dest_path }}/Makefile"
register: dir_stat
register: crio_stat
- name: Verify cri-o Makefile exists in expected location
fail:
msg: "Expected cri-o to be cloned at {{ cri_o_dest_path }} but it wasn't!"
when: not dir_stat.stat.exists or not dir_stat.stat.isreg
msg: "Expected cri-o to be cloned at {{ cri_o_dest_path }}, but its 'Makefile' seems to be missing."
when: not crio_stat.stat.exists or not crio_stat.stat.isreg
- name: install cri-o tools
make:

View file

@ -18,14 +18,14 @@
- name: set up directories
file:
path: "{{ go_path }}/{{ item }}"
path: "{{ go_path }}/src/github.com/{{ item }}"
state: directory
with_items:
- "src/github.com/containernetworking"
- "src/github.com/kubernetes-incubator"
- "src/github.com/k8s.io"
- "src/github.com/sstephenson"
- "src/github.com/opencontainers"
- "containernetworking"
- "kubernetes-incubator"
- "k8s.io"
- "sstephenson"
- "opencontainers"
- name: install Go tools and dependencies
shell: /usr/bin/go get -u "github.com/{{ item }}"

View file

@ -4,16 +4,38 @@
gather_facts: False # Requires low-level ansible-dependencies
tags:
- always
tags:
- setup
tasks:
- name: Ensure low-level ansible-dependencies are installed
raw: $(type -P dnf || type -P yum) install -y python2 python2-dnf libselinux-python git rsync
- 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
ignore_errors: True
- name: Gather only networking facts for speed
setup:
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"
# > is YAML for replace non-orphan newlines with single spaces
STORAGE_OPTS: >
--storage-driver=overlay
{% if ansible_distribution in ["RedHat", "CentOS"] %}
--storage-opt overlay.override_kernel_check=1
{% endif %}
- hosts: '{{ subjects | default("none") }}'
vars_files:

View file

@ -10,11 +10,6 @@
regexp: ' go test \"\$'
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
file:
path: "{{ artifacts }}"

View file

@ -1,6 +1,6 @@
---
# Path to encode into /etc/environment on all hosts
# Base directory for all go-related source, build, and install.
go_path: "/go"
# Absolute path on control-host where the cri-o source exists
@ -9,15 +9,6 @@ cri_o_src_path: "{{ playbook_dir }}/../../../"
# Absolute path on subject-host where cri-o source is expected
cri_o_dest_path: "{{ go_path }}/src/github.com/kubernetes-incubator/cri-o"
# Global environment variables to use for tasks on subject-hosts
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
artifacts: "/tmp/artifacts" # Base-directory for collection
crio_integration_filepath: "{{ artifacts }}/testout.txt"