Uploaded image for project: 'Couchbase Go SDK'
  1. Couchbase Go SDK
  2. GOCBC-431

Go SDK does not work with publically addressable Kubernetes cluster

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.0
    • Fix Version/s: 1.6.1
    • Component/s: library
    • Labels:
      None

      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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

          Hide
          ingenthr Matt Ingenthron added a comment -

          I don't know if this can make our April maint. release, but if you get to a more complete fix and find it low risk to include a fix, I'd support that. The QE test coverage doesn't cover it.

          Note you should be able to test with a simple Docker setup like we did previously in this case, though Matt Carabine had a more complex test env.

          Show
          ingenthr Matt Ingenthron added a comment - I don't know if this can make our April maint. release, but if you get to a more complete fix and find it low risk to include a fix, I'd support that. The QE test coverage doesn't cover it. Note you should be able to test with a simple Docker setup like we did previously in this case, though Matt Carabine had a more complex test env.
          Hide
          charles.dixon Charles Dixon added a comment -

          Will include this in today's April maintenance release. As QE coverage doesn't touch it this removes any point of running situational testing against it.

          Show
          charles.dixon Charles Dixon added a comment - Will include this in today's April maintenance release. As QE coverage doesn't touch it this removes any point of running situational testing against it.
          Hide
          build-team Couchbase Build Team added a comment -

          Build sync_gateway-2.6.0-37 contains gocbcore commit 5905fd8 with commit message:
          GOCBC-431: Fix issue where alternate addresses ports not set

          Show
          build-team Couchbase Build Team added a comment - Build sync_gateway-2.6.0-37 contains gocbcore commit 5905fd8 with commit message: GOCBC-431 : Fix issue where alternate addresses ports not set
          Hide
          build-team Couchbase Build Team added a comment -

          Build sync_gateway-2.5.1-8 contains gocbcore commit 5905fd8 with commit message:
          GOCBC-431: Fix issue where alternate addresses ports not set

          Show
          build-team Couchbase Build Team added a comment - Build sync_gateway-2.5.1-8 contains gocbcore commit 5905fd8 with commit message: GOCBC-431 : Fix issue where alternate addresses ports not set

            People

            • Assignee:
              matt.carabine Matt Carabine
              Reporter:
              matt.carabine Matt Carabine
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.