Skip to content

Commit

Permalink
feat: postgresをcloudnative-pgに変更
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Mar 18, 2024
1 parent 5a00f07 commit 4af8df8
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 71 deletions.
71 changes: 71 additions & 0 deletions k8s/cloudnative-pg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: akarinext-web-pg
namespace: akarinext-web
spec:
description: "database for akarinext-web"
imageName: ghcr.io/cloudnative-pg/postgresql:16.1
instances: 3
startDelay: 300
stopDelay: 300
primaryUpdateStrategy: unsupervised

superuserSecret:
name: akarinext-web-pg-superuser

postgresql:
parameters:
timezone: 'Asia/Tokyo'
# pg_hba:
# - host all all all md5

bootstrap:
initdb:
database: akarinext-web
owner: yupix
secret:
name: akarinext-web-pg-app

# postgresql:
# pg_hba:
# - host all all all md5

# superuserSecret:
# name: db-superuser

# backup:
# barmanObjectStore:
# destinationPath: s3://bucket-name/backups
# endpointURL: https://s3-storage.address
# s3Credentials:
# accessKeyId:
# name: s3-creds
# key: ACCESS_KEY_ID
# secretAccessKey:
# name: s3-creds
# key: ACCESS_SECRET_KEY
# wal:
# compression: bzip2
# data:
# compression: bzip2
# retentionPolicy: "30d"

storage:
storageClass: nfs-client
size: 20Gi

resources:
requests:
memory: "800Mi"
cpu: "500m"
limits:
memory: "2000Mi"
cpu: "1000m"

monitoring:
enablePodMonitor: true

nodeMaintenanceWindow:
inProgress: false
reusePVC: false
3 changes: 1 addition & 2 deletions k8s/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ namespace: akarinext-web

resources:
- deployment.yaml
- psql.yaml
- psql-claim.yaml
- cloudnative-pg.yaml

images:
- name: ghcr.io/akarinext/www.akarinext.org
Expand Down
20 changes: 20 additions & 0 deletions k8s/pg-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: v1
kind: Secret
metadata:
name: akarinext-web-pg-app
namespace: akarinext-web
type: kubernetes.io/basic-auth
data:
username: eXVwaXg= # yupix
password: base64 # password
---
apiVersion: v1
kind: Secret
metadata:
name: akarinext-web-pg-superuser
namespace: akarinext-web
type: kubernetes.io/basic-auth
data:
username: cG9zdGdyZXM= # postgres
password: base64=
13 changes: 0 additions & 13 deletions k8s/psql-claim.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions k8s/psql-configmap.yaml

This file was deleted.

45 changes: 0 additions & 45 deletions k8s/psql.yaml

This file was deleted.

0 comments on commit 4af8df8

Please sign in to comment.