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.
  1. 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>  
    
  2. 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  
    
  3. Copy the AI Gateway extension from the APIC deployment.
    1. Use the following command to list APIM pod names:
      $ kubectl -n <namespace> get po -l app.kubernetes.io/name=apim -o name  
      
    2. 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  
      
  4. Combine the current gateway extension with the AI Gateway extension.
    1. Extract your current gateway extension in one folder:
      $ unzip current_gateway_extension_implementation.zip -d a_dir  
      
    2. Extract the AI Gateway extension in another folder:
      $ unzip /tmp/ai-gateway-extension.zip -d b_dir  
      
    3. Create a new directory to merge the extensions:
      $ mkdir c_dir  
      
    4. Merge the contents of manifest.json from b_dir into the manifest.json in a_dir, and save the new file in c_dir.
    5. Copy the .zip and .yaml files from a_dir and b_dir to c_dir:
      $ cp a_dir/*.zip a_dir/*.yaml b_dir/*.zip c_dir  
      
    6. Create a new zip file from contents of c_dir:
      $ cd c_dir  
      $ zip /tmp/combined-gateway-extension.zip *  
      
  5. 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 that Enable AI Gateway flag is not enabled on this gateway.