Skip to content

Use custom NGF Debian image for tests #2260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/nfr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ jobs:
echo "GKE_PROJECT=${{ secrets.GCP_PROJECT_ID }}" >> vars.env
echo "GKE_SVC_ACCOUNT=${{ secrets.GCP_SERVICE_ACCOUNT }}" >> vars.env
echo "GKE_NODES_SERVICE_ACCOUNT=${{ secrets.GKE_NODES_SERVICE_ACCOUNT }}" >> vars.env
echo "IMAGE=projects/debian-cloud/global/images/debian-11-bullseye-v20240213" >> vars.env
echo "NETWORK_TAGS=nfr-tests-${{ github.run_id }}-${{ matrix.type }}" >> vars.env
echo "NGF_REPO=nginxinc" >> vars.env
echo "NGF_BRANCH=${{ github.ref_name }}" >> vars.env
Expand Down
8 changes: 4 additions & 4 deletions tests/scripts/create-and-setup-gcp-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ gcloud compute firewall-rules create ${RESOURCE_NAME} \
--source-ranges=${SOURCE_IP_RANGE} \
--target-tags=${NETWORK_TAGS}

gcloud compute instances create ${RESOURCE_NAME} --project=${GKE_PROJECT} --zone=${GKE_CLUSTER_ZONE} --machine-type=e2-medium \
gcloud compute instances create ${RESOURCE_NAME} --project=${GKE_PROJECT} --zone=${GKE_CLUSTER_ZONE} --machine-type=n2-standard-2 \
--network-interface=network-tier=PREMIUM,stack-type=IPV4_ONLY,subnet=default --maintenance-policy=MIGRATE \
--provisioning-model=STANDARD --service-account=${GKE_SVC_ACCOUNT} \
--scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append,https://www.googleapis.com/auth/cloud-platform \
--tags=${NETWORK_TAGS} --create-disk=auto-delete=yes,boot=yes,device-name=${RESOURCE_NAME},image=${IMAGE},mode=rw,size=10 --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --labels=goog-ec-src=vm_add-gcloud --reservation-affinity=any
--tags=${NETWORK_TAGS} --create-disk=auto-delete=yes,boot=yes,device-name=${RESOURCE_NAME},image-family=projects/${GKE_PROJECT}/global/images/ngf-debian,mode=rw,size=20 --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --labels=goog-ec-src=vm_add-gcloud --reservation-affinity=any

# Add VM IP to GKE master control node access, if required
if [ "${ADD_VM_IP_AUTH_NETWORKS}" = "true" ]; then
Expand All @@ -44,5 +44,5 @@ for ((i=1; i<=MAX_RETRIES; i++)); do
done

gcloud compute scp --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} ${SCRIPT_DIR}/vars.env username@${RESOURCE_NAME}:~

gcloud compute ssh --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} username@${RESOURCE_NAME} --command="bash -s" < ${SCRIPT_DIR}/remote-scripts/install-deps.sh
gcloud compute ssh --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} username@${RESOURCE_NAME} \
--command="git clone https://github.com/${NGF_REPO}/nginx-gateway-fabric.git && cd nginx-gateway-fabric/tests && git checkout ${NGF_BRANCH} && gcloud container clusters get-credentials ${GKE_CLUSTER_NAME} --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} --quiet"
15 changes: 0 additions & 15 deletions tests/scripts/remote-scripts/install-deps.sh

This file was deleted.

2 changes: 0 additions & 2 deletions tests/scripts/remote-scripts/run-nfr-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ set -e

source ~/vars.env

echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile && . $HOME/.profile

if [ "$START_LONGEVITY" == "true" ]; then
GINKGO_LABEL="longevity-setup"
elif [ "$STOP_LONGEVITY" == "true" ]; then
Expand Down
2 changes: 0 additions & 2 deletions tests/scripts/remote-scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ set -e

source ~/vars.env

echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile && . $HOME/.profile

cd nginx-gateway-fabric/tests && make test TAG=${TAG} PREFIX=${PREFIX} NGINX_PREFIX=${NGINX_PREFIX} NGINX_PLUS_PREFIX=${NGINX_PLUS_PREFIX} PLUS_ENABLED=${PLUS_ENABLED} GINKGO_LABEL=${GINKGO_LABEL} GINKGO_FLAGS=${GINKGO_FLAGS} PULL_POLICY=Always GW_SERVICE_TYPE=LoadBalancer GW_SVC_GKE_INTERNAL=true NGF_VERSION=${NGF_VERSION}
8 changes: 7 additions & 1 deletion tests/scripts/run-tests-gcp-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ gcloud compute scp --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} ${SCRIPT_
gcloud compute ssh --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} username@${RESOURCE_NAME} \
--command="export START_LONGEVITY=${START_LONGEVITY} &&\
export STOP_LONGEVITY=${STOP_LONGEVITY} &&\
bash -s" < ${SCRIPT_DIR}/remote-scripts/${SCRIPT}
source /etc/profile &&\
bash -s" < ${SCRIPT_DIR}/remote-scripts/${SCRIPT}; retcode=$?

if [ $retcode -ne 0 ]; then
echo "Error running tests on VM"
exit 1
fi

if [ "${NFR}" = "true" ]; then
gcloud compute scp --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} --recurse username@${RESOURCE_NAME}:~/nginx-gateway-fabric/tests/results .
Expand Down
1 change: 0 additions & 1 deletion tests/scripts/vars.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ GKE_CLUSTER_REGION=<region where GKE cluster is deployed>
GKE_PROJECT=<GCP project>
GKE_SVC_ACCOUNT=<service account with k8s admin permissions>
GKE_NODES_SERVICE_ACCOUNT=<service account for the GKE nodes to assume>
IMAGE=projects/debian-cloud/global/images/debian-11-bullseye-v20240213
NETWORK_TAGS=<network tags>
NGF_REPO=nginxinc
NGF_BRANCH=main
Expand Down
Loading