Skip to content

Commit

Permalink
Merge pull request #306 from RADAR-base/refactor/radar-postgres
Browse files Browse the repository at this point in the history
Refactor postgresql and timescaledb charts
  • Loading branch information
pvannierop authored Dec 18, 2024
2 parents 1919329 + 9a03f01 commit 9bed521
Show file tree
Hide file tree
Showing 12 changed files with 297 additions and 0 deletions.
4 changes: 4 additions & 0 deletions charts/radar-postgresql/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 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
6 changes: 6 additions & 0 deletions charts/radar-postgresql/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: postgresql
repository: file://../../external/postgresql
version: 12.1.9
digest: sha256:e93cc220482fa3bc4716a91f198e34e2de2bb22e0d20655c061f019d12a20559
generated: "2024-12-16T09:05:31.66774333+01:00"
18 changes: 18 additions & 0 deletions charts/radar-postgresql/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v2
name: radar-postgresql
version: 0.1.0
appVersion: 11.16.0
description: PostgreSQL (Postgres) is an open source object-relational database known
for reliability and data integrity. ACID-compliant, it supports foreign keys, joins,
views, triggers and stored procedures.
maintainers:
- email: [email protected]
name: Keyvan Hedayati
url: https://www.thehyve.nl
- email: [email protected]
name: Pim van Nierop
url: https://www.thehyve.nl/experts/pim-van-nierop
dependencies:
- name: postgresql
version: 12.1.9
repository: file://../../external/postgresql
58 changes: 58 additions & 0 deletions charts/radar-postgresql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@


