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
This commit is contained in:
Sirius Devops 2026-05-21 04:08:58 +00:00
commit b0748538c0
29 changed files with 929 additions and 1 deletions

View file

@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: trading-dashboard-config
namespace: customer1
data:
DB_HOST: "hermes-pgdb-rw.customer1.svc.cluster.local"
DB_PORT: "5432"
DB_NAME: "trading_data"
DATA_SERVICE_URL: "http://trading-data-service.customer1.svc.cluster.local"
EXECUTE_SERVICE_URL: "http://trading-execute-service.customer1.svc.cluster.local"
NEWS_SERVICE_URL: "http://trading-news-service.customer1.svc.cluster.local"

View file

@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: trading-data-service-config
namespace: customer1
data:
DB_HOST: "hermes-pgdb-rw.customer1.svc.cluster.local"
DB_PORT: "5432"
DB_NAME: "trading_data"
REDIS_HOST: "trading-redis.customer1.svc.cluster.local"
REDIS_PORT: "6379"
KAFKA_BROKER: "trading-kafka.customer1.svc.cluster.local:9092"
LOG_LEVEL: "info"

View file

@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: trading-execute-service-config
namespace: customer1
data:
DB_HOST: "hermes-pgdb-rw.customer1.svc.cluster.local"
DB_PORT: "5432"
DB_NAME: "trading_data"
REDIS_HOST: "trading-redis.customer1.svc.cluster.local"
REDIS_PORT: "6379"
KAFKA_BROKER: "trading-kafka.customer1.svc.cluster.local:9092"
LOG_LEVEL: "info"

View file

@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- data-service-config.yaml
- execute-service-config.yaml
- news-service-config.yaml
- dashboard-config.yaml

View file

@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: trading-news-service-config
namespace: customer1
data:
DB_HOST: "hermes-pgdb-rw.customer1.svc.cluster.local"
DB_PORT: "5432"
DB_NAME: "trading_data"
REDIS_HOST: "trading-redis.customer1.svc.cluster.local"
REDIS_PORT: "6379"
NEWS_FETCH_INTERVAL: "300"
LOG_LEVEL: "info"

View file

@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: trading-dashboard
namespace: customer1
labels:
app: trading-dashboard
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: trading-dashboard
template:
metadata:
labels:
app: trading-dashboard
annotations:
checksum/config: trading-dashboard-config
spec:
terminationGracePeriodSeconds: 30
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 1000
containers:
- name: dashboard
image: ghcr.io/sirius0xdev/trading-dashboard:latest
imagePullPolicy: Always
ports:
- containerPort: 8000
name: http
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
envFrom:
- configMapRef:
name: trading-dashboard-config
env:
- name: DB_USER
valueFrom:
secretKeyRef:
name: trading-db-credentials
key: username
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: trading-db-credentials
key: password
startupProbe:
httpGet:
path: /api/health
port: 8000
initialDelaySeconds: 15
periodSeconds: 5
failureThreshold: 6
livenessProbe:
httpGet:
path: /api/health
port: 8000
initialDelaySeconds: 30
periodSeconds: 30
readinessProbe:
httpGet:
path: /api/health
port: 8000
initialDelaySeconds: 5
periodSeconds: 10

View file

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml

View file

@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: trading-dashboard-svc
namespace: customer1
annotations:
tailscale.com/expose: "true"
tailscale.com/hostname: "trading-dashboard"
tailscale.com/tags: "tag:k8s-operator"
tailscale.com/ports: "http:80"
spec:
selector:
app: trading-dashboard
ports:
- port: 80
targetPort: 8000
name: http
type: ClusterIP

View file

@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: trading-data-service
namespace: customer1
labels:
app: trading-data-service
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: trading-data-service
template:
metadata:
labels:
app: trading-data-service
annotations:
checksum/config: trading-data-service-config
spec:
terminationGracePeriodSeconds: 30
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 1000
containers:
- name: data-service
image: ghcr.io/sirius0xdev/trading-data-service:latest
imagePullPolicy: Always
ports:
- containerPort: 8001
name: http
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
envFrom:
- configMapRef:
name: trading-data-service-config
env:
- name: DB_USER
valueFrom:
secretKeyRef:
name: trading-db-credentials
key: username
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: trading-db-credentials
key: password
startupProbe:
httpGet:
path: /health
port: 8001
initialDelaySeconds: 15
periodSeconds: 5
failureThreshold: 6
livenessProbe:
httpGet:
path: /health
port: 8001
initialDelaySeconds: 30
periodSeconds: 30
readinessProbe:
httpGet:
path: /health
port: 8001
initialDelaySeconds: 5
periodSeconds: 10

View file

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml

View file

@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: trading-data-service
namespace: customer1
annotations:
tailscale.com/expose: "true"
tailscale.com/hostname: "trading-data-service"
tailscale.com/tags: "tag:k8s-operator"
tailscale.com/ports: "http:80"
spec:
selector:
app: trading-data-service
ports:
- port: 80
targetPort: 8001
name: http
type: ClusterIP

View file

@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: trading-execute-service
namespace: customer1
labels:
app: trading-execute-service
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: trading-execute-service
template:
metadata:
labels:
app: trading-execute-service
annotations:
checksum/config: trading-execute-service-config
spec:
terminationGracePeriodSeconds: 30
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 1000
containers:
- name: execute-service
image: ghcr.io/sirius0xdev/trading-execute-service:latest
imagePullPolicy: Always
ports:
- containerPort: 8002
name: http
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
envFrom:
- configMapRef:
name: trading-execute-service-config
env:
- name: DB_USER
valueFrom:
secretKeyRef:
name: trading-db-credentials
key: username
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: trading-db-credentials
key: password
startupProbe:
httpGet:
path: /health
port: 8002
initialDelaySeconds: 15
periodSeconds: 5
failureThreshold: 6
livenessProbe:
httpGet:
path: /health
port: 8002
initialDelaySeconds: 30
periodSeconds: 30
readinessProbe:
httpGet:
path: /health
port: 8002
initialDelaySeconds: 5
periodSeconds: 10

View file

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml

View file

@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: trading-execute-service
namespace: customer1
annotations:
tailscale.com/expose: "true"
tailscale.com/hostname: "trading-execute-service"
tailscale.com/tags: "tag:k8s-operator"
tailscale.com/ports: "http:80"
spec:
selector:
app: trading-execute-service
ports:
- port: 80
targetPort: 8002
name: http
type: ClusterIP

View file

@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: customer1
resources:
- data-service
- execute-service
- news-service
- dashboard
- configmaps
- secrets
- network-policies
- routes

View file

@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- trading-network-policies.yaml

View file

@ -0,0 +1,109 @@
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

View file

@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: trading-news-service
namespace: customer1
labels:
app: trading-news-service
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: trading-news-service
template:
metadata:
labels:
app: trading-news-service
annotations:
checksum/config: trading-news-service-config
spec:
terminationGracePeriodSeconds: 30
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 1000
containers:
- name: news-service
image: ghcr.io/sirius0xdev/trading-news-service:latest
imagePullPolicy: Always
ports:
- containerPort: 8003
name: http
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
envFrom:
- configMapRef:
name: trading-news-service-config
env:
- name: DB_USER
valueFrom:
secretKeyRef:
name: trading-db-credentials
key: username
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: trading-db-credentials
key: password
startupProbe:
httpGet:
path: /health
port: 8003
initialDelaySeconds: 15
periodSeconds: 5
failureThreshold: 6
livenessProbe:
httpGet:
path: /health
port: 8003
initialDelaySeconds: 30
periodSeconds: 30
readinessProbe:
httpGet:
path: /health
port: 8003
initialDelaySeconds: 5
periodSeconds: 10

View file

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml

View file

@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: trading-news-service
namespace: customer1
annotations:
tailscale.com/expose: "true"
tailscale.com/hostname: "trading-news-service"
tailscale.com/tags: "tag:k8s-operator"
tailscale.com/ports: "http:80"
spec:
selector:
app: trading-news-service
ports:
- port: 80
targetPort: 8003
name: http
type: ClusterIP

View file

@ -0,0 +1,53 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: trading-dashboard-route
namespace: customer1
spec:
parentRefs:
- name: external-http-gateway
hostnames:
- "sirius-sec.com"
- "www.sirius-sec.com"
rules:
- matches:
- path:
type: PathPrefix
value: /trade
backendRefs:
- name: trading-dashboard-svc
port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: trading-api-routes
namespace: customer1
spec:
parentRefs:
- name: external-http-gateway
hostnames:
- "sirius-sec.com"
- "www.sirius-sec.com"
rules:
- matches:
- path:
type: PathPrefix
value: /api/data
backendRefs:
- name: trading-data-service
port: 80
- matches:
- path:
type: PathPrefix
value: /api/execute
backendRefs:
- name: trading-execute-service
port: 80
- matches:
- path:
type: PathPrefix
value: /api/news
backendRefs:
- name: trading-news-service
port: 80

View file

@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- http-routes.yaml

View file

@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- trading-secrets.yaml

View file

