From f709caf3713e31a90e8c0a4685c3df77fa9deeee Mon Sep 17 00:00:00 2001 From: Xan Manning Date: Sat, 7 Mar 2020 14:23:09 +0000 Subject: [PATCH] Skip final checks when no-flannel option is used. Fixes #16 This is because without a CNI, nodes will never be ready and the task will fail. You need to deploy your choice of CNI manually (such as Calico) then check the state of the cluster using `kubectl get nodes`. --- molecule/default/playbook-no-deploy.yml | 1 + tasks/build/configure-k3s-cluster.yml | 2 +- templates/k3s.service.j2 | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/molecule/default/playbook-no-deploy.yml b/molecule/default/playbook-no-deploy.yml index 831b989..9a16a04 100644 --- a/molecule/default/playbook-no-deploy.yml +++ b/molecule/default/playbook-no-deploy.yml @@ -7,6 +7,7 @@ k3s_no_coredns: true k3s_no_traefik: true k3s_no_servicelb: true + k3s_no_flannel: true k3s_no_local_storage: true k3s_default_local_storage_path: false k3s_no_metrics_server: true diff --git a/tasks/build/configure-k3s-cluster.yml b/tasks/build/configure-k3s-cluster.yml index 8022c65..6647e1d 100644 --- a/tasks/build/configure-k3s-cluster.yml +++ b/tasks/build/configure-k3s-cluster.yml @@ -74,4 +74,4 @@ and kubectl_get_nodes_result.stdout.find("NotReady") == -1 retries: 30 delay: 20 - when: k3s_control_node + when: k3s_control_node and not k3s_no_flannel diff --git a/templates/k3s.service.j2 b/templates/k3s.service.j2 index 06fb371..3ea880c 100644 --- a/templates/k3s.service.j2 +++ b/templates/k3s.service.j2 @@ -28,10 +28,10 @@ ExecStart={{ k3s_install_dir }}/k3s --disable-network-policy {% endif %} {% if k3s_no_flannel %} - {% if k3s_release_version is version_compare('1.0.0', '<') %} - --no-flannel - {% else %} + {% if (k3s_release_version | replace('v', '')) is version_compare('1.0.0', '>=') %} --flannel-backend none + {% else %} + --no-flannel {% endif %} {% endif %} {% if k3s_cluster_cidr is defined %}