1
0
forked from k-space/kube

Add Crunchydata PGO

This commit is contained in:
Lauri Võsandi 2023-02-26 11:09:11 +02:00
parent a51b041621
commit 41b7b509f4
7 changed files with 13839 additions and 153 deletions

View File

@ -0,0 +1,8 @@
# Postgres clusters
This is namespace for Postgres clusters managed by operator-bundle
```
kubectl create namespace postgres-clusters
kubectl apply -n postgres-clusters -f application.yaml
```

View File

@ -0,0 +1,102 @@
---
apiVersion: codemowers.io/v1alpha1
kind: ClusterPostgresDatabaseClass
metadata:
name: dedicated
spec:
targetNamespace: postgres-clusters
description: "Dedicated Postgres cluster"
replicas: 3
routers: 2
storageClass: postgres
podSpec:
nodeSelector:
dedicated: storage
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: storage
---
apiVersion: codemowers.io/v1alpha1
kind: ClusterPostgresDatabaseClass
metadata:
name: shared
spec:
targetCluster: shared
targetNamespace: postgres-clusters
description: "Shared Postgres cluster"
replicas: 3
routers: 2
storageClass: postgres
podSpec:
nodeSelector:
dedicated: storage
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: storage
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pgweb
namespace: postgres-clusters
spec:
replicas: 1
selector:
matchLabels: &selector
app: pgweb
template:
metadata:
labels: *selector
spec:
containers:
- name: pgweb
image: sosedoff/pgweb
command:
- /usr/bin/pgweb
- --bind=0.0.0.0
- --sessions
- --no-ssh
---
apiVersion: v1
kind: Service
metadata:
name: pgweb
namespace: postgres-clusters
spec:
selector:
app: pgweb
ports:
- protocol: TCP
port: 8081
targetPort: 8081
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: pgweb
namespace: postgres-clusters
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
external-dns.alpha.kubernetes.io/target: traefik.k-space.ee
traefik.ingress.kubernetes.io/router.middlewares: traefik-sso@kubernetescrd
spec:
rules:
- host: pgweb.k-space.ee
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: pgweb
port:
number: 8081
tls:
- hosts:
- "*.k-space.ee"

1
postgres-operator/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
postgres-operator-examples

View File

@ -0,0 +1,8 @@
# Postgres operator
```
git clone https://github.com/CrunchyData/postgres-operator-examples
helm template -n postgres-operator postgres-operator-examples/helm/install --include-crds --set debug=false > application.yml
kubectl create namespace postgres-operator
kubectl apply -n postgres-operator --server-side -f application.yml
```

File diff suppressed because it is too large Load Diff

View File

@ -1,67 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: pgweb
spec:
replicas: 3
selector:
matchLabels:
app: pgweb
template:
metadata:
labels:
app: pgweb
spec:
containers:
- name: pgweb
image: sosedoff/pgweb
env:
- name: PMA_PORT
value: "3306"
- name: PMA_HOSTS
value: mariadb,mariadb.etherpad.svc.cluster.local
- name: MYSQL_ROOT_PASSWORD
value: password
---
apiVersion: v1
kind: Service
metadata:
name: pgweb
annotations:
prometheus.io/scrape: 'true'
spec:
selector:
app: pgweb
ports:
- protocol: TCP
port: 8081
targetPort: 8081
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: pgweb
annotations:
kubernetes.io/ingress.class: traefik
cert-manager.io/cluster-issuer: default
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.middlewares: authelia-chain-k6-authelia-auth@kubernetescrd
traefik.ingress.kubernetes.io/router.tls: "true"
external-dns.alpha.kubernetes.io/target: traefik.k-space.ee
spec:
rules:
- host: postgres.k-space.ee
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: pgweb
port:
number: 8081
tls:
- hosts:
- postgres.k-space.ee
secretName: postgres-tls

View File

@ -1,86 +0,0 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
spec:
serviceName: postgres
selector:
matchLabels:
app: postgres
replicas: 1
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: exporter
image: prometheuscommunity/postgres-exporter:latest
env:
- name: DATA_SOURCE_NAME
value: exporter@tcp(127.0.0.1)/
- name: postgres
image: postgres:latest
securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 999
env:
- name: POSTGRES_USER
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POSTGRES_DB
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_PASSWORD
volumeMounts:
- mountPath: /var/lib/postgresql
name: postgres-data
- mountPath: /var/run/postgresql
name: postgres-run
volumes:
- name: postgres-run
emptyDir:
medium: Memory
sizeLimit: 1Mi
volumeClaimTemplates:
- metadata:
name: postgres-data
spec:
storageClassName: longhorn
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: Service
metadata:
name: postgres
spec:
ports:
- protocol: TCP
port: 5432
selector:
app: postgres
---
apiVersion: v1
kind: Service
metadata:
name: postgres-exporter
annotations:
prometheus.io/scrape: 'true'
spec:
ports:
- protocol: TCP
port: 9187
selector:
app: exporter