Skip to content

Commit

Permalink
chore: initial commit, deploying pg-pool-ii test chart w/ version 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nemo83 committed Mar 8, 2024
0 parents commit 7948314
Show file tree
Hide file tree
Showing 12 changed files with 323 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# CF Helm Charts

This repository contains Helm Charts commonly used and developed at the Cardano Foundation.

Use at your own risk.

## Helm Chart Build

This repo is configured following the Helm Chart docs available [here](https://helm.sh/docs/topics/chart_repository/)

### Building a chart

Assuming the folder containing all the charts is called `charts`, you can build and index new charts or updates as follows.

Packaging a chart:

```bash
helm package path/to/my_chart/
```

Deploying and indexing a chart:

```bash
mv my_chart-x.y.z.tgz charts/
helm repo index charts --url https://cardano-foundation.github.io/cf-helm-charts/
```

Add new or modified files to git, push changes.

Congrats, you've deployed a new or updated chart to our repository
23 changes: 23 additions & 0 deletions cf-helm-charts/cf-pg-pool-ii/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions cf-helm-charts/cf-pg-pool-ii/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: cf-pg-pool-ii
description: Pg Pool II Helm Chart
type: application
version: 0.0.1
appVersion: 4.4.2
62 changes: 62 additions & 0 deletions cf-helm-charts/cf-pg-pool-ii/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cf-pg-pool-ii.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "cf-pg-pool-ii.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cf-pg-pool-ii.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cf-pg-pool-ii.labels" -}}
helm.sh/chart: {{ include "cf-pg-pool-ii.chart" . }}
{{ include "cf-pg-pool-ii.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cf-pg-pool-ii.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cf-pg-pool-ii.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cf-pg-pool-ii.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cf-pg-pool-ii.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
38 changes: 38 additions & 0 deletions cf-helm-charts/cf-pg-pool-ii/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: pgpool-config
labels:
name: pgpool-config
data:
# TODO: Parameterize
pgpool.conf: |-
listen_addresses = '*'
port = 5432
socket_dir = '/var/run/pgpool'
pcp_listen_addresses = '*'
pcp_port = 9898
pcp_socket_dir = '/var/run/pgpool'
backend_hostname0 = '{{ .Values.postgres.main.host }}'
backend_port0 = 5432
backend_weight0 = 1
backend_flag0 = 'ALWAYS_PRIMARY|DISALLOW_TO_FAILOVER'
backend_hostname1 = '{{ .Values.postgres.replica.host }}'
backend_port1 = 5432
backend_weight1 = 1
backend_flag1 = 'DISALLOW_TO_FAILOVER'
sr_check_period = 0
health_check_period = 0
backend_clustering_mode = 'streaming_replication'
num_init_children = 32
max_pool = 4
child_life_time = 300
child_max_connections = 0
connection_life_time = 0
client_idle_limit = 0
connection_cache = on
load_balance_mode = on
ssl = on
enable_pool_hba = on
failover_on_backend_error = off
log_min_messages = warning
70 changes: 70 additions & 0 deletions cf-helm-charts/cf-pg-pool-ii/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cf-pg-pool-ii.fullname" . }}
labels:
{{- include "cf-pg-pool-ii.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "cf-pg-pool-ii.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "cf-pg-pool-ii.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: POSTGRES_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.postgres.credentials.secretName }}
key: {{ .Values.postgres.credentials.usernameKey }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.postgres.credentials.secretName }}
key: {{ .Values.postgres.credentials.passwordKey }}
- name: PGPOOL_PASSWORD_ENCRYPTION_METHOD
value: "scram-sha-256"
- name: PGPOOL_ENABLE_POOL_PASSWD
value: "true"
- name: PGPOOL_SKIP_PASSWORD_ENCRYPTION
value: "false"

ports:
- name: db
containerPort: {{ .Values.service.port }}
protocol: TCP
# livenessProbe:
# httpGet:
# path: /
# port: http
# readinessProbe:
# httpGet:
# path: /
# port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: pgpool-config
mountPath: /config
#- name: pgpool-tls
# mountPath: /config/tls
volumes:
- name: pgpool-config
configMap:
name: pgpool-config
# Configure your own TLS certificate.
# If not set, Pgpool-II will automatically generate the TLS certificate if ssl = on.
#- name: pgpool-tls
# secret:
# secretName: pgpool-tls
20 changes: 20 additions & 0 deletions cf-helm-charts/cf-pg-pool-ii/templates/service-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{ if .Values.monitoring.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "cf-pg-pool-ii.fullname" . }}
labels:
release: prometheus-stack
{{- include "cf-pg-pool-ii.labels" . | nindent 4 }}
spec:
endpoints:
- path: /actuator/prometheus
port: http
namespaceSelector:
matchNames:
- {{ $.Release.Namespace }}
selector:
matchLabels:
{{- include "cf-pg-pool-ii.labels" . | nindent 6 }}
{{ end }}
15 changes: 15 additions & 0 deletions cf-helm-charts/cf-pg-pool-ii/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "cf-pg-pool-ii.fullname" . }}
labels:
{{- include "cf-pg-pool-ii.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: db
protocol: TCP
name: db
selector:
{{- include "cf-pg-pool-ii.selectorLabels" . | nindent 4 }}
44 changes: 44 additions & 0 deletions cf-helm-charts/cf-pg-pool-ii/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
replicaCount: 1

image:
repository: pgpool/pgpool
tag: ""
pullPolicy: Always

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

service:
type: ClusterIP
port: 5432

postgres:
main:
# Host of the PSQL main instance
host: ""
replica:
# Host of the PSQL replica instance, if any
host: ""
# PSQL Secrets configuration
credentials:
# Name of the Secret object containing PSQL credentials
secretName: ""
# Secret Key of the PSQL user
usernameKey: username
# Secret Key of the PSQL user's password
passwordKey: password


resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

nodeSelector: {}

monitoring:
enabled: false
Binary file added charts/cf-pg-pool-ii-0.0.1.tgz
Binary file not shown.
14 changes: 14 additions & 0 deletions charts/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
entries:
cf-pg-pool-ii:
- apiVersion: v2
appVersion: 4.4.2
created: "2024-03-08T11:27:00.080512Z"
description: Pg Pool II Helm Chart
digest: 585403a7819c289eb3714c2a4fcb3ec44978cb3879d5335c0b498186f59a52c9
name: cf-pg-pool-ii
type: application
urls:
- https://cardano-foundation.github.io/cf-helm-charts/cf-pg-pool-ii-0.0.1.tgz
version: 0.0.1
generated: "2024-03-08T11:27:00.080096Z"

0 comments on commit 7948314

Please sign in to comment.