Skip to content

Instantly share code, notes, and snippets.

View baijum's full-sized avatar
🏠
Working from home

Baiju Muthukadan baijum

🏠
Working from home
  • Red Hat
  • India
View GitHub Profile
@baijum
baijum / petclinic-rds-ack.md
Last active September 15, 2022 18:03
Spring PetClinic with Amazon Relational Database Service using AWS Controllers for Kubernetes

Spring PetClinic with Amazon Relational Database Service using AWS Controllers for Kubernetes

Spring PetClinic is a sample Spring Boot web application. This article shows how to connect the application to an Amazon Relational Database Service using AWS Controllers for Kubernetes and an operator that implements the Service Binding Specification for Kubernetes.

Prerequisites

Keybase proof

I hereby claim:

  • I am baijum on github.
  • I am baijum (https://keybase.io/baijum) on keybase.
  • I have a public key whose fingerprint is CD3F F128 5397 68FB 1543 780D 5279 1C84 B003 881F

To claim this, I am signing this object:

Spring PetClinic Application with AWS RDS PostgreSQL

First I created a container image repository in quay.io.

$ git clone https://github.com/spring-projects/spring-petclinic.git
$ spring-petclinic
$ sudo apt-get install openjdk-11-jdk -y
$ export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
$ ./mvnw spring-boot:build-image
package secret
import (
"encoding/base64"
"github.com/asaskevich/govalidator"
corev1 "k8s.io/api/core/v1"
)
func decode(msg []byte) string {
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: percona-server-mongodb-operator
namespace: percona
spec:
channel: stable
installPlanApproval: Automatic
name: percona-server-mongodb-operator
source: community-operators
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: spring-petclinic-rest
namespace: my-postgresql
labels:
app: spring-petclinic-rest
spec:
replicas: 1
#!/bin/bash
cat <<EOF | kubectl apply -f -
apiVersion: crunchydata.com/v1
kind: Pgcluster
metadata:
annotations:
current-primary: hippo
service.binding/database: path={.spec.name}
service.binding/host: path={.spec.name}