From fba51bcc466696d4e744013400a7321b38badf66 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 14 Dec 2019 20:00:37 -0600 Subject: [PATCH] PR #53 follow-up: Add test for calico networking. --- .travis.yml | 4 ++- molecule/default/playbook-calico.yml | 50 ++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 molecule/default/playbook-calico.yml diff --git a/.travis.yml b/.travis.yml index 1bb8486..2fadd33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,9 +8,11 @@ env: matrix: - MOLECULE_DISTRO: centos7 - MOLECULE_DISTRO: ubuntu1804 - - MOLECULE_DISTRO: debian9 - MOLECULE_DISTRO: debian10 + - MOLECULE_DISTRO: debian10 + MOLECULE_PLAYBOOK: playbook-calico.yml + install: # Install test dependencies. - pip install molecule docker diff --git a/molecule/default/playbook-calico.yml b/molecule/default/playbook-calico.yml new file mode 100644 index 0000000..2e2258e --- /dev/null +++ b/molecule/default/playbook-calico.yml @@ -0,0 +1,50 @@ +--- +- name: Converge + hosts: all + become: true + + vars: + kubernetes_pod_network: + cni: 'calico' + cidr: '192.168.0.0/16' + + # Allow swap in test environments (hard to control in some Docker envs). + kubernetes_kubelet_extra_args: "--fail-swap-on=false --cgroup-driver=cgroupfs" + docker_install_compose: false + + pre_tasks: + - name: Update apt cache. + apt: update_cache=true cache_valid_time=600 + when: ansible_os_family == 'Debian' + + - name: Ensure test dependencies are installed (RedHat). + package: name=iproute state=present + when: ansible_os_family == 'RedHat' + + - name: Ensure test dependencies are installed (Debian). + package: name=iproute2 state=present + when: ansible_os_family == 'Debian' + + - name: Gather facts. + action: setup + + roles: + - role: geerlingguy.docker + - role: geerlingguy.kubernetes + + post_tasks: + - name: Get cluster info. + command: kubectl cluster-info + changed_when: false + register: kubernetes_info + + - name: Print cluster info. + debug: var=kubernetes_info.stdout + + - name: Get all running pods. + command: kubectl get pods --all-namespaces + changed_when: false + register: kubernetes_pods + + - name: Print list of running pods. + debug: var=kubernetes_pods.stdout