Add setup of a pip virtualenv for kubespray use
Don't use incorrectly setup local provisioner that ships with kubespray,
and fix integration breakage with 1.10
Change-Id: Idf6019ef03afca9e47e75748cefd9a067b19d48c
diff --git a/kubespray-installer/.gitignore b/kubespray-installer/.gitignore
index b032f2b..a608ac6 100644
--- a/kubespray-installer/.gitignore
+++ b/kubespray-installer/.gitignore
@@ -1,3 +1,5 @@
kubespray
inventories
*.retry
+ks_venv
+
diff --git a/kubespray-installer/k8s-configs.yaml b/kubespray-installer/k8s-configs.yaml
index d975633..585a752 100644
--- a/kubespray-installer/k8s-configs.yaml
+++ b/kubespray-installer/k8s-configs.yaml
@@ -29,6 +29,7 @@
- 'ansible_python_interpreter: /usr/bin/python2.7'
- 'ansible_user: {{ kubespray_remote_ssh_user }}'
- 'ansible_become: true'
+ - 'kube_feature_gates: []'
# Edit k8s-cluster.yml variable file
- name: Set Docker DNS servers strict to false
@@ -56,15 +57,3 @@
line: "docker_options: \"{{ item }} --insecure-registry={{ '{{' }} kube_service_addresses {{ '}}' }} --graph={{ '{{' }} docker_daemon_graph {{ '}}' }} {{ '{{' }} docker_log_opts {{ '}}' }}\""
with_items: "{{ k8s_nodes.split(' ') | map('regex_replace', '(.*)', '--insecure-registry=\\1/32') | join(' ') }}"
- - name: Enable local volume provisioner
- lineinfile:
- path: inventories/{{ deployment_name }}/group_vars/k8s-cluster.yml
- regexp: '^local_volume_provisioner_enabled.*'
- line: 'local_volume_provisioner_enabled: true'
-
- - name: Enable persistent volumes
- lineinfile:
- path: inventories/{{ deployment_name }}/group_vars/k8s-cluster.yml
- regexp: '^persistent_volumes_enabled.*'
- line: 'persistent_volumes_enabled: true'
-
diff --git a/kubespray-installer/setup.sh b/kubespray-installer/setup.sh
index be55105..0d1b25f 100755
--- a/kubespray-installer/setup.sh
+++ b/kubespray-installer/setup.sh
@@ -18,7 +18,7 @@
# Installs Kubespray on remote target machines.
#
-set -e -u -o pipefail
+set -e -o pipefail
KS_COMMIT="${KS_COMMIT:-73a2a180061113ac124683e5cc492ba07df33d4c}"
@@ -34,6 +34,17 @@
git checkout "$KS_COMMIT"
popd
+ # create a virtualenv with specific packages, if it doesn't exist
+ if [ ! -x "ks_venv/bin/activate" ]
+ then
+ virtualenv ks_venv
+ pip install ansible==2.5.3
+ pip install -f kubespray/kubespray/requirements.txt
+ fi
+
+ # shellcheck disable=SC1091
+ source ks_venv/bin/activate
+
# Generate inventory and var files
echo "Generating The Inventory File"
@@ -53,7 +64,6 @@
# Install Kubespray
echo "Installing Kubespray"
ansible-playbook -i "inventories/${DEPLOYMENT_NAME}/inventory.cfg" kubespray/cluster.yml -b -v
-
}
#