ADD: added name to KubePod and added the possibility to pass a shared pointer to start a pod

This commit is contained in:
Henry Winkel
2024-02-12 18:05:32 +01:00
parent 4045f21786
commit 2377948049
6 changed files with 48 additions and 1 deletions

View File

@@ -136,9 +136,19 @@ namespace kubecontrol
return this->Component_;
}
void KubePod::setName(std::string name)
{
this->Name_ = name;
}
std::string KubePod::getName()
{
return this->Name_;
}
std::string KubePod::createYAML()
{
YAML::Node node;

View File

@@ -5,6 +5,7 @@
#include <list>
#include <curlpp/Options.hpp>
#include <sstream>
#include <yaml-cpp/yaml.h>
#include <loguru.hpp>

View File

@@ -50,6 +50,18 @@ namespace kubecontrol
// LOG_S(INFO)<<response;
}
void PodController::startPod(std::shared_ptr<KubePod> Pod,bool WaitTillRunning )
{
LOG_S(INFO)<< "starting pod: "<<Pod->getUUID();
// auto response = Pod.start(ServerAddress_+ApiCall_, BearerToken_,WaitTillRunning);
auto response = Pod->start(APIInterface_,WaitTillRunning);
std::lock_guard<std::mutex>lock(mx_);
PodList_.emplace_back(std::make_unique<KubePod>(std::move(*Pod)));
}
void PodController::stopPod(std::string uuid)
{
std::lock_guard<std::mutex>lock(mx_);