kubernetes: Add ambiguous selector check to HPA #112011 fix impacting HPA implementation
What happened?
We are using two HPA to control a deployment, But both HPA will not active on the same time. we handle it using scaling policy. #112011 fix is disabling the HPA’s.
Following is our HPA’s that working on single deployment, that is been disabled by the fix #112011.
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: app-scale-up
namespace: ns
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: app
minReplicas: 5
maxReplicas: 25
metrics:
- type: External
external:
metric:
name: queue_lag_minutes
target:
type: Value
value: 5
behavior:
scaleDown:
selectPolicy: Disabled
scaleUp:
stabilizationWindowSeconds: 60
policies:
- type: Pods
value: 1
periodSeconds: 10
---
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: app-scale-down
namespace: ns
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: app
minReplicas: 5
maxReplicas: 25
metrics:
- type: External
external:
metric:
name: container_cpu_usage
target:
type: Value
value: 30
behavior:
scaleDown:
stabilizationWindowSeconds: 500
policies:
- type: Pods
value: 1
periodSeconds: 60
scaleUp:
selectPolicy: Disabled
What did you expect to happen?
The requirement is both HPA should be active. Is it possible to consider the scaling policy while determining the ambiguous selector?
How can we reproduce it (as minimally and precisely as possible)?
Create two HPA objects using the below templates
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: app-scale-up
namespace: ns
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: app
minReplicas: 5
maxReplicas: 25
metrics:
- type: External
external:
metric:
name: queue_lag_minutes
target:
type: Value
value: 5
behavior:
scaleDown:
selectPolicy: Disabled
scaleUp:
stabilizationWindowSeconds: 60
policies:
- type: Pods
value: 1
periodSeconds: 10
---
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: app-scale-down
namespace: ns
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: app
minReplicas: 5
maxReplicas: 25
metrics:
- type: External
external:
metric:
name: container_cpu_usage
target:
type: Value
value: 30
behavior:
scaleDown:
stabilizationWindowSeconds: 500
policies:
- type: Pods
value: 1
periodSeconds: 60
scaleUp:
selectPolicy: Disabled
Anything else we need to know?
No response
Kubernetes version
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.17", GitCommit:"953be8927218ec8067e1af2641e540238ffd7576", GitTreeState:"clean", BuildDate:"2023-02-22T13:34:27Z", GoVersion:"go1.19.6", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"28+", GitVersion:"v1.28.3-eks-4f4795d", GitCommit:"e77944ea667aee90c84c48a74a2a0da7a23e0508", GitTreeState:"clean", BuildDate:"2023-10-20T23:21:39Z", GoVersion:"go1.20.10", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.23) and server (1.28) exceeds the supported minor version skew of +/-1
Cloud provider
AWS EKS
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 16 (9 by maintainers)
Seems reasonable.
@k8s-triage-robot: Closing this issue, marking it as “Not Planned”.
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
lifecycle/staleis appliedlifecycle/stalewas applied,lifecycle/rottenis appliedlifecycle/rottenwas applied, the issue is closedYou can:
/reopen/remove-lifecycle rottenPlease send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned