Skip to content

Commit 7e98dd5

Browse files
Merge pull request #115 from RostislavDugin/feature/helm_chart
Feature/helm chart
2 parents 1470013 + ba37b30 commit 7e98dd5

File tree

10 files changed

+504
-0
lines changed

10 files changed

+504
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,40 @@ Then run:
157157
docker compose up -d
158158
```
159159

160+
### Option 4: Kubernetes with Helm
161+
162+
For Kubernetes deployments, use the official Helm chart:
163+
164+
```bash
165+
helm install postgresus ./deploy/postgresus -n postgresus --create-namespace
166+
```
167+
168+
To customize the installation, create a `values.yaml` file:
169+
170+
```yaml
171+
ingress:
172+
hosts:
173+
- host: backup.yourdomain.com
174+
paths:
175+
- path: /
176+
pathType: Prefix
177+
tls:
178+
- secretName: backup-yourdomain-com-tls
179+
hosts:
180+
- backup.yourdomain.com
181+
182+
persistence:
183+
size: 20Gi
184+
```
185+
186+
Then install with your custom values:
187+
188+
```bash
189+
helm install postgresus ./deploy/postgresus -n postgresus --create-namespace -f values.yaml
190+
```
191+
192+
See the [Helm chart README](deploy/postgresus/README.md) for all configuration options.
193+
160194
---
161195

162196
## 🚀 Usage

deploy/postgresus/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

deploy/postgresus/Chart.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v2
2+
name: postgresus
3+
description: A Helm chart for Postgresus - PostgreSQL backup and management system
4+
type: application
5+
version: 1.0.0
6+
appVersion: "v1.45.3"
7+
keywords:
8+
- postgresql
9+
- backup
10+
- database
11+
- restore
12+
home: https://github.com/RostislavDugin/postgresus

deploy/postgresus/README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Postgresus Helm Chart
2+
3+
## Installation
4+
5+
```bash
6+
helm install postgresus ./deploy/postgresus -n postgresus --create-namespace
7+
```
8+
9+
## Configuration
10+
11+
### Main Parameters
12+
13+
| Parameter | Description | Default Value |
14+
| ------------------ | ------------------ | --------------------------- |
15+
| `namespace.create` | Create namespace | `true` |
16+
| `namespace.name` | Namespace name | `postgresus` |
17+
| `image.repository` | Docker image | `rostislavdugin/postgresus` |
18+
| `image.tag` | Image tag | `latest` |
19+
| `image.pullPolicy` | Image pull policy | `Always` |
20+
| `replicaCount` | Number of replicas | `1` |
21+
22+
### Resources
23+
24+
| Parameter | Description | Default Value |
25+
| --------------------------- | -------------- | ------------- |
26+
| `resources.requests.memory` | Memory request | `1Gi` |
27+
| `resources.requests.cpu` | CPU request | `500m` |
28+
| `resources.limits.memory` | Memory limit | `1Gi` |
29+
| `resources.limits.cpu` | CPU limit | `500m` |
30+
31+
### Storage
32+
33+
| Parameter | Description | Default Value |
34+
| ------------------------------ | ------------------------- | ---------------------- |
35+
| `persistence.enabled` | Enable persistent storage | `true` |
36+
| `persistence.storageClassName` | Storage class | `""` (cluster default) |
37+
| `persistence.accessMode` | Access mode | `ReadWriteOnce` |
38+
| `persistence.size` | Storage size | `10Gi` |
39+
| `persistence.mountPath` | Mount path | `/postgresus-data` |
40+
41+
### Service
42+
43+
| Parameter | Description | Default Value |
44+
| -------------------------- | ----------------------- | ------------- |
45+
| `service.type` | Service type | `ClusterIP` |
46+
| `service.port` | Service port | `4005` |
47+
| `service.targetPort` | Target port | `4005` |
48+
| `service.headless.enabled` | Enable headless service | `true` |
49+
50+
### Ingress
51+
52+
| Parameter | Description | Default Value |
53+
| ----------------------- | ----------------- | ------------------------ |
54+
| `ingress.enabled` | Enable Ingress | `true` |
55+
| `ingress.className` | Ingress class | `nginx` |
56+
| `ingress.hosts[0].host` | Hostname | `postgresus.example.com` |
57+
| `ingress.tls` | TLS configuration | See values.yaml |
58+
59+
### Health Checks
60+
61+
| Parameter | Description | Default Value |
62+
| ------------------------ | ---------------------- | ------------- |
63+
| `livenessProbe.enabled` | Enable liveness probe | `true` |
64+
| `readinessProbe.enabled` | Enable readiness probe | `true` |
65+
66+
## Custom Ingress Example
67+
68+
```yaml
69+
# custom-values.yaml
70+
ingress:
71+
hosts:
72+
- host: backup.example.com
73+
paths:
74+
- path: /
75+
pathType: Prefix
76+
tls:
77+
- secretName: backup-example-com-tls
78+
hosts:
79+
- backup.example.com
80+
```
81+
82+
```bash
83+
helm install postgresus ./deploy/postgresus -n postgresus --create-namespace -f custom-values.yaml
84+
```
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "postgresus.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
*/}}
11+
{{- define "postgresus.fullname" -}}
12+
{{- if .Values.fullnameOverride }}
13+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
14+
{{- else }}
15+
{{- $name := default .Chart.Name .Values.nameOverride }}
16+
{{- if contains $name .Release.Name }}
17+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
18+
{{- else }}
19+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
20+
{{- end }}
21+
{{- end }}
22+
{{- end }}
23+
24+
{{/*
25+
Create chart name and version as used by the chart label.
26+
*/}}
27+
{{- define "postgresus.chart" -}}
28+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
29+
{{- end }}
30+
31+
{{/*
32+
Common labels
33+
*/}}
34+
{{- define "postgresus.labels" -}}
35+
helm.sh/chart: {{ include "postgresus.chart" . }}
36+
{{ include "postgresus.selectorLabels" . }}
37+
{{- if .Chart.AppVersion }}
38+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
39+
{{- end }}
40+
app.kubernetes.io/managed-by: {{ .Release.Service }}
41+
{{- end }}
42+
43+
{{/*
44+
Selector labels
45+
*/}}
46+
{{- define "postgresus.selectorLabels" -}}
47+
app.kubernetes.io/name: {{ include "postgresus.name" . }}
48+
app.kubernetes.io/instance: {{ .Release.Name }}
49+
app: postgresus
50+
{{- end }}
51+
52+
{{/*
53+
Create the name of the service account to use
54+
*/}}
55+
{{- define "postgresus.serviceAccountName" -}}
56+
{{- if .Values.serviceAccount.create }}
57+
{{- default (include "postgresus.fullname" .) .Values.serviceAccount.name }}
58+
{{- else }}
59+
{{- default "default" .Values.serviceAccount.name }}
60+
{{- end }}
61+
{{- end }}
62+
63+
{{/*
64+
Namespace
65+
*/}}
66+
{{- define "postgresus.namespace" -}}
67+
{{- if .Values.namespace.create }}
68+
{{- .Values.namespace.name }}
69+
{{- else }}
70+
{{- .Release.Namespace }}
71+
{{- end }}
72+
{{- end }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{{- if .Values.ingress.enabled -}}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: {{ include "postgresus.fullname" . }}-ingress
6+
namespace: {{ include "postgresus.namespace" . }}
7+
labels:
8+
{{- include "postgresus.labels" . | nindent 4 }}
9+
{{- with .Values.ingress.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
spec:
14+
{{- if .Values.ingress.className }}
15+
ingressClassName: {{ .Values.ingress.className }}
16+
{{- end }}
17+
{{- if .Values.ingress.tls }}
18+
tls:
19+
{{- range .Values.ingress.tls }}
20+
- hosts:
21+
{{- range .hosts }}
22+
- {{ . | quote }}
23+
{{- end }}
24+
secretName: {{ .secretName }}
25+
{{- end }}
26+
{{- end }}
27+
rules:
28+
{{- range .Values.ingress.hosts }}
29+
- host: {{ .host | quote }}
30+
http:
31+
paths:
32+
{{- range .paths }}
33+
- path: {{ .path }}
34+
pathType: {{ .pathType }}
35+
backend:
36+
service:
37+
name: {{ include "postgresus.fullname" $ }}-service
38+
port:
39+
number: {{ $.Values.service.port }}
40+
{{- end }}
41+
{{- end }}
42+
{{- end }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{- if .Values.namespace.create }}
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: {{ .Values.namespace.name }}
6+
labels:
7+
{{- include "postgresus.labels" . | nindent 4 }}
8+
{{- end }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "postgresus.fullname" . }}-service
5+
namespace: {{ include "postgresus.namespace" . }}
6+
labels:
7+
{{- include "postgresus.labels" . | nindent 4 }}
8+
spec:
9+
type: {{ .Values.service.type }}
10+
ports:
11+
- port: {{ .Values.service.port }}
12+
targetPort: {{ .Values.service.targetPort }}
13+
protocol: TCP
14+
name: http
15+
selector:
16+
{{- include "postgresus.selectorLabels" . | nindent 4 }}
17+
---
18+
{{- if .Values.service.headless.enabled }}
19+
apiVersion: v1
20+
kind: Service
21+
metadata:
22+
name: {{ include "postgresus.fullname" . }}-headless
23+
namespace: {{ include "postgresus.namespace" . }}
24+
labels:
25+
{{- include "postgresus.labels" . | nindent 4 }}
26+
spec:
27+
type: ClusterIP
28+
clusterIP: None
29+
ports:
30+
- port: {{ .Values.service.port }}
31+
targetPort: {{ .Values.service.targetPort }}
32+
protocol: TCP
33+
name: http
34+
selector:
35+
{{- include "postgresus.selectorLabels" . | nindent 4 }}
36+
{{- end }}

0 commit comments

Comments
 (0)