-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
98 changed files
with
889 additions
and
567 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
174 changes: 174 additions & 0 deletions
174
kubernetes/apps/database/crunchy-postgres-operator/cluster/cluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/postgres-operator.crunchydata.com/postgrescluster_v1beta1.json | ||
apiVersion: postgres-operator.crunchydata.com/v1beta1 | ||
kind: PostgresCluster | ||
metadata: | ||
name: &name postgres | ||
spec: | ||
postgresVersion: 17 | ||
|
||
metadata: | ||
labels: | ||
crunchy-userinit.ramblurr.github.com/enabled: "true" | ||
crunchy-userinit.ramblurr.github.com/superuser: "postgres" | ||
|
||
patroni: # turn on sync writes to at least 1 other replica | ||
dynamicConfiguration: | ||
synchronous_mode: true | ||
postgresql: | ||
max_wal_size: 5GB | ||
synchronous_commit: "on" | ||
pg_hba: | ||
- hostnossl all all 10.69.0.0/16 md5 # Needed because dbman does not support SSL yet | ||
- hostssl all all all md5 | ||
parameters: | ||
max_connections: 500 | ||
instances: | ||
- name: postgres | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: crunchy-postgres | ||
replicas: &replica 3 | ||
dataVolumeClaimSpec: | ||
storageClassName: openebs-hostpath | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 80Gi | ||
topologySpreadConstraints: | ||
- maxSkew: 1 | ||
topologyKey: "kubernetes.io/hostname" | ||
whenUnsatisfiable: "DoNotSchedule" | ||
labelSelector: | ||
matchLabels: | ||
postgres-operator.crunchydata.com/cluster: *name | ||
postgres-operator.crunchydata.com/data: postgres | ||
|
||
users: | ||
# Superuser | ||
- name: postgres | ||
databases: | ||
- postgres | ||
options: "SUPERUSER" | ||
password: &password | ||
type: AlphaNumeric | ||
# Applications | ||
- name: authelia | ||
databases: | ||
- authelia | ||
password: *password | ||
- name: ghostfolio | ||
databases: | ||
- ghostfolio | ||
password: *password | ||
- name: joplin | ||
databases: | ||
- joplin | ||
password: *password | ||
- name: lychee | ||
databases: | ||
- lychee | ||
password: *password | ||
- name: outline | ||
databases: | ||
- outline | ||
password: *password | ||
- name: paperless | ||
databases: | ||
- paperless | ||
password: *password | ||
- name: pushover-notifier | ||
databases: | ||
- pushover-notifier | ||
password: *password | ||
- name: tandoor | ||
databases: | ||
- tandoor | ||
password: *password | ||
- name: vaultwarden | ||
databases: | ||
- vaultwarden | ||
password: *password | ||
- name: vikunja | ||
databases: | ||
- vikunja | ||
password: *password | ||
backups: | ||
pgbackrest: | ||
configuration: &backupConfig | ||
- secret: | ||
name: crunchy-postgres-secret | ||
global: &backupFlag | ||
compress-type: "bz2" | ||
compress-level: "9" | ||
# Minio | ||
repo1-block: "y" | ||
repo1-bundle: "y" | ||
repo1-path: /crunchy-pgo | ||
repo1-retention-full: "30" # days | ||
repo1-retention-full-type: "time" | ||
repo1-s3-uri-style: path | ||
manual: | ||
repoName: repo1 | ||
options: | ||
- --type=full | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: crunchy-postgres-backup | ||
repos: | ||
- name: repo1 # Minio | ||
s3: &minio | ||
bucket: crunchy-postgres | ||
endpoint: "s3.${SECRET_INTERNAL_DOMAIN}" | ||
region: us-east-1 | ||
schedules: | ||
full: "0 1 * * 0" # Sunday at 01:00 | ||
differential: "0 1 * * 1-6" # Mon-Sat at 01:00 | ||
incremental: "0 2-23 * * *" # Every hour except 01:00 | ||
|
||
# dataSource: | ||
# pgbackrest: | ||
# stanza: "db" | ||
# configuration: *backupConfig | ||
# global: *backupFlag | ||
# repo: | ||
# name: "repo1" | ||
# s3: *minio | ||
|
||
monitoring: | ||
pgmonitor: | ||
exporter: | ||
resources: | ||
requests: | ||
cpu: 10m | ||
memory: 64M | ||
limits: | ||
memory: 512M | ||
|
||
proxy: | ||
pgBouncer: | ||
port: 5432 | ||
service: | ||
metadata: | ||
annotations: | ||
lbipam.cilium.io/ips: ${CLUSTER_LB_POSTGRES} | ||
type: LoadBalancer | ||
replicas: *replica | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: crunchy-postgres-pgbouncer | ||
config: | ||
global: | ||
pool_mode: "session" # Grafana requires session https://github.com/grafana/grafana/issues/74260#issuecomment-1702795311. Everything else is happy with transaction | ||
client_tls_sslmode: prefer | ||
default_pool_size: "100" | ||
max_client_conn: "500" | ||
topologySpreadConstraints: | ||
- maxSkew: 1 | ||
topologyKey: "kubernetes.io/hostname" | ||
whenUnsatisfiable: "DoNotSchedule" | ||
labelSelector: | ||
matchLabels: | ||
postgres-operator.crunchydata.com/cluster: *name | ||
postgres-operator.crunchydata.com/role: pgbouncer |
26 changes: 26 additions & 0 deletions
26
kubernetes/apps/database/crunchy-postgres-operator/cluster/externalsecret.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/external-secrets.io/externalsecret_v1beta1.json | ||
apiVersion: external-secrets.io/v1beta1 | ||
kind: ExternalSecret | ||
metadata: | ||
name: crunchy-postgres | ||
spec: | ||
refreshInterval: 5m | ||
secretStoreRef: | ||
kind: ClusterSecretStore | ||
name: onepassword-connect | ||
target: | ||
name: crunchy-postgres-secret | ||
template: | ||
engineVersion: v2 | ||
data: | ||
s3.conf: | | ||
[global] | ||
repo1-s3-key={{ .CRUNCHY_POSTGRES_S3_ACCESS_KEY }} | ||
repo1-s3-key-secret={{ .CRUNCHY_POSTGRES_S3_SECRET_KEY }} | ||
encryption.conf: | | ||
[global] | ||
repo1-cipher-pass={{ .CRUNCHY_POSTGRES_BACKUP_ENCRYPTION_CIPHER }} | ||
dataFrom: | ||
- extract: | ||
key: crunchy-postgres |
8 changes: 8 additions & 0 deletions
8
kubernetes/apps/database/crunchy-postgres-operator/cluster/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
# yaml-language-server: $schema=https://json.schemastore.org/kustomization | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ./externalsecret.yaml | ||
- ./cluster.yaml | ||
- ./podmonitor.yaml |
37 changes: 37 additions & 0 deletions
37
kubernetes/apps/database/crunchy-postgres-operator/cluster/podmonitor.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PodMonitor | ||
metadata: | ||
name: cpgo-postgres | ||
spec: | ||
jobLabel: cpgo-postgres | ||
namespaceSelector: | ||
matchNames: | ||
- database | ||
podMetricsEndpoints: | ||
- honorLabels: true | ||
path: /metrics | ||
port: exporter | ||
relabelings: | ||
- sourceLabels: | ||
[ | ||
"__meta_kubernetes_namespace", | ||
"__meta_kubernetes_pod_label_postgres_operator_crunchydata_com_cluster", | ||
] | ||
targetLabel: pg_cluster | ||
separator: "/" | ||
replacement: "$1$2" | ||
- sourceLabels: | ||
[ | ||
__meta_kubernetes_pod_label_postgres_operator_crunchydata_com_instance, | ||
] | ||
targetLabel: deployment | ||
- sourceLabels: | ||
[__meta_kubernetes_pod_label_postgres_operator_crunchydata_com_role] | ||
targetLabel: role | ||
- sourceLabels: [__meta_kubernetes_pod_name] | ||
targetLabel: instance | ||
selector: | ||
matchLabels: | ||
postgres-operator.crunchydata.com/cluster: postgres | ||
postgres-operator.crunchydata.com/crunchy-postgres-exporter: "true" |
19 changes: 19 additions & 0 deletions
19
...rnetes/apps/database/crunchy-postgres-operator/clustersecretstore/clustersecretstore.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
apiVersion: external-secrets.io/v1beta1 | ||
kind: ClusterSecretStore | ||
metadata: | ||
name: crunchy-pgo-secrets | ||
spec: | ||
provider: | ||
kubernetes: | ||
remoteNamespace: database | ||
server: | ||
caProvider: | ||
type: ConfigMap | ||
name: kube-root-ca.crt | ||
namespace: database | ||
key: ca.crt | ||
auth: | ||
serviceAccount: | ||
name: external-secrets-pg | ||
namespace: database |
7 changes: 7 additions & 0 deletions
7
kubernetes/apps/database/crunchy-postgres-operator/clustersecretstore/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
# yaml-language-server: $schema=https://json.schemastore.org/kustomization | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ./rbac.yaml | ||
- ./clustersecretstore.yaml |
31 changes: 31 additions & 0 deletions
31
kubernetes/apps/database/crunchy-postgres-operator/clustersecretstore/rbac.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: external-secrets-pg | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["secrets"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["authorization.k8s.io"] | ||
resources: ["selfsubjectrulesreviews"] | ||
verbs: ["create"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: &name external-secrets-pg | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: *name | ||
subjects: | ||
- kind: ServiceAccount | ||
name: *name | ||
namespace: database | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: external-secrets-pg | ||
namespace: database |
Oops, something went wrong.