Skip to content

Commit 468f2e1

Browse files
committed
add pgpool support on postgres
Signed-off-by: notTabassum <oyshee@appscode.com>
1 parent 594ec92 commit 468f2e1

11 files changed

Lines changed: 233 additions & 1 deletion

File tree

apis/installer/v1alpha1/ace_ace_types.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,16 @@ type Settings struct {
396396
Firebase FirebaseSettings `json:"firebase"`
397397
// +optional
398398
Marketplace *MarketplaceSettings `json:"marketplace,omitempty"`
399+
// +optional
400+
PgPool *PgPoolSettings `json:"pgpool,omitempty"`
401+
}
402+
403+
type PgPoolSettings struct {
404+
Enabled bool `json:"enabled"`
405+
Replicas int `json:"replicas"`
406+
Resources core.ResourceRequirements `json:"resources"`
407+
// +optional
408+
Config map[string]string `json:"config,omitempty"`
399409
}
400410

401411
type DBSettings struct {

apis/installer/v1alpha1/zz_generated.deepcopy.go

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

catalog/imagelist.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
- alpine:3.20
22
- bats/bats:1.11.0
3+
- ghcr.io/appscode-images/pgpool2:4.6.0
4+
- ghcr.io/appscode-images/pgpool2_exporter:v1.2.2
35
- ghcr.io/appscode-images/registry:3.1.1
46
- ghcr.io/appscode/ace:v0.2.0
57
- ghcr.io/appscode/acerproxy:v0.2.0
@@ -37,3 +39,4 @@
3739
- ghcr.io/voyagermesh/envoy:v1.37.2-ac
3840
- ghcr.io/voyagermesh/gateway:v1.7.1
3941
- minio/minio:RELEASE.2023-01-12T02-06-16Z
42+
- registry.k8s.io/git-sync/git-sync:v4.4.2
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
- alpine:3.20
2+
- bats/bats:1.11.0
3+
- ghcr.io/appscode-images/registry:3.1.1
4+
- ghcr.io/appscode/ace:v0.2.0
5+
- ghcr.io/appscode/acerproxy:v0.2.0
6+
- ghcr.io/appscode/aceshifter:v0.0.3
7+
- ghcr.io/appscode/b3:v2026.7.10
8+
- ghcr.io/appscode/billing-ui:2.4.0
9+
- ghcr.io/appscode/catalog-manager:v0.13.0
10+
- ghcr.io/appscode/cert-manager-webhook-ace:v0.0.2
11+
- ghcr.io/appscode/cloudflare-dns-proxy:v0.0.5
12+
- ghcr.io/appscode/cluster-presets:v0.0.12
13+
- ghcr.io/appscode/cluster-ui:2.4.0
14+
- ghcr.io/appscode/curl:alpine
15+
- ghcr.io/appscode/deploy-ui:0.3.6
16+
- ghcr.io/appscode/fileserver:v0.0.1
17+
- ghcr.io/appscode/gh-ci-webhook:v0.0.20
18+
- ghcr.io/appscode/gotenberg:8.25
19+
- ghcr.io/appscode/grafana:v2025.2.3
20+
- ghcr.io/appscode/inbox-server:postgres-latest
21+
- ghcr.io/appscode/inbox-ui:0.0.5
22+
- ghcr.io/appscode/kube-rbac-proxy:v0.18.2
23+
- ghcr.io/appscode/kubectl-nonroot:1.34
24+
- ghcr.io/appscode/kubedb-ui:2.4.0
25+
- ghcr.io/appscode/license-proxyserver:v0.1.1
26+
- ghcr.io/appscode/marketplace-ui:0.3.1
27+
- ghcr.io/appscode/maxmind-geoip:city-mmdb-latest
28+
- ghcr.io/appscode/offline-license-server:v0.0.76
29+
- ghcr.io/appscode/outboxsyncer:v0.5.0
30+
- ghcr.io/appscode/platform-ui:2.4.0
31+
- ghcr.io/appscode/s3proxy:sha-a82ca68
32+
- ghcr.io/appscode/service-provider:v0.0.2
33+
- ghcr.io/appscode/smtprelay:v0.0.4
34+
- ghcr.io/appscode/website:v2026.7.10
35+
- ghcr.io/voyagermesh/crd-manager:v0.2.0
36+
- ghcr.io/voyagermesh/echoserver:v20221109
37+
- ghcr.io/voyagermesh/envoy:v1.37.2-ac
38+
- ghcr.io/voyagermesh/gateway:v1.7.1
39+
- minio/minio:RELEASE.2023-01-12T02-06-16Z
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- ghcr.io/appscode-images/pgpool2:4.6.0
2+
- ghcr.io/appscode-images/pgpool2_exporter:v1.2.2
3+
- registry.k8s.io/git-sync/git-sync:v4.4.2

charts/ace/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ The following table lists the configurable parameters of the `ace` chart and the
139139
| settings.db.auth.username | | <code>postgres</code> |
140140
| settings.db.auth.password | | <code>"xyz"</code> |
141141
| settings.db.logSQL | | <code>false</code> |
142+
| settings.pgpool.enabled | | <code>true</code> |
143+
| settings.pgpool.replicas | | <code>1</code> |
144+
| settings.pgpool.config.num_init_children | | <code>"10"</code> |
145+
| settings.pgpool.config.max_pool | | <code>"40"</code> |
146+
| settings.pgpool.config.client_idle_limit | | <code>"180"</code> |
147+
| settings.pgpool.resources.limits.memory | | <code>512Mi</code> |
148+
| settings.pgpool.resources.requests.memory | | <code>256Mi</code> |
149+
| settings.pgpool.resources.requests.cpu | | <code>250m</code> |
142150
| settings.cache.version | | <code>"7.2.4"</code> |
143151
| settings.cache.cacheInterval | | <code>60</code> |
144152
| settings.cache.persistence.size | | <code>10Gi</code> |

charts/ace/templates/_helpers.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,12 @@ Returns the ServiceMonitor labels
173173
Determine database host name
174174
*/}}
175175
{{- define "settings.database.host" -}}
176+
{{- if .Values.settings.pgpool.enabled -}}
177+
{{- printf "%s-pgpool.%s.svc:9999" (include "ace.fullname" .) .Release.Namespace -}}
178+
{{- else -}}
176179
{{- printf "%s-db.%s.svc:5432" (include "ace.fullname" .) .Release.Namespace -}}
177180
{{- end -}}
181+
{{- end -}}
178182

