Skip to content

Commit ab6e4bd

Browse files
authored
Merge pull request #3488 from chrischdi/pr-gcve-cherry-pick-1-11
[release-1.11] 🌱 Cherry-Pick: Changes for community owned Prow CI
2 parents c355917 + 76caa7a commit ab6e4bd

File tree

9 files changed

+57
-47
lines changed

9 files changed

+57
-47
lines changed

β€Žhack/e2e.shβ€Ž

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ export BOSKOS_RESOURCE_OWNER=cluster-api-provider-vsphere
4343
if [[ "${JOB_NAME}" != "" ]]; then
4444
export BOSKOS_RESOURCE_OWNER="${JOB_NAME}/${BUILD_ID}"
4545
fi
46-
export BOSKOS_RESOURCE_TYPE=vsphere-project-cluster-api-provider
46+
export BOSKOS_RESOURCE_TYPE="gcve-vsphere-project"
47+
# Fallback for mirror-prow.
48+
if [[ "${GOVC_URL:-}" == "10.2.224.4" ]]; then
49+
BOSKOS_RESOURCE_TYPE=vsphere-project-cluster-api-provider
50+
fi
4751

4852
on_exit() {
4953
# Only handle Boskos when we have to (not for vcsim)
@@ -55,11 +59,6 @@ on_exit() {
5559
[ -z "${BOSKOS_HOST:-}" ] || docker run -e VSPHERE_USERNAME -e VSPHERE_PASSWORD gcr.io/k8s-staging-capi-vsphere/extra/boskosctl:latest release --boskos-host="${BOSKOS_HOST}" --resource-owner="${BOSKOS_RESOURCE_OWNER}" --resource-name="${BOSKOS_RESOURCE_NAME}" --vsphere-server="${VSPHERE_SERVER}" --vsphere-tls-thumbprint="${VSPHERE_TLS_THUMBPRINT}" --vsphere-folder="${BOSKOS_RESOURCE_FOLDER}" --vsphere-resource-pool="${BOSKOS_RESOURCE_POOL}"
5660
fi
5761

58-
# kill the VPN only when we started it (not vcsim)
59-
if [[ ! "${GINKGO_FOCUS:-}" =~ $RE_VCSIM ]]; then
60-
docker kill vpn
61-
fi
62-
6362
# Cleanup VSPHERE_PASSWORD from temporary artifacts directory.
6463
if [[ "${ORIGINAL_ARTIFACTS}" != "" ]]; then
6564
# Delete non-text files from artifacts directory to not leak files accidentially
@@ -91,47 +90,43 @@ on_exit() {
9190

9291
trap on_exit EXIT
9392

94-
# NOTE: when running on CI without presets, value for variables are missing: GOVC_URL, GOVC_USERNAME, GOVC_PASSWORD, VM_SSH_PUB_KEY),
93+
# Sanitize input envvars to not contain newline
94+
GOVC_USERNAME=$(echo "${GOVC_USERNAME:-}" | tr -d "\n")
95+
GOVC_PASSWORD=$(echo "${GOVC_PASSWORD:-}" | tr -d "\n")
96+
GOVC_URL=$(echo "${GOVC_URL:-}" | tr -d "\n")
97+
VSPHERE_TLS_THUMBPRINT=$(echo "${VSPHERE_TLS_THUMBPRINT:-}" | tr -d "\n")
98+
BOSKOS_HOST=$(echo "${BOSKOS_HOST:-}" | tr -d "\n")
99+
100+
# NOTE: when running on CI without presets, value for variables are missing: GOVC_URL, GOVC_USERNAME, GOVC_PASSWORD),
95101
# but this is not an issue when we are targeting vcsim (corresponding VSPHERE_ variables will be injected during test setup).
96102
export VSPHERE_SERVER="${GOVC_URL:-}"
97103
export VSPHERE_USERNAME="${GOVC_USERNAME:-}"
98104
export VSPHERE_PASSWORD="${GOVC_PASSWORD:-}"
99-
export VSPHERE_SSH_AUTHORIZED_KEY="${VM_SSH_PUB_KEY:-}"
100-
export VSPHERE_SSH_PRIVATE_KEY="/root/ssh/.private-key/private-key"
101105
export E2E_CONF_FILE="${REPO_ROOT}/test/e2e/config/vsphere.yaml"
102106
export E2E_CONF_OVERRIDE_FILE=""
103107
export E2E_VM_OPERATOR_VERSION="${VM_OPERATOR_VERSION:-v1.8.6-0-gde75746a}"
104108
export DOCKER_IMAGE_TAR="/tmp/images/image.tar"
105109
export GC_KIND="false"
106110

111+
SSH_KEY_DIR=$(mktemp -d)
112+
export VSPHERE_SSH_PRIVATE_KEY
113+
VSPHERE_SSH_PRIVATE_KEY="${SSH_KEY_DIR}/ssh-key"
114+
ssh-keygen -t ed25519 -f "${VSPHERE_SSH_PRIVATE_KEY}" -N ""
115+
export VSPHERE_SSH_AUTHORIZED_KEY
116+
VSPHERE_SSH_AUTHORIZED_KEY="$(cat "${VSPHERE_SSH_PRIVATE_KEY}.pub")"
117+
118+
# Fallback for mirror-prow.
119+
if [[ "${GOVC_URL:-}" == "10.2.224.4" ]]; then
120+
VSPHERE_SSH_AUTHORIZED_KEY="${VM_SSH_PUB_KEY:-}"
121+
VSPHERE_SSH_PRIVATE_KEY="/root/ssh/.private-key/private-key"
122+
E2E_CONF_OVERRIDE_FILE="$(pwd)/test/e2e/config/config-overrides-mirror-prow.yaml"
123+
fi
124+
107125
# Make tests run in-parallel
108126
export GINKGO_NODES=5
109127

110-
# Only run the vpn/check for IPAM when we need them (not for vcsim)
128+
# Only run the boskos/check for IPAM when we need them (not for vcsim)
111129
if [[ ! "${GINKGO_FOCUS:-}" =~ $RE_VCSIM ]]; then
112-
# Run the vpn client in container
113-
docker run --rm -d --name vpn -v "${HOME}/.openvpn/:${HOME}/.openvpn/" \
114-
-w "${HOME}/.openvpn/" --cap-add=NET_ADMIN --net=host --device=/dev/net/tun \
115-
gcr.io/k8s-staging-capi-vsphere/extra/openvpn:latest
116-
117-
# Tail the vpn logs
118-
docker logs vpn
119-
120-
# Wait until the VPN connection is active.
121-
function wait_for_vpn_up() {
122-
local n=0
123-
until [ $n -ge 30 ]; do
124-
curl "https://${VSPHERE_SERVER}" --connect-timeout 2 -k && RET=$? || RET=$?
125-
if [[ "$RET" -eq 0 ]]; then
126-
break
127-
fi
128-
n=$((n + 1))
129-
sleep 1
130-
done
131-
return "$RET"
132-
}
133-
wait_for_vpn_up
134-
135130
# If BOSKOS_HOST is set then acquire a vsphere-project from Boskos.
136131
if [ -n "${BOSKOS_HOST:-}" ]; then
137132
# Check out the account from Boskos and store the produced environment
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
# This e2e config file contains an example of overrides for a tests targeting a user provided vCenter instance.
3+
# Those overrides will be applied on top of the content of the config file used for CI (only variables and intervals are considered)
4+
5+
variables:
6+
VSPHERE_COMPUTE_CLUSTER: "Cluster-1"
7+
VSPHERE_DATACENTER: "SDDC-Datacenter"
8+
VSPHERE_FOLDER: "/SDDC-Datacenter/vm/Workloads/cluster-api-provider-vsphere"
9+
VSPHERE_RESOURCE_POOL: "/SDDC-Datacenter/host/Cluster-1/Resources/Compute-ResourcePool/cluster-api-provider-vsphere"
10+
VSPHERE_DATASTORE: "WorkloadDatastore"
11+
VSPHERE_STORAGE_POLICY: "Cluster API vSphere Storage Policy"
12+
VSPHERE_NETWORK: "sddc-cgw-network-10"
13+
VSPHERE_DISTRIBUTED_PORT_GROUP: "/SDDC-Datacenter/network/sddc-cgw-network-10"
14+
15+
intervals:

β€Žtest/e2e/config/vsphere.yamlβ€Ž

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ variables:
282282
WORKER_MACHINE_COUNT: 1
283283
IP_FAMILY: "IPv4"
284284
CLUSTER_CLASS_NAME: "quick-start"
285-
VSPHERE_COMPUTE_CLUSTER: "Cluster-1"
286-
VSPHERE_DATACENTER: "SDDC-Datacenter"
287-
VSPHERE_FOLDER: "/SDDC-Datacenter/vm/Workloads/cluster-api-provider-vsphere"
288-
VSPHERE_RESOURCE_POOL: "/SDDC-Datacenter/host/Cluster-1/Resources/Compute-ResourcePool/cluster-api-provider-vsphere"
289-
VSPHERE_DATASTORE: "WorkloadDatastore"
290-
VSPHERE_STORAGE_POLICY: "Cluster API vSphere Storage Policy"
285+
VSPHERE_COMPUTE_CLUSTER: "k8s-gcve-cluster"
286+
VSPHERE_DATACENTER: "Datacenter"
287+
VSPHERE_FOLDER: "/Datacenter/vm/Workloads/prow"
288+
VSPHERE_RESOURCE_POOL: "/Datacenter/host/k8s-gcve-cluster/Resources/prow"
289+
VSPHERE_DATASTORE: "vsanDatastore"
290+
VSPHERE_STORAGE_POLICY: "vSAN Default Storage Policy"
291291
VSPHERE_STORAGE_CLASS: "test-storageclass"
292292
VSPHERE_MACHINE_CLASS_NAME: "test-machine-class"
293293
# CI runs vm-operator v1.8.6 on vCenter 8, setting CPU and Memory does not work and defaults to 2 CPUs / 2Gi memory.
@@ -302,8 +302,8 @@ variables:
302302
VSPHERE_CONTENT_LIBRARY: "capv"
303303
VSPHERE_CONTENT_LIBRARY_ITEMS: "ubuntu-2204-kube-v1.28.0,ubuntu-2204-kube-v1.29.0,ubuntu-2204-kube-v1.30.0,ubuntu-2404-kube-v1.31.0"
304304
VSPHERE_IMAGE_NAME: "ubuntu-2404-kube-v1.31.0"
305-
VSPHERE_NETWORK: "sddc-cgw-network-10"
306-
VSPHERE_DISTRIBUTED_PORT_GROUP: "/SDDC-Datacenter/network/sddc-cgw-network-10"
305+
VSPHERE_NETWORK: "k8s-ci"
306+
VSPHERE_DISTRIBUTED_PORT_GROUP: "/Datacenter/network/k8s-ci"
307307
VSPHERE_TEMPLATE: "ubuntu-2404-kube-v1.31.0"
308308
FLATCAR_VSPHERE_TEMPLATE: "flatcar-stable-3975.2.0-kube-v1.31.0"
309309
KUBETEST_CONFIGURATION: "./data/kubetest/conformance.yaml"

β€Žtest/e2e/data/infrastructure-vsphere-govmomi/main/commons/cluster-network-CIDR.yamlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ spec:
77
clusterNetwork:
88
pods:
99
cidrBlocks:
10-
- 192.168.30.0/24
10+
- 192.168.128.0/24

β€Žtest/e2e/data/infrastructure-vsphere-govmomi/v1.10/commons/cluster-network-CIDR.yamlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ spec:
77
clusterNetwork:
88
pods:
99
cidrBlocks:
10-
- 192.168.30.0/24
10+
- 192.168.128.0/24

β€Žtest/e2e/data/infrastructure-vsphere-govmomi/v1.9/commons/cluster-network-CIDR.yamlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ spec:
77
clusterNetwork:
88
pods:
99
cidrBlocks:
10-
- 192.168.30.0/24
10+
- 192.168.128.0/24

β€Žtest/e2e/data/infrastructure-vsphere-supervisor/main/commons/cluster-network-CIDR.yamlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ spec:
77
clusterNetwork:
88
pods:
99
cidrBlocks:
10-
- 192.168.30.0/24
10+
- 192.168.128.0/24

β€Žtest/e2e/data/infrastructure-vsphere-supervisor/v1.10/commons/cluster-network-CIDR.yamlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ spec:
77
clusterNetwork:
88
pods:
99
cidrBlocks:
10-
- 192.168.30.0/24
10+
- 192.168.128.0/24

β€Žtest/e2e/data/infrastructure-vsphere-supervisor/v1.9/commons/cluster-network-CIDR.yamlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ spec:
77
clusterNetwork:
88
pods:
99
cidrBlocks:
10-
- 192.168.30.0/24
10+
- 192.168.128.0/24

0 commit comments

Comments
Β (0)