Files
bootnode/infra/k8s/bootnode-deployment.yaml
zeekay 5ee151b452 infra: replace all nginx references with hanzo ingress
Migrate every ingress resource from nginx annotations to
traefik.ingress.kubernetes.io for hanzoai/ingress controller.
Update network policies to match hanzo-ingress pod selector.
Update operator config to use className: hanzo.
2026-03-25 12:11:56 -07:00

428 lines
8.7 KiB
YAML

apiVersion: v1
kind: Namespace
metadata:
name: bootnode
labels:
app: bootnode
environment: production
---
apiVersion: v1
kind: ConfigMap
metadata:
name: bootnode-config
namespace: bootnode
data:
APP_ENV: "production"
API_PREFIX: "/v1"
LOG_LEVEL: "INFO"
RATE_LIMIT_REQUESTS: "1000"
RATE_LIMIT_COMPUTE_UNITS: "10000"
CORS_ORIGINS: "https://bootno.de,https://admin.bootno.de"
TRUSTED_HOSTS: "bootno.de,admin.bootno.de"
---
# NOTE: bootnode-secrets is managed by External Secrets Operator
# See external-secrets.yaml for the ExternalSecret that syncs from Hanzo KMS
# Do NOT define a manual Secret here — it conflicts with the ExternalSecret target
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: bootnode-postgres
namespace: bootnode
labels:
app: bootnode-postgres
spec:
replicas: 1
selector:
matchLabels:
app: bootnode-postgres
template:
metadata:
labels:
app: bootnode-postgres
spec:
containers:
- name: postgres
image: postgres:16-alpine
env:
- name: POSTGRES_DB
value: bootnode
- name: POSTGRES_USER
value: bootnode
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: bootnode-secrets
key: POSTGRES_PASSWORD
ports:
- containerPort: 5432
volumeMounts:
- name: postgres-storage
mountPath: /var/lib/postgresql/data
livenessProbe:
exec:
command:
- pg_isready
- -U
- bootnode
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
exec:
command:
- pg_isready
- -U
- bootnode
initialDelaySeconds: 5
periodSeconds: 5
resources:
limits:
memory: "2Gi"
cpu: "1000m"
requests:
memory: "1Gi"
cpu: "500m"
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: postgres-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pvc
namespace: bootnode
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
storageClassName: fast-ssd
---
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: bootnode
spec:
selector:
app: bootnode-postgres
ports:
- port: 5432
targetPort: 5432
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: bootnode-redis
namespace: bootnode
labels:
app: bootnode-redis
spec:
replicas: 1
selector:
matchLabels:
app: bootnode-redis
template:
metadata:
labels:
app: bootnode-redis
spec:
containers:
- name: redis
image: redis:7-alpine
command: ["sh", "-c"]
args:
- redis-server --appendonly yes --requirepass "$REDIS_PASSWORD"
env:
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: bootnode-secrets
key: REDIS_PASSWORD
ports:
- containerPort: 6379
volumeMounts:
- name: redis-storage
mountPath: /data
livenessProbe:
tcpSocket:
port: 6379
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
tcpSocket:
port: 6379
initialDelaySeconds: 5
periodSeconds: 5
resources:
limits:
memory: "1Gi"
cpu: "500m"
requests:
memory: "512Mi"
cpu: "250m"
volumes:
- name: redis-storage
persistentVolumeClaim:
claimName: redis-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redis-pvc
namespace: bootnode
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
storageClassName: fast-ssd
---
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: bootnode
spec:
selector:
app: bootnode-redis
ports:
- port: 6379
targetPort: 6379
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: bootnode-api
namespace: bootnode
labels:
app: bootnode-api
spec:
replicas: 3
selector:
matchLabels:
app: bootnode-api
template:
metadata:
labels:
app: bootnode-api
spec:
initContainers:
- name: db-migrate
image: ghcr.io/hanzoai/bootnode:api-latest
command: ["python", "-m", "alembic", "upgrade", "head"]
envFrom:
- configMapRef:
name: bootnode-config
- secretRef:
name: bootnode-secrets
containers:
- name: api
image: ghcr.io/hanzoai/bootnode:api-latest
ports:
- containerPort: 8000
name: http
- containerPort: 9999
name: zap
envFrom:
- configMapRef:
name: bootnode-config
- secretRef:
name: bootnode-secrets
livenessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 5
periodSeconds: 5
resources:
limits:
memory: "2Gi"
cpu: "1000m"
requests:
memory: "1Gi"
cpu: "500m"
---
apiVersion: v1
kind: Service
metadata:
name: bootnode-api-service
namespace: bootnode
spec:
selector:
app: bootnode-api
ports:
- port: 80
targetPort: 8000
name: http
- port: 9999
targetPort: 9999
name: zap
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: bootnode-web
namespace: bootnode
labels:
app: bootnode-web
spec:
replicas: 2
selector:
matchLabels:
app: bootnode-web
template:
metadata:
labels:
app: bootnode-web
spec:
containers:
- name: web
image: ghcr.io/hanzoai/bootnode:web-latest
ports:
- containerPort: 3000
env:
- name: NEXT_PUBLIC_API_URL
value: "https://api.bootno.de"
- name: NODE_ENV
value: "production"
livenessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 5
periodSeconds: 5
resources:
limits:
memory: "1Gi"
cpu: "500m"
requests:
memory: "512Mi"
cpu: "250m"
---
apiVersion: v1
kind: Service
metadata:
name: bootnode-web-service
namespace: bootnode
spec:
selector:
app: bootnode-web
ports:
- port: 80
targetPort: 3000
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: bootnode-ingress
namespace: bootnode
annotations:
kubernetes.io/ingress.class: "hanzo"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
tls:
- hosts:
- bootno.de
- api.bootno.de
- admin.bootno.de
secretName: bootnode-tls
rules:
- host: bootno.de
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: bootnode-web-service
port:
number: 80
- host: admin.bootno.de
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: bootnode-web-service
port:
number: 80
- host: api.bootno.de
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: bootnode-api-service
port:
number: 80
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: bootnode-api-pdb
namespace: bootnode
spec:
minAvailable: 2
selector:
matchLabels:
app: bootnode-api
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: bootnode-web-pdb
namespace: bootnode
spec:
minAvailable: 1
selector:
matchLabels:
app: bootnode-web
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: bootnode-api-hpa
namespace: bootnode
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: bootnode-api
minReplicas: 3
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80