-
Notifications
You must be signed in to change notification settings - Fork 0
Test case 1: SB + postgresql running within the same namespace #25
Copy link
Copy link
Open
Labels
Description
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:
- Have access to a k8s cluster and TAP
- Have a postgresql DB deployed within the target namespace
demo-4 - 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 whattanzu services types list | grep postgresqlcommand displayskc get resourceclaim -n demo-4: Nokc 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
Reactions are currently unavailable