Skip to content

Commit b75a50f

Browse files
authored
fix(helm): confine the PII service with its NetworkPolicy whenever pii is enabled (#10051)
1 parent ddcdb14 commit b75a50f

4 files changed

Lines changed: 54 additions & 43 deletions

File tree

‎helm/sim/Chart.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: sim
33
description: A Helm chart for Sim - the open-source AI workspace where teams build, deploy, and manage AI agents
44
type: application
5-
version: 1.11.18
5+
version: 1.11.19
66
appVersion: "v0.8.26"
77
kubeVersion: ">=1.25.0-0"
88
home: https://sim.ai

‎helm/sim/templates/networkpolicy.yaml‎

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -348,42 +348,6 @@ spec:
348348
port: 443
349349
{{- end }}
350350

351-
{{- if .Values.pii.enabled }}
352-
---
353-
# Network Policy for the PII (Presidio) service
354-
apiVersion: networking.k8s.io/v1
355-
kind: NetworkPolicy
356-
metadata:
357-
name: {{ include "sim.fullname" . }}-pii
358-
namespace: {{ .Release.Namespace }}
359-
labels:
360-
{{- include "sim.pii.labels" . | nindent 4 }}
361-
spec:
362-
podSelector:
363-
matchLabels:
364-
{{- include "sim.pii.selectorLabels" . | nindent 6 }}
365-
policyTypes:
366-
- Ingress
367-
- Egress
368-
ingress:
369-
# Allow ingress from main application
370-
- from:
371-
- podSelector:
372-
matchLabels:
373-
{{- include "sim.app.selectorLabels" . | nindent 10 }}
374-
ports:
375-
- protocol: TCP
376-
port: {{ .Values.pii.service.targetPort }}
377-
egress:
378-
# Allow DNS resolution. Models are baked into the image, so no external egress.
379-
- to: []
380-
ports:
381-
- protocol: UDP
382-
port: 53
383-
- protocol: TCP
384-
port: 53
385-
{{- end }}
386-
387351
{{- if .Values.telemetry.enabled }}
388352
---
389353
# Network Policy for OpenTelemetry Collector
@@ -515,3 +479,39 @@ spec:
515479
port: 53
516480
{{- end }}
517481
{{- end }}
482+
483+
{{- if .Values.pii.enabled }}
484+
---
485+
# Network Policy for the PII (Presidio) service. Outside the networkPolicy.enabled guard: the service has no auth.
486+
apiVersion: networking.k8s.io/v1
487+
kind: NetworkPolicy
488+
metadata:
489+
name: {{ include "sim.fullname" . }}-pii
490+
namespace: {{ .Release.Namespace }}
491+
labels:
492+
{{- include "sim.pii.labels" . | nindent 4 }}
493+
spec:
494+
podSelector:
495+
matchLabels:
496+
{{- include "sim.pii.selectorLabels" . | nindent 6 }}
497+
policyTypes:
498+
- Ingress
499+
- Egress
500+
ingress:
501+
# Allow ingress from main application
502+
- from:
503+
- podSelector:
504+
matchLabels:
505+
{{- include "sim.app.selectorLabels" . | nindent 10 }}
506+
ports:
507+
- protocol: TCP
508+
port: {{ .Values.pii.service.targetPort }}
509+
egress:
510+
# Allow DNS resolution. Models are baked into the image, so no external egress.
511+
- to: []
512+
ports:
513+
- protocol: UDP
514+
port: 53
515+
- protocol: TCP
516+
port: 53
517+
{{- end }}

‎helm/sim/tests/pii_test.yaml‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,27 @@ tests:
106106
- protocol: TCP
107107
port: 5001
108108

109-
- it: renders a dedicated NetworkPolicy for the PII service
109+
- it: confines the PII service to app pods even when networkPolicy.enabled=false
110110
template: networkpolicy.yaml
111111
set:
112-
networkPolicy.enabled: true
113112
pii.enabled: true
114-
documentSelector:
115-
path: metadata.name
116-
value: t-sim-pii
117113
asserts:
118-
- isKind: { of: NetworkPolicy }
114+
- hasDocuments: { count: 1 }
119115
- equal:
120116
path: spec.podSelector.matchLabels["app.kubernetes.io/component"]
121117
value: pii
118+
- equal:
119+
path: spec.ingress
120+
value:
121+
- from:
122+
- podSelector:
123+
matchLabels:
124+
app.kubernetes.io/name: sim
125+
app.kubernetes.io/instance: t
126+
app.kubernetes.io/component: app
127+
ports:
128+
- protocol: TCP
129+
port: 5001
122130

123131
- it: pii pod inherits global tolerations (not component-scoped)
124132
template: deployment-pii.yaml

‎helm/sim/values.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,9 @@ ollama:
947947
# Guardrails PII block and configured data-retention masking work. Set
948948
# app.env.INTERNAL_API_BASE_URL to the in-cluster app service URL (the redaction path calls the app's own
949949
# /api/guardrails/mask-batch, which must be reachable from inside the cluster).
950+
# The service has no authentication, so its NetworkPolicy (ingress from app pods
951+
# only, DNS-only egress) renders whenever pii.enabled, even when
952+
# networkPolicy.enabled is false. Your CNI must enforce NetworkPolicy for it to apply.
950953
pii:
951954
# Enable/disable the PII redaction service
952955
enabled: false

0 commit comments

Comments
 (0)