From c439c7153f4d470d4eb60935041e9e4e66983074 Mon Sep 17 00:00:00 2001 From: Sambit Mishra Date: Mon, 22 Jan 2018 20:17:02 +0000 Subject: [PATCH] Removing experimental feature changes Removed PodUid_s from ContainerProcess_CL, ContainerID_g,InstanceName_s,ContainerRestartCount_d and PodRestartCount_d from KubePodInventory_CL --- source/code/plugin/in_kube_podinventory.rb | 27 +------------------ .../Container_Process_Class_Provider.cpp | 8 +----- ...tainer_Process_Class_Provider_UnitTest.cpp | 2 -- 3 files changed, 2 insertions(+), 35 deletions(-) diff --git a/source/code/plugin/in_kube_podinventory.rb b/source/code/plugin/in_kube_podinventory.rb index 8fd4a7d5f..3ab43b649 100644 --- a/source/code/plugin/in_kube_podinventory.rb +++ b/source/code/plugin/in_kube_podinventory.rb @@ -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 @@ -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 diff --git a/source/code/providers/Container_Process_Class_Provider.cpp b/source/code/providers/Container_Process_Class_Provider.cpp index 413db4d82..62061fd9a 100644 --- a/source/code/providers/Container_Process_Class_Provider.cpp +++ b/source/code/providers/Container_Process_Class_Provider.cpp @@ -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 @@ -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 @@ -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; } } @@ -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()); } diff --git a/test/code/providers/Container_Process_Class_Provider_UnitTest.cpp b/test/code/providers/Container_Process_Class_Provider_UnitTest.cpp index 138f170fe..42ffd9baa 100644 --- a/test/code/providers/Container_Process_Class_Provider_UnitTest.cpp +++ b/test/code/providers/Container_Process_Class_Provider_UnitTest.cpp @@ -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()); @@ -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());