-
Notifications
You must be signed in to change notification settings - Fork 138
Add IPv6 testing script for use in release process #3931
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
Changes from 10 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b3ad34b
Add IPv6 testing script for use in release process
shaun-nx d3e7041
Fix pre-commit errors
shaun-nx 90040b1
Update wording in release process
shaun-nx 4770f1f
Merge branch 'main' into tests/ipv6-release-testing
shaun-nx f1b9a66
Merge branch 'main' into tests/ipv6-release-testing
shaun-nx 1d53be6
Use NGINX release channel image and get IPv6 address from gateway status
shaun-nx 0a492a8
Fix pre-commit error
shaun-nx 9d59dfa
Update echo outputs
shaun-nx cf6ef1c
Merge branch 'main' into tests/ipv6-release-testing
shaun-nx 9d9ccd8
Merge branch 'main' into tests/ipv6-release-testing
shaun-nx 6fe6987
Merge branch 'main' into tests/ipv6-release-testing
shaun-nx 643a7b0
Update script to use make commands. Update make commands with new var…
shaun-nx b413a3f
Run pre-commit
shaun-nx 9ed997c
Merge branch 'main' into tests/ipv6-release-testing
shaun-nx af1d32e
Merge branch 'main' into tests/ipv6-release-testing
shaun-nx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
networking: | ||
ipFamily: ipv6 # Explicitly set the cluster to use IPv6 | ||
apiServerAddress: "::1" | ||
disableDefaultCNI: false # Use Kind's default CNI | ||
nodes: | ||
- role: control-plane |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
name: gateway | ||
spec: | ||
gatewayClassName: nginx | ||
listeners: | ||
- name: http | ||
port: 80 | ||
protocol: HTTP | ||
hostname: "*.example.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: test-app-ipv6 | ||
namespace: default | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: test-app-ipv6 | ||
template: | ||
metadata: | ||
labels: | ||
app: test-app-ipv6 | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginxdemos/nginx-hello:plain-text | ||
ports: | ||
- containerPort: 80 | ||
resources: | ||
limits: | ||
cpu: "100m" | ||
memory: "128Mi" | ||
requests: | ||
cpu: "50m" | ||
memory: "64Mi" | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: test-app-ipv6-service | ||
namespace: default | ||
spec: | ||
selector: | ||
app: test-app-ipv6 | ||
ports: | ||
- port: 80 | ||
targetPort: 80 | ||
ipFamilies: [IPv6] | ||
ipFamilyPolicy: SingleStack | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: test-route-ipv6 | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: gateway | ||
sectionName: http | ||
namespace: default | ||
hostnames: | ||
- "ipv6-test.example.com" | ||
rules: | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
backendRefs: | ||
- name: test-app-ipv6-service | ||
port: 80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: ipv6-test-client | ||
namespace: default | ||
labels: | ||
app: ipv6-test-client | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: test-client | ||
image: curlimages/curl:8.16.0 | ||
imagePullPolicy: IfNotPresent | ||
command: ["sleep", "3600"] # Keep pod alive for exec commands | ||
resources: | ||
limits: | ||
cpu: "100m" | ||
memory: "128Mi" | ||
requests: | ||
cpu: "50m" | ||
memory: "64Mi" | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
runAsNonRoot: true | ||
runAsUser: 65534 | ||
capabilities: | ||
drop: | ||
- ALL | ||
dnsConfig: | ||
options: | ||
- name: single-request-reopen | ||
- name: ndots | ||
value: "2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e # Exit immediately if a command exits with a non-zero status | ||
|
||
RELEASE=$1 | ||
RELEASE_IMAGE=$2 | ||
|
||
if [[ -z $RELEASE || -z $RELEASE_IMAGE ]]; then | ||
echo "Usage: $0 <RELEASE> <RELEASE_IMAGE> [HELM_RELEASE_NAME] [NAMESPACE] [CLUSTER_NAME]" | ||
echo "Error: RELEASE and RELEASE_IMAGE are required parameters. Example usage $(make ipv6-test RELEASE=vX.Y.Z RELEASE_IMAGE=release-X.Y-rc)" | ||
exit 1 | ||
fi | ||
|
||
HELM_RELEASE_NAME=${3:-ngf} | ||
NAMESPACE=${4:-nginx-gateway} | ||
CLUSTER_NAME=${5:-ipv6-only-${RELEASE}} | ||
RELEASE_REPO=ghcr.io/nginx/nginx-gateway-fabric | ||
|
||
cleanup() { | ||
echo "Cleaning up resources..." | ||
kind delete cluster --name ${CLUSTER_NAME} || true | ||
shaun-nx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
trap cleanup EXIT | ||
|
||
kind create cluster --name ${CLUSTER_NAME} --config ipv6/config/kind-ipv6-only.yaml | ||
salonichf5 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
echo "== Applying Gateway API CRDs" | ||
kubectl kustomize "https://github.com/nginx/nginx-gateway-fabric/config/crd/gateway-api/standard?ref=${RELEASE}" | kubectl apply -f - | ||
|
||
salonichf5 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
echo "== Installing NGINX Gateway Fabric..." | ||
echo "== Using NGF from ${RELEASE_REPO}:${RELEASE_IMAGE}..." | ||
echo "== Using NGINX from ${RELEASE_REPO}/nginx:${RELEASE_IMAGE}..." | ||
|
||
helm install ${HELM_RELEASE_NAME} --wait oci://ghcr.io/nginx/charts/nginx-gateway-fabric \ | ||
--create-namespace -n ${NAMESPACE} \ | ||
--set nginx.config.ipFamily=ipv6 \ | ||
--set nginx.service.type=ClusterIP \ | ||
--set nginxGateway.image.repository=${RELEASE_REPO} \ | ||
--set nginxGateway.image.tag=${RELEASE_IMAGE} \ | ||
--set nginx.image.repository=${RELEASE_REPO}/nginx \ | ||
--set nginx.image.tag=${RELEASE_IMAGE} | ||
salonichf5 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
echo "== Deploying Gateway..." | ||
kubectl apply -f ipv6/manifests/gateway.yaml | ||
|
||
kubectl wait --for=condition=accepted --timeout=300s gateway/gateway | ||
POD_NAME=$(kubectl get pods -l app.kubernetes.io/instance=${HELM_RELEASE_NAME} -o jsonpath='{.items[0].metadata.name}') | ||
kubectl wait --for=condition=ready --timeout=300s pod/${POD_NAME} | ||
|
||
echo "== Deploying IPv6 test application" | ||
kubectl apply -f ipv6/manifests/ipv6-test-app.yaml | ||
|
||
echo "== Waiting for test applications to be ready..." | ||
kubectl wait --for=condition=available --timeout=300s deployment/test-app-ipv6 | ||
|
||
echo " ==Getting NGF service IPv6 address from gateway status" | ||
NGF_IPV6=$(kubectl get gateway -o jsonpath='{.items[0].status.addresses[0].value}') | ||
echo "NGF IPv6 Address: $NGF_IPV6" | ||
|
||
echo "=== Running IPv6-Only Tests ===" | ||
|
||
echo "== Starting IPv6 test client" | ||
kubectl apply -f ipv6/manifests/ipv6-test-client.yaml | ||
kubectl wait --for=condition=ready --timeout=300s pod/ipv6-test-client | ||
|
||
echo "== Test 1: Basic IPv6 connectivity ==" | ||
kubectl exec ipv6-test-client -- curl --version | ||
kubectl exec ipv6-test-client -- nslookup gateway-nginx.default.svc.cluster.local || echo "Test 1: Basic IPv6 connectivity failed" | ||
test1_status=$? | ||
|
||
if [[ $test1_status -eq 0 ]]; then | ||
echo "✅ Test 1: Basic IPv6 connectivity succeeded" | ||
fi | ||
|
||
echo "== Test 2: NGF Service IPv6 connectivity ==" | ||
kubectl exec ipv6-test-client -- curl -6 --connect-timeout 30 --max-time 60 -v \ | ||
-H "Host: ipv6-test.example.com" \ | ||
"http://[${NGF_IPV6}]:80/" || echo "Test 2: NGF Service IPv6 connectivity failed" | ||
test2_status=$? | ||
|
||
if [[ $test2_status -eq 0 ]]; then | ||
echo "✅ Test 2: NGF Service IPv6 connectivity succeeded" | ||
fi | ||
|
||
echo "== Test 3: Service DNS IPv6 connectivity ==" | ||
kubectl exec ipv6-test-client -- curl -6 --connect-timeout 30 --max-time 60 -v \ | ||
-H "Host: ipv6-test.example.com" \ | ||
"http://gateway-nginx.default.svc.cluster.local:80/" || echo "Test 3: Service DNS IPv6 connectivity failed" | ||
test3_status=$? | ||
|
||
if [[ $test3_status -eq 0 ]]; then | ||
echo "✅ Test 3: Service DNS IPv6 connectivity succeeded" | ||
fi | ||
|
||
echo "=== Displaying IPv6-Only Configuration ===" | ||
echo "NGF Pod IPv6 addresses:" | ||
kubectl get pods -n nginx-gateway -o wide || true | ||
echo "NGF Service configuration:" | ||
kubectl get service ${HELM_RELEASE_NAME}-nginx-gateway-fabric -n nginx-gateway -o yaml || true | ||
|
||
if [[ $test1_status -eq 0 && $test2_status -eq 0 && $test3_status -eq 0 ]]; then | ||
echo -e "✅ All tests passed!" | ||
else | ||
echo -e "❌ One or more tests failed. Check the output above to help debug any issues." | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.