Back to Linkerd

Interfaces

namerd/docs/interface.md

1.7.513.7 KB
Original Source

Interfaces

An interface is a published network interface to Namerd. All of the interfaces listed below provide Finagle's NameInterpreter functionality for remote resolution of destinations using dtabs stored in Namerd. Additionally, the io.l5d.httpController interface provides a dtab read/write API that's used by namerctl.

<aside class="notice"> These parameters are available to the interface regardless of kind. Interfaces may also have kind-specific parameters. </aside>
KeyDefault ValueDescription
kindrequiredEither io.l5d.thriftNameInterpreter, io.l5d.mesh,io.l5d.destination or io.l5d.httpController.
ipinterface dependentThe local IP address on which to serve the namer interface.
portinterface dependentThe port number on which to serve the namer interface.
socketOptionsnoneSocket options for a configured interface. See Socket Options
tlsno tlsThe namer interface will serve over TLS if this parameter is provided. See Server TLS.

Thrift Name Interpreter

kind: io.l5d.thriftNameInterpreter

A read-only interface providing NameInterpreter functionality over the ThriftMux protocol. Use Linkerd's io.l5d.namerd interpreter to resolve destinations via this interface.

KeyDefault ValueDescription
iploopback addressThe local IP address on which to serve the namer interface. A value like 0.0.0.0 configures Namerd to listen on all local IPv4 interfaces.
port4100The port number on which to serve the namer interface.
socketOptionsnoneSocket options for the thrift name interpreter interface. See Socket Options
cachesee cacheBinding and address cache size configuration.
tlsno tlsThe namer interface will serve over TLS if this parameter is provided. See Server TLS.

Cache

KeyDefault ValueDescription
bindingCacheActive1000The size of the binding active cache.
bindingCacheInactive100The size of the binding inactive cache.
bindingCacheInactiveTTLSecs600The amount of time, in seconds, to keep objects in the binding inactive cache before expiring them.
addrCacheActive1000The size of the address active cache.
addrCacheInactive100The size of the address inactive cache.
addrCacheInactiveTTLSecs600The amount of time, in seconds, to keep objects in the address inactive cache before expiring them.

gRPC Mesh Interface

kind: io.l5d.mesh

A read-only interface providing NameInterpreter functionality over the gRPC protocol. Use Linkerd's io.l5d.mesh interpreter to resolve destinations via this interface.

KeyDefault ValueDescription
iploopback addressThe local IP address on which to serve the namer interface. A value like 0.0.0.0 configures Namerd to listen on all local IPv4 interfaces.
port4321The port number on which to serve the namer interface.
socketOptionsnoneSocket options for the mesh interface. See Socket Options
tlsno tlsThe namer interface will serve over TLS if this parameter is provided. See Server TLS. The server TLS key file must be in PKCS#8 format.
h2AccessLognoneSets the access log path. If not specified, no access log is written.
h2AccessLogRollPolicyneverWhen to roll the logfile. Possible values: Never, Hourly, Daily, Weekly(n) (where n is a day of the week), util-style data size strings (e.g. 3.megabytes, 1.gigabyte).
h2AccessLogAppendtrueAppend to an existing logfile, or truncate it
h2AccessLogRotateCount-1How many rotated logfiles to keep around, maximum. -1 means to keep them all.

Linkerd2 Destination Interface

kind: io.l5d.destination

A gRPC interface implementation based on Linkerd 2's destination API. It's intended for Linkerd 2 proxies to resolve request paths through Namerd's interpreter in a Linkerd 1.x Kubernetes daemonset environment.

KeyDefault ValueDescription
iploopback addressThe local IP address on which to serve the destination interface. A value like 0.0.0.0 configures Namerd to listen on all local IPv4 interfaces.
port8086The port number on which to serve the destination interface.
socketOptionsnoneSocket options to set for the l5d2 destination interface. See Socket Options
prefix/svcThe prefix to use when delegating Linkerd2 request paths to Namerd
namespacedefaultThe namespace with which Namerd should use to retrieve a dtab

Http Controller

kind: io.l5d.httpController

The HTTP controller provides APIs for reading and writing dtabs, as well as for viewing how names are resolved. This API can also be accessed using the namerctl command line tool. Additionally, this API provides an HTTP implementation of the NameInterpreter interface. Use Linkerd's io.l5d.namerd.http interpreter to resolve destinations via this interface.

KeyDefault ValueDescription
iploopback addressThe local IP address on which to serve the namer interface. A value like 0.0.0.0 configures Namerd to listen on all local IPv4 interfaces.
port4180The port number on which to serve the namer interface.
socketOptionsnoneSocket options to set for the http controller interface. See Socket Options
tlsno tlsThe namer interface will serve over TLS if this parameter is provided. See Server TLS.

GET /api/1/dtabs

Sample request

curl :4180/api/1/dtabs

Sample response

["default"]

Returns a list of all dtab namespaces.

Response CodeDescription
200Ok

Content-types: application/json

GET /api/1/dtabs/<namespace>

Sample request

curl :4180/api/1/dtabs/default

Sample response

[{"prefix":"/svc","dst":"/#/io.l5d.fs"}]

Returns the requested dtab. The dtab version is returned in the Etag response header.

ParameterTypeDescription
namespacepathThe dtab namespace to retrieve.
watchuriIf true, updates are returned as a streaming response.
AcceptheaderThe requested content type for the dtab (application/dtab or application/json).
Response CodeDescription
200Ok
404Dtab namespace does not exist

