Merge fix/internet-egress-and-tags (world egress per class + image tags)
This commit is contained in:
14 files changed
+221
-5
No files matched your search
@@ -123,6 +123,22 @@ spec:
|
|||||||
- port: '3000'
|
- port: '3000'
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
---
|
---
|
||||||
|
# CiliumNetworkPolicy internet/world egress (internet class, R-NET-05): gitea-allow-internet-egress
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: gitea-allow-internet-egress
|
||||||
|
namespace: gitea
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: gitea
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: gitea
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- world
|
||||||
|
---
|
||||||
# HTTPRoute gitea-3000 (R-TLS/R-DNS)
|
# HTTPRoute gitea-3000 (R-TLS/R-DNS)
|
||||||
apiVersion: gateway.networking.k8s.io/v1
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
kind: HTTPRoute
|
kind: HTTPRoute
|
||||||
|
|||||||
+17
-1
@@ -76,7 +76,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: jackett
|
- name: jackett
|
||||||
image: lscr.io/linuxserver/jackett:0.22.1327
|
image: lscr.io/linuxserver/jackett:latest
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 9117
|
- containerPort: 9117
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@@ -123,6 +123,22 @@ spec:
|
|||||||
- port: '9117'
|
- port: '9117'
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
---
|
---
|
||||||
|
# CiliumNetworkPolicy internet/world egress (vpn class, R-NET-05): jackett-allow-internet-egress
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: jackett-allow-internet-egress
|
||||||
|
namespace: jackett
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: jackett
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: jackett
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- world
|
||||||
|
---
|
||||||
# HTTPRoute jackett-9117 (R-TLS/R-DNS)
|
# HTTPRoute jackett-9117 (R-TLS/R-DNS)
|
||||||
apiVersion: gateway.networking.k8s.io/v1
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
kind: HTTPRoute
|
kind: HTTPRoute
|
||||||
|
|||||||
@@ -123,6 +123,22 @@ spec:
|
|||||||
- port: '80'
|
- port: '80'
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
---
|
---
|
||||||
|
# CiliumNetworkPolicy internet/world egress (internet class, R-NET-05): pihole-allow-internet-egress
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: pihole-allow-internet-egress
|
||||||
|
namespace: pihole
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: pihole
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: pihole
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- world
|
||||||
|
---
|
||||||
# HTTPRoute pihole-80 (R-TLS/R-DNS)
|
# HTTPRoute pihole-80 (R-TLS/R-DNS)
|
||||||
apiVersion: gateway.networking.k8s.io/v1
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
kind: HTTPRoute
|
kind: HTTPRoute
|
||||||
|
|||||||
+17
-1
@@ -73,7 +73,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: plex
|
- name: plex
|
||||||
image: plexinc/pms-docker:1.41.3.9314-a0bfa8370
|
image: plexinc/pms-docker:latest
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 32400
|
- containerPort: 32400
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@@ -120,6 +120,22 @@ spec:
|
|||||||
- port: '32400'
|
- port: '32400'
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
---
|
---
|
||||||
|
# CiliumNetworkPolicy internet/world egress (internet class, R-NET-05): plex-allow-internet-egress
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: plex-allow-internet-egress
|
||||||
|
namespace: plex
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: plex
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: plex
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- world
|
||||||
|
---
|
||||||
# HTTPRoute plex-32400 (R-TLS/R-DNS)
|
# HTTPRoute plex-32400 (R-TLS/R-DNS)
|
||||||
apiVersion: gateway.networking.k8s.io/v1
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
kind: HTTPRoute
|
kind: HTTPRoute
|
||||||
|
|||||||
@@ -123,6 +123,22 @@ spec:
|
|||||||
- port: '8080'
|
- port: '8080'
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
---
|
---
|
||||||
|
# CiliumNetworkPolicy internet/world egress (vpn class, R-NET-05): qbittorrent-allow-internet-egress
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: qbittorrent-allow-internet-egress
|
||||||
|
namespace: qbittorrent
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: qbittorrent
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: qbittorrent
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- world
|
||||||
|
---
|
||||||
# HTTPRoute qbittorrent-8080 (R-TLS/R-DNS)
|
# HTTPRoute qbittorrent-8080 (R-TLS/R-DNS)
|
||||||
apiVersion: gateway.networking.k8s.io/v1
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
kind: HTTPRoute
|
kind: HTTPRoute
|
||||||
|
|||||||
@@ -165,6 +165,22 @@ spec:
|
|||||||
- port: '7878'
|
- port: '7878'
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
---
|
---
|
||||||
|
# CiliumNetworkPolicy internet/world egress (vpn class, R-NET-05): radarr-allow-internet-egress
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: radarr-allow-internet-egress
|
||||||
|
namespace: radarr
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: radarr
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: radarr
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- world
|
||||||
|
---
|
||||||
# HTTPRoute radarr-7878 (R-TLS/R-DNS)
|
# HTTPRoute radarr-7878 (R-TLS/R-DNS)
|
||||||
apiVersion: gateway.networking.k8s.io/v1
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
kind: HTTPRoute
|
kind: HTTPRoute
|
||||||
|
|||||||
@@ -165,6 +165,22 @@ spec:
|
|||||||
- port: '8989'
|
- port: '8989'
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
---
|
---
|
||||||
|
# CiliumNetworkPolicy internet/world egress (vpn class, R-NET-05): sonarr-allow-internet-egress
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: sonarr-allow-internet-egress
|
||||||
|
namespace: sonarr
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: sonarr
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: sonarr
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- world
|
||||||
|
---
|
||||||
# HTTPRoute sonarr-8989 (R-TLS/R-DNS)
|
# HTTPRoute sonarr-8989 (R-TLS/R-DNS)
|
||||||
apiVersion: gateway.networking.k8s.io/v1
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
kind: HTTPRoute
|
kind: HTTPRoute
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
name: jackett
|
name: jackett
|
||||||
kind: container
|
kind: container
|
||||||
source:
|
source:
|
||||||
image: lscr.io/linuxserver/jackett:0.22.1327 # pinned stable tag (R-UPD-01); update.range governs advancement
|
image: lscr.io/linuxserver/jackett:latest
|
||||||
exposure: internal # LAN-only web UI at jackett.home.keithjackson.dev (docs/13 row 4; R-DNS/R-NET)
|
exposure: internal # LAN-only web UI at jackett.home.keithjackson.dev (docs/13 row 4; R-DNS/R-NET)
|
||||||
egress: vpn # indexer scraping via node PIA tunnel + kill-switch (docs/03; ADR-0015; R-NET-05/06)
|
egress: vpn # indexer scraping via node PIA tunnel + kill-switch (docs/03; ADR-0015; R-NET-05/06)
|
||||||
storage:
|
storage:
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
name: plex
|
name: plex
|
||||||
kind: container
|
kind: container
|
||||||
source:
|
source:
|
||||||
image: plexinc/pms-docker:1.41.3.9314-a0bfa8370 # pinned recent stable build (verify tag at deploy)
|
image: plexinc/pms-docker:latest
|
||||||
exposure: public # edge port-forward + public DNS; clients + Seerr reach it (docs/09; R-DNS/R-NET)
|
exposure: public # edge port-forward + public DNS; clients + Seerr reach it (docs/09; R-DNS/R-NET)
|
||||||
egress: internet # normal WAN egress (docs/03; R-NET-05)
|
egress: internet # normal WAN egress (docs/03; R-NET-05)
|
||||||
storage:
|
storage:
|
||||||
|
|||||||
+41
-1
@@ -375,6 +375,32 @@ def _route_meta(s: dict, route: dict) -> dict:
|
|||||||
return meta
|
return meta
|
||||||
|
|
||||||
|
|
||||||
|
def r_internet_egress(s: dict) -> dict:
|
||||||
|
"""North-south egress allow: let the app reach the INTERNET (Cilium reserved `world`
|
||||||
|
entity = everything outside the cluster), which is the whole point of the `egress` class
|
||||||
|
(docs/03: internet-class → WAN; vpn-class → steered through the node tun0 PIA tunnel with
|
||||||
|
the nftables kill-switch, ADR-0015). The default-deny baseline (R-NET-01) allows only DNS
|
||||||
|
so EAST-WEST stays denied; this ADDITIVE policy opens ONLY `world` (non-cluster) egress —
|
||||||
|
cluster/east-west traffic stays denied except the declared `dependencies`. Every app
|
||||||
|
declares an egress class (EGRESS_CLASSES), so every app gets this. The steering + kill-
|
||||||
|
switch (a cluster-wide singleton keyed on the egress-class pod label) decide the PATH; this
|
||||||
|
policy decides that north-south egress is ALLOWED at all.
|
||||||
|
"""
|
||||||
|
return {
|
||||||
|
"apiVersion": "cilium.io/v2",
|
||||||
|
"kind": "CiliumNetworkPolicy",
|
||||||
|
"metadata": {
|
||||||
|
"name": f"{s['name']}-allow-internet-egress",
|
||||||
|
"namespace": s["name"],
|
||||||
|
"labels": {"app.kubernetes.io/name": s["name"]},
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"endpointSelector": {"matchLabels": {"app.kubernetes.io/name": s["name"]}},
|
||||||
|
"egress": [{"toEntities": ["world"]}],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def r_httproutes(s: dict) -> list:
|
def r_httproutes(s: dict) -> list:
|
||||||
"""One HTTPRoute per ingressRoute, attaching host -> service port on the shared Gateway.
|
"""One HTTPRoute per ingressRoute, attaching host -> service port on the shared Gateway.
|
||||||
|
|
||||||
@@ -674,6 +700,15 @@ def render(sd: dict, image_automation: bool = True) -> list:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ie = r_internet_egress(s)
|
||||||
|
docs.append(
|
||||||
|
(
|
||||||
|
"CiliumNetworkPolicy world egress allow (egress class governs the path; R-NET-05): "
|
||||||
|
f"{ie['metadata']['name']}",
|
||||||
|
ie,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
for hr in r_httproutes(s):
|
for hr in r_httproutes(s):
|
||||||
docs.append((f"HTTPRoute {hr['metadata']['name']} (R-TLS/R-DNS)", hr))
|
docs.append((f"HTTPRoute {hr['metadata']['name']} (R-TLS/R-DNS)", hr))
|
||||||
|
|
||||||
@@ -781,7 +816,12 @@ def _selftest() -> int:
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
cnps = [d[1] for d in dep_docs if d[1]["kind"] == "CiliumNetworkPolicy"]
|
cnps = [d[1] for d in dep_docs if d[1]["kind"] == "CiliumNetworkPolicy"]
|
||||||
check(len(cnps) == 1, "one dependency must render one CiliumNetworkPolicy allow")
|
dep_cnps = [c for c in cnps if c["metadata"]["name"] == "y-allow-db-5432"]
|
||||||
|
check(len(dep_cnps) == 1, "one dependency must render one CiliumNetworkPolicy allow")
|
||||||
|
check(
|
||||||
|
any(c["metadata"]["name"] == "y-allow-internet-egress" for c in cnps),
|
||||||
|
"every app (egress class) must render a world/internet egress allow",
|
||||||
|
)
|
||||||
|
|
||||||
# 4b) exposure (ingressRoutes) -> an ADDITIVE gateway-ingress CiliumNetworkPolicy that
|
# 4b) exposure (ingressRoutes) -> an ADDITIVE gateway-ingress CiliumNetworkPolicy that
|
||||||
# allows ONLY the reserved `ingress` (Gateway proxy) identity to the exposed port,
|
# allows ONLY the reserved `ingress` (Gateway proxy) identity to the exposed port,
|
||||||
|
|||||||
@@ -98,6 +98,22 @@ spec:
|
|||||||
- port: '8080'
|
- port: '8080'
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
---
|
---
|
||||||
|
# CiliumNetworkPolicy world egress allow (egress class governs the path; R-NET-05): paas-demo-allow-internet-egress
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: paas-demo-allow-internet-egress
|
||||||
|
namespace: paas-demo
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: paas-demo
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: paas-demo
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- world
|
||||||
|
---
|
||||||
# HTTPRoute paas-demo-8080 (R-TLS/R-DNS)
|
# HTTPRoute paas-demo-8080 (R-TLS/R-DNS)
|
||||||
apiVersion: gateway.networking.k8s.io/v1
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
kind: HTTPRoute
|
kind: HTTPRoute
|
||||||
|
|||||||
@@ -56,6 +56,22 @@ spec:
|
|||||||
- name: baseline-demo
|
- name: baseline-demo
|
||||||
image: nginx:1.27
|
image: nginx:1.27
|
||||||
---
|
---
|
||||||
|
# CiliumNetworkPolicy world egress allow (egress class governs the path; R-NET-05): baseline-demo-allow-internet-egress
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: baseline-demo-allow-internet-egress
|
||||||
|
namespace: baseline-demo
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: baseline-demo
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: baseline-demo
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- world
|
||||||
|
---
|
||||||
# ServiceMonitor (R-OBS-01)
|
# ServiceMonitor (R-OBS-01)
|
||||||
apiVersion: monitoring.coreos.com/v1
|
apiVersion: monitoring.coreos.com/v1
|
||||||
kind: ServiceMonitor
|
kind: ServiceMonitor
|
||||||
|
|||||||
+16
@@ -123,6 +123,22 @@ spec:
|
|||||||
- port: '8989'
|
- port: '8989'
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
---
|
---
|
||||||
|
# CiliumNetworkPolicy world egress allow (egress class governs the path; R-NET-05): sonarr-allow-internet-egress
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: sonarr-allow-internet-egress
|
||||||
|
namespace: sonarr
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: sonarr
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: sonarr
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- world
|
||||||
|
---
|
||||||
# HTTPRoute sonarr-8989 (R-TLS/R-DNS)
|
# HTTPRoute sonarr-8989 (R-TLS/R-DNS)
|
||||||
apiVersion: gateway.networking.k8s.io/v1
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
kind: HTTPRoute
|
kind: HTTPRoute
|
||||||
|
|||||||
@@ -123,6 +123,22 @@ spec:
|
|||||||
- port: '8989'
|
- port: '8989'
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
---
|
---
|
||||||
|
# CiliumNetworkPolicy world egress allow (egress class governs the path; R-NET-05): sonarr-allow-internet-egress
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: sonarr-allow-internet-egress
|
||||||
|
namespace: sonarr
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: sonarr
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: sonarr
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- world
|
||||||
|
---
|
||||||
# HTTPRoute sonarr-8989 (R-TLS/R-DNS)
|
# HTTPRoute sonarr-8989 (R-TLS/R-DNS)
|
||||||
apiVersion: gateway.networking.k8s.io/v1
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
kind: HTTPRoute
|
kind: HTTPRoute
|
||||||
|
|||||||
Reference in new issue
Block a user