Skip to content

Commit

Permalink
filter network unattributed project out where necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
cgoodfred committed May 4, 2024
1 parent b1364a1 commit 7f6132b
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions koku/api/report/ocp/provider_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ def __init__(self, provider, report_type, schema_name):
"operation": "exact",
"parameter": "Platform unallocated",
},
{
"field": "namespace",
"operation": "exact",
"parameter": "Network unattributed",
},
],
},
},
Expand Down Expand Up @@ -479,6 +484,11 @@ def __init__(self, provider, report_type, schema_name):
"operation": "exact",
"parameter": "Platform unallocated",
},
{
"field": "namespace",
"operation": "exact",
"parameter": "Network unattributed",
},
],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ user_defined_project_sum as (
AND report_period_id = {{report_period_id}}
AND lids.namespace != 'Worker unallocated'
AND lids.namespace != 'Platform unallocated'
AND lids.namespace != 'Network unattributed'
AND (cost_category_id IS NULL OR cat.name != 'Platform')
GROUP BY usage_start, cluster_id, source_uuid
),
Expand Down Expand Up @@ -96,6 +97,7 @@ cte_line_items as (
AND report_period_id = {{report_period_id}}
AND lids.namespace IS NOT NULL
AND lids.namespace != 'Worker unallocated'
AND lids.namespace != 'Network unattributed'
GROUP BY lids.usage_start, lids.node, lids.namespace, lids.cluster_id, cost_category_id, lids.data_source
)
INSERT INTO {{schema | sqlsafe}}.reporting_ocpusagelineitem_daily_summary (
Expand Down Expand Up @@ -196,4 +198,5 @@ WHERE ctl.distributed_cost != 0;
-- AND usage_start = '2023-03-01'
-- AND cost_category_id IS NOT NULL
-- AND lids.namespace != 'Worker unallocated'
-- AND lids.namespace != 'Network unattributed'
-- GROUP BY lids.usage_start, lids.cluster_id, lids.node, lids.namespace;
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ user_defined_project_sum as (
AND report_period_id = {{report_period_id}}
AND lids.namespace != 'Worker unallocated'
AND lids.namespace != 'Platform unallocated'
AND lids.namespace != 'Network unattributed'
AND (cost_category_id IS NULL OR cat.name != 'Platform')
GROUP BY usage_start, cluster_id, source_uuid
),
Expand Down Expand Up @@ -92,6 +93,7 @@ cte_line_items as (
AND lids.usage_start <= {{end_date}}::date
AND report_period_id = {{report_period_id}}
AND lids.namespace IS NOT NULL
AND lids.namespace != 'Network unattributed'
AND data_source = 'Pod'
AND (cost_category_id IS NULL OR cat.name != 'Platform')
GROUP BY lids.usage_start, lids.node, lids.namespace, lids.cluster_id
Expand Down Expand Up @@ -193,6 +195,7 @@ WHERE ctl.distributed_cost != 0;
-- WHERE distributed_cost IS NOT NULL
-- AND usage_start = '2023-03-01'
-- AND lids.namespace != 'Worker unallocated'
-- AND lids.namespace != 'Network unattributed'
-- AND cost_model_rate_type = 'worker_distributed'
-- GROUP BY lids.usage_start, lids.cluster_id, lids.node, lids.namespace;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ INSERT INTO {{schema | sqlsafe}}.reporting_ocp_pod_summary_by_node_p (
AND data_source = 'Pod'
AND namespace IS DISTINCT FROM 'Worker unallocated'
AND namespace IS DISTINCT FROM 'Platform unallocated'
AND namespace IS DISTINCT FROM 'Network unattributed'
GROUP BY usage_start, cluster_id, cluster_alias, node, cost_model_rate_type
;
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ INSERT INTO {{schema | sqlsafe}}.reporting_ocp_pod_summary_by_project_p (
AND data_source = 'Pod'
AND namespace IS DISTINCT FROM 'Worker unallocated'
AND namespace IS DISTINCT FROM 'Platform unallocated'
AND namespace IS DISTINCT FROM 'Network unattributed'
GROUP BY usage_start, cluster_id, cluster_alias, namespace, cost_model_rate_type
;
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ INSERT INTO {{schema | sqlsafe}}.reporting_ocp_pod_summary_p (
AND data_source = 'Pod'
AND namespace IS DISTINCT FROM 'Worker unallocated'
AND namespace IS DISTINCT FROM 'Platform unallocated'
AND namespace IS DISTINCT FROM 'Network unattributed'
GROUP BY usage_start, cluster_id, cluster_alias, cost_model_rate_type
;
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ JOIN hive.{{ schema | sqlsafe}}.reporting_ocpusagelineitem_daily_summary as ocp
)
AND ocp.namespace != 'Worker unallocated'
AND ocp.namespace != 'Platform unallocated'
AND ocp.namespace != 'Network unattributed'
LEFT JOIN hive.{{schema | sqlsafe}}.reporting_ocpgcpcostlineitem_project_daily_summary_temp AS pds
ON gcp.uuid = pds.gcp_uuid
WHERE gcp.source = {{gcp_source_uuid}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ JOIN hive.{{schema | sqlsafe}}.gcp_openshift_daily_tag_matched_temp as gcp
)
AND ocp.namespace != 'Worker unallocated'
AND ocp.namespace != 'Platform unallocated'
AND ocp.namespace != 'Network unattributed'
WHERE ocp.source = {{ocp_source_uuid}}
AND ocp.report_period_id = {{report_period_id}}
AND ocp.year = {{year}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ cte_unallocated_capacity AS (
AND lids.usage_start < date_add('day', 1, {{end_date}})
AND lids.namespace != 'Platform unallocated'
AND lids.namespace != 'Worker unallocated'
AND lids.namespace != 'Network unattributed'
AND lids.node IS NOT NULL
AND lids.data_source = 'Pod'
GROUP BY lids.node, lids.usage_start, lids.source_uuid
Expand Down

0 comments on commit 7f6132b

Please sign in to comment.