feat: Add NetworkPolicy for Ollama security on high-performance branch (Task 3)

This commit is contained in:
sync-test 2026-07-06 01:50:32 +05:30
parent 8f777775c9
commit b709d31b67

View file

@ -0,0 +1,53 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: ollama-ingress-restriction
namespace: nxtgauge-ai
labels:
app: ollama
spec:
podSelector:
matchLabels:
app: ollama
policyTypes:
- Ingress
ingress:
# Allow traffic from users service (port 11434)
- from:
- namespaceSelector:
matchLabels:
name: default
podSelector:
matchLabels:
app: users
ports:
- protocol: TCP
port: 11434
# Allow traffic from payments service
- from:
- namespaceSelector:
matchLabels:
name: default
podSelector:
matchLabels:
app: payments
ports:
- protocol: TCP
port: 11434
# Allow traffic from nxtgauge-ai-assistant service
- from:
- namespaceSelector:
matchLabels:
name: nxtgauge-ai
podSelector:
matchLabels:
app: nxtgauge-ai-assistant
ports:
- protocol: TCP
port: 11434
# Allow traffic from within the same namespace (for health checks, etc.)
- from:
- podSelector: {}
ports:
- protocol: TCP
port: 11434