mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-20 13:30:46 +02:00
helm: drop the API server rule from the admin policy
No seaweedfs binary talks to the Kubernetes API - there is no client-go in go.mod - so the rule granted admin an egress path it never uses, and forced anyone running admin with egress on to name an API server address for it. The pod-RW ClusterRole the comment was reasoning from is a leftover from a migration and is not read by any component.
This commit is contained in:
@@ -1072,15 +1072,31 @@ jobs:
|
||||
if not failed:
|
||||
print("every policy allows DNS when egress is on")
|
||||
|
||||
# The API server rule goes only to the components that talk to it.
|
||||
# The API server rule goes only to what talks to it, which is the COSI
|
||||
# sidecar and, on an upgrade that grows a PVC, the resize hook. No
|
||||
# seaweedfs binary does - there is no client-go in go.mod - so admin
|
||||
# must not be in here: it would force everyone running admin to name an
|
||||
# API server address for a connection that is never made.
|
||||
apiserver = {c for c, p in pols.items()
|
||||
if any("ipBlock" in t for r in p["spec"]["egress"] for t in r.get("to") or [])}
|
||||
expected = {"admin", "objectstorage-provisioner"}
|
||||
expected = {"objectstorage-provisioner"}
|
||||
if apiserver != expected:
|
||||
failed.append(f"API server egress granted to {sorted(apiserver)}, expected {sorted(expected)}")
|
||||
else:
|
||||
print(f"API server egress limited to {sorted(expected)}")
|
||||
|
||||
# Which means egress on its own must render for a release that runs
|
||||
# neither COSI nor a resize: no component of it reaches the API server,
|
||||
# so nothing may demand a CIDR for one.
|
||||
for label, values in {"defaults": {}, "admin": {"admin.enabled": "true"}}.items():
|
||||
try:
|
||||
render(dict(values, **{"networkPolicy.enabled": "true",
|
||||
"networkPolicy.egress.enabled": "true"}))
|
||||
print(f"egress on {label} renders without kubeApiServer.cidrs")
|
||||
except subprocess.CalledProcessError as e:
|
||||
failed.append(f"{label}: egress needs kubeApiServer.cidrs but nothing "
|
||||
f"in the release talks to the API server: {(e.output or '')[:200]}")
|
||||
|
||||
# The resize hook's policy is gated on the same lookup as its Job, so
|
||||
# neither is ever in a rendered set - a policy on its own would be an
|
||||
# orphaned hook resource on every install, since Helm does not collect
|
||||
|
||||
Reference in New Issue
Block a user