[VOL-4073] Added namespace input argument to sizing python script, and moved file to scripts folder
Change-Id: Icab82d9a8c791f310b480e1c4f58aaf63f657078
diff --git a/VERSION b/VERSION
index 9f8d8a9..2701a22 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.8.3
+2.8.4
diff --git a/tests/scale/sizing.py b/scripts/sizing.py
similarity index 95%
rename from tests/scale/sizing.py
rename to scripts/sizing.py
index f00dbe6..c976c15 100644
--- a/tests/scale/sizing.py
+++ b/scripts/sizing.py
@@ -49,7 +49,7 @@
"rwcore"
]
-def main(address, out_folder, since):
+def main(address, out_folder, since, namespace="default"):
"""
Query Prometheus and generate .pdf files for CPU and Memory consumption for each POD
:param address: string The address of the Prometheus instance to query
@@ -59,9 +59,9 @@
"""
time_delta = int(since) * 60
- container_mem_query = "sum by(pod) (container_memory_working_set_bytes{namespace='default',container!='',container!='POD'})"
+ container_mem_query = "sum by(pod) (container_memory_working_set_bytes{namespace='%s',container!='',container!='POD'})" % namespace
- container_cpu_query = "sum by(pod) (rate(container_cpu_usage_seconds_total{namespace='default',container!='',container!='POD'}[%sm])) * 100" % since
+ container_cpu_query = "sum by(pod) (rate(container_cpu_usage_seconds_total{namespace='%s',container!='',container!='POD'}[%sm])) * 100" % (namespace, since)
now = time.time()
cpu_params = {
@@ -351,6 +351,8 @@
default="plots")
parser.add_argument("-s", "--since", help="When to start sampling the data (in minutes before now)",
default=10)
+ parser.add_argument("-n", "--namespace", help="Kubernetes namespace for collecting metrics",
+ default="default")
args = parser.parse_args()
- main(args.address, args.output, args.since)
+ main(args.address, args.output, args.since, args.namespace)