limit PAI worker daemon port range (#4546)

refer to issue #4384.
Work host daemon may use port range which overlap PAI job port range. Change the work node port range to avoid conflict.
This commit is contained in:
Binyang2014 2020-05-19 22:43:50 +08:00 коммит произвёл GitHub
Родитель a2acd37144
Коммит 0f05a1772b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 54 добавлений и 1 удалений

Просмотреть файл

@ -56,6 +56,8 @@ ansible-playbook -i ${HOME}/pai-deploy/cluster-cfg/hosts.yml drivers-install.yml
ansible-playbook -i ${HOME}/pai-deploy/cluster-cfg/hosts.yml docker-runtime-setup.yml || exit $?
ansible-playbook -i ${HOME}/pai-deploy/cluster-cfg/hosts.yml set-host-daemon-port-range.yml || exit $?
/bin/bash requirement.sh -m ${MASTER_LIST} -w ${WORKER_LIST} -c ${CLUSTER_CONFIG} || exit $?
/bin/bash script/kubernetes-boot.sh || exit $?

Просмотреть файл

@ -67,4 +67,10 @@ docker_image_tag: <% latest-release %>
# openpai_kubespray_extra_var:
# kay: value
# key: value
# key: value
#######################################################################
# host daemon port setting #
#######################################################################
# host_daemon_port_start: 40000
# host_daemon_port_end: 65535

Просмотреть файл

@ -0,0 +1,28 @@
#!/bin/bash
while getopts "c:" opt; do
case $opt in
c)
CLUSTER_CONFIG=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG"
exit 1
;;
esac
done
echo "cluster config file path: ${CLUSTER_CONFIG}"
ABS_CONFIG_PATH="$(echo ${CLUSTER_CONFIG})"
echo "Config path is: ${ABS_CONFIG_PATH}"
ansible-playbook -i ${HOME}/pai-pre-check/pre-check.yml set-host-daemon-port-range.yaml -e "@${ABS_CONFIG_PATH}"
ret_code_check=$?
if [ $ret_code_check -eq 0 ]
then
echo "Preinstall script finished succssfully"
else
echo "Preinstall script exited with error"
exit $ret_code_check
fi

Просмотреть файл

@ -50,6 +50,8 @@ ansible all -i ${HOME}/pai-deploy/cluster-cfg/hosts.yml -m ping || exit $?
/bin/bash requirement.sh -m ${MASTER_LIST} -w ${WORKER_LIST} -c ${CLUSTER_CONFIG} || exit $?
/bin/bash preinstall.sh -c ${CLUSTER_CONFIG} || exit $?
/bin/bash script/kubernetes-boot.sh || exit $?

Просмотреть файл

@ -0,0 +1,2 @@
host_daemon_port_start: 40000
host_daemon_port_end: 65535

Просмотреть файл

@ -0,0 +1,6 @@
---
- name: "Set host daemon port range"
sysctl:
name: net.ipv4.ip_local_port_range
value: "{{ host_daemon_port_start }} {{ host_daemon_port_end }}"
state: present

Просмотреть файл

@ -0,0 +1,7 @@
---
- hosts: gpu
become: true
become_user: root
gather_facts: true
roles:
- { role: port }