@ -0,0 +1,32 @@
apiVersion: ENC[AES256_GCM,data:j4g=,iv:Bb3E3dbyD1MUIsthCltT2rRNNorduAL7QmPG8oRy31g=,tag:htxjh/00z6RGQNNyKCUviw==,type:str]
kind: ENC[AES256_GCM,data:k3FRKBzN,iv:Pvtu7bnGWQNl9pkjtU8GpHjpeg00oFXatf3jxxtQEpw=,tag:zj/yAy/DpCfLO7MdH3hiMA==,type:str]
metadata:
name: ENC[AES256_GCM,data:ZpbqQd2YyEfnugJ27JVAmqBf8Q7m75B0,iv:4njbS+2AYJuxzNERSOjOH8wmoI1KM0ocUT7OgeoGEgo=,tag:spwlHcpeQM0G8O3VPHoDOg==,type:str]
namespace: ENC[AES256_GCM,data:4ErEXcBaI8Yp,iv:IKHgZ6Gm5X21Atnnm2xOFU11IgSfw5X5Wdnl25EDyOI=,tag:znkdsNDkIb4mxBY4yJbX9g==,type:str]
type: ENC[AES256_GCM,data:dd7uKLw+,iv:qRkV8K+ytp55rLGNIP1lG2yZ+LENt/FkdDiWzi/1tik=,tag:aUWQ+ZOQS7/hXcnceCyrTQ==,type:str]
stringData:
#ENC[AES256_GCM,data:Xol7d8ednDll9VKfZ62jZRdARcmz8UJ/6ovDaw8OHrPb72aUdA==,iv:TvGk+LiK0+maCioF5daeWDTNKOSRA5pBFf9PgKL/9Z4=,tag:34kee3TQNsCdIpyEtE12mA==,type:comment]
news-api-key: ENC[AES256_GCM,data:eNMLhs55u3bwVqD4l2tQhgq1+wp/9rCa,iv:7BjlJqgJbg6BqdXxNphnIWKA/LYFZJc3qqJ360/EteY=,tag:hs5vfj+zP9OCq2tDucItIg==,type:str]
market-data-api-key: ENC[AES256_GCM,data:ol3aAC9ijFcFUo7jEVQv7mKjCLpUXBuaVThwRzG/fQ==,iv:YouuIdmj6aK0tuYJtDuiOt91gnUtK2xdshVZxy+gCH4=,tag:MAs8mS/+ndC8AYdI+WdFcA==,type:str]
#ENC[AES256_GCM,data:Si0AKl5/sWrYDNSYiC35iD7vtvP9CzAb,iv:cyBrgR5cFSta+bPdyyCUXrKH68Hi84UbGFqiWskQb7s=,tag:w9+sotMjBTuyfcGYIHfN+w==,type:comment]
service-auth-token: ENC[AES256_GCM,data:NCu/mBKdGIFNXTA5n7M53UXjMaZy9UdzImC90GPU,iv:JPLeNfTDWV3VLbVIUidL6w1IrJN09LTGIyPn0tJlj90=,tag:RIzC8FfGXBmE2PRZzgaAww==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1uuxf066xuuqgvjppxfcmqkwfcufnwp3wcwnl9h20g9k4l8nkw9jsaungf7
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBFTzBrN3V5elJmNjNGZ28y
Q1JOQUt5eURqSFZNZkJUNWMrV1NTZEFiYkgwCnlDSTFYTW8zcU02M0NJdXZjYSti
Ylh0bWpJd0k2MWt6VjNNTUlNU0pTUVUKLS0tIENHUEU4VElXbC96bXBGRmo3QXpQ
ZkxxUDRubGt0dnRoQXVtS2xFSnhTRkUKs+rcKiZvgA7mffGo7GkkFL4vWnTIGAIn
RXwlbDNPEhiK+6lh/TgkV2CYXDBt1Hwfk4fzhZknYjY3Psp0ufvY2Q==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2026-05-21T04:08:04Z"
mac: ENC[AES256_GCM,data:EEuPQ1n7qAab7xkQYNt4rxzNy+u6PSYn+hFUTv3ZwmKbMHW7zQY3BgkwalDVrTC4ZNOLy3tGjVDB6v0KXmwXiXwvYL0Y17h8zRiU4id+zQl+oeZTMCFoUZ5Piz69DxO06cMaZF7+6K+9uQ0JLkZsnY3hb82xKAKbl9E/MFdvr6s=,iv:ldIAz5IKNFnbvcNpzo9qX6n0evix7tsLcTPiouB8lfk=,tag:KXDYrz4vfXkWH0cUHsOUdw==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.9.4