Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[do not merge] some testing tweaks #5508

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions koku/api/report/ocp/provider_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,17 @@ def __init__(self, provider, report_type, schema_name):
"request_memory": Sum("pod_request_memory_gigabyte_hours") / 24,
"request_cpu_units": Max(Value("Core", output_field=CharField())),
"request_memory_units": Max(Value("GiB", output_field=CharField())),
"cost_total_distributed": self.cloud_infrastructure_cost
+ self.markup_cost
+ self.cost_model_cost
+ self.distributed_platform_cost
+ self.distributed_worker_cost
+ self.distributed_unattributed_network_cost
+ self.distributed_unattributed_storage_cost,
"cost_platform_distributed": self.distributed_platform_cost,
"cost_worker_unallocated_distributed": self.distributed_worker_cost,
"cost_network_unattributed_distributed": self.distributed_unattributed_network_cost,
"cost_storage_unattributed_distributed": self.distributed_unattributed_storage_cost,
},
"capacity_aggregate": {},
"annotations": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ WITH cte_narrow_dataset as (
lids.namespace,
lids.node,
lids.resource_id,
lids.pod_labels,
lids.node_capacity_cpu_cores,
lids.node_capacity_cpu_core_hours,
lids.node_capacity_memory_gigabytes,
Expand Down Expand Up @@ -79,6 +80,7 @@ cte_line_items as (
filtered.namespace,
filtered.node,
max(resource_id) as resource_id,
filtered.pod_labels,
max(node_capacity_cpu_cores) as node_capacity_cpu_cores,
max(node_capacity_cpu_core_hours) as node_capacity_cpu_core_hours,
max(node_capacity_memory_gigabytes) as node_capacity_memory_gigabytes,
Expand Down Expand Up @@ -115,7 +117,7 @@ cte_line_items as (
ON udps.usage_start = filtered.usage_start
AND udps.cluster_id = filtered.cluster_id
WHERE filtered.namespace IS NOT NULL
GROUP BY filtered.usage_start, filtered.node, filtered.namespace, filtered.cluster_id, cost_category_id, filtered.data_source
GROUP BY filtered.usage_start, filtered.node, filtered.namespace, filtered.cluster_id, cost_category_id, filtered.data_source, filtered.pod_labels
)
INSERT INTO {{schema | sqlsafe}}.reporting_ocpusagelineitem_daily_summary (
uuid,
Expand All @@ -128,6 +130,7 @@ INSERT INTO {{schema | sqlsafe}}.reporting_ocpusagelineitem_daily_summary (
namespace,
node,
resource_id,
pod_labels,
node_capacity_cpu_cores,
node_capacity_cpu_core_hours,
node_capacity_memory_gigabytes,
Expand All @@ -150,6 +153,7 @@ SELECT
ctl.namespace,
ctl.node,
ctl.resource_id,
ctl.pod_labels,
ctl.node_capacity_cpu_cores,
ctl.node_capacity_cpu_core_hours,
ctl.node_capacity_memory_gigabytes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ WITH cte_narrow_dataset as (
lids.namespace,
lids.node,
lids.resource_id,
lids.pod_labels,
lids.node_capacity_cpu_cores,
lids.node_capacity_cpu_core_hours,
lids.node_capacity_memory_gigabytes,
Expand Down Expand Up @@ -77,6 +78,7 @@ cte_line_items as (
filtered.namespace,
filtered.node,
max(resource_id) as resource_id,
filtered.pod_labels,
max(node_capacity_cpu_cores) as node_capacity_cpu_cores,
max(node_capacity_cpu_core_hours) as node_capacity_cpu_core_hours,
max(node_capacity_memory_gigabytes) as node_capacity_memory_gigabytes,
Expand Down Expand Up @@ -113,7 +115,7 @@ cte_line_items as (
ON udps.usage_start = filtered.usage_start
AND udps.cluster_id = filtered.cluster_id
WHERE filtered.namespace IS NOT NULL
GROUP BY filtered.usage_start, filtered.node, filtered.namespace, filtered.cluster_id, cost_category_id, filtered.data_source
GROUP BY filtered.usage_start, filtered.node, filtered.namespace, filtered.cluster_id, cost_category_id, filtered.data_source, filtered.pod_labels
)
INSERT INTO {{schema | sqlsafe}}.reporting_ocpusagelineitem_daily_summary (
uuid,
Expand All @@ -126,6 +128,7 @@ INSERT INTO {{schema | sqlsafe}}.reporting_ocpusagelineitem_daily_summary (
namespace,
node,
resource_id,
pod_labels,
node_capacity_cpu_cores,
node_capacity_cpu_core_hours,
node_capacity_memory_gigabytes,
Expand All @@ -149,6 +152,7 @@ SELECT
ctl.namespace,
ctl.node,
ctl.resource_id,
ctl.pod_labels,
ctl.node_capacity_cpu_cores,
ctl.node_capacity_cpu_core_hours,
ctl.node_capacity_memory_gigabytes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ WITH cte_narrow_dataset as (
lids.namespace,
lids.node,
lids.resource_id,
lids.pod_labels,
lids.node_capacity_cpu_cores,
lids.node_capacity_cpu_core_hours,
lids.node_capacity_memory_gigabytes,
Expand Down Expand Up @@ -77,6 +78,7 @@ cte_line_items as (
filtered.namespace,
filtered.node,
max(resource_id) as resource_id,
filtered.pod_labels,
max(node_capacity_cpu_cores) as node_capacity_cpu_cores,
max(node_capacity_cpu_core_hours) as node_capacity_cpu_core_hours,
max(node_capacity_memory_gigabytes) as node_capacity_memory_gigabytes,
Expand Down Expand Up @@ -113,7 +115,7 @@ cte_line_items as (
ON udps.usage_start = filtered.usage_start
AND udps.cluster_id = filtered.cluster_id
WHERE filtered.namespace IS NOT NULL
GROUP BY filtered.usage_start, filtered.node, filtered.namespace, filtered.cluster_id, filtered.cost_category_id, filtered.data_source
GROUP BY filtered.usage_start, filtered.node, filtered.namespace, filtered.cluster_id, filtered.cost_category_id, filtered.data_source, filtered.pod_labels
)
INSERT INTO {{schema | sqlsafe}}.reporting_ocpusagelineitem_daily_summary (
uuid,
Expand All @@ -126,6 +128,7 @@ INSERT INTO {{schema | sqlsafe}}.reporting_ocpusagelineitem_daily_summary (
namespace,
node,
resource_id,
pod_labels,
node_capacity_cpu_cores,
node_capacity_cpu_core_hours,
node_capacity_memory_gigabytes,
Expand All @@ -149,6 +152,7 @@ SELECT
ctl.namespace,
ctl.node,
ctl.resource_id,
ctl.pod_labels,
ctl.node_capacity_cpu_cores,
ctl.node_capacity_cpu_core_hours,
ctl.node_capacity_memory_gigabytes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ WITH cte_narrow_dataset as (
lids.namespace,
lids.node,
lids.resource_id,
lids.pod_labels,
lids.node_capacity_cpu_cores,
lids.node_capacity_cpu_core_hours,
lids.node_capacity_memory_gigabytes,
Expand Down Expand Up @@ -77,6 +78,7 @@ cte_line_items as (
filtered.namespace,
filtered.node,
max(resource_id) as resource_id,
filtered.pod_labels,
max(node_capacity_cpu_cores) as node_capacity_cpu_cores,
max(node_capacity_cpu_core_hours) as node_capacity_cpu_core_hours,
max(node_capacity_memory_gigabytes) as node_capacity_memory_gigabytes,
Expand Down Expand Up @@ -114,7 +116,7 @@ cte_line_items as (
AND udps.cluster_id = filtered.cluster_id
WHERE filtered.namespace IS NOT NULL
AND data_source = 'Pod'
GROUP BY filtered.usage_start, filtered.node, filtered.namespace, filtered.cluster_id
GROUP BY filtered.usage_start, filtered.node, filtered.namespace, filtered.cluster_id, filtered.pod_labels
)
INSERT INTO {{schema | sqlsafe}}.reporting_ocpusagelineitem_daily_summary (
uuid,
Expand All @@ -127,6 +129,7 @@ INSERT INTO {{schema | sqlsafe}}.reporting_ocpusagelineitem_daily_summary (
namespace,
node,
resource_id,
pod_labels,
node_capacity_cpu_cores,
node_capacity_cpu_core_hours,
node_capacity_memory_gigabytes,
Expand All @@ -149,6 +152,7 @@ SELECT
ctl.namespace,
ctl.node,
ctl.resource_id,
ctl.pod_labels,
ctl.node_capacity_cpu_cores,
ctl.node_capacity_cpu_core_hours,
ctl.node_capacity_memory_gigabytes,
Expand Down