Skip to content

Instantly share code, notes, and snippets.

@baijum
Last active July 26, 2021 10:27
Show Gist options
  • Select an option

  • Save baijum/b99cd8e542868a00b2b5efc2e1b7dc10 to your computer and use it in GitHub Desktop.

Select an option

Save baijum/b99cd8e542868a00b2b5efc2e1b7dc10 to your computer and use it in GitHub Desktop.
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: spring-petclinic-rest
namespace: my-postgresql
labels:
app: spring-petclinic-rest
spec:
replicas: 1
selector:
matchLabels:
app: spring-petclinic-rest
template:
metadata:
labels:
app: spring-petclinic-rest
spec:
containers:
- name: application
image: quay.io/baijum/spring-petclinic-rest:latest
env:
- name: SPRING_PROFILES_ACTIVE
value: postgresql,spring-data-jpa
ports:
- name: http
containerPort: 9966
---
apiVersion: v1
kind: Service
metadata:
name: spring-petclinic-rest
namespace: my-postgresql
spec:
ports:
- port: 80
targetPort: 9966
selector:
app: spring-petclinic-rest
#!/bin/bash
export pgo_cluster_name=hippo
export cluster_namespace=my-postgresql
export pgo_cluster_username=hippo
export PGPASSWORD=$(kubectl -n "${cluster_namespace}" get secrets \
"${pgo_cluster_name}-${pgo_cluster_username}-secret" -o "jsonpath={.data['password']}" | base64 -d)
nohup kubectl -n ${cluster_namespace} port-forward svc/hippo 5432:5432 &
sleep 5
curl -LO https://raw.githubusercontent.com/spring-petclinic/spring-petclinic-rest/master/src/main/resources/db/postgresql/initDB.sql
psql -h localhost -U "${pgo_cluster_username}" "${pgo_cluster_name}" -f initDB.sql
curl -LO https://raw.githubusercontent.com/spring-petclinic/spring-petclinic-rest/master/src/main/resources/db/postgresql/populateDB.sql
psql -h localhost -U "${pgo_cluster_username}" "${pgo_cluster_name}" -f populateDB.sql
apiVersion: crunchydata.com/v1
kind: Pgcluster
metadata:
annotations:
current-primary: hippo
service.binding/database: path={.spec.name}
service.binding/host: path={.spec.name}
service.binding/port: path={.spec.port}
labels:
crunchy-pgha-scope: hippo
deployment-name: hippo
name: hippo
pg-cluster: hippo
pgo-version: 4.7.0
pgouser: admin
name: hippo
namespace: my-postgresql
spec:
BackrestStorage:
accessmode: ReadWriteMany
matchLabels: ""
name: ""
size: 1G
storageclass: ""
storagetype: create
supplementalgroups: ""
PrimaryStorage:
accessmode: ReadWriteMany
matchLabels: ""
name: hippo
size: 1G
storageclass: ""
storagetype: create
supplementalgroups: ""
ReplicaStorage:
accessmode: ReadWriteMany
matchLabels: ""
name: ""
size: 1G
storageclass: ""
storagetype: create
supplementalgroups: ""
annotations: {}
ccpimage: crunchy-postgres-ha
ccpimageprefix: "registry.developers.crunchydata.com/crunchydata"
ccpimagetag: centos8-13.3-4.7.0
clustername: hippo
database: hippo
exporterport: "9187"
limits: {}
name: hippo
pgDataSource:
restoreFrom: ""
restoreOpts: ""
pgbadgerport: "10000"
pgoimageprefix: "registry.developers.crunchydata.com/crunchydata"
podAntiAffinity:
default: preferred
pgBackRest: preferred
pgBouncer: preferred
port: "5432"
tolerations: []
user: hippo
userlabels:
pgo-version: 4.7.0
apiVersion: binding.operators.coreos.com/v1alpha1
kind: ServiceBinding
metadata:
name: spring-petclinic-rest
namespace: my-postgresql
spec:
services:
- group: "crunchydata.com"
version: v1
kind: Pgcluster
name: hippo
- group: ""
version: v1
kind: Secret
name: hippo-hippo-secret
application:
name: spring-petclinic-rest
group: apps
version: v1
resource: deployments
mappings:
- name: type
value: "postgresql"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment