Enabling AI Gateway on gateway service with gateway extensions
The API Connect provides a CLI option to manually enable the AI Gateway extension while retaining your existing gateway extension on the gateway service.
Before you begin
Ensure you have an existing gateway extension deployed to the gateway service. For example, you can create one using the CLI (logged in as the cloud admin user) or through the Cloud Manager (CM) UI:
$ apic gateway-extensions:create <path>/your-existing-gateway-extension.zip --scope org --org admin --gateway-service <datapower-api-gateway> --availability-zone <availability-zone-name>
Procedure
Note: These steps use the
apic
CLI. You must log in as the cloud admin user.
Similar steps can be performed using the Cloud Manager UI.- Log in with the
apic
CLI as the cloud admin user.$ alias apic="apic -s <your APIC platform API endpoint>" $ apic login -r admin/default-idp-1 -u <user> -p <password>
- Retrieve the currently deployed gateway extension from the gateway
service.
$ apic gateway-extensions:implementation --org admin --gateway-service <datapower-api-gateway> --availability-zone <availability-zone-name> $ mv gateway_extension_implementation.zip current_gateway_extension_implementation.zip
- Copy the AI Gateway
extension from the APIC deployment.
- Use the following command to list APIM pod
names:
$ kubectl -n <namespace> get po -l app.kubernetes.io/name=apim -o name
- Choose an APIM pod name and copy the AI Gateway
extension:
$ kubectl cp -c apim <apim pod name>:/apim-init/gateway-extension.zip /tmp/ai-gateway-extension.zip
- Use the following command to list APIM pod
names:
- Combine the current gateway extension with the AI Gateway extension.
- Extract your current gateway extension in one
folder:
$ unzip current_gateway_extension_implementation.zip -d a_dir
- Extract the AI Gateway extension in another folder:
$ unzip /tmp/ai-gateway-extension.zip -d b_dir
- Create a new directory to merge the extensions:
$ mkdir c_dir
- Merge the contents of
manifest.json
fromb_dir
into themanifest.json
ina_dir
, and save the new file inc_dir
. - Copy the
.zip
and.yaml
files froma_dir
andb_dir
toc_dir
:$ cp a_dir/*.zip a_dir/*.yaml b_dir/*.zip c_dir
- Create a new zip file from contents of
c_dir
:$ cd c_dir $ zip /tmp/combined-gateway-extension.zip *
- Extract your current gateway extension in one
folder:
- Update the gateway service with the combined
extension.
$ apic gateway-extensions:update /tmp/combined-gateway-extension.zip --scope org --org admin --gateway-service <datapower-api-gateway> --availability-zone <availability-zone-name>
Note: Even after following this procedure to apply AI Gateway extensions, a current limitation is that APIC UI and CLI will still show thatEnable AI Gateway
flag is not enabled on this gateway.