ADD: added container class and adapted test

This commit is contained in:
Henry Winkel
2024-03-14 09:46:37 +01:00
parent 37627a16ca
commit b645005aeb
11 changed files with 219 additions and 70 deletions

View File

@@ -17,33 +17,13 @@
#include <curlpp/cURLpp.hpp>
#include <filesystem>
#include <kubecontrol/Container.hpp>
namespace kubecontrol
{
enum PullPolicy: uint32_t
{
ALWAYS,
IFNOTPRESENT,
NEVER
};
inline std::string toString(const PullPolicy &kind)
{
switch (kind)
{
case PullPolicy::ALWAYS: return "Always";
case PullPolicy::IFNOTPRESENT: return "IfNotPresent";
case PullPolicy::NEVER: return "Never";
default: return "Always";
}
}
struct PodChild
{
std::string UUID;
@@ -68,8 +48,8 @@ namespace kubecontrol
class KubePod
{
public:
KubePod(std::string &Owner, std::string &Uuid, std::string &ContainerImage,std::string Namespace = "simulator") ;
KubePod(std::string &Owner, std::string &Uuid, std::string &Component, std::string &ContainerImage,std::string Namespace = "simulator");
KubePod(const std::string &Owner, const std::string &Uuid, const std::string &ContainerImage, const std::string &Namespace = "simulator") ;
KubePod(const std::string &Owner, const std::string &Uuid, const std::string &Component, const std::string &ContainerImage, const std::string &Namespace = "simulator");
/**
* @brief returns the uuid of the pod
@@ -172,7 +152,22 @@ namespace kubecontrol
* @param envs std::map<std::string,std:.string>
* @param PullPolicy std::string (defualt: Always) possible:( IfNotPresent, Never)
*/
void addContainer(std::string name,std::string image, std::shared_ptr<std::map<std::string, std::string>> envs = nullptr, PullPolicy pullPolicy = ALWAYS);
void addContainer(std::string name,std::string image, std::map<std::string, std::string> &envs , kubecontrol::PullPolicy pullPolicy = ALWAYS);
/**
* @brief add container object
*
* @param containter
*/
void addContainer(Container containter);
/**
* @brief
*
* @param containerUUID
* @param envs
*/
void addEnvValuesToContainer(std::string containerUUID, std::map<std::string, std::string> envs);
/**
* @brief sets the name of the pod
@@ -211,7 +206,7 @@ namespace kubecontrol
std::string Uuid_;
std::string Name_;
std::string Component_;
std::vector<YAML::Node> ContainerImages_;
std::vector<Container> ContainerImages_;
// std::string ContainerImage_;
std::string ContainerRegistry_;
std::string PathToYaml_;