m/test/e2e: test NodePort
This was originally written as a test for validating fixes for
the issue that NodePort was not working if any non-local pods were in
the NodePort service, even for externalTrafficPolicy: cluster services.
As it turns out CL:2795 fixed this, the changes in previous versions of
this CL broke it again. So now it just consists of the test itself,
which passes.
Change-Id: If4cf4ffc46a5456b4defa330776e043593e61b29
Reviewed-on: https://review.monogon.dev/c/monogon/+/1924
Tested-by: Jenkins CI
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
diff --git a/metropolis/test/e2e/httpserver/main.go b/metropolis/test/e2e/httpserver/main.go
new file mode 100644
index 0000000..3b593db
--- /dev/null
+++ b/metropolis/test/e2e/httpserver/main.go
@@ -0,0 +1,19 @@
+// httpserver serves a test HTTP endpoint for E2E testing.
+package main
+
+import (
+ "net/http"
+ "os"
+)
+
+func main() {
+ nodeName := os.Getenv("NODE_NAME")
+ http.ListenAndServe(":8080", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("X-Node-Name", nodeName)
+ w.Header().Set("X-Remote-IP", r.RemoteAddr)
+ w.WriteHeader(http.StatusOK)
+ // Send a big chunk to root out MTU/MSS issues.
+ testPayload := make([]byte, 2000)
+ w.Write(testPayload)
+ }))
+}