Fixes #88: Switch tests and defaults from Docker to containerd.

This commit is contained in:
Jeff Geerling 2022-09-14 14:42:00 -05:00
parent 1881f6161a
commit 3a236239a7
6 changed files with 11 additions and 47 deletions

View File

@ -1,36 +0,0 @@
---
language: python
services: docker
env:
global:
- ROLE_NAME: kubernetes
matrix:
- MOLECULE_DISTRO: centos8
- MOLECULE_DISTRO: centos7
- MOLECULE_DISTRO: ubuntu1804
- MOLECULE_DISTRO: debian10
- MOLECULE_DISTRO: debian10
MOLECULE_PLAYBOOK: playbook-calico.yml
before_install:
# Upgrade Docker to work with docker-py.
- curl https://gist.githubusercontent.com/geerlingguy/ce883ad4aec6a5f1187ef93bd338511e/raw/36612d28981d92863f839c5aefe5b7dd7193d6c6/travis-ci-docker-upgrade.sh | sudo bash
install:
# Install test dependencies.
- pip install molecule[docker] yamllint ansible-lint docker
before_script:
# Use actual Ansible Galaxy role name for the project directory.
- cd ../
- mv ansible-role-$ROLE_NAME geerlingguy.$ROLE_NAME
- cd geerlingguy.$ROLE_NAME
script:
# Run tests.
- molecule test
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -6,7 +6,7 @@ An Ansible Role that installs [Kubernetes](https://kubernetes.io) on Linux.
## Requirements ## Requirements
Requires Docker or another [Container Runtime](https://kubernetes.io/docs/setup/production-environment/container-runtimes) ; recommended role for Docker installation: `geerlingguy.docker`. Requires a compatible [Container Runtime](https://kubernetes.io/docs/setup/production-environment/container-runtimes); recommended role for CRI installation: `geerlingguy.containerd`.
## Role Variables ## Role Variables
@ -70,14 +70,14 @@ Options under `kind: ClusterConfiguration`. Including `kubernetes_pod_network.ci
```yaml ```yaml
kubernetes_config_kubelet_configuration: kubernetes_config_kubelet_configuration:
cgroupDriver: cgroupfs cgroupDriver: systemd
``` ```
Options to configure kubelet on any nodes in your cluster through the `kubeadm init` process. To get the syntax of this options see https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file and https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration. Options to configure kubelet on any nodes in your cluster through the `kubeadm init` process. To get the syntax of this options see https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file and https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration.
NOTE: This is the recommended way to do the kubelet-configuration. Most command-line-options are deprecated. NOTE: This is the recommended way to do the kubelet-configuration. Most command-line-options are deprecated.
NOTE: The recommended cgroupDriver depends on your [Container Runtime](https://kubernetes.io/docs/setup/production-environment/container-runtimes). When using this role with containerd instead of docker, this value should be changed to `systemd`. NOTE: The recommended cgroupDriver depends on your [Container Runtime](https://kubernetes.io/docs/setup/production-environment/container-runtimes). When using this role with Docker instead of containerd, this value should be changed to `cgroupfs`.
```yaml ```yaml
kubernetes_config_kube_proxy_configuration: {} kubernetes_config_kube_proxy_configuration: {}

View File

@ -30,7 +30,7 @@ kubernetes_pod_network:
kubernetes_kubeadm_kubelet_config_file_path: '/etc/kubernetes/kubeadm-kubelet-config.yaml' kubernetes_kubeadm_kubelet_config_file_path: '/etc/kubernetes/kubeadm-kubelet-config.yaml'
kubernetes_config_kubelet_configuration: kubernetes_config_kubelet_configuration:
cgroupDriver: "cgroupfs" cgroupDriver: "systemd"
kubernetes_config_init_configuration: kubernetes_config_init_configuration:
localAPIEndpoint: localAPIEndpoint:

View File

@ -8,8 +8,8 @@
cni: 'calico' cni: 'calico'
cidr: '192.168.0.0/16' cidr: '192.168.0.0/16'
# Allow swap in test environments (hard to control in some Docker envs). # Allow swap in test environments (hard to control in some envs).
kubernetes_kubelet_extra_args: "--fail-swap-on=false --cgroup-driver=cgroupfs" kubernetes_kubelet_extra_args: "--fail-swap-on=false --cgroup-driver=systemd"
docker_install_compose: false docker_install_compose: false
pre_tasks: pre_tasks:
@ -29,7 +29,7 @@
action: setup action: setup
roles: roles:
- role: geerlingguy.docker - role: geerlingguy.containerd
- role: geerlingguy.kubernetes - role: geerlingguy.kubernetes
post_tasks: post_tasks:

View File

@ -4,8 +4,8 @@
become: true become: true
vars: vars:
# Allow swap in test environments (hard to control in some Docker envs). # Allow swap in test environments (hard to control in some envs).
kubernetes_kubelet_extra_args: "--fail-swap-on=false --cgroup-driver=cgroupfs" kubernetes_kubelet_extra_args: "--fail-swap-on=false --cgroup-driver=systemd"
docker_install_compose: false docker_install_compose: false
pre_tasks: pre_tasks:
@ -25,7 +25,7 @@
action: setup action: setup
roles: roles:
- role: geerlingguy.docker - role: geerlingguy.containerd
- role: geerlingguy.kubernetes - role: geerlingguy.kubernetes
post_tasks: post_tasks:

View File

@ -1,2 +1,2 @@
--- ---
- src: geerlingguy.docker - src: geerlingguy.containerd