-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test starting an ngrok agent in CI (#523)
* Add ngrok-agent ci step * Add bindings e2e tests * Move more e2e tests to Makefile targets * Add bindings chainsaw tests * Add chainsaw tests for bindings services * Try with more dollar signs * Add make to action * Try with alpine and make * Try with github.workspace volume mount * Add static assets to e2e-fixtures ; Update Makefile * Add tcp bindings e2e test * With /bin/sh * With different dir * Try with volume mount * With debian * With different envar approach * With --detach * With 60s * With chainsaw timeouts instead * Test with 10m timeout * With different assertion * With ubuntu apt ngrok rather than docker * With ubuntu apt ngrok rather than docker * With ubuntu apt ngrok rather than docker * No directory to cd * With direct asserts * With debug step * With trues * With sleep * With dump logs * Even more logs * With dump Secret/ngrok-operator-default-tls * Adjust chainsaw tests to ensure tls.crt is valid * Remove superfluous docker-build step * Remove accidental extra steps * With specific IMG * With specific IMG * With error on ngrok-op doesn't start * With handling registry formatting * With different k3s action * Cleanup * Ensure tlsSecret is set to the found/created secret * Remove rebase artifacts
- Loading branch information
Showing
7 changed files
with
236 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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 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 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 @@ | ||
Hello from ngrok-operator |
This file contains 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 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 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,111 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
name: bindings | ||
spec: | ||
timeouts: | ||
assert: 3m | ||
steps: | ||
- name: assert BoundEndpoint http://assets-denied.example is denied | ||
try: | ||
- assert: | ||
resource: | ||
apiVersion: bindings.k8s.ngrok.com/v1alpha1 | ||
kind: BoundEndpoint | ||
metadata: | ||
name: ngrok-238b1294-28ba-5de5-8713-8a2928d8a2f9 # stable hash | ||
namespace: ngrok-operator | ||
spec: | ||
allowed: false | ||
endpointURI: "http://assets-denied.example:80" | ||
scheme: "http" | ||
# port: <-- port is allocated and may be out of order, do not assert | ||
target: | ||
service: "assets-denied" | ||
namespace: "example" | ||
protocol: TCP | ||
port: 80 | ||
status: | ||
~.(endpoints): | ||
status: "denied" | ||
|
||
- name: assert BoundEndpoint http://assets-allowed.e2e is bound | ||
try: | ||
- assert: | ||
resource: | ||
apiVersion: bindings.k8s.ngrok.com/v1alpha1 | ||
kind: BoundEndpoint | ||
metadata: | ||
name: ngrok-adb90775-7749-5b56-92f4-d52ee756975b # stable hash | ||
namespace: ngrok-operator | ||
spec: | ||
allowed: true | ||
endpointURI: "http://assets-allowed.e2e:80" | ||
scheme: "http" | ||
# port: <-- port is allocated and may be out of order, do not assert | ||
target: | ||
service: "assets-allowed" | ||
namespace: "e2e" | ||
protocol: TCP | ||
port: 80 | ||
status: | ||
~.(endpoints): | ||
status: "bound" | ||
# TargetService | ||
- assert: | ||
resource: | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: assets-allowed | ||
namespace: e2e | ||
spec: | ||
type: ExternalName | ||
externalName: ngrok-adb90775-7749-5b56-92f4-d52ee756975b.ngrok-operator.svc.cluster.local # stable hash | ||
~.(ports): | ||
name: http | ||
port: 80 | ||
targetPort: 80 | ||
protocol: TCP | ||
# UpstreamService | ||
- assert: | ||
resource: | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: ngrok-adb90775-7749-5b56-92f4-d52ee756975b # stable hash | ||
namespace: ngrok-operator | ||
spec: | ||
type: ClusterIP | ||
~.(ports): | ||
name: http | ||
port: 80 | ||
# targetPort: < -- port is allocated and may be out of order, do not assert | ||
protocol: TCP | ||
|
||
- name: test assets retrieval via BoundEndpoint TargetService | ||
try: | ||
- script: | ||
content: | | ||
# See contents in `make e2e-start-ngrok` task | ||
WANT="Hello from ngrok-operator" | ||
# 2>/dev/null to suppress kubectl default output | ||
# first line is the contents, last line in "deleted pod" message | ||
# remove newline to compare strings directly | ||
GOT=$(kubectl run --restart=Never --rm --attach --image=dersimn/netutils net-utils -- curl -s http://assets-allowed.e2e/hello_world.txt 2>/dev/null | head -n1 | tr -d '\n') | ||
[ $? -eq 0 ] || { echo "Failed to retrieve assets"; exit 1; } | ||
[ "$GOT" = "$WANT" ] || { echo "Incorrect assets content: want '$WANT', got '$GOT'"; exit 1; } | ||
- name: test tcp connection via BoundEndpoint UpstreamService | ||
try: | ||
- script: | ||
content: | | ||
WANT_REGEX="Connection to tcp-echo\.e2e .* 4242 port .* succeeded" | ||
# 2>/dev/null to suppress kubectl default output | ||
# first line is the contents, last line in "deleted pod" message | ||
GOT=$(kubectl run --restart=Never --rm --attach --image=dersimn/netutils net-utils -- nc -zv tcp-echo.e2e 4242 2>/dev/null | head -n1) | ||
[ $? -eq 0 ] || { echo "Failed to establish tcp connection"; exit 1; } | ||
(echo "$GOT" | grep -q "$WANT_REGEX") || { echo "Unexpected nc output: want '$WANT_REGEX' got '$GOT'"; exit 1; } |
This file contains 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