Skip to content

Commit

Permalink
feat: add cloudnative pg on default installation
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Choudhary <[email protected]>
  • Loading branch information
vishal-chdhry committed Sep 4, 2024
1 parent 07d09c1 commit fabf9bb
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 267 deletions.
6 changes: 0 additions & 6 deletions charts/reports-server/Chart.lock

This file was deleted.

10 changes: 5 additions & 5 deletions charts/reports-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ maintainers:
url: https://kyverno.io/
email: [email protected]
kubeVersion: ">=1.16.0-0"
dependencies:
- condition: postgresql.enabled
name: postgresql
version: 13.4.1
repository: oci://registry-1.docker.io/bitnamicharts
# dependencies:
# - condition: postgresql.enabled
# name: cloudnative-pg
# version: 0.22.0
# repository: https://cloudnative-pg.github.io/charts
10 changes: 3 additions & 7 deletions charts/reports-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ helm install reports-server --namespace reports-server --create-namespace report
| service.port | int | `443` | Service port |
| config.debug | bool | `false` | Enable debug (to use inmemorydatabase) |
| config.db.secretName | string | `""` | If set, database connection information will be read from the Secret with this name. Overrides `db.host`, `db.name`, `db.user`, and `db.password`. |
| config.db.host | string | `""` | Database host |
| config.db.host | string | `"reports-server-cluster-rw.reports-server"` | Database host |
| config.db.hostSecretKeyName | string | `"host"` | The database host will be read from this `key` in the specified Secret, when `db.secretName` is set. |
| config.db.name | string | `"reportsdb"` | Database name |
| config.db.dbNameSecretKeyName | string | `"dbname"` | The database name will be read from this `key` in the specified Secret, when `db.secretName` is set. |
| config.db.user | string | `"postgres"` | Database user |
| config.db.user | string | `"app"` | Database user |
| config.db.userSecretKeyName | string | `"username"` | The database username will be read from this `key` in the specified Secret, when `db.secretName` is set. |
| config.db.password | string | `"reports"` | Database password |
| config.db.password | string | `"password"` | Database password |
| config.db.passwordSecretKeyName | string | `"password"` | The database password will be read from this `key` in the specified Secret, when `db.secretName` is set. |
| config.db.sslmode | string | `"disable"` | Database SSL |
| config.db.sslrootcert | string | `""` | Database SSL root cert |
Expand All @@ -86,10 +86,6 @@ helm install reports-server --namespace reports-server --create-namespace report

Kubernetes: `>=1.16.0-0`

| Repository | Name | Version |
|------------|------|---------|
| oci://registry-1.docker.io/bitnamicharts | postgresql | 13.4.1 |

## Maintainers

| Name | Email | Url |
Expand Down
Binary file removed charts/reports-server/charts/postgresql-13.4.1.tgz
Binary file not shown.
30 changes: 30 additions & 0 deletions charts/reports-server/templates/cnpg-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: reports-server-cluster
namespace: {{ $.Release.Namespace }}
labels:
{{- include "reports-server.labels" . | nindent 4 }}
spec:
instances: 3
primaryUpdateStrategy: unsupervised
bootstrap:
initdb:
database: reportsdb
owner: app
secret:
name: app-secret
storage:
size: 10Gi
---
apiVersion: v1
kind: Secret
metadata:
name: app-secret
namespace: {{ $.Release.Namespace }}
labels:
{{- include "reports-server.labels" . | nindent 4 }}
type: kubernetes.io/basic-auth
data:
username: YXBw
password: cGFzc3dvcmQ=
6 changes: 3 additions & 3 deletions charts/reports-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ config:
secretName: ""

# -- Database host
host: ""
host: reports-server-cluster-rw.reports-server
# -- The database host will be read from this `key` in the specified Secret, when `db.secretName` is set.
hostSecretKeyName: "host"

Expand All @@ -188,13 +188,13 @@ config:
dbNameSecretKeyName: "dbname"

# -- Database user
user: postgres
user: app

# -- The database username will be read from this `key` in the specified Secret, when `db.secretName` is set.
userSecretKeyName: "username"

# -- Database password
password: reports
password: password

# -- The database password will be read from this `key` in the specified Secret, when `db.secretName` is set.
passwordSecretKeyName: "password"
Expand Down
39 changes: 39 additions & 0 deletions config/install-inmemory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ metadata:
app.kubernetes.io/version: "v0.1.1"
app.kubernetes.io/managed-by: Helm
---
apiVersion: v1
kind: Secret
metadata:
name: app-secret
namespace: reports-server
labels:
helm.sh/chart: reports-server-0.1.1
app.kubernetes.io/name: reports-server
app.kubernetes.io/instance: reports-server
app.kubernetes.io/version: "v0.1.1"
app.kubernetes.io/managed-by: Helm
type: kubernetes.io/basic-auth
data:
username: YXBw
password: cGFzc3dvcmQ=
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand Down Expand Up @@ -223,6 +239,29 @@ spec:
- emptyDir: {}
name: tmp-dir
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: reports-server-cluster
namespace: reports-server
labels:
helm.sh/chart: reports-server-0.1.1
app.kubernetes.io/name: reports-server
app.kubernetes.io/instance: reports-server
app.kubernetes.io/version: "v0.1.1"
app.kubernetes.io/managed-by: Helm
spec:
instances: 3
primaryUpdateStrategy: unsupervised
bootstrap:
initdb:
database: reportsdb
owner: app
secret:
name: app-secret
storage:
size: 10Gi
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
Expand Down
Loading

0 comments on commit fabf9bb

Please sign in to comment.