Files
sless/deployments/k8s/iot-postgres.yaml
T

67 lines
1.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Создано: 2026-04-05
# Postgres для IoT телеметрии — отдельный от sless postgres (тот для invocations логов).
# Deployment (не StatefulSet) — для dev/demo. В prod заменить на managed Postgres.
#
# Суперюзер iot_admin используется оператором для:
# - CREATE USER tenant_{ns} + CREATE DATABASE tenant_{ns}
# - CREATE TABLE iot_telemetry в tenant DB
# Клиенты НЕ имеют прямого доступа — только через REST API платформы.
---
apiVersion: v1
kind: Secret
metadata:
name: iot-postgres-secret
namespace: sless
stringData:
# Суперпользователь — для управления tenant databases
POSTGRES_USER: "iot_admin"
POSTGRES_PASSWORD: "iot-pg-super-2026"
POSTGRES_DB: "iot_platform"
# DSN для оператора и mqtt-bridge (superuser к management DB)
IOT_PG_DSN: "postgresql://iot_admin:iot-pg-super-2026@iot-postgres.sless.svc:5432/iot_platform?sslmode=disable"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: iot-postgres
namespace: sless
labels:
app: iot-postgres
spec:
replicas: 1
selector:
matchLabels:
app: iot-postgres
template:
metadata:
labels:
app: iot-postgres
spec:
containers:
- name: postgres
image: postgres:16-alpine
ports:
- containerPort: 5432
envFrom:
- secretRef:
name: iot-postgres-secret
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
---
apiVersion: v1
kind: Service
metadata:
name: iot-postgres
namespace: sless
spec:
selector:
app: iot-postgres
ports:
- port: 5432
targetPort: 5432