FIX: fixed a bug where the classes are fixed to a namespace

This commit is contained in:
Henry Winkel
2023-09-27 13:43:04 +02:00
parent 2779eb1be3
commit 49b36053d7
5 changed files with 9 additions and 7 deletions

View File

@@ -215,7 +215,7 @@ namespace kubecontrol
this->createYAML();
LOG_S(ERROR)<< this->PathToYaml_;
LOG_S(INFO)<< this->PathToYaml_;
std::stringstream stream;
stream << YAMLNode_;

View File

@@ -21,6 +21,7 @@ namespace kubecontrol
YAML::Node config = YAML::LoadFile(pathToKubectlConfig);
BearerToken_ = config["users"][0]["user"]["token"].as<std::string>();
Namespace_ = config["contexts"][0]["context"]["namespace"].as<std::string>();
char * KUBERNETES_SERVICE_HOST = std::getenv("KUBERNETES_SERVICE_HOST");
char * KUBERNETES_SERVICE_PORT = std::getenv("KUBERNETES_SERVICE_PORT");
@@ -35,7 +36,7 @@ namespace kubecontrol
ServerAddress_ = config["clusters"][0]["cluster"]["server"].as<std::string>();
}
ApiCall_ = "/api/v1/namespaces/hwinkel/pods/";
ApiCall_ = "/api/v1/namespaces/"+Namespace_+"/pods/";
} catch (std::exception& e) {
LOG_S(ERROR)<< e.what();
throw e.what();

View File

@@ -44,7 +44,7 @@ namespace kubecontrol
void kubecontrol::getPods()
{
std::string curlURL = ServerAddress_+"/api/v1/namespaces/hwinkel/pods/";
std::string curlURL = ServerAddress_+"/api/v1/namespaces/simulator/pods/";
std::string AuthString = "Authorization: Bearer " + BearerToken_;
std::list<std::string> headers;
@@ -85,7 +85,7 @@ namespace kubecontrol
void kubecontrol::startPod()
{
std::string curlURL = ServerAddress_+"/api/v1/namespaces/hwinkel/pods/";
std::string curlURL = ServerAddress_+"/api/v1/namespaces/simulator/pods/";
std::string AuthString = "Authorization: Bearer " + BearerToken_;
std::list<std::string> headers;
@@ -155,7 +155,7 @@ namespace kubecontrol
void kubecontrol::deletePod(std::string uid)
{
std::string curlURL = ServerAddress_+"/api/v1/namespaces/hwinkel/pods/"+ uid;
std::string curlURL = ServerAddress_+"/api/v1/namespaces/simulator/pods/"+ uid;
std::string AuthString = "Authorization: Bearer " + BearerToken_;
std::list<std::string> headers;