add postgres

This commit is contained in:
2024-08-22 19:11:17 +05:00
parent 324ddccee3
commit 2731af1bfe
5 changed files with 47 additions and 26 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
1password-credentials.json

View File

@@ -9,8 +9,8 @@ repositories:
url: https://kubernetes.github.io/ingress-nginx url: https://kubernetes.github.io/ingress-nginx
- name: bitnami - name: bitnami
url: https://charts.bitnami.com/bitnami url: https://charts.bitnami.com/bitnami
- name: 1password - name: postgres
url: https://1password.github.io/connect-helm-charts url: https://cloudnative-pg.github.io/charts
--- ---
releases: releases:
# Distributed Storage # Distributed Storage
@@ -49,10 +49,8 @@ releases:
values: values:
- ./values/externaldns.values.yaml - ./values/externaldns.values.yaml
# 1Password Operator # Postgres operator
- name: 1password-system - name: postgres-system
namespace: 1password-system namespace: postgres-system
chart: 1password/connect chart: cnpg/cloudnative-pg
version: 1.15.1 version: 0.21.6
values:
- ./values/1password.values.yaml

View File

@@ -1,8 +0,0 @@
---
connect:
credentials: "1password-credentials.json"
operator:
create: true
token:
value: ${OP_TOKEN}
autoRestart: true

View File

@@ -1,17 +1,13 @@
controller: controller:
ingressClassResource: ingressClassResource:
# -- Name of the ingressClass
name: nginx-internal name: nginx-internal
# -- Is this ingressClass enabled or not
enabled: true enabled: true
# -- Is this the default ingressClass for the cluster
default: true default: true
# -- Controller-value of the controller that is processing this ingressClass
controllerValue: "k8s.io/ingress-nginx" controllerValue: "k8s.io/ingress-nginx"
# -- Parameters is a link to a custom resource containing additional
# configuration for the controller. This is optional if the controller
# does not require extra parameters.
parameters: {} parameters: {}
# -- For backwards compatibility with ingress.class annotation, use ingressClass.
# Algorithm is as follows, first ingressClassName is considered, if not present, controller looks for ingress.class annotation
ingressClass: nginx-internal ingressClass: nginx-internal
service:
annotations:
external-dns.alpha.kubernetes.io/hostname: postgres.home
tcp:
5432: "postgres-system/postgres-cluster-rw:5432"

34
postgres/cluster.yaml Normal file
View File

@@ -0,0 +1,34 @@
---
apiVersion: onepassword.com/v1
kind: OnePasswordItem
metadata:
name: postgres-password
namespace: postgres-system
spec:
itemPath: "vaults/Lab/items/Postgres"
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: postgres-cluster
namespace: postgres-system
spec:
instances: 3
minSyncReplicas: 1
maxSyncReplicas: 2
primaryUpdateStrategy: unsupervised
postgresql:
pg_hba:
- host all all all md5
enableSuperuserAccess: false
bootstrap:
initdb:
database: postgres
secret:
name: postgres-password
storage:
size: 1Gi