Skip to content

Commit a1e1a3a

Browse files
authored
feat(postgres): add resource limits to postgres (#413)
Signed-off-by: Philip Miglinci <[email protected]>
1 parent 80f3639 commit a1e1a3a

File tree

5 files changed

+108
-2
lines changed

5 files changed

+108
-2
lines changed

packages/index.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ packages:
9393
shortDescription: Detects hardware features available on each node in a
9494
Kubernetes cluster, and advertises those features using node labels.
9595
- iconUrl: https://www.postgresql.org/media/img/about/press/elephant.png
96-
latestVersion: v16.4.0+1
96+
latestVersion: v16.4.0+2
9797
name: postgresql
9898
scope: Namespaced
9999
shortDescription: The World's Most Advanced Open Source Relational Database
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"my-postgres" --value "databaseName=my-postgres" --value "storageSize=1Gi" --value "memory=128Mi"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: postgresql.cnpg.io/v1
2+
kind: Cluster
3+
metadata:
4+
name: cluster
5+
spec:
6+
instances: 1
7+
imageName: ghcr.io/cloudnative-pg/postgresql:16.4
8+
bootstrap:
9+
initdb: {}
10+
storage: {}
11+
monitoring:
12+
enablePodMonitor: true
13+
resources:
14+
limits:
15+
memory: 256Mi
16+
requests:
17+
cpu: 10m
18+
memory: 256Mi
+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# yaml-language-server: $schema=https://glasskube.dev/schemas/v1/package-manifest.json
2+
name: postgresql
3+
scope: Namespaced
4+
defaultNamespace: default
5+
iconUrl: https://www.postgresql.org/media/img/about/press/elephant.png
6+
shortDescription: The World's Most Advanced Open Source Relational Database
7+
longDescription: |
8+
This package creates a PostgreSQL database running in your cluster using the cloudnative-pg operator.
9+
dependencies:
10+
- name: cloudnative-pg
11+
references:
12+
- label: Website
13+
url: https://www.postgresql.org/
14+
manifests:
15+
- url: ./manifest.yaml
16+
valueDefinitions:
17+
instances:
18+
type: number
19+
defaultValue: "1"
20+
constraints:
21+
min: 0
22+
targets:
23+
- resource:
24+
apiGroup: postgresql.cnpg.io/v1
25+
kind: Cluster
26+
name: cluster
27+
patch:
28+
op: add
29+
path: /spec/instances
30+
valueTemplate: "{{.}}"
31+
enableSuperuserAccess:
32+
type: boolean
33+
targets:
34+
- resource:
35+
apiGroup: postgresql.cnpg.io/v1
36+
kind: Cluster
37+
name: cluster
38+
patch:
39+
op: add
40+
path: /spec/enableSuperuserAccess
41+
valueTemplate: "{{.}}"
42+
databaseName:
43+
type: text
44+
constraints:
45+
required: true
46+
minLength: 1
47+
targets:
48+
- resource:
49+
apiGroup: postgresql.cnpg.io/v1
50+
kind: Cluster
51+
name: cluster
52+
patch:
53+
op: add
54+
path: /spec/bootstrap/initdb/database
55+
storageSize:
56+
type: text
57+
defaultValue: 10Gi
58+
targets:
59+
- resource:
60+
apiGroup: postgresql.cnpg.io/v1
61+
kind: Cluster
62+
name: cluster
63+
patch:
64+
op: add
65+
path: /spec/storage/size
66+
memory:
67+
constraints: { }
68+
defaultValue: 256Mi
69+
type: text
70+
metadata:
71+
label: PostgreSQL memory request and limit
72+
targets:
73+
- patch:
74+
op: replace
75+
path: /spec/resources/requests/memory
76+
resource:
77+
apiGroup: apps/v1
78+
kind: Deployment
79+
name: redis
80+
- patch:
81+
op: replace
82+
path: /spec/resources/limits/memory
83+
resource:
84+
apiGroup: apps/v1
85+
kind: Deployment
86+
name: redis

packages/postgresql/versions.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
latestVersion: v16.4.0+1
1+
latestVersion: v16.4.0+2
22
versions:
33
- version: v16.4.0+1
4+
- version: v16.4.0+2

0 commit comments

Comments
 (0)