gcloud-lab/apps/base/customer1/trading-platform/network-policies/trading-network-policies.yaml
Sirius Devops b0748538c0 feat: add trading-platform K8s manifests for customer1
- Scaffold trading-platform under apps/base/customer1/trading-platform/
- Add 4 microservice deployments: data-service, execute-service, news-service, dashboard
- Add ConfigMaps with DB/Kafka/Redis connection configs
- Add HTTPRoutes via Gateway API (external-http-gateway)
- Add NetworkPolicies for inter-service and DB/Kafka/Redis egress
- Add SOPS-encrypted secrets (age key)
- Add Kafka (KRaft) and Redis infrastructure to hermes-db/
- Update root and staging kustomizations

All containers: non-root, readOnlyRootFilesystem, resource limits, health probes
Images: ghcr.io/sirius0xdev/trading-{service}:latest
2026-05-21 04:17:05 +00:00

109 lines
2.5 KiB
YAML

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: trading-platform-netpol
namespace: customer1
spec:
podSelector:
matchExpressions:
- key: app
operator: In
values:
- trading-data-service
- trading-execute-service
- trading-news-service
- trading-dashboard
policyTypes:
- Ingress
- Egress
ingress:
# Allow from Gateway / ingress controller
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: customer1
ports:
- port: 8000
protocol: TCP
- port: 8001
protocol: TCP
- port: 8002
protocol: TCP
- port: 8003
protocol: TCP
# Allow inter-service communication
- from:
- podSelector:
matchExpressions:
- key: app
operator: In
values:
- trading-data-service
- trading-execute-service
- trading-news-service
- trading-dashboard
ports:
- port: 8000
protocol: TCP
- port: 8001
protocol: TCP
- port: 8002
protocol: TCP
- port: 8003
protocol: TCP
egress:
# Allow DNS
- to:
- namespaceSelector: {}
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
# Allow DB access
- to:
- podSelector:
matchLabels:
cnpg.io/cluster: hermes-pgdb
ports:
- port: 5432
protocol: TCP
# Allow Redis access
- to:
- podSelector:
matchLabels:
app: trading-redis
ports:
- port: 6379
protocol: TCP
# Allow Kafka access
- to:
- podSelector:
matchLabels:
app: trading-kafka
ports:
- port: 9092
protocol: TCP
# Allow inter-service egress
- to:
- podSelector:
matchExpressions:
- key: app
operator: In
values:
- trading-data-service
- trading-execute-service
- trading-news-service
- trading-dashboard
ports:
- port: 8000
protocol: TCP
- port: 8001
protocol: TCP
- port: 8002
protocol: TCP
- port: 8003
protocol: TCP