statefulset.yaml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. apiVersion: apps/v1
  2. kind: StatefulSet
  3. metadata:
  4. name: postgres
  5. namespace: {{NAMESPACE}}
  6. labels:
  7. app: postgres
  8. app.kubernetes.io/part-of: claude-code-hub
  9. spec:
  10. serviceName: postgres
  11. replicas: 1
  12. selector:
  13. matchLabels:
  14. app: postgres
  15. template:
  16. metadata:
  17. labels:
  18. app: postgres
  19. spec:
  20. securityContext:
  21. fsGroup: 999
  22. containers:
  23. - name: postgres
  24. image: postgres:18
  25. ports:
  26. - containerPort: 5432
  27. name: postgres
  28. env:
  29. - name: POSTGRES_DB
  30. value: claude_code_hub
  31. - name: POSTGRES_USER
  32. value: claude_code_hub
  33. - name: POSTGRES_PASSWORD
  34. valueFrom:
  35. secretKeyRef:
  36. name: claude-code-hub-secrets
  37. key: pg-password
  38. - name: PGDATA
  39. value: /var/lib/postgresql/data/pgdata
  40. - name: TZ
  41. value: {{TIMEZONE}}
  42. - name: PGTZ
  43. value: {{TIMEZONE}}
  44. args:
  45. - "-c"
  46. - "max_connections=200"
  47. - "-c"
  48. - "shared_buffers=1GB"
  49. - "-c"
  50. - "effective_cache_size=3GB"
  51. - "-c"
  52. - "work_mem=16MB"
  53. - "-c"
  54. - "maintenance_work_mem=512MB"
  55. - "-c"
  56. - "wal_buffers=64MB"
  57. - "-c"
  58. - "checkpoint_completion_target=0.9"
  59. - "-c"
  60. - "random_page_cost=1.1"
  61. - "-c"
  62. - "log_min_duration_statement=1000"
  63. resources:
  64. requests:
  65. cpu: 500m
  66. memory: 2Gi
  67. limits:
  68. cpu: "4"
  69. memory: 4Gi
  70. volumeMounts:
  71. - name: postgres-data
  72. mountPath: /var/lib/postgresql/data
  73. livenessProbe:
  74. exec:
  75. command:
  76. - pg_isready
  77. - "-U"
  78. - claude_code_hub
  79. initialDelaySeconds: 30
  80. periodSeconds: 10
  81. timeoutSeconds: 5
  82. readinessProbe:
  83. exec:
  84. command:
  85. - pg_isready
  86. - "-U"
  87. - claude_code_hub
  88. initialDelaySeconds: 5
  89. periodSeconds: 5
  90. timeoutSeconds: 3
  91. volumeClaimTemplates:
  92. - metadata:
  93. name: postgres-data
  94. spec:
  95. accessModes:
  96. - ReadWriteOnce
  97. storageClassName: {{STORAGE_CLASS}}
  98. resources:
  99. requests:
  100. storage: {{PG_STORAGE_SIZE}}