Skip to content

Commit

Permalink
Minimize crunchydb resource requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
TimCsaky committed Oct 23, 2024
1 parent 6674e99 commit a9d4cef
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 47 deletions.
65 changes: 46 additions & 19 deletions .github/environments/values.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,6 @@ postgres:
# --------crunchydb config: ------
# --------------------------------

# # --- resource allocation ----
# instances:
# - name: db # do not change this name after initial install, pvc (data) and stateful sets will be deleted
# replicas: 2
# dataVolumeClaimSpec:
# accessModes:
# - "ReadWriteOnce"
# resources:
# requests:
# storage: 0.5Gi
# storageClassName: "netapp-block-standard"
# resources:
# requests:
# cpu: 50m
# memory: 128Mi
# limits:
# cpu: 100m
# memory: 256Mi

# -------- backups ---------
pgBackRestConfig:
global:
Expand All @@ -71,3 +52,49 @@ postgres:
requests:
storage: 2Gi
storageClassName: "netapp-file-backup"
manual:
repoName: repo1
options:
- --type=full
repoHost:
resources:
requests:
cpu: 20m
memory: 128Mi
limits:
cpu: 50m
memory: 256Mi
sidecars:
pgbackrest:
resources:
requests:
cpu: 5m
memory: 16Mi
limits:
cpu: 20m
memory: 64Mi
pgbackrestConfig:
resources:
requests:
cpu: 5m
memory: 32Mi
limits:
cpu: 20m
memory: 64Mi
jobs:
resources:
requests:
cpu: 10m
memory: 64Mi
limits:
cpu: 50m
memory: 128Mi

# ----- do a databse backup restore
dataSource:
postgresCluster:
clusterName: postgres-master
repoName: repo1
options:
- --type=time
- --target="2021-06-09 14:15:11-04"
14 changes: 11 additions & 3 deletions .github/environments/values.pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ postgres:
# --------crunchydb config: ------
# --------------------------------

# --- resource allocation ----
instances:
- name: db # do not change this name after initial install, pvc (data) and stateful sets will be deleted
replicas: 1
replicas: 3
dataVolumeClaimSpec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: 0.5Gi
storage: .5Gi
storageClassName: "netapp-block-standard"
resources:
requests:
Expand All @@ -29,6 +28,15 @@ postgres:
limits:
cpu: 100m
memory: 256Mi
sidecars:
replicaCertCopy:
resources:
requests:
cpu: 1m
memory: 32Mi
limits:
cpu: 50m
memory: 64Mi

# -------- backups ---------
pgBackRestConfig: {}
73 changes: 57 additions & 16 deletions .github/environments/values.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ postgres:
# --------crunchydb config: ------
# --------------------------------

# --- cluster resource allocation ----
instances:
- name: db # do not change this name after initial install, pvc (data) and stateful sets will be deleted
replicas: 3
Expand All @@ -41,18 +40,64 @@ postgres:
- "ReadWriteOnce"
resources:
requests:
storage: 5Gi
storage: 2Gi
storageClassName: "netapp-block-standard"
resources:
requests:
cpu: 1m
memory: 256Mi
cpu: 50m
memory: 128Mi
limits:
cpu: 100m
memory: 512Mi
memory: 256Mi
sidecars:
replicaCertCopy:
resources:
requests:
cpu: 1m
memory: 32Mi
limits:
cpu: 50m
memory: 64Mi

# -------- backups ---------
pgBackRestConfig:
manual:
repoName: repo1
options:
- --type=full
repoHost:
resources:
requests:
cpu: 20m
memory: 128Mi
limits:
cpu: 50m
memory: 256Mi
sidecars:
pgbackrest:
resources:
requests:
cpu: 5m
memory: 16Mi
limits:
cpu: 20m
memory: 64Mi
pgbackrestConfig:
resources:
requests:
cpu: 5m
memory: 32Mi
limits:
cpu: 20m
memory: 64Mi
jobs:
resources:
requests:
cpu: 10m
memory: 64Mi
limits:
cpu: 50m
memory: 128Mi
configuration:
# secret for saving backups to S3
- secret:
Expand Down Expand Up @@ -87,17 +132,13 @@ postgres:
endpoint: https://nrs.objectstore.gov.bc.ca
region: us-east-1

# # ----- pgBouncer (network pooling) ------
# pgBouncerConfig:
# replicas: 2

# -------- monitoring ---------
monitoring: true
monitoringConfig:
resources:
requests:
cpu: 1m
memory: 16Mi
limits:
cpu: 35m
memory: 32Mi
resources:
requests:
cpu: 1m
memory: 16Mi
limits:
cpu: 35m
memory: 32Mi
63 changes: 58 additions & 5 deletions .github/environments/values.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ postgres:
- "ReadWriteOnce"
resources:
requests:
storage: 0.5Gi
storage: 1Gi
storageClassName: "netapp-block-standard"
resources:
requests:
Expand All @@ -50,14 +50,64 @@ postgres:
limits:
cpu: 100m
memory: 256Mi
sidecars:
replicaCertCopy:
resources:
requests:
cpu: 1m
memory: 32Mi
limits:
cpu: 50m
memory: 64Mi

# -------- backups ---------
pgBackRestConfig:
manual:
repoName: repo1
options:
- --type=full
repoHost:
resources:
requests:
cpu: 20m
memory: 128Mi
limits:
cpu: 50m
memory: 256Mi
sidecars:
pgbackrest:
resources:
requests:
cpu: 5m
memory: 16Mi
limits:
cpu: 20m
memory: 64Mi
pgbackrestConfig:
resources:
requests:
cpu: 5m
memory: 32Mi
limits:
cpu: 20m
memory: 64Mi
jobs:
resources:
requests:
cpu: 10m
memory: 64Mi
limits:
cpu: 50m
memory: 128Mi
global:
# log-level-console: debug
# --- pvc
repo1-retention-full: "2"
repo1-retention-diff: "3"
# --- s3
repo2-path: /backups/common-object-management-service/postgres/test
repo2-retention-full: "30"
repo2-s3-uri-style: path
repos:
- name: repo1
schedules:
Expand All @@ -71,7 +121,10 @@ postgres:
requests:
storage: 2Gi
storageClassName: "netapp-file-backup"

# # ----- pgBouncer (network pooling) ------
# pgBouncerConfig:
# replicas: 2
- name: repo2
schedules:
full: "0 3 * * *" # full backup every day at 3am
s3:
bucket: csstops
endpoint: https://nrs.objectstore.gov.bc.ca
region: us-east-1
4 changes: 2 additions & 2 deletions charts/coms/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: common-object-management-service
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.1.3
version: 1.1.5
kubeVersion: ">= 1.13.0"
description: A microservice for managing access control to S3 Objects
# A chart can be either an 'application' or a 'library' chart.
Expand All @@ -28,7 +28,7 @@ sources:
- https://github.com/bcgov/common-object-management-service
dependencies:
- name: postgrescluster
version: 1.1.3
version: 1.1.5
repository: "file://../postgres"
condition: postgres.enabled
alias: postgres
Expand Down
10 changes: 9 additions & 1 deletion charts/coms/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ postgres:
- "ReadWriteOnce"
resources:
requests:
storage: 0.5Gi
storage: 1Gi
storageClassName: "netapp-block-standard"
resources:
requests:
Expand Down Expand Up @@ -281,6 +281,14 @@ postgres:
limits:
cpu: 20m
memory: 64Mi
pgbackrestConfig:
resources:
requests:
cpu: 5m
memory: 32Mi
limits:
cpu: 20m
memory: 64Mi
jobs:
resources:
requests:
Expand Down
2 changes: 1 addition & 1 deletion charts/postgres/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name: postgrescluster
description: A Helm chart for Kubernetes
type: application
# The version below should match the version on the PostgresCluster CRD
version: 1.1.3
version: 1.1.5
appVersion: 5.6.0

0 comments on commit a9d4cef

Please sign in to comment.