Skip to content

Commit

Permalink
Removing experimental feature changes
Browse files Browse the repository at this point in the history
Removed PodUid_s from ContainerProcess_CL, ContainerID_g,InstanceName_s,ContainerRestartCount_d and PodRestartCount_d from KubePodInventory_CL
  • Loading branch information
samisms committed Jan 22, 2018
1 parent 27f820a commit c439c71
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 35 deletions.
27 changes: 1 addition & 26 deletions source/code/plugin/in_kube_podinventory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,11 @@ def enumerate(podList = nil)
record['PodLabel'] = [items['metadata']['labels']]
record['Namespace'] = items['metadata']['namespace']
record['PodCreationTimeStamp'] = items['metadata']['creationTimestamp']
record['PodStartTime'] = items['status']['startTime']
record['PodStatus'] = items['status']['phase']
record['PodIp'] =items['status']['podIP']
record['Computer'] = items['spec']['nodeName']
record['ClusterName'] = KubernetesApiClient.getClusterName
podRestartCount = 0
items['status']['containerStatuses'].each do |container|
containerRestartCount = 0
#container Id is of the form
#docker://dfd9da983f1fd27432fb2c1fe3049c0a1d25b1c697b2dc1a530c986e58b16527
record['ContainerID'] = container['containerID'].split("//")[1]
#keeping this as InstanceName so as to be consistent with perf table
record['InstanceName'] = container['name']
#Pod restart count is a sumtotal of restart counts of individual containers
#within the pod. The restart count of a container is maintained by kubernetes
#itself in the form of a container label.
containerRestartCount = container['restartCount']
record['ContainerRestartCount'] = containerRestartCount
podRestartCount += containerRestartCount
records.push(record)
end
records.each do |record|
record['PodRestartCount'] = podRestartCount
router.emit(@tag, time, record) if record
end
router.emit(@tag, time, record) if record
end
end
rescue => errorStr
Expand All @@ -103,11 +83,6 @@ def enumerate(podList = nil)
record['PodIp'] = ""
record['Computer'] = ""
record['ClusterName'] = ""
record['ContainerID'] = ""
record['InstanceName'] = ""
record['ContainerRestartCount'] = ""
record['PodRestartCount'] = "0"
record['PodStartTime'] = ""
router.emit(@tag, time, record)
end
end
Expand Down
8 changes: 1 addition & 7 deletions source/code/providers/Container_Process_Class_Provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include "../dockerapi/DockerRemoteApi.h"
#include "../dockerapi/DockerRestHelper.h"

#define EMPTYGUID "00000000-0000-0000-0000-000000000000"

using namespace std;

MI_BEGIN_NAMESPACE
Expand Down Expand Up @@ -60,8 +58,7 @@ class ContainerProcessQuery
{
string containerId = string(cJSON_GetObjectItem(containerEntry, "Id")->valuestring);
string containerName;
string containerPod;
string containerPodUid;
string containerPod;
string containerNamespace;

// Get container name
Expand All @@ -76,13 +73,11 @@ class ContainerProcessQuery
//add namespace pod info
containerPod = containerMetaInformation[2];
containerNamespace = containerMetaInformation[3];
containerPodUid = containerMetaInformation[4];
}
else
{
containerPod = "None";
containerNamespace = "None";
containerPodUid = EMPTYGUID;
}
}

Expand Down Expand Up @@ -117,7 +112,6 @@ class ContainerProcessQuery
processInstance.Id_value(containerId.c_str());
processInstance.Name_value(containerName.c_str());
processInstance.Pod_value(containerPod.c_str());
processInstance.PodUid_value(containerPodUid.c_str());
processInstance.Namespace_value(containerNamespace.c_str());
processInstance.Computer_value(hostname.c_str());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class ContainerProcessTest : public CppUnit::TestFixture
wstring instanceId = context[i].GetProperty(L"InstanceID", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg));
CPPUNIT_ASSERT(instanceId.length());
CPPUNIT_ASSERT_EQUAL(wstring(L"cptpodname"), context[i].GetProperty(L"Pod", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg)));
CPPUNIT_ASSERT_EQUAL(wstring(L"cptid"), context[i].GetProperty(L"PodUid", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg)));
CPPUNIT_ASSERT_EQUAL(wstring(L"cptnamepsace"), context[i].GetProperty(L"Namespace", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg)));
CPPUNIT_ASSERT_EQUAL(wstring(L"root"), context[i].GetProperty(L"Uid", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg)));
CPPUNIT_ASSERT(context[i].GetProperty(L"PID", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg)).length());
Expand Down Expand Up @@ -87,7 +86,6 @@ class ContainerProcessTest : public CppUnit::TestFixture
wstring instanceId = context[i].GetProperty(L"InstanceID", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg));
CPPUNIT_ASSERT(instanceId.length());
CPPUNIT_ASSERT_EQUAL(wstring(L"None"), context[i].GetProperty(L"Pod", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg)));
CPPUNIT_ASSERT_EQUAL(wstring(L"00000000-0000-0000-0000-000000000000"), context[i].GetProperty(L"PodUid", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg)));
CPPUNIT_ASSERT_EQUAL(wstring(L"None"), context[i].GetProperty(L"Namespace", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg)));
CPPUNIT_ASSERT_EQUAL(wstring(L"root"),context[i].GetProperty(L"Uid", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg)));
CPPUNIT_ASSERT(context[i].GetProperty(L"PID", CALL_LOCATION(errMsg)).GetValue_MIString(CALL_LOCATION(errMsg)).length());
Expand Down

0 comments on commit c439c71

Please sign in to comment.