Skip to content

Commit 0cd0798

Browse files
authored
Merge pull request #2306 from k8s-infra-cherrypick-robot/cherry-pick-2262-to-release-0.9
[release-0.9] 🌱 Series of backports for CI stability
2 parents 25b9986 + a702ed9 commit 0cd0798

File tree

5 files changed

+189
-4
lines changed

5 files changed

+189
-4
lines changed

hack/ci/cloud-init/controller.yaml.tpl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
VERBOSE=True
1313
LOG_COLOR=True
1414

15+
# Host tuning
16+
ENABLE_SYSCTL_MEM_TUNING="True"
17+
ENABLE_SYSCTL_NET_TUNING="True"
18+
ENABLE_ZSWAP="True"
19+
1520
# Octavia
1621
enable_plugin octavia https://github.com/openstack/octavia stable/${OPENSTACK_RELEASE}
1722
enable_plugin octavia-dashboard https://github.com/openstack/octavia-dashboard stable/${OPENSTACK_RELEASE}
@@ -43,6 +48,14 @@
4348
OVN_L3_CREATE_PUBLIC_NETWORK="True"
4449
Q_AGENT="ovn"
4550

51+
# WORKAROUND:
52+
# https://github.com/kubernetes-sigs/cluster-api-provider-openstack/issues/2320
53+
# OVN built from source using LTS versions. Should be removed once OVS is more stable without the pin.
54+
# https://opendev.org/openstack/neutron/src/commit/83de306105f9329e24c97c4af6c3886de20e7d70/zuul.d/tempest-multinode.yaml#L603-L604
55+
OVN_BUILD_FROM_SOURCE=True
56+
OVN_BRANCH=branch-24.03
57+
OVS_BRANCH=branch-3.3
58+
4659
# Octavia
4760
ENABLED_SERVICES+=,octavia,o-api,o-cw,o-hm,o-hk,o-da
4861

@@ -88,6 +101,12 @@
88101
# query_placement_for_availability_zone is the default from Xena
89102
query_placement_for_availability_zone = True
90103

104+
[workarounds]
105+
# FIXME(stephenfin): This is temporary while we get to the bottom of
106+
# https://bugs.launchpad.net/nova/+bug/2091114 It should not be kept after
107+
# we bump to 2025.1
108+
disable_deep_image_inspection = True
109+
91110
[[post-config|$CINDER_CONF]]
92111
[DEFAULT]
93112
storage_availability_zone = ${PRIMARY_AZ}

hack/ci/cloud-init/worker.yaml.tpl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
VERBOSE=True
1212
LOG_COLOR=True
1313

14+
# Host tuning
15+
ENABLE_SYSCTL_MEM_TUNING="True"
16+
ENABLE_SYSCTL_NET_TUNING="True"
17+
ENABLE_ZSWAP="True"
18+
1419
DATABASE_PASSWORD=secretdatabase
1520
RABBIT_PASSWORD=secretrabbit
1621
ADMIN_PASSWORD=secretadmin
@@ -39,6 +44,14 @@
3944
Q_ML2_PLUGIN_MECHANISM_DRIVERS="ovn,logger"
4045
Q_AGENT="ovn"
4146

47+
# WORKAROUND:
48+
# https://github.com/kubernetes-sigs/cluster-api-provider-openstack/issues/2320
49+
# OVN built from source using LTS versions. Should be removed once OVS is more stable without the pin.
50+
# https://opendev.org/openstack/neutron/src/commit/83de306105f9329e24c97c4af6c3886de20e7d70/zuul.d/tempest-multinode.yaml#L603-L604
51+
OVN_BUILD_FROM_SOURCE=True
52+
OVN_BRANCH=branch-24.03
53+
OVS_BRANCH=branch-3.3
54+
4255
# Additional services
4356
ENABLED_SERVICES+=${OPENSTACK_ADDITIONAL_SERVICES}
4457
DISABLED_SERVICES+=${OPENSTACK_DISABLED_SERVICES}
@@ -47,6 +60,12 @@
4760
[DEFAULT]
4861
cpu_allocation_ratio = 2.0
4962

63+
[workarounds]
64+
# FIXME(stephenfin): This is temporary while we get to the bottom of
65+
# https://bugs.launchpad.net/nova/+bug/2091114 It should not be kept after
66+
# we bump to 2025.1
67+
disable_deep_image_inspection = True
68+
5069
[[post-config|$CINDER_CONF]]
5170
[DEFAULT]
5271
storage_availability_zone = ${SECONDARY_AZ}

hack/ci/create_devstack.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ source "${scriptdir}/${RESOURCE_TYPE}.sh"
3131

3232
CLUSTER_NAME=${CLUSTER_NAME:-"capo-e2e"}
3333

34-
OPENSTACK_RELEASE=${OPENSTACK_RELEASE:-"2023.2"}
34+
OPENSTACK_RELEASE=${OPENSTACK_RELEASE:-"2024.2"}
3535
OPENSTACK_ENABLE_HORIZON=${OPENSTACK_ENABLE_HORIZON:-"false"}
3636

3737
# Devstack will create a provider network using this range
@@ -47,6 +47,9 @@ PRIVATE_NETWORK_CIDR=${PRIVATE_NETWORK_CIDR:-"10.0.3.0/24"}
4747
CONTROLLER_IP=${CONTROLLER_IP:-"10.0.3.15"}
4848
WORKER_IP=${WORKER_IP:-"10.0.3.16"}
4949

50+
SKIP_INIT_INFRA=${SKIP_INIT_INFRA:-}
51+
SKIP_SECONDARY_AZ=${SKIP_SECONDARY_AZ:-}
52+
5053
PRIMARY_AZ=testaz1
5154
SECONDARY_AZ=testaz2
5255

@@ -273,7 +276,11 @@ function main() {
273276
# is available, and wait if it is not.
274277
#
275278
# For efficiency, tests which require multi-AZ SHOULD run as late as possible.
276-
create_worker
279+
if [[ -n "${SKIP_SECONDARY_AZ:-}" ]]; then
280+
echo "Skipping worker creation..."
281+
else
282+
create_worker
283+
fi
277284

278285
public_ip=$(get_public_ip)
279286
cat << EOF > "${REPO_ROOT_ABSOLUTE}/clouds.yaml"

hack/ci/gce-project.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ function create_vm {
9595
--zone "$GCP_ZONE" \
9696
--enable-nested-virtualization \
9797
--image-project ubuntu-os-cloud \
98-
--image-family ubuntu-2204-lts \
99-
--boot-disk-size 200G \
98+
--image-family ubuntu-2404-lts-amd64 \
99+
--boot-disk-size 500G \
100100
--boot-disk-type pd-ssd \
101101
--can-ip-forward \
102102
--tags http-server,https-server,novnc,openstack-apis \

hack/ci/libvirt.sh

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2024 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# hack script for preparing libvirt to run cluster-api-provider-openstack e2e
18+
19+
set -x -o errexit -o nounset -o pipefail
20+
21+
# Required environment variables:
22+
# SSH_PUBLIC_KEY_FILE
23+
# SSH_PRIVATE_KEY_FILE
24+
# LIBVIRT_NETWORK_NAME
25+
26+
function cloud_init {
27+
LIBVIRT_NETWORK_NAME=${LIBVIRT_NETWORK_NAME:-${CLUSTER_NAME}-network}
28+
LIBVIRT_IMAGE_NAME=${LIBVIRT_IMAGE_NAME:-ubuntu-2404-lts}
29+
30+
LIBVIRT_MEMORY=${LIBVIRT_MEMORY:-8192}
31+
LIBVIRT_MEMORY_controller=${LIBVIRT_MEMORY_controller:-$LIBVIRT_MEMORY}
32+
LIBVIRT_MEMORY_worker=${LIBVIRT_MEMORY_worker:-$LIBVIRT_MEMORY}
33+
34+
LIBVIRT_VCPU=${LIBVIRT_VCPU:-4}
35+
LIBVIRT_VCPU_controller=${LIBVIRT_VCPU_controller:-$LIBVIRT_VCPU}
36+
LIBVIRT_VCPU_worker=${LIBVIRT_VCPU_worker:-$LIBVIRT_VCPU}
37+
38+
LIBVIRT_MAC_controller="00:60:2f:32:81:00"
39+
LIBVIRT_MAC_worker="00:60:2f:32:81:01"
40+
}
41+
42+
function init_infrastructure() {
43+
if ! virsh net-info "${LIBVIRT_NETWORK_NAME}" &>/dev/null; then
44+
virsh net-define <(cat <<EOF
45+
<network>
46+
<name>${LIBVIRT_NETWORK_NAME}</name>
47+
<forward mode='nat'>
48+
<nat>
49+
<port start='1024' end='65535'/>
50+
</nat>
51+
</forward>
52+
<bridge name="capobr0" stp="on" delay="0"/>
53+
<ip address="${PRIVATE_NETWORK_CIDR%/*}" netmask="255.255.255.0">
54+
<dhcp>
55+
<range start="${PRIVATE_NETWORK_CIDR%.*}.10" end="${PRIVATE_NETWORK_CIDR%.*}.199"/>
56+
<host mac="${LIBVIRT_MAC_controller}" name='controller' ip="${CONTROLLER_IP}"/>
57+
<host mac="${LIBVIRT_MAC_worker}" name='worker' ip="${WORKER_IP}"/>
58+
</dhcp>
59+
</ip>
60+
</network>
61+
EOF
62+
)
63+
virsh net-start "${LIBVIRT_NETWORK_NAME}"
64+
virsh net-autostart "${LIBVIRT_NETWORK_NAME}"
65+
fi
66+
67+
if [ ! -f "/tmp/${LIBVIRT_IMAGE_NAME}.qcow2" ]; then
68+
curl -o "/tmp/${LIBVIRT_IMAGE_NAME}.qcow2" https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img
69+
fi
70+
}
71+
72+
function create_vm {
73+
local name=$1 && shift
74+
local ip=$1 && shift
75+
local userdata=$1 && shift
76+
local public=$1 && shift
77+
78+
local memory=LIBVIRT_MEMORY_${name}
79+
memory=${!memory}
80+
local vcpu=LIBVIRT_VCPU_${name}
81+
vcpu=${!vcpu}
82+
local servername="${CLUSTER_NAME}-${name}"
83+
local mac=LIBVIRT_MAC_${name}
84+
mac=${!mac}
85+
86+
# Values which weren't initialised if we skipped init_infrastructure. Use names instead.
87+
networkid=${networkid:-${LIBVIRT_NETWORK_NAME}}
88+
volumeid=${volumeid:-${LIBVIRT_IMAGE_NAME}_${name}.qcow2}
89+
90+
sudo cp "/tmp/${LIBVIRT_IMAGE_NAME}.qcow2" "/var/lib/libvirt/images/${volumeid}"
91+
sudo qemu-img resize "/var/lib/libvirt/images/${volumeid}" +200G
92+
93+
local serverid
94+
local serverid
95+
if ! virsh dominfo "${servername}" &>/dev/null; then
96+
sudo virt-install \
97+
--name "${servername}" \
98+
--memory "${memory}" \
99+
--vcpus "${vcpu}" \
100+
--import \
101+
--disk "/var/lib/libvirt/images/${volumeid},format=qcow2,bus=virtio" \
102+
--network network="${networkid}",mac="${mac}" \
103+
--os-variant=ubuntu22.04 \
104+
--graphics none \
105+
--cloud-init user-data="${userdata}" \
106+
--noautoconsole
107+
fi
108+
}
109+
110+
function get_public_ip {
111+
echo "${CONTROLLER_IP}"
112+
}
113+
114+
function get_mtu {
115+
# Set MTU statically for libvirt
116+
echo 1500
117+
}
118+
119+
function get_ssh_public_key_file {
120+
echo "${SSH_PUBLIC_KEY_FILE}"
121+
}
122+
123+
function get_ssh_private_key_file {
124+
# Allow this to be unbound. This is handled in create_devstack.sh
125+
echo "${SSH_PRIVATE_KEY_FILE:-}"
126+
}
127+
128+
function cloud_cleanup {
129+
for serverid in $(virsh list --all --name | grep -E "${CLUSTER_NAME}-controller|${CLUSTER_NAME}-worker"); do
130+
virsh destroy "${serverid}"
131+
virsh undefine "${serverid}" --remove-all-storage
132+
done
133+
134+
for networkid in $(virsh net-list --name | grep -E "${CLUSTER_NAME}"); do
135+
virsh net-destroy "${networkid}"
136+
virsh net-undefine "${networkid}"
137+
done
138+
139+
true
140+
}

0 commit comments

Comments
 (0)