Skip to content
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

Some updates to handle different cases for e2e run #226

Merged
merged 1 commit into from
May 19, 2023
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
2 changes: 1 addition & 1 deletion docs/developer-guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Several examples are provided in the [`e2e-fixtures` folder](https://github.com/
Then, you need to update the `value` field in that new file.

You can then apply the given example via `kubectl apply -k e2e-fixtures/<example in question>`, i.e.
`kubectl apply -k e2e-fixtures/hello-world-ingess`.
`kubectl apply -k e2e-fixtures/hello-world-ingress`.

### E2E Tests

Expand Down
5 changes: 5 additions & 0 deletions e2e-fixtures/hello-world-ingress/EXAMPLE-config-pt2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 1. Copy this file to ./config.yaml
# 2. Set you unique FQDN in the "value" field below
- op: replace
path: /spec/rules/0/host
value: <UNIQUE SUBDOMAIN>.ngrok.io
5 changes: 4 additions & 1 deletion e2e-fixtures/hello-world-ingress/EXAMPLE-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
# 2. Set you unique FQDN in the "value" field below
- op: replace
path: /spec/rules/0/host
value: <UNIQUE SUBDOMAIN>.ngrok.io
value: <UNIQUE SUBDOMAIN>.ngrok.io
- op: replace
path: /spec/rules/1/host
value: <UNIQUE SUBDOMAIN>.ngrok.io
6 changes: 3 additions & 3 deletions e2e-fixtures/hello-world-ingress/hello-world-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
name: nginx
port:
number: 80
- host: bezek-hello-world-ingress-2.ngrok.io
- host: SET-VIA-config.yaml
http:
paths:
- path: /test
Expand Down Expand Up @@ -59,7 +59,7 @@ metadata:
spec:
ingressClassName: ngrok
rules:
- host: bezek-hello-world-ingress-2.ngrok.io
- host: SET-VIA-config.yaml
http:
paths:
- path: /second
Expand Down Expand Up @@ -146,4 +146,4 @@ spec:
protocol: TCP
targetPort: 80
selector:
app: nginx
app: nginx
8 changes: 7 additions & 1 deletion e2e-fixtures/hello-world-ingress/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ patchesJson6902:
version: v1
kind: Ingress
name: minimal-ingress
path: config.yaml
path: config.yaml
- target:
group: networking.k8s.io
version: v1
kind: Ingress
name: minimal-ingress-pt2
path: config-pt2.yaml
2 changes: 1 addition & 1 deletion e2e-fixtures/ingress-class/e2e-expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ config.yaml:
"/": "HTTP/2 200"
config-different.yaml:
paths:
"/": "HTTP/1.1 404 Not Found"
"/": "HTTP/2 404"
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
go-tools
golangci-lint
kubernetes-helm
jq
yq
];
};
}));
Expand Down
4 changes: 2 additions & 2 deletions helm/ingress-controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This is the helm chart to install the ngrok ingress controller
## Prerequisites

The cluster Must be setup with a secret named `ngrok-ingress-controller-credentials` with the following keys:
* NGROK\_AUTHTOKEN
* NGROK\_API\_KEY
* AUTHTOKEN
* API\_KEY

## Install the controller with helm

Expand Down
16 changes: 14 additions & 2 deletions scripts/e2e.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ kubectl config set-context --current --namespace=$namespace

# TODO: Use ngrok cli api to delete all edges owned by the ingress controller

echo "~~~ Validating dependencies"
for prog in jq yq
do
PROGPATH=`which $prog || echo ''`
if [ "${PROGPATH:-}" == "" ]
then
echo "Program '$prog' not found, please install it. Exiting"
exit
fi
done

echo "~~~ Cleaning up previous deploy of e2e-fixtures"
for example in $(ls -d e2e-fixtures/*)
do
Expand All @@ -29,7 +40,7 @@ echo "--- Deploying ngrok-ingress-controller"
make deploy

echo "--- Deploying e2e-fixtures"
if [ "$GOOGLE_CLIENT_ID" != "" ]
if [ "${GOOGLE_CLIENT_ID:-}" != "" ]
then
kubectl create secret generic ngrok-corp-ingress-oauth-credentials \
--from-literal=ClientID=$GOOGLE_CLIENT_ID \
Expand All @@ -40,6 +51,7 @@ do
kubectl apply -k $example || true
done

echo "--- Waiting for deployment"
sleep 120

# Run tests
Expand Down Expand Up @@ -84,4 +96,4 @@ then
echo "!!! Tests Failed!"
exit 1
fi
echo "Tests Passed."
echo "Tests Passed."