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

HPA is not working properly due to replicas set #29388

Closed
amoon78 opened this issue Sep 13, 2024 · 3 comments · Fixed by #29489
Closed

HPA is not working properly due to replicas set #29388

amoon78 opened this issue Sep 13, 2024 · 3 comments · Fixed by #29489
Assignees
Labels
apache solved tech-issues The user has a technical issue about an application triage Triage is needed

Comments

@amoon78
Copy link
Contributor

amoon78 commented Sep 13, 2024

Name and Version

bitnami/apache 11.2.17

What architecture are you using?

arm64

What steps will reproduce the bug?

When autoscaling is enabled to use HPA to rescale the pod per target setting, the pod doesn't rescale by HPA setting since spec.replicas is in deploy. (https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#migrating-deployments-and-statefulsets-to-horizontal-autoscaling)
https://github.com/bitnami/charts/blob/main/bitnami/apache/templates/deployment.yaml#L19
Can we have a condition for the replica setting in the template? like,

  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}

And, regarding this issue (kubernetes/kubernetes#74099) in the HPA controller, is it possible to switch the resource order in https://github.com/bitnami/charts/blob/main/bitnami/apache/templates/hpa.yaml#L24-L47

What is the expected behavior?

  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  metrics:
    {{- if .Values.autoscaling.targetMemory }}
    - type: Resource
      resource:
        name: memory
        {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
        targetAverageUtilization: {{ .Values.autoscaling.targetMemory }}
        {{- else }}
        target:
          type: Utilization
          averageUtilization: {{ .Values.autoscaling.targetMemory }}
        {{- end }}
    {{- end }}
    {{- if .Values.autoscaling.targetCPU }}
    - type: Resource
      resource:
        name: cpu
        {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
        targetAverageUtilization: {{ .Values.autoscaling.targetCPU }}
        {{- else }}
        target:
          type: Utilization
          averageUtilization: {{ .Values.autoscaling.targetCPU }}
        {{- end }}
    {{- end }}

What do you see instead?

  • spec.replicas is always seen in deploying even hpa is enabled.
  • The HPA controller keeps trying to reorder the spec.metrics list
@amoon78 amoon78 added the tech-issues The user has a technical issue about an application label Sep 13, 2024
@github-actions github-actions bot added the triage Triage is needed label Sep 13, 2024
@carrodher
Copy link
Member

Thank you for bringing this issue to our attention. We appreciate your involvement! If you're interested in contributing a solution, we welcome you to create a pull request. The Bitnami team is excited to review your submission and offer feedback. You can find the contributing guidelines here.

Your contribution will greatly benefit the community. Feel free to reach out if you have any questions or need assistance.

@amoon78
Copy link
Contributor Author

amoon78 commented Sep 17, 2024

Thanks @carrodher, i opened pr #29489 (please ignore #29484 which i had to close for some issue)

@carrodher
Copy link
Member

Thank you for opening this issue and submitting the associated Pull Request. Our team will review and provide feedback. Once the PR is merged, the issue will automatically close.

Your contribution is greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apache solved tech-issues The user has a technical issue about an application triage Triage is needed
Projects
None yet
2 participants