52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
#pragma once
|
|
#include "kubecontrol/KubernetesAPI.hpp"
|
|
#include <cstddef>
|
|
#include <kubecontrol/KubePod.hpp>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace kubecontrol
|
|
{
|
|
|
|
struct PodInfos
|
|
{
|
|
std::string UUID;
|
|
std::string IP;
|
|
std::string Status;
|
|
std::string Component;
|
|
std::string Owner;
|
|
std::vector<std::string> UUIDOfChilds;
|
|
};
|
|
class PodController
|
|
{
|
|
public:
|
|
PodController(std::string pathToKubectlConfig);
|
|
|
|
std::string getServerAddress();
|
|
|
|
void startPod(KubePod Pod,bool WaitTillRunning = true );
|
|
void stopPod(std::string uuid);
|
|
void stopAllPods();
|
|
|
|
std::vector<PodInfos> getInfoForAllPods();
|
|
PodInfos getInfoForPod(std::string uuid);
|
|
|
|
KubernetesAPI getKubernetesAPI();
|
|
|
|
private:
|
|
KubernetesAPI APIInterface_;
|
|
std::vector<std::unique_ptr<KubePod>> PodList_;
|
|
|
|
std::string Namespace_;
|
|
std::string ApiCall_;
|
|
|
|
PodInfos extractInfosFromKubePod(KubePod *pod);
|
|
|
|
|
|
mutable std::mutex mx_;
|
|
|
|
};
|
|
} // namespace ku
|