Content-types: application/json, application/dtab

POST /api/1/dtabs/<namespace>

Sample request

curl :4180/api/1/dtabs/pandoracorn -X POST -d '/foo => /bar' -H 'Content-Type: application/dtab'

Sample response (204 NO CONTENT)

Creates a new dtab with the given namespace. The post body should contain the dtab to create and can be in json or dtab format.

ParameterTypeDescription
namespacepathThe dtab namespace to create.
Content-TypeheaderThe content type of the provided dtab (application/dtab or application/json).
N/Apost-bodyThe dtab to create.
Response CodeDescription
204Created
400Dtab is malformed
409Dtab namespace already exists

PUT /api/1/dtabs/<namespace>

Sample request

curl :4180/api/1/dtabs/pandoracorn -X PUT -d '/bar => /bas' -H 'Content-Type: application/dtab'

Sample response (204 NO CONTENT)

Modifies an existing dtab. The post body should contain the updated dtab.

ParameterTypeDescription
namespacepathThe dtab namespace to update.
Content-TypeheaderThe content type of the provided dtab (application/dtab or application/json).
If-MatchheaderIf provided, the update will only be applied if the If-Match header matches the current dtab version. This can be used to prevent conflicting updates.
N/Apost-bodyThe dtab to create.
Response CodeDescription
204Updated
400Dtab is malformed
404Dtab namespace does not exist
412If-Match header is provided and does not match the current dtab version

DELETE /api/1/dtabs/<namespace>

Sample request

curl :4180/api/1/dtabs/pandoracorn -X DELETE

Sample response (204 NO CONTENT)

Deletes an existing dtab with the given namespace. Returns status code 404 if the dtab namespace does not exist.

ParameterTypeDescription
namespacepathThe dtab namespace to delete.
Response CodeDescription
204Deleted
404Dtab namespace does not exist

GET /api/1/bind/<namespace>

Sample request

curl ':4180/api/1/bind/default?path=/http/1.1/GET/default'

Sample response

{
   "bound" : {
      "addr" : {
         "type" : "bound",
         "meta" : {},
         "addrs" : [
            {
               "meta" : {},
               "ip" : "127.0.0.1",
               "port" : 9990
            }
         ]
      },
      "id" : "/#/io.l5d.fs/default",
      "path" : "/"
   },
   "type" : "leaf"
}

Returns the bound tree for the given logical name in the context of the given namespace.

ParameterTypeDescription
namespacepathThe dtab namespace to use.
pathuriThe logical name to bind.
dtaburiAdditional dtab entries to use, in application/dtab format.
watchuriIf true, updates are returned as a streaming response.
Response CodeDescription
200Ok
400Path is malformed

Content-types: application/json

GET /api/1/addr/<namespace>

Sample request

curl ':4180/api/1/addr/default?path=/%23/io.l5d.fs/default'

Sample response

{
   "addrs" : [
      {
         "meta" : {},
         "ip" : "127.0.0.1",
         "port" : 9990
      }
   ],
   "meta" : {},
   "type" : "bound"
}

Returns the addresses for a given concrete name.

ParameterTypeDescription
namespacepathThe dtab namespace to use.
pathuriThe logical name to bind.
watchuriIf true, updates are returned as a streaming response.
Response CodeDescription
200Ok
400Path is malformed

Content-types: application/json

GET /api/1/resolve/<namespace>

Sample request

curl ':4180/api/1/bind/resolve?path=/http/1.1/GET/default'

Sample response

{
   "type" : "bound",
   "meta" : {},
   "addrs" : [
      {
         "ip" : "127.0.0.1",
         "meta" : {},
         "port" : 9990
      }
   ]
}

Returns the addresses for a given logical name. This is effectively a combination of the bind and addr APIs.

ParameterTypeDescription
namespacepathThe dtab namespace to use.
pathuriThe logical name to bind.
dtaburiAdditional dtab entries to use, in application/dtab format.
watchuriIf true, updates are returned as a streaming response.
Response CodeDescription
200Ok
400Path is malformed

Content-types: application/json

GET /api/1/delegate/<namespace>

Sample request

curl ':4180/api/1/bind/delegate?path=/svc/default'

Sample response

{
   "path" : "/svc/default",
   "type" : "delegate",
   "delegate" : {
      "bound" : {
         "path" : "/",
         "addr" : {
            "type" : "bound",
            "addrs" : [
               {
                  "meta" : {},
                  "ip" : "127.0.0.1",
                  "port" : 9990
               }
            ],
            "meta" : {}
         },
         "id" : "/#/io.l5d.fs/default"
      },
      "type" : "leaf",
      "dentry" : {
         "prefix" : "/svc",
         "dst" : "/#/io.l5d.fs"
      },
      "path" : "/#/io.l5d.fs/default"
   }
}

Returns a delegation tree for a given logical name which shows each step of the delegation process.

ParameterTypeDescription
namespacepathThe dtab namespace to use.
pathuriThe logical name to bind.
dtaburiAdditional dtab entries to use, in application/dtab format.
watchuriIf true, updates are returned as a streaming response.
Response CodeDescription
200Ok
400Path is malformed

Content-types: application/json

GET /api/1/bound-names

Sample Request

curl :4180/api/1/bound-names

Sample Response

[
   "/#/io.l5d.fs/default"
]

Returns a list of concrete names that Namerd knows about.

ParameterTypeDescription
watchuriIf true, updates are returned as a streaming response.
Response CodeDescription
200Ok

Content-types: application/json