Next we are going to publish the application APIs to the world.
There are two ways of creating this configuration, the first one is manual similar to the way we performed the configuration until this point and the second one is described bellow.
As part of their development cycle, the developers of the Arcadia application are generating an OpenApi specification to describe their APIs.
We are going to use this API specification in order to publish the services to the world.
curl -k -sc cookie.txt -X POST --url "https://$controller_ip/api/v1/platform/login" --header 'Content-Type: application/json' --data '{"credentials": {"type": "BASIC","username": "nginx@f5.com","password": "Admin2020"}}'
curl -k -sb cookie.txt -c cookie.txt --location --request PUT "https://$controller_ip/api/v1/services/api-definitions/arcadia-api/versions/v1" --header 'Content-Type: application/json' --header 'Content-Type: text/plain' --data "@files/6controller/arcadia_api_spec.json"
We have just uploaded the OpenApi spec to the Nginx Controller.
Go to “N” -> “Services” -> “APIs”.
You can see the “Arcadia API” definition listed.
Check the DNS name of the backend servers we need to point our APIs to:
kubectl get svc
Output
We are interested in “main” and “app2” and their DNS names are arcadia-main and arcadia-app2.
Create the configuration of each of the workloads:
Name: arcadia-app2
Click Save
Add a Workload:
First input: arcadia-app2
Port: 80
Repeat the steps above for arcadia-main.
Return to “N” -> “Services”-> “APIs” -> “API Definitions” -> “Arcadia API” -> “Pen” Icon -> “Add a Published API”:
Published API Name: arcadia-pub-api
Environment: prod
Application: arcadia-api
Gateways: api.arcadia.aws.cloud
Save
All URLs that start with /api - assign the “arcadia-app2” workload
All URLs that start with /trading - assign the “arcadia-main” workload
After adding each route click Save.
When done click “Publish”.