Dobby
3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
|
Plugin used to map in the wpeframework (aka thunder) server. More...
#include <ThunderPlugin.h>
Public Member Functions | |
ThunderPlugin (std::shared_ptr< rt_dobby_schema > &containerConfig, const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::string &rootfsPath) | |
Constructor - called when plugin is loaded by PluginLauncher. More... | |
std::string | name () const override |
Should return the name of the plugin. More... | |
unsigned | hookHints () const final |
Set the bit flags for which hooks we're going to use. More... | |
bool | postInstallation () final |
Dobby Hook - run in host namespace once when container bundle is downloaded. More... | |
bool | preCreation () final |
bool | createRuntime () final |
bool | postHalt () final |
std::vector< std::string > | getDependencies () const override |
Should return the names of the plugins this plugin depends on. More... | |
Public Member Functions inherited from RdkPluginBase | |
virtual bool | createContainer () |
virtual bool | postStart () |
virtual bool | postStop () |
Private Member Functions | |
Netfilter::RuleSet | constructRules () const |
std::string | constructDNATRule (const std::string &containerIp, in_port_t port) const |
Constructs a DNAT PREROUTING rule to send anything from the container on the given port to localhost outside the container. More... | |
std::string | constructCONNLIMITRule (const std::string &containerIp, const std::string &vethName, in_port_t port, uint32_t connLimit) const |
Constructs an INPUT REJECT rule to reject connection if exceed the limit. More... | |
std::string | constructACCEPTRule (const std::string &containerIp, const std::string &vethName, in_port_t port) const |
Constructs a INPUT ACCEPT rule to allow packets from the container over the dobby0 bridge to localhost. More... | |
bool | isNatNetworkMode () const |
Private Attributes | |
const std::string | mName |
std::shared_ptr< rt_dobby_schema > | mContainerConfig |
const std::string | mRootfsPath |
const std::shared_ptr< DobbyRdkPluginUtils > | mUtils |
std::shared_ptr< Netfilter > | mNetfilter |
in_port_t | mThunderPort |
std::mutex | mLock |
const bool | mEnableConnLimit |
const std::string | mSocketDirectory |
const std::string | mSocketPath |
bool | mSocketExists |
Additional Inherited Members | |
Public Types inherited from IDobbyRdkPlugin | |
enum | HintFlags : unsigned { PostInstallationFlag = (1 << 0) , PreCreationFlag = (1 << 1) , CreateRuntimeFlag = (1 << 2) , CreateContainerFlag = (1 << 3) , PostStartFlag = (1 << 5) , PostHaltFlag = (1 << 6) , PostStopFlag = (1 << 7) , Unknown = 0 } |
Bit flags that should be returned by hookHints. More... | |
Plugin used to map in the wpeframework (aka thunder) server.
This plugin does two things; it uses iptables to setup routing to the wpeframework server, and it optionally creates a security token for the app and puts it in the containers env variables.
ThunderPlugin::ThunderPlugin | ( | std::shared_ptr< rt_dobby_schema > & | containerConfig, |
const std::shared_ptr< DobbyRdkPluginUtils > & | utils, | ||
const std::string & | rootfsPath | ||
) |
Constructor - called when plugin is loaded by PluginLauncher.
Do not change the parameters for this constructor - must match C methods created by REGISTER_RDK_PLUGIN macro
Note plugin name is not case sensitive
|
private |
Constructs a INPUT ACCEPT rule to allow packets from the container over the dobby0 bridge to localhost.
[in] | id | The id of the container. |
[in] | containerIp | The ip address inside the container. |
[in] | vethName | The name of the veth device (outside the container) that belongs to the container. |
[in] | port | The port number to add the DNAT rule for. |
|
private |
Constructs an INPUT REJECT rule to reject connection if exceed the limit.
[in] | id | The id of the container. |
[in] | containerIp | The ip address inside the container. |
[in] | vethName | The name of the veth device (outside the container) that belongs to the container. |
[in] | port | The port number to add the DNAT rule for. |
|
private |
Constructs a DNAT PREROUTING rule to send anything from the container on the given port to localhost outside the container.
[in] | id | The id of the container. |
[in] | containerIp | The ip address inside the container. |
[in] | port | The port number to add the DNAT rule for. |
|
finalvirtual |
Hook Name: createRuntime Hook Execution Namespace: host Hook Path Resolution: host
Execution: OCI Runtime (runc/crun)
Hook Description: Run during the create operation, after the runtime environment has been created and before the pivot root or any equivalent operation.
Called after the container namespaces are created, so provides an opportunity to customize the container (e.g. the network namespace could be specified in this hook).
Reimplemented from RdkPluginBase.
|
overridevirtual |
Should return the names of the plugins this plugin depends on.
This can be used to determine the order in which the plugins should be processed when running hooks.
Reimplemented from RdkPluginBase.
|
finalvirtual |
Set the bit flags for which hooks we're going to use.
This plugin uses all the hooks so set all the flags
Implements IDobbyRdkPlugin.
|
inlineoverridevirtual |
Should return the name of the plugin.
Implements IDobbyRdkPlugin.
|
finalvirtual |
Hook Name: postHalt Hook Execution Namespace: host Hook Path Resolution: host
Execution: Dobby
Hook Description: When a SIGTERM signal is received from the container. Before the delete operation is called
For example, this hook could perform clean up when a container closes
Reimplemented from RdkPluginBase.
|
finalvirtual |
Dobby Hook - run in host namespace once when container bundle is downloaded.
Updates the /etc/services and /etc/hosts file to point to the mapped thunder server
Reimplemented from RdkPluginBase.
|
finalvirtual |
Hook Name: preCreation Hook Execution Namespace: host Hook Path Resolution: host
Execution: Dobby
Hook Description: Runs before the runtime’s create operation is called. This hook runs every time container need to be created.
Reimplemented from RdkPluginBase.