Files
homelab/k8s/infra/forgejo-runner/templates/networkpolicy.yaml
T
Story Crater Bot 720181c900 feat: let the runner build and the cluster pull from the Forgejo registry
- Runner egress: allow 192.168.1.160/32:443. forgejo.riotpiao.com resolves to
  the ingress LB, inside the 192.168.1.0/24 block the NetworkPolicy denies, so
  docker push hung until timeout.
- dind CA: also mount homelab-ca at /etc/docker/certs.d/forgejo.riotpiao.com/,
  the path dockerd actually reads for per-registry trust.
- Pull secret: dockerconfigjson for the api namespace; /v2/ answers 401.
- AppProject: allow the Forgejo repo as a source for api-gw.
2026-08-19 21:48:01 -07:00

42 lines
1.2 KiB
YAML

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ .Release.Name }}-egress
namespace: {{ .Release.Namespace }}
spec:
podSelector:
matchLabels:
app: {{ .Release.Name }}
policyTypes: [Egress]
egress:
# Forgejo — same cicd namespace (git push, registry push/pull)
- to:
- podSelector: {}
# CoreDNS
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
ports:
- protocol: UDP
port: 53
- protocol: TCP
port: 53
# Internet (action deps, base images) — never LAN or pod network
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 192.168.1.0/24
- 10.244.0.0/16
# Single LAN exception: the ingress-nginx LoadBalancer, which is how
# forgejo.riotpiao.com resolves. Image pushes go to that name so the tag
# matches what containerd pulls on the nodes; without this the whole /24 is
# denied above and `docker push` hangs until it times out.
- to:
- ipBlock:
cidr: {{ .Values.egress.ingressLoadBalancerIP }}/32
ports:
- protocol: TCP
port: 443