From fa292c6a57e7484eec6961dca8a02f39576bc9d3 Mon Sep 17 00:00:00 2001 From: Ryan Conway Date: Thu, 12 Nov 2026 18:49:39 +0000 Subject: [PATCH] Allow egress to S3 from the fileServer, with support for optional CIDR ranges. --- helm/codeapi/templates/network-policy.yaml | 16 ++++++++++++++++ helm/codeapi/values.yaml | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/helm/codeapi/templates/network-policy.yaml b/helm/codeapi/templates/network-policy.yaml index fe24123f..be0ac66f 100644 --- a/helm/codeapi/templates/network-policy.yaml +++ b/helm/codeapi/templates/network-policy.yaml @@ -246,6 +246,22 @@ spec: - protocol: TCP port: 9000 {{- end }} + {{- if .Values.fileServer.s3.enabled }} + {{- with .Values.networkPolicy.fileServer.s3CIDRs }} + {{- range . }} + - to: + - ipBlock: + cidr: {{ . | quote }} + ports: + - protocol: TCP + port: 443 + {{- end }} + {{- else }} + - ports: + - protocol: TCP + port: 443 + {{- end }} + {{- end }} {{- include "codeapi.redisEgress" . | nindent 4 }} --- apiVersion: networking.k8s.io/v1 diff --git a/helm/codeapi/values.yaml b/helm/codeapi/values.yaml index 33c32af0..8c35c4b4 100644 --- a/helm/codeapi/values.yaml +++ b/helm/codeapi/values.yaml @@ -539,5 +539,14 @@ networkPolicy: # egress on the configured Redis port to any destination because standard # Kubernetes NetworkPolicy cannot target redis.external.host by DNS name. externalCIDRs: [] + fileServer: + # Used only when fileServer.s3.enabled=true, to allow egress to S3 (and STS, + # with IRSA). If empty, NetworkPolicy permits TCP egress on 443 to any + # destination, because standard Kubernetes NetworkPolicy cannot target the + # S3 and STS endpoints by DNS name. To restrict it, list e.g. the subnets of + # your S3 and STS VPC interface endpoints, or the S3 ranges published at + # https://ip-ranges.amazonaws.com/ip-ranges.json. Note: Those change over time, + # and don't include STS, which IRSA also needs. + s3CIDRs: [] toolCallServer: allowExternalEgress: false # Allow tool call server to reach external APIs