Description
The Go SDK does not work when using external connectivity, even when specifying network=external.
The logs when this failure occurs looks like this:
GOCB 13:59:33.630136 agent.go:744: Attempting to request CCCP configuration
|
GOCB 13:59:33.658676 agent.go:772: cb-example-0000.cb-example.marabine.co.uk:11207
|
GOCB 13:59:33.658713 agent.go:774: Using network type external for connections
|
GOCB 13:59:33.658753 agent.go:776: Configuration was deemed invalid &{revId:109 uuid:020008d270ad55afb27eeaae157abb75 bktType:1 kvServerList:[] capiEpList:[] mgmtEpList:[] n1qlEpList:[] ftsEpList:[] cbasEpList:[] vbMap:0xc0002a2020 ketamaMap:<nil>}
|
GOCB 13:59:33.658986 agent.go:823: Starting HTTP looper! []
|
GOCB 13:59:33.659068 agenthttpcfg.go:46: HTTP Looper starting.
|
GOCB 13:59:33.659076 agenthttpcfg.go:64: Pick Failed.
|
GOCB 13:59:33.659085 agenthttpcfg.go:67: Could not find any alive http hosts.
|
panic: failed to connect to any of the specified hosts
|
The interesting part is that all of the lists are empty, so the config is invalid.
The reason that the lists are empty is that gocb seems to pull the ports from AlternateAddress ports: https://github.com/couchbase/gocbcore/blob/d99b2e670fd5024febb3fe653a9628f9eea4156c/routeconfig.go#L64
In the case of a publically addressable Kubernetes cluster (using public DNS), the hostname in external is overridden but there are no ports.
For example:
{"rev":109,"nodesExt":[{"services":{"mgmt":8091,"mgmtSSL":18091,"cbas":8095,"cbasCc":9111,"cbasAdmin":9110,"cbasSSL":18095,"eventingAdminPort":8096,"eventingSSL":18096,"fts":8094,"ftsSSL":18094,"indexAdmin":9100,"indexScan":9101,"indexHttp":9102,"indexStreamInit":9103,"indexStreamCatchup":9104,"indexStreamMaint":9105,"indexHttps":19102,"capiSSL":18092,"capi":8092,"kvSSL":11207,"projector":9999,"kv":11210,"moxi":11211,"n1ql":8093,"n1qlSSL":18093},"hostname":"cb-example-0002.cb-example.default.svc","alternateAddresses":{"external":{"hostname":"cb-example-0002.cb-example.marabine.co.uk"}}}]}
|
A naive reproduction attempt, removing the line of code identified above (clearly this won't be sufficient for the real fix) allowed the go SDK to work correctly.
Attachments
For Gerrit Dashboard: GOCBC-431 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
107869,2 | GOCBC-431: Fix issue where alternate addresses ports not set | v7 | gocbcore | Status: MERGED | +2 | +1 |
107871,2 | GOCBC-431: Fix issue where alternate addresses ports not set | master | gocbcore | Status: MERGED | +2 | +1 |
138470,4 | Update agent_diag.go | master | gocbcore | Status: ABANDONED | -1 | 0 |