Watch
0
0
Fork
You've already forked hyperhive
0

k8s: deny ingress to every pod by default

This commit is contained in:
atlas 2026-11-27 15:10:15 +01:00 • committed by mara
commit 51ae57fb02

View file

@ -687,6 +687,18 @@ pkgs.testers.runNixOSTest {
machine.wait_until_fails(dials(other, ip, METRICS), timeout=120)
for _ in range(3):
assert machine.execute(dials(other, ip, METRICS))[0] != 0
# The responder's health port answers the node with a status and is
# closed to the same two sources: the namespace's default admits the
# node and nobody else, and the pod's own policy names the client port
# only.
code = machine.succeed(f"curl -s -o /dev/null -w '%{{http_code}}' --max-time 5 http://{pod_ip}:8080/healthz").strip()
assert code == "200", code
machine.wait_until_fails(dials(other, pod_ip, 8080), timeout=120)
for port in (8080, METRICS):
assert machine.execute(dials(other, pod_ip, port))[0] != 0, port
assert machine.execute(f"ip netns exec agent nc -z -w 4 {pod_ip} {port}")[0] != 0, port
deny = json.loads(kube(machine, "get networkpolicy default-deny-ingress -o json"))["spec"]
assert deny == {"podSelector": {}, "policyTypes": ["Ingress"]}, deny
with subtest("a leaf that has to be issued again is issued beside the running server, which reloads it for new connections"):
uid = pod(machine, pod_name)["metadata"]["uid"]