ADD: added guid usage to identify a pod
This commit is contained in:
@@ -23,6 +23,16 @@ namespace kubecontrol
|
||||
|
||||
}
|
||||
|
||||
std::string KubePod::getUUID()
|
||||
{
|
||||
return this->Uuid_;
|
||||
}
|
||||
|
||||
std::string KubePod::getLabel()
|
||||
{
|
||||
return this->Label_;
|
||||
}
|
||||
|
||||
void KubePod::setEnvironmentVar(std::string key, std::string val)
|
||||
{
|
||||
EnvirmonentVars_.emplace(key,val);
|
||||
@@ -99,14 +109,17 @@ namespace kubecontrol
|
||||
request.setOpt(new curlpp::options::Post(true));
|
||||
|
||||
|
||||
|
||||
std::ifstream is;
|
||||
is.open (this->PathToYaml_, std::ios::binary );
|
||||
is.seekg (0, std::ios::end);
|
||||
long length = is.tellg();
|
||||
is.seekg (0, std::ios::beg);
|
||||
char *buffer = new char [length];
|
||||
is.read (buffer,length);
|
||||
if(std::filesystem::exists(this->PathToYaml_) != true)
|
||||
{
|
||||
this->createYAML();
|
||||
}
|
||||
std::ifstream is;
|
||||
is.open (this->PathToYaml_, std::ios::binary );
|
||||
is.seekg (0, std::ios::end);
|
||||
long length = is.tellg();
|
||||
is.seekg (0, std::ios::beg);
|
||||
char *buffer = new char [length];
|
||||
is.read (buffer,length);
|
||||
|
||||
|
||||
|
||||
@@ -178,7 +191,6 @@ namespace kubecontrol
|
||||
|
||||
request.perform();
|
||||
auto response = mWriterChunk.getResponse();
|
||||
|
||||
return nlohmann::json::parse(response);
|
||||
}
|
||||
|
||||
|
||||
22
src/kubecontrol/PodController.cpp
Normal file
22
src/kubecontrol/PodController.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
#include <kubecontrol/PodController.hpp>
|
||||
|
||||
|
||||
namespace kubecontrol
|
||||
{
|
||||
PodController::PodController(std::string pathToKubectlConfig)
|
||||
{
|
||||
YAML::Node config = YAML::LoadFile(pathToKubectlConfig);
|
||||
|
||||
BearerToken_ = config["users"][0]["user"]["token"].as<std::string>();
|
||||
ServerAddress_ = config["clusters"][0]["cluster"]["server"].as<std::string>();
|
||||
ApiCall_ = "/api/v1/namespaces/hwinkel/pods/";
|
||||
}
|
||||
|
||||
std::string PodController::getServerAddress()
|
||||
{
|
||||
return this->ServerAddress_;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user