Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transport Refactor #60867

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
316391c
Move resover stuff to tcp where it is useful
dwoz Sep 12, 2021
f9ff5f7
Refactor into transports and channels
dwoz Sep 12, 2021
254d201
Clean up transports
dwoz Sep 24, 2021
f4efcb8
Fix Serial references
dwoz Sep 28, 2021
caf9433
Pickle PubServer
dwoz Sep 29, 2021
b58dc00
Fix pillar tests on macos
dwoz Sep 29, 2021
aad01dd
More test fixes
dwoz Sep 29, 2021
aeda673
Add pub server tests
dwoz Sep 30, 2021
7bc8986
Start to add base class defs
dwoz Oct 3, 2021
8cdfb57
Remove raw opt from client send
dwoz Oct 3, 2021
b6b8c21
Fix master_uri test
dwoz Oct 3, 2021
e15e2b0
fix wart
dwoz Oct 3, 2021
7ef402d
Clean up some docs and test fix
dwoz Oct 7, 2021
870616f
Address docs and hard coded strings
dwoz Oct 18, 2021
3fc2723
Fix bad import
dwoz Oct 18, 2021
427f163
Not all transports have daemons
dwoz Oct 29, 2021
efb8e79
Clear funcs cache channels
dwoz Oct 30, 2021
38f6403
Add connect method to connect pub server channels
dwoz Nov 1, 2021
f89c116
Fix pre-commit
dwoz Nov 1, 2021
c662f6b
add changelog
dwoz Nov 1, 2021
10a31ec
Fix broken test
dwoz Nov 1, 2021
d10b200
Cleanup based on review comments
dwoz Nov 2, 2021
bcdccee
Fix ZeroMQ references
dwoz Nov 2, 2021
a6859a9
Remove rabbitmq stuff for now
dwoz Nov 3, 2021
2d47356
Cleanup and address PR comments
dwoz Nov 4, 2021
43a780c
fix pre-commit
dwoz Nov 4, 2021
75fde9d
Add missing logic from refactor
dwoz Nov 19, 2021
f00518e
Remove port info from channel doc strings
dwoz Nov 20, 2021
999d821
Fix param docs
dwoz Nov 20, 2021
f293bbc
Update publish_daemon docstring
dwoz Nov 20, 2021
431bd45
Remove un-needed import
dwoz Nov 20, 2021
79380d2
Use deepcopy for opts
dwoz Nov 20, 2021
6cbd898
Remove un-used import
dwoz Nov 20, 2021
b4931e4
Remove un-needed imports
dwoz Nov 20, 2021
044bac7
Add deprecations for salt.transport.(client,server)
dwoz Nov 20, 2021
03e0151
Document deprecation in docstring
dwoz Nov 20, 2021
866ee9e
Call parent class no-op __init__
dwoz Nov 21, 2021
610db71
Use salt.channel.client instead of salt.transport.client
dwoz Nov 24, 2021
077681c
fix unit tests
dwoz Nov 24, 2021
13cca4d
Fix more tests
dwoz Nov 24, 2021
d5c0723
Clean up salt.transport.(client,server) references
dwoz Nov 24, 2021
a730edb
Fix reference to salt.transport.client
dwoz Nov 25, 2021
73be1ee
Test tcp test fix
dwoz Nov 25, 2021
9c6db3f
Try tcp test fix
dwoz Nov 26, 2021
485ca2f
Add message logging
dwoz Nov 26, 2021
6453c9e
test tcp
dwoz Dec 1, 2021
299b2bb
Test fix
dwoz Dec 12, 2021
a41616f
Fix pre-commit
dwoz Dec 12, 2021
c2c14da
Test tcp message client refactor fix
dwoz Dec 13, 2021
c91899e
fix pre-commit
dwoz Dec 13, 2021
03a4d7f
Fix broken unit test
dwoz Dec 13, 2021
f856b5f
Clean up doc strings
dwoz Dec 14, 2021
fae15bf
Enable topics for tcp transport
dwoz Dec 14, 2021
f5c25b4
Deltaproxy does not work with subscriptions
dwoz Dec 15, 2021
295e5c2
Fix docstrings
dwoz Jan 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/61161.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Re-factor transport to make them more plug-able
dwoz marked this conversation as resolved.
Show resolved Hide resolved
32 changes: 32 additions & 0 deletions doc/topics/channels/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. _channels:

=============
Salt Channels
=============

One of the fundamental features of Salt is remote execution. Salt has two basic
"channels" for communicating with minions. Each channel requires a client
(minion) and a server (master) implementation to work within Salt. These pairs
of channels will work together to implement the specific message passing
required by the channel interface. Channels use :ref:`Transports <transports>`
for sending and receiving messages.


Pub Channel
===========
The pub channel, or publish channel, is how a master sends a job (payload) to a
dwoz marked this conversation as resolved.
Show resolved Hide resolved
minion. This is a basic pub/sub paradigm, which has specific targeting semantics.
All data which goes across the publish system should be encrypted such that only
members of the Salt cluster can decrypt the published payloads.


Req Channel
===========
The req channel is how the minions send data to the master. This interface is
primarily used for fetching files and returning job returns. The req channels
have two basic interfaces when talking to the master. ``send`` is the basic
method that guarantees the message is encrypted at least so that only minions
attached to the same master can read it-- but no guarantee of minion-master
confidentiality, whereas the ``crypted_transfer_decode_dictentry`` method does
guarantee minion-master confidentiality. The req channel is also used by the
salt cli to publish jobs to the master.
1 change: 1 addition & 0 deletions doc/topics/configuration/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ secure and troubleshoot, and how to perform many other administrative tasks.
../tutorials/cron
../hardening
../../security/index
../channels/index
../transports/index
../master_tops/index
../../ref/returners/index
Expand Down
54 changes: 29 additions & 25 deletions doc/topics/transports/index.rst
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
.. _transports:
.. _transports:

==============
Salt Transport
==============

One of fundamental features of Salt is remote execution. Salt has two basic
"channels" for communicating with minions. Each channel requires a
client (minion) and a server (master) implementation to work within Salt. These
pairs of channels will work together to implement the specific message passing
required by the channel interface.


Pub Channel
===========
The pub channel, or publish channel, is how a master sends a job (payload) to a
minion. This is a basic pub/sub paradigm, which has specific targeting semantics.
All data which goes across the publish system should be encrypted such that only
members of the Salt cluster can decrypt the publishes.


Req Channel
===========
The req channel is how the minions send data to the master. This interface is
primarily used for fetching files and returning job returns. The req channels
have two basic interfaces when talking to the master. ``send`` is the basic
method that guarantees the message is encrypted at least so that only minions
attached to the same master can read it-- but no guarantee of minion-master
confidentiality, whereas the ``crypted_transfer_decode_dictentry`` method does
guarantee minion-master confidentiality.

Transports in Salt are used by :ref:`Channels <channels>` to send messages between Masters, Minions,
and the Salt CLI. Transports can be brokerless or brokered. There are two types
of server / client implementations needed to implement a channel.


Publish Server
==============

The publish server implements a publish / subscribe paradigm and is used by
Minions to receive jobs from Masters.

Publish Client
==============

The publish client subscribes and receives messages from a Publish Server.
dwoz marked this conversation as resolved.
Show resolved Hide resolved


Request Server
==============

The request server implements a request / reply paradigm. Every request sent by
the client must recieve exactly one reply.

Request Client
==============

The request client sends requests to a Request Server and recieves a reply message.


.. toctree::
Expand Down
18 changes: 9 additions & 9 deletions doc/topics/transports/tcp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
TCP Transport
=============

The tcp transport is an implementation of Salt's channels using raw tcp sockets.
The tcp transport is an implementation of Salt's transport using raw tcp sockets.
Since this isn't using a pre-defined messaging library we will describe the wire
protocol, message semantics, etc. in this document.

Expand Down Expand Up @@ -83,17 +83,17 @@ Crypto
The current implementation uses the same crypto as the ``zeromq`` transport.


Pub Channel
===========
For the pub channel we send messages without "message ids" which the remote end
interprets as a one-way send.
Publish Server and Client
=========================
For the publish server and client we send messages without "message ids" which
the remote end interprets as a one-way send.

.. note::

As of today we send all publishes to all minions and rely on minion-side filtering.


Req Channel
===========
For the req channel we send messages with a "message id". This "message id" allows
us to multiplex messages across the socket.
Request Server and Client
=========================
For the request server and client we send messages with a "message id". This
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question is this actually a dict element like "message_id"? Is that an implementation detail or actually part of the protocol. If it's a required part of the protocol we should be explicit about its spelling, ... we send messages with a message_idkey. Thismessage_id` allows us to multiplex messages across the socket.

"message id" allows us to multiplex messages across the socket.
31 changes: 16 additions & 15 deletions doc/topics/transports/zeromq.rst
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
================
Zeromq Transport
ZeroMQ Transport
================

.. note::

Zeromq is the current default transport within Salt
ZeroMQ is the current default transport within Salt

Zeromq is a messaging library with bindings into many languages. Zeromq implements
ZeroMQ is a messaging library with bindings into many languages. ZeroMQ implements
a socket interface for message passing, with specific semantics for the socket type.


Pub Channel
===========
The pub channel is implemented using zeromq's pub/sub sockets. By default we don't
use zeromq's filtering, which means that all publish jobs are sent to all minions
and filtered minion side. Zeromq does have publisher side filtering which can be
enabled in salt using :conf_master:`zmq_filtering`.
Publish Server and Client
=========================
The publish server and client are implemented using ZeroMQ's pub/sub sockets. By
default we don't use ZeroMQ's filtering, which means that all publish jobs are
sent to all minions and filtered minion side. ZeroMQ does have publisher side
filtering which can be enabled in salt using :conf_master:`zmq_filtering`.


Req Channel
===========
The req channel is implemented using zeromq's req/rep sockets. These sockets
enforce a send/recv pattern, which forces salt to serialize messages through these
socket pairs. This means that although the interface is asynchronous on the minion
we cannot send a second message until we have received the reply of the first message.
Request Server and Client
=========================
The request server and client are implemented using ZeroMQ's req/rep sockets.
These sockets enforce a send/recv pattern, which forces salt to serialize
messages through these socket pairs. This means that although the interface is
asynchronous on the minion we cannot send a second message until we have
received the reply of the first message.
4 changes: 2 additions & 2 deletions salt/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
import time
from collections.abc import Iterable, Mapping

import salt.channel.client
import salt.config
import salt.exceptions
import salt.loader
import salt.payload
import salt.transport.client
import salt.utils.args
import salt.utils.dictupdate
import salt.utils.files
Expand Down Expand Up @@ -511,7 +511,7 @@ def _send_token_request(self, load):
salt.utils.zeromq.ip_bracket(self.opts["interface"]),
str(self.opts["ret_port"]),
)
with salt.transport.client.ReqChannel.factory(
with salt.channel.client.ReqChannel.factory(
self.opts, crypt="clear", master_uri=master_uri
) as channel:
return channel.send(load)
Expand Down
File renamed without changes.
Loading