This commit is contained in:
Chris Evich 2017-11-07 19:44:47 +00:00 committed by GitHub
commit adafa23265
20 changed files with 320 additions and 214 deletions

View file

@ -10,70 +10,6 @@
msg: "Expected cri-o to be cloned at {{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o but it wasn't!" msg: "Expected cri-o to be cloned at {{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o but it wasn't!"
when: not dir_stat.stat.exists when: not dir_stat.stat.exists
- name: install cri-o tools
make:
target: install.tools
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: build cri-o - name: build cri-o
make: make:
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o" chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install cri-o
make:
target: install
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install cri-o systemd files
make:
target: install.systemd
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install cri-o config
make:
target: install.config
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install configs
copy:
src: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/{{ item.src }}"
dest: "{{ item.dest }}"
remote_src: yes
with_items:
- src: contrib/cni/10-crio-bridge.conf
dest: /etc/cni/net.d/10-crio-bridge.conf
- src: contrib/cni/99-loopback.conf
dest: /etc/cni/net.d/99-loopback.conf
- src: test/redhat_sigstore.yaml
dest: /etc/containers/registries.d/registry.access.redhat.com.yaml
- name: run with overlay
replace:
regexp: 'storage_driver = ""'
replace: 'storage_driver = "overlay"'
name: /etc/crio/crio.conf
backup: yes
- name: run with systemd cgroup manager
replace:
regexp: 'cgroup_manager = "cgroupfs"'
replace: 'cgroup_manager = "systemd"'
name: /etc/crio/crio.conf
backup: yes
- name: add docker.io default registry
lineinfile:
dest: /etc/crio/crio.conf
line: '"docker.io"'
insertafter: 'registries = \['
regexp: 'docker\.io'
state: present
- name: add overlay storage opts on RHEL/CentOS
lineinfile:
dest: /etc/crio/crio.conf
line: '"overlay.override_kernel_check=1"'
insertafter: 'storage_option = \['
regexp: 'overlay\.override_kernel_check=1'
state: present
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'

View file

@ -1,16 +0,0 @@
---
- name: clone cri-tools source repo
git:
repo: "https://github.com/kubernetes-incubator/cri-tools.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-tools"
version: "9ff5e8f78a4182ab8d5ba9bcccdda5f338600eab"
- name: install crictl
command: "/usr/bin/go install github.com/kubernetes-incubator/cri-tools/cmd/crictl"
- name: link crictl
file:
src: "{{ ansible_env.GOPATH }}/bin/crictl"
dest: /usr/bin/crictl
state: link

View file

@ -1,11 +1,6 @@
--- ---
- name: clone kubernetes source repo # TODO: Is this required for building kube, or can it happen after?
git:
repo: "https://github.com/runcom/kubernetes.git"
dest: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes"
version: "cri-o-patched-1.8"
- name: install etcd - name: install etcd
command: "hack/install-etcd.sh" command: "hack/install-etcd.sh"
args: args:
@ -14,50 +9,3 @@
- name: build kubernetes - name: build kubernetes
make: make:
chdir: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes" chdir: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes"
- name: Add custom cluster service file for the e2e testing
copy:
dest: /etc/systemd/system/customcluster.service
content: |
[Unit]
After=network-online.target
Wants=network-online.target
[Service]
WorkingDirectory={{ ansible_env.GOPATH }}/src/k8s.io/kubernetes
ExecStart=/usr/local/bin/createcluster.sh
User=root
[Install]
WantedBy=multi-user.target
- name: Add create cluster background script for e2e testing
copy:
dest: /usr/local/bin/createcluster.sh
content: |
#!/bin/bash
export PATH=/usr/local/go/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/root/bin:{{ ansible_env.GOPATH }}/bin:{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/third_party/etcd:{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/_output/local/bin/linux/amd64/
export CONTAINER_RUNTIME=remote
export CGROUP_DRIVER=systemd
export CONTAINER_RUNTIME_ENDPOINT='/var/run/crio.sock --runtime-request-timeout=5m'
export ALLOW_SECURITY_CONTEXT=","
export ALLOW_PRIVILEGED=1
export DNS_SERVER_IP={{ ansible_eth0.ipv4.address }}
export API_HOST={{ ansible_eth0.ipv4.address }}
export API_HOST_IP={{ ansible_eth0.ipv4.address }}
export KUBE_ENABLE_CLUSTER_DNS=true
./hack/local-up-cluster.sh
mode: "u=rwx,g=rwx,o=x"
- name: Set kubernetes_provider to be local
lineinfile:
dest: /etc/environment
line: 'KUBERNETES_PROVIDER=local'
regexp: 'KUBERNETES_PROVIDER='
state: present
- name: Set KUBECONFIG
lineinfile:
dest: /etc/environment
line: 'KUBECONFIG=/var/run/kubernetes/admin.kubeconfig'
regexp: 'KUBECONFIG='
state: present

View file

@ -1,50 +1,12 @@
--- ---
- name: clone plugins source repo
git:
repo: "https://github.com/containernetworking/plugins.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins"
version: "dcf7368eeab15e2affc6256f0bb1e84dd46a34de"
- name: build plugins - name: build plugins
command: "./build.sh" command: "./build.sh"
args: args:
chdir: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins" chdir: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins"
- name: install plugins # TODO: Okay to rename this plugins -> custom-bridge-plugins?
copy: - name: build custom-bridge-plugins
src: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins/bin/{{ item }}"
dest: "/opt/cni/bin"
mode: "o=rwx,g=rx,o=rx"
remote_src: yes
with_items:
- bridge
- dhcp
- flannel
- host-local
- ipvlan
- loopback
- macvlan
- ptp
- sample
- tuning
- vlan
- name: clone runcom plugins source repo
git:
repo: "https://github.com/runcom/plugins.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins"
version: "custom-bridge"
force: yes
- name: build plugins
command: "./build.sh" command: "./build.sh"
args: args:
chdir: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins" chdir: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/custom-bridge-plugins"
- name: install custom bridge
copy:
src: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins/bin/bridge"
dest: "/opt/cni/bin/bridge-custom"
mode: "o=rwx,g=rx,o=rx"
remote_src: yes

View file

@ -1,23 +1,6 @@
--- ---
- name: clone runc source repo
git:
repo: "https://github.com/opencontainers/runc.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/opencontainers/runc"
version: "84a082bfef6f932de921437815355186db37aeb1"
- name: build runc - name: build runc
make: make:
params: BUILDTAGS="seccomp selinux" params: BUILDTAGS="seccomp selinux"
chdir: "{{ ansible_env.GOPATH }}/src/github.com/opencontainers/runc" chdir: "{{ ansible_env.GOPATH }}/src/github.com/opencontainers/runc"
- name: install runc
make:
target: "install"
chdir: "{{ ansible_env.GOPATH }}/src/github.com/opencontainers/runc"
- name: link runc
file:
src: /usr/local/sbin/runc
dest: /usr/bin/runc
state: link

View file

@ -1,10 +1,5 @@
--- ---
- name: clone bats source repo
git:
repo: "https://github.com/sstephenson/bats.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/sstephenson/bats"
- name: install bats - name: install bats
command: "./install.sh /usr/local" command: "./install.sh /usr/local"
args: args:

View file

@ -0,0 +1,65 @@
---
- name: install cri-o tools
make:
target: install.tools
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install cri-o
make:
target: install
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install cri-o systemd files
make:
target: install.systemd
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install cri-o config
make:
target: install.config
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install configs
copy:
src: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/{{ item.src }}"
dest: "{{ item.dest }}"
remote_src: yes
with_items:
- src: contrib/cni/10-crio-bridge.conf
dest: /etc/cni/net.d/10-crio-bridge.conf
- src: contrib/cni/99-loopback.conf
dest: /etc/cni/net.d/99-loopback.conf
- src: test/redhat_sigstore.yaml
dest: /etc/containers/registries.d/registry.access.redhat.com.yaml
- name: run with overlay
replace:
regexp: 'storage_driver = ""'
replace: 'storage_driver = "overlay"'
name: /etc/crio/crio.conf
backup: yes
- name: run with systemd cgroup manager
replace:
regexp: 'cgroup_manager = "cgroupfs"'
replace: 'cgroup_manager = "systemd"'
name: /etc/crio/crio.conf
backup: yes
- name: add docker.io default registry
lineinfile:
dest: /etc/crio/crio.conf
line: '"docker.io"'
insertafter: 'registries = \['
regexp: 'docker\.io'
state: present
- name: add overlay storage opts on RHEL/CentOS
lineinfile:
dest: /etc/crio/crio.conf
line: '"overlay.override_kernel_check=1"'
insertafter: 'storage_option = \['
regexp: 'overlay\.override_kernel_check=1'
state: present
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'

View file

@ -0,0 +1,10 @@
---
- name: install crictl
command: "/usr/bin/go install github.com/kubernetes-incubator/cri-tools/cmd/crictl"
- name: link crictl
file:
src: "{{ ansible_env.GOPATH }}/bin/crictl"
dest: /usr/bin/crictl
state: link

View file

@ -0,0 +1,48 @@
---
- name: Add custom cluster service file for the e2e testing
copy:
dest: /etc/systemd/system/customcluster.service
content: |
[Unit]
After=network-online.target
Wants=network-online.target
[Service]
WorkingDirectory={{ ansible_env.GOPATH }}/src/k8s.io/kubernetes
ExecStart=/usr/local/bin/createcluster.sh
User=root
[Install]
WantedBy=multi-user.target
- name: Add create cluster background script for e2e testing
copy:
dest: /usr/local/bin/createcluster.sh
content: |
#!/bin/bash
export PATH=/usr/local/go/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/root/bin:{{ ansible_env.GOPATH }}/bin:{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/third_party/etcd:{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/_output/local/bin/linux/amd64/
export CONTAINER_RUNTIME=remote
export CGROUP_DRIVER=systemd
export CONTAINER_RUNTIME_ENDPOINT='/var/run/crio.sock --runtime-request-timeout=5m'
export ALLOW_SECURITY_CONTEXT=","
export ALLOW_PRIVILEGED=1
export DNS_SERVER_IP={{ ansible_eth0.ipv4.address }}
export API_HOST={{ ansible_eth0.ipv4.address }}
export API_HOST_IP={{ ansible_eth0.ipv4.address }}
export KUBE_ENABLE_CLUSTER_DNS=true
./hack/local-up-cluster.sh
mode: "u=rwx,g=rwx,o=x"
- name: Set kubernetes_provider to be local
lineinfile:
dest: /etc/environment
line: 'KUBERNETES_PROVIDER=local'
regexp: 'KUBERNETES_PROVIDER='
state: present
- name: Set KUBECONFIG
lineinfile:
dest: /etc/environment
line: 'KUBECONFIG=/var/run/kubernetes/admin.kubeconfig'
regexp: 'KUBECONFIG='
state: present

View file

@ -0,0 +1,28 @@
---
- name: install plugins
copy:
src: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins/bin/{{ item }}"
dest: "/opt/cni/bin"
mode: "o=rwx,g=rx,o=rx"
remote_src: yes
with_items:
- bridge
- dhcp
- flannel
- host-local
- ipvlan
- loopback
- macvlan
- ptp
- sample
- tuning
- vlan
- name: install custom bridge
copy:
# TODO: Okay to rename this plugins -> custom-bridge-plugins?
src: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/custom-bridge-plugins/bin/bridge"
dest: "/opt/cni/bin/bridge-custom"
mode: "o=rwx,g=rx,o=rx"
remote_src: yes

View file

@ -0,0 +1,12 @@
---
- name: install runc
make:
target: "install"
chdir: "{{ ansible_env.GOPATH }}/src/github.com/opencontainers/runc"
- name: link runc
file:
src: /usr/local/sbin/runc
dest: /usr/bin/runc
state: link

View file

@ -4,28 +4,30 @@
- "{{ playbook_dir }}/vars.yml" - "{{ playbook_dir }}/vars.yml"
tags: tags:
- setup - setup
tasks: pre_tasks:
- name: set up the system - name: set up the system
include: system.yml include: system.yml
- name: install Golang tools - name: install Golang tools
include: golang.yml include: golang.yml
- name: clone build and install bats roles:
include: "build/bats.yml" - role: git_repo_cloned
git_ops: '{{ git_operations }}'
always_force: False
- name: clone build and install cri-tools post_tasks:
include: "build/cri-tools.yml"
- name: clone build and install kubernetes - name: Install ETCD and Build Kubernetes
include: "build/kubernetes.yml" include: "build/kubernetes.yml"
- name: clone build and install runc - name: Build runc
include: "build/runc.yml" include: "build/runc.yml"
- name: clone build and install networking plugins - name: Build networking plugins
include: "build/plugins.yml" include: "build/plugins.yml"
- hosts: all - hosts: all
remote_user: root remote_user: root
vars_files: vars_files:
@ -33,10 +35,43 @@
tags: tags:
- integration - integration
- e2e - e2e
tasks: roles:
- name: clone build and install cri-o - role: git_repo_cloned
git_ops: '{{ git_operations }}'
always_force: True
post_tasks:
- name: Install BATS
include: "install/bats.yml"
- name: Install cri-tools
include: "install/cri-tools.yml"
- name: Re-Install ETCD and Re-Build Kubernetes
include: "build/kubernetes.yml"
- name: Re-Install kubernetes
include: "install/kubernetes.yml"
- name: Build runc
include: "build/runc.yml"
- name: install runc
include: "install/runc.yml"
- name: Build networking plugins
include: "build/plugins.yml"
- name: Install networking plugins
include: "install/plugins.yml"
- name: Build CRI-O
include: "build/cri-o.yml" include: "build/cri-o.yml"
- name: Install CRI-O
include: "install/cri-o.yml"
- hosts: all - hosts: all
remote_user: root remote_user: root
vars_files: vars_files:

View file

@ -0,0 +1,18 @@
---
# Maximum time to wait (in seconds) for each git operation to complete
git_op_timeout: '{{ 60 * 30 }}'
# Interval time (in seconds) to wait between each git status check
git_op_status_delay: '10'
# List of dictionaries, with options to the git ansible module.
git_ops:
# Default depth to use when no depth option specified (above).
# 1: shallow clone only reference HEAD
# None: clone all commits
git_def_depth: 1
# When true, always force-clone, clobbering any posible local changes.
always_force: False

View file

@ -0,0 +1,25 @@
---
- name: The destination directory always exists
file:
path: "{{ git_op.dest }}"
state: directory
- name: git_op's options are fed to git module
git:
dest: "{{ git_op.dest }}"
repo: "{{ git_op.repo }}"
depth: "{{ git_op.depth | default(git_def_depth | int) }}"
recursive: "{{ git_op['recursive'] | default(omit) }}"
reference: "{{ git_op.reference | default(omit) }}"
refspec: "{{ git_op.refspec | default(omit) }}"
remote: "{{ git_op.remote | default(omit) }}"
version: "{{ git_op.version | default(omit) }}"
force: "{{ git_op.force | default(omit) if not always_force else True }}"
register: result
async: "{{ git_op_timeout }}"
poll: 0
- name: git_op async-state is included in async_results list
set_fact:
async_results: "{{ async_results | union([result]) }}"

View file

@ -0,0 +1,11 @@
---
- name: All async states in async_result completed or timed out
async_status:
jid: "{{ async_result.ansible_job_id }}"
failed_when: result | failed
register: result
until: result.finished | bool
# Guarantee at least one retry
retries: "{{ (git_op_timeout|int / git_op_status_delay|int) | round(method='ceil')|int }}"
delay: "{{ git_op_status_delay|int }}"

View file

@ -0,0 +1,23 @@
---
- assert:
that:
# Verify conformance with defaults, expected types, and values
- "git_op_timeout | default(0) >= 1"
- "git_op_status_delay | default(0) >= 1"
- "git_ops is defined"
# Verify vars were not overridden by command-line, include, or role override
- "async_results == []"
- "result == None"
- name: All git operations are run in parallel
include: "{{ role_path }}/tasks/async_git.yml"
with_items: "{{ git_ops }}"
loop_control:
loop_var: "git_op"
- name: All parallel git operations are completed and are successful
include: "{{ role_path }}/tasks/async_status.yml"
with_items: "{{ async_results }}"
loop_control:
loop_var: "async_result"

View file

@ -0,0 +1,4 @@
---
async_results: []
result:

View file

@ -23,10 +23,7 @@
- libassuan-devel - libassuan-devel
- libffi-devel - libffi-devel
- libgpg-error-devel - libgpg-error-devel
- libguestfs-tools
- libseccomp-devel - libseccomp-devel
- libvirt-client
- libvirt-python
- libxml2-devel - libxml2-devel
- libxslt-devel - libxslt-devel
- make - make
@ -41,8 +38,6 @@
- ostree-devel - ostree-devel
- pkgconfig - pkgconfig
- python - python
- python2-boto
- python2-crypto
- python-devel - python-devel
- python-virtualenv - python-virtualenv
- PyYAML - PyYAML

View file

@ -1,8 +1,5 @@
--- ---
- name: clone build and install cri-tools
include: "build/cri-tools.yml"
- name: Make testing output verbose so it can be converted to xunit - name: Make testing output verbose so it can be converted to xunit
lineinfile: lineinfile:
dest: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/hack/make-rules/test.sh" dest: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/hack/make-rules/test.sh"

View file

@ -1,5 +1,32 @@
--- ---
# List of repositories to clone. Each item accepts any option or value supported
# by Ansible's ``git`` module.
git_operations:
- repo: "https://github.com/sstephenson/bats.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/sstephenson/bats"
- repo: "https://github.com/kubernetes-incubator/cri-tools.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-tools"
version: "9ff5e8f78a4182ab8d5ba9bcccdda5f338600eab"
- repo: "https://github.com/runcom/kubernetes.git"
dest: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes"
version: "cri-o-patched-1.8"
- repo: "https://github.com/containernetworking/plugins.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins"
version: "dcf7368eeab15e2affc6256f0bb1e84dd46a34de"
# TODO: Okay to rename this plugins -> custom-bridge-plugins and drop force: yes?
- repo: "https://github.com/runcom/plugins.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/custom-bridge-plugins"
version: "custom-bridge"
- repo: "https://github.com/opencontainers/runc.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/opencontainers/runc"
version: "84a082bfef6f932de921437815355186db37aeb1"
# 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"