Consume API endpoints via Local Kubernetes

The consumption of API endpoints is an addition to the default IDS interaction that allows to exchange API endpoints. This allows for existing HTTP services to work over IDS. For this the OpenAPI Data App is used.

The process of consuming an API is as follows:

  1. retrieve metadata of the connector and OpenAPI data app resources,
  2. send the HTTP request to the OpenAPI data app connected to your own connector

The test connector deployed at https://test-connector.playground.dataspac.es/ui/ provides an agent that exposes an test server implementing the https://httpbin.org/ API specification.

Configuration

  • Download templates
  • Create IDS Identity secret
    Create an Kubernetes secret containing the certificates that you’ve created in the Request Playground Identities step.
    kubectl create secret generic ids-identity-secret --from-file=ids.crt=./component.crt --from-file=ids.key=./component.key --from-file=ca.crt=./cachain.crt
    
    • Modify ids.info.idsid, ids.info.curator, ids.info.maintainer in the values.local.yaml file to the corresponding identifiers that you filled in during creation of the certificates. ids.info.idsid should be the Connector ID, and ids.info.curator, ids.info.maintainer should be the Participant ID.
  • Change Admin User credentials
    The default password is playground but this can be changed to a more secure password, which is especially needed for public Kubernetes deployments.
  • Enable OpenAPI data app
    • Uncomment the OpenAPI block at the bottom of the template.

Deployment

For this the Helm repository must be added:

helm repo add tsg https://nexus.dataspac.es/repository/tsg-helm
helm repo update

After that the Helm chart must be installed, for the local Kubernetes version:

helm upgrade --install playground tsg/tsg-connector --version 3.0.0-master -f values.local.yaml

The user interface of the TSG Core Container will be available at: http://localhost:31000

To view the deployment and show the logs of the TSG Core Container, either Lens or kubectl can be used. For Lens, the main view will be Workloads > Pods. For kubectl the following commands can be used to view information of the deployment:

kubectl get pods
kubectl logs -f deployment/playground-tsg-connector-core-container

OpenAPI Data App

An OpenAPI Data App is deployed on https://test-connector.playground.dataspac.es. This OpenAPI Data App forwards the requests that are sent to it a service implementing the https://httpbin.org/ API specification.

To test if the deployment worked correctly, visit http://localhost:31001/#/. This contains a very simple form where you can enter a message which is sent to the httpbin OpenAPI data app. If everything is setup correctly, you should see the message you sent being returned in a response.

Deploy your own client

If you want, you can also write a custom client app that communicates with httpbin. For this, you only have to change the image name in the httpbin-ui container. Make sure that your application adds the FORWARD_TO, FORWARD_SENDER, FORWARD_RECIPIENT, FORWARD_ACCESSURL and API_BACKEND headers to its outgoing requests.

This step is especially useful if you are going to provide an API.

Clean-up

If you do not want to proceed with other tutorials, you can remove the resources used.

To remove all of the used Kubernetes resources execute:

helm uninstall playground
kubectl delete secret/ids-identity-secret

Didn't find what you were looking for?