install-kubernetes: add support for cri-o runtime
This adds optional support for using the cri-o rather than the (still default) docker runtime. Change-Id: I0f7cbb758a21cb022ceac24654183138bebf83bf
This commit is contained in:
parent
6d5826844a
commit
03e42f874b
@ -17,3 +17,9 @@ An ansible role to install kubernetes.
|
||||
|
||||
List of dns resolvers to configure in k8s. Use this to override the
|
||||
resolvers that are found by default.
|
||||
|
||||
.. zuul:rolevar:: kubernetes_runtime
|
||||
:default: docker
|
||||
|
||||
Which kubernetes runtime to use; values are ``docker`` or
|
||||
``cri-o``.
|
||||
|
@ -1,3 +1,4 @@
|
||||
install_kubernetes_with_cluster: True
|
||||
minikube_version: latest
|
||||
minikube_dns_resolvers: []
|
||||
kubernetes_runtime: docker
|
||||
|
28
roles/install-kubernetes/tasks/crio.yaml
Normal file
28
roles/install-kubernetes/tasks/crio.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
- name: Add project atomic PPA
|
||||
apt_repository:
|
||||
repo: ppa:projectatomic/ppa
|
||||
become: true
|
||||
- name: Install packages
|
||||
package:
|
||||
name:
|
||||
- cri-o-1.15
|
||||
- containernetworking-plugins
|
||||
- podman
|
||||
- cri-tools
|
||||
state: present
|
||||
become: true
|
||||
- name: Fix conmon symlink
|
||||
file:
|
||||
src: /usr/bin/conmon
|
||||
dest: /usr/libexec/crio/conmon
|
||||
owner: root
|
||||
group: root
|
||||
state: link
|
||||
become: true
|
||||
- name: Set crio cgroup driver
|
||||
ini_file:
|
||||
path: /etc/crio/crio.conf
|
||||
section: crio.runtime
|
||||
option: cgroup_manager
|
||||
value: '"cgroupfs"'
|
||||
become: true
|
@ -14,6 +14,10 @@
|
||||
include_role:
|
||||
name: install-docker
|
||||
|
||||
- name: Install crio
|
||||
when: kubernetes_runtime == 'cri-o'
|
||||
include_tasks: crio.yaml
|
||||
|
||||
- name: Create .kube directory
|
||||
file:
|
||||
path: "{{ ansible_user_dir }}/.kube"
|
||||
@ -50,7 +54,7 @@
|
||||
|
||||
- name: Start Minikube
|
||||
become: yes
|
||||
command: "/tmp/minikube --vm-driver=none start {{ minikube_args }}"
|
||||
command: "/tmp/minikube --vm-driver=none --container-runtime={{ kubernetes_runtime }} {{ minikube_args }} start"
|
||||
environment:
|
||||
MINIKUBE_WANTUPDATENOTIFICATION: false
|
||||
MINIKUBE_WANTREPORTERRORPROMPT: false
|
||||
|
9
test-playbooks/install-kubernetes/crio.yaml
Normal file
9
test-playbooks/install-kubernetes/crio.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
- hosts: all
|
||||
name: Install kubernetes with minikube
|
||||
roles:
|
||||
- role: install-kubernetes
|
||||
vars:
|
||||
minikube_dns_resolvers:
|
||||
- '1.1.1.1'
|
||||
- '8.8.8.8'
|
||||
kubernetes_runtime: cri-o
|
@ -1,4 +1,4 @@
|
||||
- hosts: primary
|
||||
- hosts: all
|
||||
name: Install kubernetes with minikube
|
||||
roles:
|
||||
- role: install-kubernetes
|
7
test-playbooks/install-kubernetes/post.yaml
Normal file
7
test-playbooks/install-kubernetes/post.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Get minikube logs
|
||||
become: true
|
||||
shell: "/tmp/minikube logs > {{ ansible_user_dir }}/zuul-output/logs/minikube.txt"
|
||||
environment:
|
||||
MINIKUBE_HOME: "{{ ansible_user_dir }}"
|
@ -26,9 +26,9 @@
|
||||
label: ubuntu-bionic
|
||||
|
||||
- job:
|
||||
name: zuul-jobs-test-install-kubernetes
|
||||
name: zuul-jobs-test-install-kubernetes-docker
|
||||
description: |
|
||||
Test the install-kubernetes role
|
||||
Test the install-kubernetes role with docker
|
||||
|
||||
This job tests changes to the install-kubernetes roles. It
|
||||
is not meant to be used directly but rather run on changes to
|
||||
@ -37,11 +37,23 @@
|
||||
- roles/install-docker/.*
|
||||
- roles/install-kubernetes/.*
|
||||
- test-playbooks/install-kubernetes.yaml
|
||||
run: test-playbooks/install-kubernetes.yaml
|
||||
nodeset:
|
||||
nodes:
|
||||
- name: primary
|
||||
label: ubuntu-bionic
|
||||
run: test-playbooks/install-kubernetes/docker.yaml
|
||||
post-run: test-playbooks/install-kubernetes/post.yaml
|
||||
|
||||
- job:
|
||||
name: zuul-jobs-test-install-kubernetes-crio
|
||||
description: |
|
||||
Test the install-kubernetes role with crio-o
|
||||
|
||||
This job tests changes to the install-kubernetes roles. It
|
||||
is not meant to be used directly but rather run on changes to
|
||||
roles in the zuul-jobs repo.
|
||||
files:
|
||||
- roles/install-docker/.*
|
||||
- roles/install-kubernetes/.*
|
||||
- test-playbooks/install-kubernetes.yaml
|
||||
run: test-playbooks/install-kubernetes/crio.yaml
|
||||
post-run: test-playbooks/install-kubernetes/post.yaml
|
||||
|
||||
# List all the jobs in this file.
|
||||
|
||||
@ -49,6 +61,7 @@
|
||||
check:
|
||||
jobs: &id001
|
||||
- zuul-jobs-test-registry
|
||||
- zuul-jobs-test-install-kubernetes
|
||||
- zuul-jobs-test-install-kubernetes-docker
|
||||
- zuul-jobs-test-install-kubernetes-crio
|
||||
gate:
|
||||
jobs: *id001
|
||||
|
Loading…
x
Reference in New Issue
Block a user