From 3a236239a727056965c7329305a2fbdf43b08c37 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Wed, 14 Sep 2022 14:42:00 -0500 Subject: [PATCH] Fixes #88: Switch tests and defaults from Docker to containerd. --- .travis.yml | 36 ------------------------------- README.md | 6 +++--- defaults/main.yml | 2 +- molecule/default/calico.yml | 6 +++--- molecule/default/converge.yml | 6 +++--- molecule/default/requirements.yml | 2 +- 6 files changed, 11 insertions(+), 47 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 61c6b8e..0000000 --- a/.travis.yml +++ /dev/null @@ -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/ diff --git a/README.md b/README.md index 173f518..26a43f0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ An Ansible Role that installs [Kubernetes](https://kubernetes.io) on Linux. ## 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 @@ -70,14 +70,14 @@ Options under `kind: ClusterConfiguration`. Including `kubernetes_pod_network.ci ```yaml 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. 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 kubernetes_config_kube_proxy_configuration: {} diff --git a/defaults/main.yml b/defaults/main.yml index 172e1de..2fc763e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -30,7 +30,7 @@ kubernetes_pod_network: kubernetes_kubeadm_kubelet_config_file_path: '/etc/kubernetes/kubeadm-kubelet-config.yaml' kubernetes_config_kubelet_configuration: - cgroupDriver: "cgroupfs" + cgroupDriver: "systemd" kubernetes_config_init_configuration: localAPIEndpoint: diff --git a/molecule/default/calico.yml b/molecule/default/calico.yml index 2e2258e..1fd035c 100644 --- a/molecule/default/calico.yml +++ b/molecule/default/calico.yml @@ -8,8 +8,8 @@ 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" + # Allow swap in test environments (hard to control in some envs). + kubernetes_kubelet_extra_args: "--fail-swap-on=false --cgroup-driver=systemd" docker_install_compose: false pre_tasks: @@ -29,7 +29,7 @@ action: setup roles: - - role: geerlingguy.docker + - role: geerlingguy.containerd - role: geerlingguy.kubernetes post_tasks: diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index f93c7d7..46c5610 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -4,8 +4,8 @@ become: true vars: - # Allow swap in test environments (hard to control in some Docker envs). - kubernetes_kubelet_extra_args: "--fail-swap-on=false --cgroup-driver=cgroupfs" + # Allow swap in test environments (hard to control in some envs). + kubernetes_kubelet_extra_args: "--fail-swap-on=false --cgroup-driver=systemd" docker_install_compose: false pre_tasks: @@ -25,7 +25,7 @@ action: setup roles: - - role: geerlingguy.docker + - role: geerlingguy.containerd - role: geerlingguy.kubernetes post_tasks: diff --git a/molecule/default/requirements.yml b/molecule/default/requirements.yml index 3a013f3..8f7dff5 100644 --- a/molecule/default/requirements.yml +++ b/molecule/default/requirements.yml @@ -1,2 +1,2 @@ --- -- src: geerlingguy.docker +- src: geerlingguy.containerd