179183
{{- define "settings.oauth2JWTSecret" -}}
180184
{{ .Values.settings.security.oauth2JWTSecret | default (randAlphaNum 43) }}

charts/ace/templates/db/db-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ metadata:
1212
type: Opaque
1313
stringData:
1414
user.conf: |
15-
max_connections=110
15+
max_connections=400
1616
{{- if .Values.pgoutbox.enabled }}
1717
wal_level=logical
1818
max_wal_senders=50
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{{- if .Values.settings.pgpool.enabled }}
2+
apiVersion: kubedb.com/v1alpha2
3+
kind: Pgpool
4+
metadata:
5+
name: {{ include "ace.fullname" . }}-pgpool
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "ace.labels" . | nindent 4 }}
9+
spec:
10+
version: "4.6.0"
11+
replicas: {{ .Values.settings.pgpool.replicas }}
12+
postgresRef:
13+
name: {{ include "ace.fullname" . }}-db
14+
namespace: {{ .Release.Namespace }}
15+
syncUsers: true
16+
deletionPolicy: {{ .Values.settings.db.deletionPolicy }}
17+
{{- if .Values.settings.pgpool.config }}
18+
configuration:
19+
inline:
20+
pgpool.conf: |
21+
{{- range $k, $v := .Values.settings.pgpool.config }}
22+
{{ $k }}={{ $v }}
23+
{{- end }}
24+
{{- end }}
25+
podTemplate:
26+
spec:
27+
containers:
28+
- name: pgpool
29+
resources:
30+
{{- toYaml .Values.settings.pgpool.resources | nindent 10 }}
31+
{{- if eq (include "distro.openshift" $) "true" }}
32+
securityContext:
33+
runAsGroup: {{ .Values.securityContext.runAsUser }}
34+
runAsUser: {{ .Values.securityContext.runAsUser }}
35+
capabilities:
36+
drop:
37+
- ALL
38+
runAsNonRoot: true
39+
seccompProfile:
40+
type: RuntimeDefault
41+
securityContext:
42+
fsGroup: {{ .Values.securityContext.runAsUser }}
43+
runAsUser: {{ .Values.securityContext.runAsUser }}
44+
runAsGroup: {{ .Values.securityContext.runAsUser }}
45+
{{- end }}
46+
{{- if .Values.global.monitoring }}
47+
monitor:
48+
agent: {{ .Values.global.monitoring.agent }}
49+
prometheus:
50+
serviceMonitor:
51+
interval: 30s
52+
labels:
53+
{{- toYaml .Values.global.monitoring.serviceMonitor.labels | nindent 10 }}
54+
{{- end }}
55+
{{- end }}
56+
57+
---
58+
59+
apiVersion: catalog.kubedb.com/v1alpha1
60+
kind: PgpoolVersion
61+
metadata:
62+
name: 4.6.0
63+
spec:
64+
exporter:
65+
image: ghcr.io/appscode-images/pgpool2_exporter:v1.2.2
66+
gitSyncer:
67+
image: registry.k8s.io/git-sync/git-sync:v4.4.2
68+
pgpool:
69+
image: ghcr.io/appscode-images/pgpool2:4.6.0
70+
securityContext:
71+
runAsAnyNonRoot: true
72+
runAsUser: 70
73+
updateConstraints:
74+
allowlist:
75+
- '>= 4.6.0, <= 4.6.0'
76+
version: 4.6.0

charts/ace/values.openapiv3_schema.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24690,6 +24690,54 @@ properties:
2469024690
required:
2469124691
- encryptionKey
2469224692
type: object
24693+
pgpool:
24694+
properties:
24695+
config:
24696+
additionalProperties:
24697+
type: string
24698+
type: object
24699+
enabled:
24700+
type: boolean
24701+
replicas:
24702+
type: integer
24703+
resources:
24704+
properties:
24705+
claims:
24706+
items:
24707+
properties:
24708+
name:
24709+
type: string
24710+
request:
24711+
type: string
24712+
required:
24713+
- name
24714+
type: object
24715+
type: array
24716+
x-kubernetes-list-map-keys:
24717+
- name
24718+
x-kubernetes-list-type: map
24719+
limits:
24720+
additionalProperties:
24721+
anyOf:
24722+
- type: integer
24723+
- type: string
24724+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
24725+
x-kubernetes-int-or-string: true
24726+
type: object
24727+
requests:
24728+
additionalProperties:
24729+
anyOf:
24730+
- type: integer
24731+
- type: string
24732+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
24733+
x-kubernetes-int-or-string: true
24734+
type: object
24735+
type: object
24736+
required:
24737+
- enabled
24738+
- replicas
24739+
- resources
24740+
type: object
2469324741
platform:
2469424742
properties:
2469524743
appName:

0 commit comments

Comments
 (0)