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

[ProcessContainers] Runtime configurable containers #1723

Merged
merged 7 commits into from
Aug 15, 2024

Conversation

sebaszm
Copy link
Contributor

@sebaszm sebaszm commented Aug 13, 2024

Container runtime is selectable via enum string "lxc", "runc", "crun", "dobby", "awc" in root/configuration/containertype. LXC is the default.

/etc/Thunder/plugins/Messenger.json

{
 "locator":"libThunderMessenger.so",
 "classname":"Messenger",
 "startmode":"Deactivated",
 "configuration":{
  "root":{
   "mode":"Container",
   "configuration": {
     "containertype": "lxc"
   }
  }
 }
}

Each container runtime has separate configuration that is passed to its Initialize(config) method. Initialize() and Deinitialize() replace system-wide Logging() call. Container system configuration has been moved from COM to the runtime implementation (it was specific to LXC). Each runtime can define its own configuration, if any.

/etc/Thunder/config.json

{
 "version":"5.0.0",
  ...
 "processcontainers": {
   "lxc": {
     "logging":"100KB",
     "loggingdir":"/tmp"
   }
 },

The runtime implementations are registering themselves in ContainerAdminstrator via static initialization.

The previously singleton "administrators" of each implementation are turned into producers that create IContainer concrete objects for the ContainerAdminstrator (i.e. the a factory). The BaseAdministrator common codeis removed as the functionality has been taken over by the factory. The ContainerAdminstrator holds the live containers in a ProxyList.

This solution requires southbound interface changes. LXC and runC implementations are adapted along.

@sebaszm sebaszm marked this pull request as draft August 13, 2024 14:23
@rdkcmf-jenkins
Copy link

Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/Thunder/1723/rdkcentral/Thunder

  • Commit: 125e8a2

Report detail: gist

@rdkcmf-jenkins
Copy link

WARNING: A Blackduck scan failure has been waived

A prior failure has been upvoted

  • Upvote reason: OK

  • Commit: 125e8a2

@sebaszm sebaszm force-pushed the development/configurable-containers branch from 125e8a2 to b47f000 Compare August 13, 2024 21:17
@sebaszm sebaszm force-pushed the development/configurable-containers branch from fe92f55 to 41ba5b4 Compare August 13, 2024 21:59
@sebaszm sebaszm marked this pull request as ready for review August 13, 2024 22:24
Copy link
Contributor

@pwielders pwielders left a comment

Choose a reason for hiding this comment

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

Since you are on a deserved holiday, oke to merge and will pick the comment up in a next cycle ?

virtual void Deinitialize()= 0;

// Creates a new container
virtual Core::ProxyType<IContainer> Container(const string& id, IStringIterator& searchPaths, const string& logPath, const string& configuration) = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

We are working everywhere with Interface pointers everywhere, why are we now using a proxyType around the interface (at the end we can put it in a ProxyTypeContainer, but for the interface it makes it more depending on Thunder features) Can we not simply retunr a IContainer here ?

}

public:
Core::ProxyType<IContainer> Container(const IContainer::containertype type, const string& id,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the explicit public Container call, here on 69, not also emplacing the container in the _containers list ? It looks like it is done by calling (from the real implementation line 64 ?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind figured it out. It is all due to the automatic lifetime management from the ProxyListType<>... If that the administrator holds the last reference it drops the container. Correct ?

~ContainerProducerRegistrationType()
{
ContainerAdministrator::Instance().Revoke(CONTAINERTYPE);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not have in this class, the PRODUCER an aggregated member and than announce (CONTAINERTYPE, IContainerProducer& _Producer); Saves you a list with autopointers and new in the administrator and lifetime is guaranteed aligned with the Announce and Revoke.
It is my allergy to visible "new" 's and std::unique_ptr that triggered this deep dive ;-) and potential simple fix to avoid them..

@pwielders pwielders self-requested a review August 15, 2024 08:41
Copy link
Contributor

@pwielders pwielders left a comment

Choose a reason for hiding this comment

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

wil pick up the remarks in the next round. Sebas is on holiday now..

@pwielders pwielders merged commit d07b0d1 into master Aug 15, 2024
56 checks passed
@pwielders pwielders deleted the development/configurable-containers branch August 15, 2024 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants