ProofedMesh/deploy/approval-service/40-networkpolicy.yaml

104 lines
3.3 KiB
YAML
Raw Permalink Normal View History

# NetworkPolicy for approval-service.
#
# Cluster-wide NetworkPolicy enforcement is already active on BasicStack
# (see cluster memory on NetworkPolicy activation). Any pod in agent-trust
# without a policy is isolated by default; this file is the explicit
# allow-list for approval-service.
#
# Ingress: only from the Pangolin ingress edge (public traffic terminates
# at Pangolin/Traefik; nothing in-cluster calls approval-service
# directly in Phase 1).
# Egress: signing-service (:8081) + transparency-log (:8080) in
# agent-trust, Pocket-ID (:1411) for OIDC discovery/JWKS, DNS, and (once
# trust-pg lands) a Postgres :5432 egress to trust-pg in agent-trust.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: approval-service
namespace: agent-trust
labels:
app.kubernetes.io/name: approval-service
app.kubernetes.io/part-of: proofedmesh
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: approval-service
policyTypes:
- Ingress
- Egress
ingress:
# Public traffic reaches approval-service via the Pangolin resource,
# but the actual TCP connection is made by the Traefik ingress pod
# in kube-system (Pangolin only renders the Traefik config; it does
# not sit in the request path). Keep this list conservative — add
# additional callers on demand, not speculatively.
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
app.kubernetes.io/name: traefik
ports:
- port: 8080
protocol: TCP
egress:
# signing-service (ADR-0005 signer) + transparency-log (Trillian frontend)
# live in the same agent-trust namespace; future trust-pg will too.
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: agent-trust
podSelector:
matchLabels:
app.kubernetes.io/name: signing-service
ports:
- port: 8081
protocol: TCP
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: agent-trust
podSelector:
matchLabels:
app.kubernetes.io/name: transparency-log
ports:
- port: 8080
protocol: TCP
# Future trust-pg Postgres egress — pre-authorised here so the pod
# does not need a NetworkPolicy edit when DEV-607's prod store lands.
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: agent-trust
podSelector:
matchLabels:
app.kubernetes.io/name: trust-pg
ports:
- port: 5432
protocol: TCP
# Pocket-ID for OIDC discovery + token endpoint.
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: pocket-id
podSelector:
matchLabels:
app: pocket-id
ports:
- port: 1411
protocol: TCP
# DNS egress to kube-system CoreDNS.
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP