Skip to content

Commit

Permalink
lint: libs
Browse files Browse the repository at this point in the history
Signed-off-by: TPT <[email protected]>
  • Loading branch information
terylpt committed Jul 29, 2024
1 parent b904fa6 commit da9e171
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 39 deletions.
57 changes: 29 additions & 28 deletions src/libs/k8scontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,34 +163,35 @@ void K8sContext::clearPods() {
void K8sContext::clearAllPods() { m_pods.clear(); }

void K8sContext::updateAndWritePodState(std::string &uid) {
/* SF_DEBUG(m_logger, "Update and write pod state for modified pod: " << uid)
const k8s_state_t &k8sState =
m_cxt->getInspector()->m_k8s_client->get_state();
const k8s_pod_t *pod =
k8sState.get_component<k8s_pods, k8s_pod_t>(k8sState.get_pods(), uid);
if (pod != nullptr) {
std::shared_ptr<PodObj> podO = getPod(uid);
if (podO == nullptr) {
SF_DEBUG(m_logger,
"Unable to find pod object in cache. Ignoring pod modification: "
<< uid)
return;
}
std::shared_ptr<PodObj> podObj = createPod(pod, k8sState);
if (podObj != nullptr) {
podObj->refs = podO->refs;
m_pods[pod->get_uid()] = podObj;
m_writer->writePod(&(podObj->pod));
podObj->written = true;
} else {
SF_DEBUG(m_logger, "Unable to find pod with uid" << uid)
}
} else {
SF_DEBUG(m_logger,
"Unable to find pod with uid " << uid << " in global k8s state. ")
}*/
/* SF_DEBUG(m_logger, "Update and write pod state for modified pod: " << uid)
const k8s_state_t &k8sState =
m_cxt->getInspector()->m_k8s_client->get_state();
const k8s_pod_t *pod =
k8sState.get_component<k8s_pods, k8s_pod_t>(k8sState.get_pods(), uid);
if (pod != nullptr) {
std::shared_ptr<PodObj> podO = getPod(uid);
if (podO == nullptr) {
SF_DEBUG(m_logger,
"Unable to find pod object in cache. Ignoring pod modification:
"
<< uid)
return;
}
std::shared_ptr<PodObj> podObj = createPod(pod, k8sState);
if (podObj != nullptr) {
podObj->refs = podO->refs;
m_pods[pod->get_uid()] = podObj;
m_writer->writePod(&(podObj->pod));
podObj->written = true;
} else {
SF_DEBUG(m_logger, "Unable to find pod with uid" << uid)
}
} else {
SF_DEBUG(m_logger,
"Unable to find pod with uid " << uid << " in global k8s state. ")
}*/
}

void K8sContext::updateCompState(sysflow::K8sAction action,
Expand Down
6 changes: 3 additions & 3 deletions src/libs/k8scontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class K8sContext {
PodTable m_pods;
context::SysFlowContext *m_cxt;
writer::SysFlowWriter *m_writer;
/* std::shared_ptr<PodObj> createPod(const k8s_pod_t *p,
const k8s_state_t &k8sState);
*/
/* std::shared_ptr<PodObj> createPod(const k8s_pod_t *p,
const k8s_state_t &k8sState);
*/
public:
K8sContext(context::SysFlowContext *cxt, writer::SysFlowWriter *writer);
virtual ~K8sContext();
Expand Down
2 changes: 1 addition & 1 deletion src/libs/sysflowcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ SysFlowContext::SysFlowContext(SysFlowConfig *config)
if (k8sURL != nullptr) {
SF_INFO(m_logger, "Initing k8s client. URL: "
<< k8sURL << " and certificate: " << k8sCert)
//m_inspector->init_k8s_client(k8sURL, k8sCert, &config->exporterID, true);
// m_inspector->init_k8s_client(k8sURL, k8sCert, &config->exporterID, true);
m_inspector->set_internal_events_mode(true);
m_k8sEnabled = true;
}
Expand Down
14 changes: 7 additions & 7 deletions src/libs/sysflowprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ int SysFlowProcessor::run() {
continue;
}

/* if (m_cxt->getInspector()->m_k8s_client != nullptr &&
m_cxt->getInspector()->m_k8s_client->get_capture_events().size() > 0) {
SF_INFO(m_logger,
"Events Count: " << m_cxt->getInspector()
->m_k8s_client->get_capture_events()
.size());
}*/
/* if (m_cxt->getInspector()->m_k8s_client != nullptr &&
m_cxt->getInspector()->m_k8s_client->get_capture_events().size() > 0) {
SF_INFO(m_logger,
"Events Count: " << m_cxt->getInspector()
->m_k8s_client->get_capture_events()
.size());
}*/

switch (ev->get_type()) {
SF_EXECVE_ENTER()
Expand Down

0 comments on commit da9e171

Please sign in to comment.