Skip to content

Commit

Permalink
feat(postgres): add resource limits to postgres (#413)
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Miglinci <[email protected]>
  • Loading branch information
pmig authored Sep 24, 2024
1 parent 80f3639 commit a1e1a3a
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ packages:
shortDescription: Detects hardware features available on each node in a
Kubernetes cluster, and advertises those features using node labels.
- iconUrl: https://www.postgresql.org/media/img/about/press/elephant.png
latestVersion: v16.4.0+1
latestVersion: v16.4.0+2
name: postgresql
scope: Namespaced
shortDescription: The World's Most Advanced Open Source Relational Database
Expand Down
1 change: 1 addition & 0 deletions packages/postgresql/v16.4.0+2/.test/config-values.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"my-postgres" --value "databaseName=my-postgres" --value "storageSize=1Gi" --value "memory=128Mi"
18 changes: 18 additions & 0 deletions packages/postgresql/v16.4.0+2/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster
spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgresql:16.4
bootstrap:
initdb: {}
storage: {}
monitoring:
enablePodMonitor: true
resources:
limits:
memory: 256Mi
requests:
cpu: 10m
memory: 256Mi
86 changes: 86 additions & 0 deletions packages/postgresql/v16.4.0+2/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# yaml-language-server: $schema=https://glasskube.dev/schemas/v1/package-manifest.json
name: postgresql
scope: Namespaced
defaultNamespace: default
iconUrl: https://www.postgresql.org/media/img/about/press/elephant.png
shortDescription: The World's Most Advanced Open Source Relational Database
longDescription: |
This package creates a PostgreSQL database running in your cluster using the cloudnative-pg operator.
dependencies:
- name: cloudnative-pg
references:
- label: Website
url: https://www.postgresql.org/
manifests:
- url: ./manifest.yaml
valueDefinitions:
instances:
type: number
defaultValue: "1"
constraints:
min: 0
targets:
- resource:
apiGroup: postgresql.cnpg.io/v1
kind: Cluster
name: cluster
patch:
op: add
path: /spec/instances
valueTemplate: "{{.}}"
enableSuperuserAccess:
type: boolean
targets:
- resource:
apiGroup: postgresql.cnpg.io/v1
kind: Cluster
name: cluster
patch:
op: add
path: /spec/enableSuperuserAccess
valueTemplate: "{{.}}"
databaseName:
type: text
constraints:
required: true
minLength: 1
targets:
- resource:
apiGroup: postgresql.cnpg.io/v1
kind: Cluster
name: cluster
patch:
op: add
path: /spec/bootstrap/initdb/database
storageSize:
type: text
defaultValue: 10Gi
targets:
- resource:
apiGroup: postgresql.cnpg.io/v1
kind: Cluster
name: cluster
patch:
op: add
path: /spec/storage/size
memory:
constraints: { }
defaultValue: 256Mi
type: text
metadata:
label: PostgreSQL memory request and limit
targets:
- patch:
op: replace
path: /spec/resources/requests/memory
resource:
apiGroup: apps/v1
kind: Deployment
name: redis
- patch:
op: replace
path: /spec/resources/limits/memory
resource:
apiGroup: apps/v1
kind: Deployment
name: redis
3 changes: 2 additions & 1 deletion packages/postgresql/versions.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
latestVersion: v16.4.0+1
latestVersion: v16.4.0+2
versions:
- version: v16.4.0+1
- version: v16.4.0+2

0 comments on commit a1e1a3a

Please sign in to comment.