# radar-postgresql

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![AppVersion: 11.16.0](https://img.shields.io/badge/AppVersion-11.16.0-informational?style=flat-square)

PostgreSQL (Postgres) is an open source object-relational database known for reliability and data integrity. ACID-compliant, it supports foreign keys, joins, views, triggers and stored procedures.

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| Keyvan Hedayati | <[email protected]> | <https://www.thehyve.nl> |
| Pim van Nierop | <[email protected]> | <https://www.thehyve.nl/experts/pim-van-nierop> |

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| file://../../external/postgresql | postgresql | 12.1.9 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| postgresql.image.repository | string | `"bitnami/postgresql"` | |
| postgresql.image.tag | string | `"11.16.0"` | |
| postgresql.global.postgresql.auth.postgresPassword | string | `""` | |
| postgresql.auth.postgresPassword | string | `""` | |
| postgresql.auth.username | string | `""` | |
| postgresql.auth.password | string | `""` | |
| postgresql.auth.database | string | `""` | |
| postgresql.replication.applicationName | string | `"radar"` | |
| postgresql.primary.initdb.scripts."multi-db-init.sh" | string | `"#!/bin/bash\nset -e\nset -u\nexport PGPASSWORD=\"$POSTGRESQL_PASSWORD\"\n\nfunction create_user_and_database() {\n export PGPASSWORD=\"$POSTGRESQL_PASSWORD\"\n local database=$1\n local database_exist=$(psql -U postgres -tAc \"SELECT 1 FROM pg_database WHERE datname='$database';\")\n if [[ \"$database_exist\" == 1 ]]; then\n echo \"Database $database already exists\"\n else\n echo \"Database $database does not exist\"\n echo \" Creating database '$database' for user postgres\"\n psql -U postgres -v ON_ERROR_STOP=1 <<-EOSQL\n CREATE DATABASE \"$database\";\n GRANT ALL PRIVILEGES ON DATABASE $database TO postgres;\nEOSQL\n fi\n}\n\nif [ -n \"$POSTGRES_MULTIPLE_DATABASES\" ]; then\n echo \"Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES\"\n for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do\n create_user_and_database $db\n done\n echo \"Databases created\"\nfi\n"` | |
| postgresql.primary.extraEnvVars | list | `[]` | |
| postgresql.primary.podAnnotations."backup.velero.io/backup-volumes" | string | `"data"` | |
| postgresql.primary.podAnnotations."post.hook.backup.velero.io/command" | string | `"[\"/bin/fsfreeze\", \"--unfreeze\", \"/bitnami/postgresql\"]"` | |
| postgresql.primary.podAnnotations."post.hook.backup.velero.io/container" | string | `"fsfreeze"` | |
| postgresql.primary.podAnnotations."pre.hook.backup.velero.io/command" | string | `"[\"/bin/fsfreeze\", \"--freeze\", \"/bitnami/postgresql\"]"` | |
| postgresql.primary.podAnnotations."pre.hook.backup.velero.io/container" | string | `"fsfreeze"` | |
| postgresql.primary.sidecars[0].name | string | `"fsfreeze"` | |
| postgresql.primary.sidecars[0].image | string | `"busybox"` | |
| postgresql.primary.sidecars[0].securityContext.privileged | bool | `true` | |
| postgresql.primary.sidecars[0].volumeMounts[0].mountPath | string | `"/bitnami/postgresql"` | |
| postgresql.primary.sidecars[0].volumeMounts[0].name | string | `"data"` | |
| postgresql.primary.sidecars[0].volumeMounts[0].readOnly | bool | `false` | |
| postgresql.primary.sidecars[0].command[0] | string | `"/bin/sh"` | |
| postgresql.primary.sidecars[0].command[1] | string | `"-c"` | |
| postgresql.primary.sidecars[0].command[2] | string | `"sleep infinity"` | |
| postgresql.primary.persistence.enabled | bool | `true` | |
| postgresql.primary.persistence.existingClaim | string | `""` | |
| postgresql.primary.persistence.mountPath | string | `"/bitnami/postgresql"` | |
| postgresql.primary.persistence.size | string | `"8Gi"` | |
| postgresql.volumePermissions.enabled | bool | `true` | |
| postgresql.metrics.enabled | bool | `true` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.8.1](https://github.com/norwoodj/helm-docs/releases/v1.8.1)
Binary file not shown.
76 changes: 76 additions & 0 deletions charts/radar-postgresql/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
postgresql:
image:
repository: bitnami/postgresql
tag: 11.16.0
global:
postgresql:
auth:
postgresPassword: ""
auth:
postgresPassword: ""
username: ""
password: ""
database: ""
replication:
applicationName: radar
primary:
initdb:
scripts:
multi-db-init.sh: |
#!/bin/bash
set -e
set -u
export PGPASSWORD="$POSTGRESQL_PASSWORD"
function create_user_and_database() {
export PGPASSWORD="$POSTGRESQL_PASSWORD"
local database=$1
local database_exist=$(psql -U postgres -tAc "SELECT 1 FROM pg_database WHERE datname='$database';")
if [[ "$database_exist" == 1 ]]; then
echo "Database $database already exists"
else
echo "Database $database does not exist"
echo " Creating database '$database' for user postgres"
psql -U postgres -v ON_ERROR_STOP=1 <<-EOSQL
CREATE DATABASE "$database";
GRANT ALL PRIVILEGES ON DATABASE $database TO postgres;
EOSQL
fi
}
if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then
echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES"
for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do
create_user_and_database $db
done
echo "Databases created"
fi
extraEnvVars: []
podAnnotations:
backup.velero.io/backup-volumes: data
post.hook.backup.velero.io/command: '["/bin/fsfreeze", "--unfreeze", "/bitnami/postgresql"]'
post.hook.backup.velero.io/container: fsfreeze
pre.hook.backup.velero.io/command: '["/bin/fsfreeze", "--freeze", "/bitnami/postgresql"]'
pre.hook.backup.velero.io/container: fsfreeze
sidecars:
- name: fsfreeze
image: busybox
securityContext:
privileged: true
volumeMounts:
- mountPath: "/bitnami/postgresql"
name: data
readOnly: false
command:
- "/bin/sh"
- "-c"
- "sleep infinity"
persistence:
enabled: true
existingClaim: ""
mountPath: /bitnami/postgresql
size: 8Gi
volumePermissions:
enabled: true
metrics:
enabled: true
4 changes: 4 additions & 0 deletions charts/radar-timescaledb/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 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
6 changes: 6 additions & 0 deletions charts/radar-timescaledb/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: postgresql
repository: file://../../external/postgresql
version: 12.1.9
digest: sha256:e93cc220482fa3bc4716a91f198e34e2de2bb22e0d20655c061f019d12a20559
generated: "2024-12-16T09:05:31.66774333+01:00"
18 changes: 18 additions & 0 deletions charts/radar-timescaledb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v2
name: radar-timescaledb
version: 0.1.0
appVersion: latest-pg12-bitnami
description: TimescaleDB is an open-source time-series database optimized for fast ingest and complex queries, built as
an extension to PostgreSQL. It leverages PostgreSQL's reliability and ecosystem while adding time-series specific
optimizations and features, such as automatic partitioning and compression.
maintainers:
- email: [email protected]
name: Keyvan Hedayati
url: https://www.thehyve.nl
- email: [email protected]
name: Pim van Nierop
url: https://www.thehyve.nl/experts/pim-van-nierop
dependencies:
- name: postgresql
version: 12.1.9
repository: file://../../external/postgresql
58 changes: 58 additions & 0 deletions charts/radar-timescaledb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@


# radar-timescaledb

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![AppVersion: latest-pg12-bitnami](https://img.shields.io/badge/AppVersion-latest--pg12--bitnami-informational?style=flat-square)

TimescaleDB is an open-source time-series database optimized for fast ingest and complex queries, built as an extension to PostgreSQL. It leverages PostgreSQL's reliability and ecosystem while adding time-series specific optimizations and features, such as automatic partitioning and compression.

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| Keyvan Hedayati | <[email protected]> | <https://www.thehyve.nl> |
| Pim van Nierop | <[email protected]> | <https://www.thehyve.nl/experts/pim-van-nierop> |

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| file://../../external/postgresql | postgresql | 12.1.9 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| postgresql.image.repository | string | `"timescale/timescaledb"` | |
| postgresql.image.tag | string | `"latest-pg12-bitnami"` | |
| postgresql.image.pullPolicy | string | `"Always"` | |
| postgresql.global.postgresql.auth.postgresPassword | string | `""` | |
| postgresql.auth.postgresPassword | string | `""` | |
| postgresql.auth.username | string | `""` | |
| postgresql.auth.password | string | `""` | |
| postgresql.auth.database | string | `""` | |
| postgresql.replication.applicationName | string | `"radar"` | |
| postgresql.primary.extraEnvVars | list | `[]` | |
| postgresql.primary.podAnnotations."backup.velero.io/backup-volumes" | string | `"data"` | |
| postgresql.primary.podAnnotations."post.hook.backup.velero.io/command" | string | `"[\"/bin/fsfreeze\", \"--unfreeze\", \"/bitnami/postgresql\"]"` | |
| postgresql.primary.podAnnotations."post.hook.backup.velero.io/container" | string | `"fsfreeze"` | |
| postgresql.primary.podAnnotations."pre.hook.backup.velero.io/command" | string | `"[\"/bin/fsfreeze\", \"--freeze\", \"/bitnami/postgresql\"]"` | |
| postgresql.primary.podAnnotations."pre.hook.backup.velero.io/container" | string | `"fsfreeze"` | |
| postgresql.primary.sidecars[0].name | string | `"fsfreeze"` | |
| postgresql.primary.sidecars[0].image | string | `"busybox"` | |
| postgresql.primary.sidecars[0].securityContext.privileged | bool | `true` | |
| postgresql.primary.sidecars[0].volumeMounts[0].mountPath | string | `"/bitnami/postgresql"` | |
| postgresql.primary.sidecars[0].volumeMounts[0].name | string | `"data"` | |
| postgresql.primary.sidecars[0].volumeMounts[0].readOnly | bool | `false` | |
| postgresql.primary.sidecars[0].command[0] | string | `"/bin/sh"` | |
| postgresql.primary.sidecars[0].command[1] | string | `"-c"` | |
| postgresql.primary.sidecars[0].command[2] | string | `"sleep infinity"` | |
| postgresql.primary.persistence.enabled | bool | `true` | |
| postgresql.primary.persistence.existingClaim | string | `""` | |
| postgresql.primary.persistence.mountPath | string | `"/bitnami/postgresql"` | |
| postgresql.primary.persistence.size | string | `"8Gi"` | |
| postgresql.volumePermissions.enabled | bool | `true` | |
| postgresql.metrics.enabled | bool | `true` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.8.1](https://github.com/norwoodj/helm-docs/releases/v1.8.1)
Binary file not shown.
49 changes: 49 additions & 0 deletions charts/radar-timescaledb/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
postgresql:
# Check https://hub.docker.com/r/timescale/timescaledb/tags
# The suffix MUST be bitnami.
# On first install, choose the latest major postgresql version. This cannot be modified afterwards.
image:
repository: timescale/timescaledb
tag: latest-pg12-bitnami
pullPolicy: Always
global:
postgresql:
auth:
postgresPassword: ""
auth:
postgresPassword: ""
username: ""
password: ""
database: ""
replication:
applicationName: radar
primary:
extraEnvVars: []
podAnnotations:
backup.velero.io/backup-volumes: data
post.hook.backup.velero.io/command: '["/bin/fsfreeze", "--unfreeze", "/bitnami/postgresql"]'
post.hook.backup.velero.io/container: fsfreeze
pre.hook.backup.velero.io/command: '["/bin/fsfreeze", "--freeze", "/bitnami/postgresql"]'
pre.hook.backup.velero.io/container: fsfreeze
sidecars:
- name: fsfreeze
image: busybox
securityContext:
privileged: true
volumeMounts:
- mountPath: "/bitnami/postgresql"
name: data
readOnly: false
command:
- "/bin/sh"
- "-c"
- "sleep infinity"
persistence:
enabled: true
existingClaim: ""
mountPath: /bitnami/postgresql
size: 8Gi
volumePermissions:
enabled: true
metrics:
enabled: true

0 comments on commit 9bed521

Please sign in to comment.