FIX: fixed a bug where the classes are fixed to a namespace
This commit is contained in:
@@ -36,6 +36,7 @@ namespace kubecontrol
|
|||||||
|
|
||||||
std::string BearerToken_;
|
std::string BearerToken_;
|
||||||
std::string ServerAddress_;
|
std::string ServerAddress_;
|
||||||
|
std::string Namespace_;
|
||||||
std::string ApiCall_;
|
std::string ApiCall_;
|
||||||
|
|
||||||
// void addPodInfoToInfoList(std::shared_ptr<PodInfo> podinfo);
|
// void addPodInfoToInfoList(std::shared_ptr<PodInfo> podinfo);
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ namespace kubecontrol
|
|||||||
|
|
||||||
this->createYAML();
|
this->createYAML();
|
||||||
|
|
||||||
LOG_S(ERROR)<< this->PathToYaml_;
|
LOG_S(INFO)<< this->PathToYaml_;
|
||||||
|
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
stream << YAMLNode_;
|
stream << YAMLNode_;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace kubecontrol
|
|||||||
YAML::Node config = YAML::LoadFile(pathToKubectlConfig);
|
YAML::Node config = YAML::LoadFile(pathToKubectlConfig);
|
||||||
|
|
||||||
BearerToken_ = config["users"][0]["user"]["token"].as<std::string>();
|
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_HOST = std::getenv("KUBERNETES_SERVICE_HOST");
|
||||||
char * KUBERNETES_SERVICE_PORT = std::getenv("KUBERNETES_SERVICE_PORT");
|
char * KUBERNETES_SERVICE_PORT = std::getenv("KUBERNETES_SERVICE_PORT");
|
||||||
@@ -35,7 +36,7 @@ namespace kubecontrol
|
|||||||
ServerAddress_ = config["clusters"][0]["cluster"]["server"].as<std::string>();
|
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) {
|
} catch (std::exception& e) {
|
||||||
LOG_S(ERROR)<< e.what();
|
LOG_S(ERROR)<< e.what();
|
||||||
throw e.what();
|
throw e.what();
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace kubecontrol
|
|||||||
|
|
||||||
void kubecontrol::getPods()
|
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::string AuthString = "Authorization: Bearer " + BearerToken_;
|
||||||
|
|
||||||
std::list<std::string> headers;
|
std::list<std::string> headers;
|
||||||
@@ -85,7 +85,7 @@ namespace kubecontrol
|
|||||||
|
|
||||||
void kubecontrol::startPod()
|
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::string AuthString = "Authorization: Bearer " + BearerToken_;
|
||||||
|
|
||||||
std::list<std::string> headers;
|
std::list<std::string> headers;
|
||||||
@@ -155,7 +155,7 @@ namespace kubecontrol
|
|||||||
|
|
||||||
void kubecontrol::deletePod(std::string uid)
|
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::string AuthString = "Authorization: Bearer " + BearerToken_;
|
||||||
|
|
||||||
std::list<std::string> headers;
|
std::list<std::string> headers;
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ SCENARIO("Testing the SimCore Sensor")
|
|||||||
GIVEN("different Attributes for a Track in different forms")
|
GIVEN("different Attributes for a Track in different forms")
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string api = "https://192.168.252.5:6443/api/v1/namespaces/hwinkel/pods/";
|
std::string api = "https://192.168.3.11:6443/api/v1/namespaces/simulator/pods/";
|
||||||
std::string token = "eyJhbGciOiJSUzI1NiIsImtpZCI6InJwN2R3a2NEWHJva0ptLVNFUnAxMnUxNEF3VUdmdURRTmw5VWZuM0NCZ3MifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJod2lua2VsIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Imh3aW5rZWwtc2VjcmV0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Imh3aW5rZWwiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJmNDNkNTc5NS1lNDFhLTQxOTYtODVkMS01YmNkZGIxNzFkYjkiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6aHdpbmtlbDpod2lua2VsIn0.TQCBkEIY0sEQjpy-3BP1SdXl94Ct-oAeD4VGNEOJEzDYBuU4Cn1fG32k2wAIgZemh6P-DcBhPk0VtCWCLYhWWwIe6FNo3FpqOxcDbu8QHlyD-Y3VnfSzKRHg9OKgUSWnc_Z5P9iBtilNQxnZp_wLOBW6TL8ZeECxeVtBBxUpYfoywSWS7mNpwxHcecP_U__LUU1tP7pYZ8OgDiSIH04CaTrQisTL-FGdcqOEYQhx4zoOyVQFWWYkfjG9oD-5zjtS29O0gckfvKLOu2y_K6RVR51szsquiJiHP1s_AcS-qq1-rXRqEpYRsLxRxr-dflL3aAjnLlPSYCwheQhjCa0fjQ";
|
std::string token = "eyJhbGciOiJSUzI1NiIsImtpZCI6Il9tUkVrVkp5VjFKeDhtV2xDTmM4R2Y1ZkhRSlBOOWxaVnhKTkZuWVlJamMifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJzaW11bGF0b3IiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlY3JldC5uYW1lIjoic2ltLXNlY3JldCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJzaW11bGF0b3IiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJlOGU5YzQ2ZS1lMzcxLTQxMTItOTgzYS1lNzM5NGJmNWE0YzEiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6c2ltdWxhdG9yOnNpbXVsYXRvciJ9.JJjzj0RCU6PJruXuyrK_mNdW4piDADXKPtEW9YP2x1R57uhTDPFfG6LPMFbZTNyeI-A7A7bmjjAt0ICJDuLeL69J8ig3TS-i54R_PB--wFr-7jZMhnNz2wueyPuXxGiIuX-36H9rZ1cA-Dgt2qtDMNhK0TvOlgwUFU_cRjb2W0NhSvH8uB0qtIqOCyVzapCVwXWinyJPGiPL3ph8VxSo6P0ZDa4UjMJ_D6IlMpUpuHriKPLjGnDwTh2oJBjMFOmC_E0Mnr6Sd0rxzsIjIeG_ST6KqoPwyCTX27CPmO74CJUguLgFXSBOjuzvxon8KRYG6VJhRawEDnTU0zx6XrPXIQ";
|
||||||
auto guid = xg::newGuid();
|
auto guid = xg::newGuid();
|
||||||
std::string uuid = guid.str();
|
std::string uuid = guid.str();
|
||||||
// int random = rand() % 100 + 1;
|
// int random = rand() % 100 + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user