Merge "Fix multinode gate after switch to Python 3"

This commit is contained in:
Zuul 2019-11-21 14:36:26 +00:00 committed by Gerrit Code Review
commit 9c8cc8b092
3 changed files with 13 additions and 12 deletions

View File

@ -17,7 +17,7 @@
parent: kuryr-kubernetes-tempest parent: kuryr-kubernetes-tempest
description: | description: |
Kuryr-Kubernetes tempest multinode job Kuryr-Kubernetes tempest multinode job
nodeset: openstack-two-node nodeset: openstack-two-node-bionic
host-vars: host-vars:
controller: controller:
devstack_plugins: devstack_plugins:
@ -43,6 +43,7 @@
devstack_localrc: devstack_localrc:
KURYR_FORCE_IMAGE_BUILD: true KURYR_FORCE_IMAGE_BUILD: true
KURYR_K8S_CONTAINERIZED_DEPLOYMENT: true KURYR_K8S_CONTAINERIZED_DEPLOYMENT: true
USE_PYTHON3: true
vars: vars:
devstack_localrc: devstack_localrc:
KURYR_K8S_CONTAINERIZED_DEPLOYMENT: true KURYR_K8S_CONTAINERIZED_DEPLOYMENT: true

View File

@ -59,8 +59,8 @@ function ovs_bind_for_kubelet() {
port_mac=$(openstack port show "$port_id" -c mac_address -f value) port_mac=$(openstack port show "$port_id" -c mac_address -f value)
fixed_ips=$(openstack port show "$port_id" -f value -c fixed_ips) fixed_ips=$(openstack port show "$port_id" -f value -c fixed_ips)
port_ips=($(python -c "print ${fixed_ips}[0]['ip_address']")) port_ips=($(python3 -c "print(${fixed_ips}[0]['ip_address'])"))
port_subnets=($(python -c "print ${fixed_ips}[0]['subnet_id']")) port_subnets=($(python3 -c "print(${fixed_ips}[0]['subnet_id'])"))
sudo ovs-vsctl -- --may-exist add-port $OVS_BRIDGE "$ifname" \ sudo ovs-vsctl -- --may-exist add-port $OVS_BRIDGE "$ifname" \
-- set Interface "$ifname" type=internal \ -- set Interface "$ifname" type=internal \
@ -79,7 +79,7 @@ function ovs_bind_for_kubelet() {
if [[ "$KURYR_SUBNET_DRIVER" == "namespace" ]]; then if [[ "$KURYR_SUBNET_DRIVER" == "namespace" ]]; then
subnetpool_id=${KURYR_NEUTRON_DEFAULT_SUBNETPOOL_ID:-${SUBNETPOOL_V4_ID}} subnetpool_id=${KURYR_NEUTRON_DEFAULT_SUBNETPOOL_ID:-${SUBNETPOOL_V4_ID}}
cidrs=$(openstack subnet pool show "${subnetpool_id}" -c prefixes -f value) cidrs=$(openstack subnet pool show "${subnetpool_id}" -c prefixes -f value)
subnetpool_cidr=$(python -c "print ${cidrs}[0]") subnetpool_cidr=$(python3 -c "print(${cidrs}[0])")
sudo ip route add "$subnetpool_cidr" via "$pod_subnet_gw" dev "$ifname" sudo ip route add "$subnetpool_cidr" via "$pod_subnet_gw" dev "$ifname"
else else
sudo ip route add "$service_subnet_cidr" via "$pod_subnet_gw" dev "$ifname" sudo ip route add "$service_subnet_cidr" via "$pod_subnet_gw" dev "$ifname"
@ -160,7 +160,7 @@ function stop_container {
# cidr - The cidr to get the range for # cidr - The cidr to get the range for
# gateway_position - Whether to reserve at 'beginning' or at 'end' # gateway_position - Whether to reserve at 'beginning' or at 'end'
function _allocation_range { function _allocation_range {
python - <<EOF "$@" python3 - <<EOF "$@"
import sys import sys
from netaddr import IPNetwork from netaddr import IPNetwork
@ -1020,7 +1020,7 @@ function create_load_balancer_member {
# Returns: tab separated CIDRs of the two halves. # Returns: tab separated CIDRs of the two halves.
function split_subnet { function split_subnet {
# precondition: The passed cidr must be of a prefix <= 30 # precondition: The passed cidr must be of a prefix <= 30
python - <<EOF "$@" python3 - <<EOF "$@"
import sys import sys
from netaddr import IPNetwork from netaddr import IPNetwork
@ -1064,7 +1064,7 @@ function openshift_node_set_dns_config {
nameserver $upstream_dns_ip nameserver $upstream_dns_ip
EOF EOF
python - <<EOF "$@" python3 - <<EOF "$@"
import os import os
import sys import sys
import tempfile import tempfile
@ -1222,7 +1222,7 @@ function run_openshift_registry {
--tls-key=${OPENSHIFT_DATA_DIR}/master/registry.key \ --tls-key=${OPENSHIFT_DATA_DIR}/master/registry.key \
-o yaml > $registry_yaml -o yaml > $registry_yaml
python - <<EOF "$registry_yaml" "$registry_ip" python3 - <<EOF "$registry_yaml" "$registry_ip"
import copy import copy
import os import os
import sys import sys
@ -1315,7 +1315,7 @@ function _nth_cidr_ip {
cidr="$1" cidr="$1"
position="$2" position="$2"
python - <<EOF "$cidr" "$position" python3 - <<EOF "$cidr" "$position"
import sys import sys
from netaddr import IPAddress, IPNetwork from netaddr import IPAddress, IPNetwork

View File

@ -188,7 +188,7 @@ function install_kuryr_cni {
} }
function _cidr_range { function _cidr_range {
python - <<EOF "$1" python3 - <<EOF "$1"
import sys import sys
from netaddr import IPAddress, IPNetwork from netaddr import IPAddress, IPNetwork
n = IPNetwork(sys.argv[1]) n = IPNetwork(sys.argv[1])
@ -232,7 +232,7 @@ function create_k8s_api_service {
-c cidr -f value) -c cidr -f value)
fixed_ips=$(openstack port show kubelet-"${HOSTNAME}" -c fixed_ips -f value) fixed_ips=$(openstack port show kubelet-"${HOSTNAME}" -c fixed_ips -f value)
kubelet_iface_ip=$(python -c "print ${fixed_ips}[0]['ip_address']") kubelet_iface_ip=$(python3 -c "print(${fixed_ips}[0]['ip_address'])")
k8s_api_clusterip=$(_cidr_range "$service_cidr" | cut -f1) k8s_api_clusterip=$(_cidr_range "$service_cidr" | cut -f1)
@ -893,7 +893,7 @@ EOF
function run_kuryr_kubernetes { function run_kuryr_kubernetes {
local python_bin=$(which python) local python_bin=$(which python3)
if is_service_enabled openshift-master; then if is_service_enabled openshift-master; then
wait_for "OpenShift API Server" "${KURYR_K8S_API_ROOT}" \ wait_for "OpenShift API Server" "${KURYR_K8S_API_ROOT}" \