Since there's not an out-of-the-box configuration for a DataPower Load Balancer Group (LBG) on APIC, this article showcases how to create an APIC gateway-extension to extend a DataPower LBG on APIC, and use it from an API.
NOTE: This will not work for a v5c extension, this is only for the native api gateway.
WARNING: Deploying this gateway-extension may cause a short outage. The API Connect Gateway Service will required to be disabled, then re-enabled.
What is a DataPower Load Balancer Group (LBG)?
Requirements:
- Access to DataPower to create the LBG.
- Access to the APIC Cloud Manager (CM) to upload the gateway-extension to the gateway in the Topology.
- Access to APIC API Manager (APIM) to create an api and invoke the LBG.
Files to be created for the LBG gateway-extension:
- manifest.json: The file that APIC will read to import the DataPower LBG export and add it to the apigw object in the apiconnect domain.
More details about the manifest definition may be found in the IBM APIC documentations. - lbg.zip: The DataPower LBG export.
- lbg-add-on-apigw.json: The file that APIC will update the APIC gateway configuration to include the LBG to be used later.
More details about overriding the configurations of the API Gateway may be found in the IBM APIC documentations.
Here is a completed sample gateway-extension to (1) download, (2) unzip the lbg-add-on-apigw.zip, (3) unzip the lbg.zip to modify the export.xml, (4) re-zip the export, and (5) re-zipping the lbg-add-on-apigw.zip to upload to APIC: lbg-add-on-apigw.zip
The next few steps will walk through configuring the LBG gateway-extension.
- Log into DataPower to create a temporary LBG or navigate to the LBG you would like to import into the APIC domain to use.
The lbg-add-on-apigw.json tells APIC to use the LBG object in the APIC gateway when an APIC Invoke policy uses it:
{
"apigw": {
"_global": {
"override": [
"loadbalancer-group lbg"
]
}
}
}
The manifest.json references and tells APIC to (1) import the lbg.zip into the apiconnect domain, and (2) add the LBG to the api gateway service LBG section.
{
"extension":{
"files":[
{
"filename":"lbg.zip",
"deploy":"immediate",
"type":"dp-import"
},
{
"filename":"lbg-add-on-apigw.json",
"type":"gwd_extension"
}
]
}
}
-
Once all is completed zip everything together as shown in the diagram below:
-
Navigate to the CM > Topology > click on the elipsis (dot, dot, dot) for the gateway and select Configure Gateway-Extension:
-
Go back to DataPower and ensure you are in the apiconnect domain. Navigate to the API Connect Gateway Service.
Disable the service, apply, then re-enable, and apply again.
After disabling and re-enabling the API Connect Gateway Service, you should see the configuration attempt to load into the gateway via syslog:
You may verify that the LBG is uploaded to the apiconnect domain and assigned to the API Gateway Service (navigate to API gateway service in the apiconnect domain on DataPower):
To use the LBG, you may simply just use the name of the LBG with the Invoke policy as shown in the diagram: