Coder Social home page Coder Social logo

quarkus-service-binding-demo's Introduction

Quarkus and Service Binding Operator

Quarkus and Service Binding Operator

~/Documents/photos/logos/png/quarkus.png

Preparation

Create a kind cluster

kind create cluster

Install OLM

curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.19.1/install.sh | bash -s v0.19.1

Install SBO

kubectl create -f https://operatorhub.io/install/service-binding-operator.yaml

Install the Postgress Operator

kubectl create -f https://operatorhub.io/install/postgresql.yaml

Create a demo namespace

kubectl create ns demo
kubectl config set-context --current --namespace=demo

Create a postgress cluster

apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
metadata:
  name: postgresql
  namespace: demo
spec:
  image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-ha:centos8-13.4-0
  postgresVersion: 13
  instances:
    - name: instance1
      dataVolumeClaimSpec:
        accessModes:
        - "ReadWriteOnce"
        resources:
          requests:
            storage: 1Gi
  backups:
    pgbackrest:
      image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:centos8-2.33-2
      repos:
      - name: repo1
        volume:
          volumeClaimSpec:
            accessModes:
            - "ReadWriteOnce"
            resources:
              requests:
                storage: 1Gi
      - name: repo2
        volume:
          volumeClaimSpec:
            accessModes:
            - "ReadWriteOnce"
            resources:
              requests:
                storage: 1Gi
  proxy:
    pgBouncer:
      image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:centos8-1.15-2
kubectl apply -f ~/pg-cluster.yml

Demo Quarkus ServiceBinding generation

Clone the examples

cd 
mkdir -p ~/demo
git clone [email protected]:quarkusio/quarkus-quickstarts.git ~/demo/quarkus-quickstarts

Pick up a postgres example

cp -r ~/demo/quarkus-quickstarts/hibernate-orm-panache-quickstart ~/demo/hibernate-orm-panache-quickstart
cd ~/demo/hibernate-orm-panache-quickstart

Add kubernetes and service binding extensions

quarkus ext add -B kubernetes kubernetes-service-binding container-image-docker

Set the Image Pull Policy

echo "quarkus.kubernetes.image-pull-policy=IfNotPresent" >> src/main/resources/application.properties

Create the container image

mvn clean install -Dquarkus.container-image.build=true -DskipTests
kind load docker-image iocanel/hibernate-orm-panache-quickstart:1.0.0-SNAPSHOT

Configure Service Binding

cat <<'EOF' >>src/main/resources/application.properties
quarkus.kubernetes-service-binding.services.my-db.api-version=postgres-operator.crunchydata.com/v1beta1
quarkus.kubernetes-service-binding.services.my-db.kind=PostgresCluster
quarkus.kubernetes-service-binding.services.my-db.name=postgresql
EOF

Deploy

mvn clean install -Dquarkus.kubernetes.deploy=true -DskipTests

Verify

kubectl port-forward service/hibernate-orm-panache-quickstart 8080:80

How we can further improve the experience ?

~/Documents/photos/magic.png

Demo Quarkus Automagic ServiceBinding generation

Overview

  • Preview of Quakus automagic binding
  • Explain convetions
  • Talk about customization

Check the generated resources

(delete-other-windows)
(find-file-other-window "~/demo/hibernate-orm-panache-quickstart/target/kubernetes/kubernetes.yml")
(shrink-window 75 t)

Remove ALL service binding configuration

sed -i '/^quarkus.kubernetes-service-binding/d' src/main/resources/application.properties 

Rebuild the application

mvn clean install -DskipTests

quarkus-service-binding-demo's People

Contributors

iocanel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.