From 871806dc579a54b4f0f2e67c6dc597aaac0eeec2 Mon Sep 17 00:00:00 2001 From: Xu Liu Date: Sat, 22 Jan 2022 01:34:47 +0800 Subject: [PATCH] Support skip deploying kube-proxy in Vagrant testbed (#3221) Signed-off-by: Xu Liu --- test/e2e/infra/vagrant/Vagrantfile | 4 ++-- .../roles/control-plane/templates/kubeadm.conf.j2 | 8 +++++++- test/e2e/infra/vagrant/provision.sh | 10 +++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/test/e2e/infra/vagrant/Vagrantfile b/test/e2e/infra/vagrant/Vagrantfile index 49d36ea7acb..db9c7b33a04 100644 --- a/test/e2e/infra/vagrant/Vagrantfile +++ b/test/e2e/infra/vagrant/Vagrantfile @@ -42,13 +42,13 @@ else end KUBE_PROXY_MODE = ENV['KUBE_PROXY_MODE'] || "iptables" -if KUBE_PROXY_MODE == "iptables" +if KUBE_PROXY_MODE == "iptables" || KUBE_PROXY_MODE == "none" KUBE_PROXY_IPVS_STRICT_ARP = false elsif KUBE_PROXY_MODE == "ipvs" # For now, we always enable strict ARP, which is required to use MetalLB KUBE_PROXY_IPVS_STRICT_ARP = true else - raise "KUBE_PROXY_MODE env variable should be one of 'iptables' or 'ipvs'" + raise "KUBE_PROXY_MODE env variable should be one of 'iptables', 'ipvs' or 'none'" end Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| diff --git a/test/e2e/infra/vagrant/playbook/roles/control-plane/templates/kubeadm.conf.j2 b/test/e2e/infra/vagrant/playbook/roles/control-plane/templates/kubeadm.conf.j2 index c2307c02e4b..d056d70cd84 100644 --- a/test/e2e/infra/vagrant/playbook/roles/control-plane/templates/kubeadm.conf.j2 +++ b/test/e2e/infra/vagrant/playbook/roles/control-plane/templates/kubeadm.conf.j2 @@ -1,9 +1,13 @@ -apiVersion: kubeadm.k8s.io/v1beta2 +apiVersion: kubeadm.k8s.io/v1beta3 kind: InitConfiguration nodeRegistration: name: "{{ node_name }}" localAPIEndpoint: advertiseAddress: "{{ k8s_api_server_ip }}" +{% if kube_proxy_mode == 'none' %} +skipPhases: +- addon/kube-proxy +{% endif %} --- apiVersion: kubeadm.k8s.io/v1beta2 kind: ClusterConfiguration @@ -16,6 +20,7 @@ apiServer: extraArgs: feature-gates: "NetworkPolicyEndPort=true" --- +{% if kube_proxy_mode != 'none' %} apiVersion: kubeproxy.config.k8s.io/v1alpha1 kind: KubeProxyConfiguration mode: "{{ kube_proxy_mode }}" @@ -23,3 +28,4 @@ mode: "{{ kube_proxy_mode }}" ipvs: strictARP: true {% endif %} +{% endif %} diff --git a/test/e2e/infra/vagrant/provision.sh b/test/e2e/infra/vagrant/provision.sh index d7a5b0b525e..2e47ea11d7a 100755 --- a/test/e2e/infra/vagrant/provision.sh +++ b/test/e2e/infra/vagrant/provision.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash - function usage() { echo "Usage: provision.sh [--ip-family ] [-l|--large] [-h|--help] Provisions the Vagrant VMs. - --ip-family Deploy IPv4, IPv6 or dual-stack Kubernetes cluster. - --large Deploy large vagrant VMs with 2 vCPUs and 4096MB memory. - By default, we deploy VMs with 2 vCPUs and 2048MB memory. - --kube-proxy-mode Which mode to use for kube-proxy (default is iptables)." + --ip-family Deploy IPv4, IPv6 or dual-stack Kubernetes cluster. + --large Deploy large vagrant VMs with 2 vCPUs and 4096MB memory. + By default, we deploy VMs with 2 vCPUs and 2048MB memory. + --kube-proxy-mode Which mode to use for kube-proxy (default is iptables). + Setting to 'none' will skip deploying kube-proxy." } K8S_IP_FAMILY="v4"