Skip to content

Commit

Permalink
Algo: enable ReadyPodsOnly feature filtering for resource metrics query
Browse files Browse the repository at this point in the history
  • Loading branch information
dayko2019 committed Oct 17, 2023
1 parent db496da commit 431b00d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 22 deletions.
6 changes: 4 additions & 2 deletions algorithm/kapacity/portrait/horizontal/predictive/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ def fetch_resource_metric_history(args, namespace, metric, scale_target, start,
workload_resource = metric_pb.WorkloadResourceQuery(group_kind=group_kind,
namespace=namespace,
name=name,
resource_name=resource_name)
resource_name=resource_name,
ready_pods_only=True)
query = metric_pb.Query(type=metric_pb.WORKLOAD_RESOURCE,
workload_resource=workload_resource)
return query_metrics(args=args, query=query, start=start, end=end)
Expand All @@ -327,7 +328,8 @@ def fetch_container_resource_metric_history(args, namespace, metric, scale_targe
namespace=namespace,
name=name,
resource_name=resource_name,
container_name=container_name)
container_name=container_name,
ready_pods_only=True)
query = metric_pb.Query(type=metric_pb.WORKLOAD_CONTAINER_RESOURCE,
workload_container_resource=workload_container_resource)
return query_metrics(args=args, query=query, start=start, end=end)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ message WorkloadResourceQuery {
string namespace = 2;
string name = 3;
string resource_name = 4;
bool ready_pods_only = 5;
}

message WorkloadContainerResourceQuery {
Expand All @@ -92,6 +93,7 @@ message WorkloadContainerResourceQuery {
string name = 3;
string resource_name = 4;
string container_name = 5;
bool ready_pods_only = 6;
}

message ObjectQuery {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -113,30 +113,34 @@ class ContainerResourceQuery(_message.Message):
def __init__(self, namespace: _Optional[str] = ..., name: _Optional[str] = ..., selector: _Optional[str] = ..., resource_name: _Optional[str] = ..., container_name: _Optional[str] = ...) -> None: ...

class WorkloadResourceQuery(_message.Message):
__slots__ = ["group_kind", "namespace", "name", "resource_name"]
__slots__ = ["group_kind", "namespace", "name", "resource_name", "ready_pods_only"]
GROUP_KIND_FIELD_NUMBER: _ClassVar[int]
NAMESPACE_FIELD_NUMBER: _ClassVar[int]
NAME_FIELD_NUMBER: _ClassVar[int]
RESOURCE_NAME_FIELD_NUMBER: _ClassVar[int]
READY_PODS_ONLY_FIELD_NUMBER: _ClassVar[int]
group_kind: GroupKind
namespace: str
name: str
resource_name: str
def __init__(self, group_kind: _Optional[_Union[GroupKind, _Mapping]] = ..., namespace: _Optional[str] = ..., name: _Optional[str] = ..., resource_name: _Optional[str] = ...) -> None: ...
ready_pods_only: bool
def __init__(self, group_kind: _Optional[_Union[GroupKind, _Mapping]] = ..., namespace: _Optional[str] = ..., name: _Optional[str] = ..., resource_name: _Optional[str] = ..., ready_pods_only: bool = ...) -> None: ...

class WorkloadContainerResourceQuery(_message.Message):
__slots__ = ["group_kind", "namespace", "name", "resource_name", "container_name"]
__slots__ = ["group_kind", "namespace", "name", "resource_name", "container_name", "ready_pods_only"]
GROUP_KIND_FIELD_NUMBER: _ClassVar[int]
NAMESPACE_FIELD_NUMBER: _ClassVar[int]
NAME_FIELD_NUMBER: _ClassVar[int]
RESOURCE_NAME_FIELD_NUMBER: _ClassVar[int]
CONTAINER_NAME_FIELD_NUMBER: _ClassVar[int]
READY_PODS_ONLY_FIELD_NUMBER: _ClassVar[int]
group_kind: GroupKind
namespace: str
name: str
resource_name: str
container_name: str
def __init__(self, group_kind: _Optional[_Union[GroupKind, _Mapping]] = ..., namespace: _Optional[str] = ..., name: _Optional[str] = ..., resource_name: _Optional[str] = ..., container_name: _Optional[str] = ...) -> None: ...
ready_pods_only: bool
def __init__(self, group_kind: _Optional[_Union[GroupKind, _Mapping]] = ..., namespace: _Optional[str] = ..., name: _Optional[str] = ..., resource_name: _Optional[str] = ..., container_name: _Optional[str] = ..., ready_pods_only: bool = ...) -> None: ...

class ObjectQuery(_message.Message):
__slots__ = ["group_kind", "namespace", "name", "selector", "metric"]
Expand Down

0 comments on commit 431b00d

Please sign in to comment.