Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test case 1: SB + postgresql running within the same namespace #25

Open
cmoulliard opened this issue Jun 15, 2022 · 0 comments
Open

Test case 1: SB + postgresql running within the same namespace #25

cmoulliard opened this issue Jun 15, 2022 · 0 comments
Labels

Comments

@cmoulliard
Copy link
Contributor

cmoulliard commented Jun 15, 2022

Scenario

Title: Spring Boot Petclinic application and postgresql running within the same namespace

Reference: TAP documentation to play the different scenario using RabbitMQ - here

Steps:

  1. Have access to a k8s cluster and TAP
  2. Have a postgresql DB deployed within the target namespace demo-4
  3. Create a workload where the serviceRef is defined as such ApiVersion:Kind:NameofTheResource
APP=spring-tap-petclinic
NS=demo-4
tanzu apps workload create $APP \
  -n $NS \
  --git-repo https://github.com/halkyonio/$APP.git \
  --git-branch main\
  --type web \
  --annotation "autoscaling.knative.dev/scaleDownDelay=15m" \
  --annotation "autoscaling.knative.dev/minScale=1" \
  --env "SPRING_PROFILES_ACTIVE=postgres" \
  --label app.kubernetes.io/part-of=$APP\
  --service-ref "db=sql.tanzu.vmware.com/v1:Postgres:postgres-db" \
  -y

Expected

  • Knative service within the Namespace: Yes
  • ClusterResource/postgresql: Yes
  • ResourceClaim within the Namespace: No
  • Postgres/postgres-db within the Namespace: Yes

Results:

Wait and check the workload's deployment using these commands:

NS=demo-4
APP=spring-tap-petclinic
tanzu apps -n $NS workload get $APP

## Get the URL of the service and  open the URL  in your browser
kc get ksvc/$APP -n $NS -o json | jq .status.address.url

Resources checked and their result:

  • kc get ClusterResource/postgresql: Yes
    Remark: The ClusterResource corresponds to what tanzu services types list | grep postgresql command displays
  • kc get resourceclaim -n demo-4: No
  • kc get Postgres/postgres-db -n demo-4: YES

Conclusion

The Spring Boot Petclinic Application has been well deployed, the URL of the service is accessible
No resourceclaim has been needed to do the binding using SBO. The PostgresDB resource has been used directly
to bind the DB with the Knative Service.

See the SBO spec section

spec:
  name: db
  service:
    apiVersion: sql.tanzu.vmware.com/v1
    kind: Postgres
    name: postgres-db
  workload:
    apiVersion: serving.knative.dev/v1
    kind: Service
    name: spring-tap-petclinic
status:
  binding:
    name: postgres-db-app-user-db-secret

To cleanup

APP=spring-tap-petclinic
NS=demo-4
tanzu apps workload delete $APP -n $NS -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant