Skip to content
Snippets Groups Projects
Commit 530b64e6 authored by Iustin Pop's avatar Iustin Pop
Browse files

A few updates to the confd design (2.1)


While the 2.1 design is old and should be “immutable”, I can't find
documentation about the confd protocol anywhere else, so let's correct
the design doc.

The patch is mostly style changes, plus a clarification on the ‘query’
field of the request, which varies *a lot* per request type.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 406a9c91
No related branches found
No related tags found
No related merge requests found
...@@ -518,27 +518,34 @@ A confd query will look like this, on the wire:: ...@@ -518,27 +518,34 @@ A confd query will look like this, on the wire::
"hmac": "4a4139b2c3c5921f7e439469a0a45ad200aead0f" "hmac": "4a4139b2c3c5921f7e439469a0a45ad200aead0f"
} }
"plj0" is a fourcc that details the message content. It stands for plain ``plj0`` is a fourcc that details the message content. It stands for plain
json 0, and can be changed as we move on to different type of protocols json 0, and can be changed as we move on to different type of protocols
(for example protocol buffers, or encrypted json). What follows is a (for example protocol buffers, or encrypted json). What follows is a
json encoded string, with the following fields: json encoded string, with the following fields:
- 'msg' contains a JSON-encoded query, its fields are: - ``msg`` contains a JSON-encoded query, its fields are:
- 'protocol', integer, is the confd protocol version (initially just - ``protocol``, integer, is the confd protocol version (initially
constants.CONFD_PROTOCOL_VERSION, with a value of 1) just ``constants.CONFD_PROTOCOL_VERSION``, with a value of 1)
- 'type', integer, is the query type. For example "node role by name" - ``type``, integer, is the query type. For example "node role by
or "node primary ip by instance ip". Constants will be provided for name" or "node primary ip by instance ip". Constants will be
the actual available query types. provided for the actual available query types
- 'query', string, is the search key. For example an ip, or a node - ``query`` is a multi-type field (depending on the ``type`` field):
name.
- 'rsalt', string, is the required response salt. The client must use
it to recognize which answer it's getting.
- 'salt' must be the current unix timestamp, according to the client. - it can be missing, when the request is fully determined by the
Servers can refuse messages which have a wrong timing, according to ``type`` field
their configuration and clock. - it can contain a string which denotes the search key: for
- 'hmac' is an hmac signature of salt+msg, with the cluster hmac key example an IP, or a node name
- it can contain a dictionary, in which case the actual details
vary further per request type
- ``rsalt``, string, is the required response salt; the client must
use it to recognize which answer it's getting.
- ``salt`` must be the current unix timestamp, according to the
client; servers should refuse messages which have a wrong timing,
according to their configuration and clock
- ``hmac`` is an hmac signature of salt+msg, with the cluster hmac key
If an answer comes back (which is optional, since confd works over UDP) If an answer comes back (which is optional, since confd works over UDP)
it will be in this format:: it will be in this format::
...@@ -554,24 +561,25 @@ it will be in this format:: ...@@ -554,24 +561,25 @@ it will be in this format::
Where: Where:
- 'plj0' the message type magic fourcc, as discussed above - ``plj0`` the message type magic fourcc, as discussed above
- 'msg' contains a JSON-encoded answer, its fields are: - ``msg`` contains a JSON-encoded answer, its fields are:
- 'protocol', integer, is the confd protocol version (initially just - ``protocol``, integer, is the confd protocol version (initially
constants.CONFD_PROTOCOL_VERSION, with a value of 1) just constants.CONFD_PROTOCOL_VERSION, with a value of 1)
- 'status', integer, is the error code. Initially just 0 for 'ok' or - ``status``, integer, is the error code; initially just ``0`` for
'1' for 'error' (in which case answer contains an error detail, 'ok' or ``1`` for 'error' (in which case answer contains an error
rather than an answer), but in the future it may be expanded to have detail, rather than an answer), but in the future it may be
more meanings (eg: 2, the answer is compressed) expanded to have more meanings (e.g. ``2`` if the answer is
- 'answer', is the actual answer. Its type and meaning is query compressed)
specific. For example for "node primary ip by instance ip" queries - ``answer``, is the actual answer; its type and meaning is query
specific: for example for "node primary ip by instance ip" queries
it will be a string containing an IP address, for "node role by it will be a string containing an IP address, for "node role by
name" queries it will be an integer which encodes the role (master, name" queries it will be an integer which encodes the role
candidate, drained, offline) according to constants. (master, candidate, drained, offline) according to constants
- 'salt' is the requested salt from the query. A client can use it to - ``salt`` is the requested salt from the query; a client can use it
recognize what query the answer is answering. to recognize what query the answer is answering.
- 'hmac' is an hmac signature of salt+msg, with the cluster hmac key - ``hmac`` is an hmac signature of salt+msg, with the cluster hmac key
Redistribute Config Redistribute Config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment