Skip to content

Commit

Permalink
Fix cluster selector
Browse files Browse the repository at this point in the history
  • Loading branch information
LeaveMyYard committed Apr 25, 2024
1 parent 7cd0c59 commit 4044b4a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ async def _parse_allocation(self, namespace: str, pods: list[str], container_nam
f"""
avg by(resource) (
kube_pod_container_resource_limits{{
{self.cluster_selector}
namespace="{namespace}",
pod=~"{'|'.join(pods)}",
container="{container_name}"
{self.cluster_selector}
}}
)
"""
Expand All @@ -66,10 +66,10 @@ async def _parse_allocation(self, namespace: str, pods: list[str], container_nam
f"""
avg by(resource) (
kube_pod_container_resource_requests{{
{self.cluster_selector}
namespace="{namespace}",
pod=~"{'|'.join(pods)}",
container="{container_name}"
{self.cluster_selector}
}}
)
"""
Expand All @@ -94,8 +94,8 @@ async def _list_containers_in_pods(self, pods: list[str]) -> set[str]:
f"""
count by (container) (
kube_pod_container_info{{
{self.cluster_selector}
pod=~"{'|'.join(pods)}"
{self.cluster_selector}
}}
)
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ async def list_workloads_by_subowner(
f"""
count by (namespace, owner_name, {subowner_label}, owner_kind) (
{metric_name} {{
{self.cluster_selector}
{namespace_selector},
owner_kind=~"{'|'.join(kinds)}"
{self.cluster_selector}
}}
)
"""
Expand Down Expand Up @@ -95,10 +95,10 @@ async def _list_pods_of_subowner(
f"""
count by (namespace, owner_name, owner_kind, pod) (
kube_pod_owner{{
{self.cluster_selector}
namespace="{namespace}",
owner_name=~"{'|'.join(subowner_names)}",
owner_kind="{subowner_kind}"
{self.cluster_selector}
}}
)
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ async def list_workloads(self, namespaces: Union[list[str], Literal["*"]]) -> li
f"""
count by (namespace, owner_name, owner_kind, pod) (
kube_pod_owner{{
{self.cluster_selector}
{namespace_selector},
owner_kind=~"{'|'.join(self.kinds_to_scan)}"
{self.cluster_selector}
}}
)
"""
Expand All @@ -50,9 +50,9 @@ async def list_workloads(self, namespaces: Union[list[str], Literal["*"]]) -> li
f"""
count by (namespace, job_name) (
kube_job_owner{{
{self.cluster_selector}
{namespace_selector},
owner_kind="CronJob"
{self.cluster_selector}
}}
)
"""
Expand Down

0 comments on commit 4044b4a

Please sign in to comment.