F5Networks / f5-appsvcs-extension

F5 BIG-IP Application Services 3 Extension
Apache License 2.0
165 stars 54 forks source link

Service Discovery task created before AS3 declaration completes (causes errors) #326

Closed chen23 closed 3 years ago

chen23 commented 4 years ago

Environment

Summary

When using service discovery the task to create service discovery is made before the AS3 declaration has completed. This can cause errors in service discovery where the partition has not been created yet.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Submit the following declaration:

    {
    "class": "ADC",
    "schemaVersion": "3.7.0",
    "id": "urn:uuid:33045210-3ab8-4636-9b2a-c98d22ab425d",
    "label": "Consul Service Discovery",
    "AS3Demo": {
    "class": "Tenant",
    "A1": {
      "class": "Application",
      "template": "generic",
      "app001_pool": {
        "class": "Pool",
        "monitors": [
          "tcp"
        ],
        "members": [
          {
            "servicePort": 80,
            "addressDiscovery": "consul",
            "updateInterval": 10,
            "uri": "http://10.1.1.8:8500/v1/catalog/service/app001",
            "credentialUpdate": false
          }
        ]
      }
    }
    }
    }
  2. Observe the following error response:

    
    Tue, 18 Aug 2020 23:50:21 GMT - fine: [appsvcs] {"message":"Begin parsing current AS3Demo config","level":"debug"}
    Tue, 18 Aug 2020 23:50:21 GMT - fine: [appsvcs] {"message":"tenant AS3Demo lacks a partition","level":"debug"}
    Tue, 18 Aug 2020 23:50:21 GMT - config: [appsvcs] {"message":"parsing current AS3Demo config time: 0.01 seconds","level":"notice"}
    Tue, 18 Aug 2020 23:50:21 GMT - fine: [appsvcs] {"message":"Begin generating AS3Demo diff","level":"debug"}
    Tue, 18 Aug 2020 23:50:21 GMT - fine: [appsvcs] {"message":"fetched declaration from target, 1 blocks, 1 Tenants","level":"debug"}
    Tue, 18 Aug 2020 23:50:21 GMT - config: [appsvcs] {"message":"generating AS3Demo diff time: 0.017 seconds","level":"notice"}
    Tue, 18 Aug 2020 23:50:21 GMT - fine: [appsvcs] {"message":"Begin updating AS3Demo","level":"debug"}
    Tue, 18 Aug 2020 23:50:21 GMT - fine: [f5-service-discovery: restWorkerTask.js] Got service discovery task request
    Tue, 18 Aug 2020 23:50:22 GMT - info: [f5-service-discovery: Task.js] Task ~AS3Demo~U0e2TGy0zmZAGgRMX7Yv3kPDny4vYDj8Qb4RRMkhfFc3D failed: Command failed: tmsh -a create ltm node /AS3Demo/consul-192.168.128.3-private address 192.168.128.3 metadata replace-all-with { appsvcs-discovery { } }
    01070734:3: Configuration error: Can't associate Node (/AS3Demo/consul-192.168.128.3-private) folder does not exist

Tue, 18 Aug 2020 23:50:22 GMT - fine: [f5-service-discovery: Task.js] Error: Command failed: tmsh -a create ltm node /AS3Demo/consul-192.168.128.3-private address 192.168.128.3 metadata replace-all-with { appsvcs-discovery { } } 01070734:3: Configuration error: Can't associate Node (/AS3Demo/consul-192.168.128.3-private) folder does not exist

at ChildProcess.exithandler (child_process.js:202:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:854:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)

Tue, 18 Aug 2020 23:50:22 GMT - fine: [f5-service-discovery: restWorkerTask.js] service discovery task succeeded Tue, 18 Aug 2020 23:50:22 GMT - fine: [appsvcs] {"message":"generating tmsh commands and pre-script iControlRest calls","level":"debug"} Tue, 18 Aug 2020 23:50:22 GMT - fine: [appsvcs] {"message":"getting whitelist","level":"debug"} Tue, 18 Aug 2020 23:50:22 GMT - fine: [appsvcs] {"message":"setting whitelist","level":"debug"} Tue, 18 Aug 2020 23:50:22 GMT - fine: [appsvcs] {"message":"executing pre-script iControl calls","level":"debug"} Tue, 18 Aug 2020 23:50:22 GMT - fine: [appsvcs] {"message":"Executing pre-script time: 0 milliseconds","level":"debug"}



### Expected Behavior
AS3 should wait until AFTER the partition/pool is created to trigger the service discovery process.

### Actual Behavior
errors related to missing partition / pool
dstokesf5 commented 4 years ago

Is this issue affected at all by your recent Service Discovery Worker merge request?

chen23 commented 4 years ago

This is less of an issue (takes less time to initialize service discovery). I would consider this close(able), but still technically an issue, but not worth fixing IMHO.