Use Case: Adding a node to a pool

This use case presents the workflow for adding a node to a pool using REST APIs. The advantage of using an iApps LX package to add a node to existing pools is that you can seamlessly apply this action to multiple deployments.

Prerequisites:

  • Access to a BIG-IP version 14.0
  • Familiarity with the iApps LX concept documentation
  • Familiarity with working with REST APIs
  • The iApps LX RPM package has been imported and includes a JSON template block with the configuration to add a node to a pool, with the JAVA script for the configuration processor and configuration for a custom GUI (optional).

Note

For information on how to import an RPM package, see Working With iControl LX/iApps LX RPM Packages.

Accessing the JSON template

Creating a JSON template, or alternatively, importing an existing template, is the first step when applying an iApps LX configuration. From the JSON template, the block instance is created. In the following example, the “id” (ending with d71b) and the “name” (p1) identify the template and within the inputProperties, the “id” : “poolMembers” represent the added node or pool member to the “p1test” pool.

  1. Use the GET REST command to retrieve the JSON block template from the /mgmt/shared/iapp/blocks
Result:The JSON block template is displayed (in https://<BIG-IP address>/mgmt/shared/iapp/blocks), with the “state”: “TEMPLATE”

Example of a JSON template

[{
           "id": "2c502aeb-64cd-4e24-872e-54b6c3f8d71b",
           "name": "p1",
           "inputProperties": [
               {
                   "id": "hostname",
                   "type": "STRING",
                   "value": ""
               },
               {
                   "id": "deviceGroupName",
                   "type": "STRING",
                   "value": ""
               },
               {
                   "id": "poolName",
                   "type": "STRING",
                   "value": "p1test"
               },
               {
                   "id": "poolType",
                   "type": "STRING",
                   "value": "round-robin",
                   "metaData": {
                       "uiHints": {
                           "list": {
                               "dataList": [
                                   "round-robin",
                                   "ratio-node",
                                   "least-sessions"
                               ],
                               "uiType": "dropdown"
                           }
                       }
                   }
               },
               {
                   "id": "poolMembers",
                   "type": "JSON",
                   "value": [
                       {
                           "ip": "192.14.3.54",
                           "port": 80
                       }
                   ]
               }
           ],
           "configurationProcessorReference": {
               "link": "https://localhost/mgmt/shared/iapp/processors/basicPoolConfig"
           },
           "auditProcessorReference": {
               "link": "https://localhost/mgmt/shared/iapp/processors/basicPoolEnforceConfiguredAudit"
           },
           "audit": {
               "intervalSeconds": 30,
               "policy": "ENFORCE_CONFIGURED"
           },
           "configProcessorTimeoutSeconds": 30,
           "statsProcessorTimeoutSeconds": 15,
           "configProcessorAffinity": {
               "processorPolicy": "LOAD_BALANCED",
               "affinityProcessorReference": {
                   "link": "https://localhost/mgmt/shared/iapp/processors/affinity/load-balanced"
               }
           },
           "state": "TEMPLATE",
           "baseReference": {
               "link": "https://localhost/mgmt/shared/iapp/blocks/a9f2603e-ef64-3556-9074-744bf0d79738"
           },
           "generation": 2,
           "lastUpdateMicros": 1516736910681155,
           "kind": "shared:iapp:blocks:blockstate",
           "selfLink": "https://localhost/mgmt/shared/iapp/blocks/2c502aeb-64cd-4e24-872e-54b6c3f8d71b"
       },

Converting the JSON template into a block instance

The configuration change to the “state” property from “TEMPLATE” to “BOUND” creates an instantiated block instance. In addition, by adding inputProperties for the added node/pool member, you are providing the configuration information that will be used to create the new node.

  1. From the JSON block template, use a PATCH Rest command to edit, add, or delete the relevant inputProperties parameters, such as “ip” or “port” as needed for this iApps LX.
  2. Update the “state” property from TEMPLATE to BOUND.
  3. Use a POST REST command to create the block instance.
Result:An-auto-generated response shows a unique ID (UUID) for the data block. The modified data block is returned to the block collection (mgmt/shared/iapp/blocks)

Example of a JSON block

[{
           "id": "2c502aeb-64cd-4e24-872e-54b6c3f8d71b",
           "name": "p1",
           "inputProperties": [
               {
                   "id": "hostname",
                   "type": "STRING",
                   "value": ""
               },
               {
                   "id": "deviceGroupName",
                   "type": "STRING",
                   "value": ""
               },
               {
                   "id": "poolName",
                   "type": "STRING",
                   "value": "p1test"
               },
               {
                   "id": "poolType",
                   "type": "STRING",
                   "value": "round-robin",
                   "metaData": {
                       "uiHints": {
                           "list": {
                               "dataList": [
                                   "round-robin",
                                   "ratio-node",
                                   "least-sessions"
                               ],
                               "uiType": "dropdown"
                           }
                       }
                   }
               },
               {
                   "id": "poolMembers",
                   "type": "JSON",
                   "value": [
                       {
                           "ip": "192.14.3.54",
                           "port": 80
                       }
                   ]
               }
           ],
           "configurationProcessorReference": {
               "link": "https://localhost/mgmt/shared/iapp/processors/basicPoolConfig"
           },
           "auditProcessorReference": {
               "link": "https://localhost/mgmt/shared/iapp/processors/basicPoolEnforceConfiguredAudit"
           },
           "audit": {
               "intervalSeconds": 30,
               "policy": "ENFORCE_CONFIGURED"
           },
           "configProcessorTimeoutSeconds": 30,
           "statsProcessorTimeoutSeconds": 15,
           "configProcessorAffinity": {
               "processorPolicy": "LOAD_BALANCED",
               "affinityProcessorReference": {
                   "link": "https://localhost/mgmt/shared/iapp/processors/affinity/load-balanced"
               }
           },
           "state": "BOUND",
           "baseReference": {
               "link": "https://localhost/mgmt/shared/iapp/blocks/a9f2603e-ef64-3556-9074-744bf0d79738"
           },
           "generation": 2,
           "lastUpdateMicros": 1516736910681155,
           "kind": "shared:iapp:blocks:blockstate",
           "selfLink": "https://localhost/mgmt/shared/iapp/blocks/2c502aeb-64cd-4e24-872e-54b6c3f8d71b"
       }

Note

This block example has a defined audit policy of ENFORCE_CONFIGURED with a 30 second intervalSeconds configured. This means that if a pool member is deleted form the pool, it will be recreated by the audit processor 30 seconds later.

Deploying the iApps LX block instance

Once the block instance is defined as BOUND, the system, based on defined configTaskProcessors, handles the request to add a node to the pool. The config processor sends a PATCH to the configuration task worker http://localhost:8100/mgmt/shared/iapp/block-configuration-tasks/bd6d102f-aee5-4ce7-8bc4-66b4fa8027d0, with the HTTP body block: { state: ‘BOUND’, dataProperties: undefined } }. The config processor gets the config task uri from the incoming onPost restoperation.The config processor sends a PATCH to the configuration task worker http://localhost:8100/mgmt/shared/iapp/block-configuration-tasks/bd6d102f-aee5-4ce7-8bc4-66b4fa8027d0, with the HTTP body block: { state: ‘BOUND’, dataProperties: undefined } }. The config processor gets the config task uri from the incoming onPost restoperation.

  1. View the block instance to verify that the state has changed to BINDING and then again to BOUND.
  2. Verify in your deployment that the node was successfully added. For example, from the default BIG-IP GUI, go to Main > Local Traffic > Pools > Pool List