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

feat(argo-rollouts): Add hpa to handle controller scaling #2694

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

vitorscassiano
Copy link

@vitorscassiano vitorscassiano commented May 15, 2024

Add support to turn-on HPA on argo rollouts controller.

Checklist:

  • I have bumped the chart version according to versioning
  • I have updated the documentation according to documentation
  • I have updated the chart changelog with all the changes that come with this pull request according to changelog.
  • Any new values are backwards compatible and/or have sensible default.
  • I have signed off all my commits as required by DCO.
  • My build is green (troubleshooting builds).

@yu-croco
Copy link
Collaborator

*sorry, it's still draft PR. 🙈

andres-vara and others added 7 commits May 16, 2024 13:13
…proj#2679)

* feat(argo-workflows): Allow adding additional ServiceAccounts to RoleBinding (argoproj#2676)

remove unnecessary if statements

Signed-off-by: Daniel Beilin <daniel.beilin@outlook.com>
Co-authored-by: Aikawa <yu.croco@gmail.com>
Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>

* feat(argo-cd): Support ability to set .Values.namespaceOverride

Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>

* fix(argo-cd): typo

Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>

* chore(deps): update actions/create-github-app-token action to v1.10.0 (argoproj#2677)

Co-authored-by: renovate[bot] <renovate[bot]@users.noreply.github.com>
Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>

* feat(argo-rollouts): Add podLabels at the controller & dashboard level (argoproj#2678)

Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>

* feat(argo-cd): Support ability to set .Values.namespaceOverride

Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>

* fix(argo-cd): typo

Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>

* fix(argo-cd): autocorrection

Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>

* fix(argo-cd): typos

Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>

* fix(argo-cd): typos

Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>

* removed auota

Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>

* Update Chart.yaml

Signed-off-by: Andres Vara <46708607+andres-vara@users.noreply.github.com>

---------

Signed-off-by: Daniel Beilin <daniel.beilin@outlook.com>
Signed-off-by: Andres Vara Parsegov <andres.vara@chase.com>
Signed-off-by: Andres Vara <46708607+andres-vara@users.noreply.github.com>
Co-authored-by: Daniel Beilin <144586547+dbeilin@users.noreply.github.com>
Co-authored-by: Aikawa <yu.croco@gmail.com>
Co-authored-by: Andres Vara Parsegov <andres.vara@chase.com>
Co-authored-by: argoproj-renovate[bot] <161757507+argoproj-renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <renovate[bot]@users.noreply.github.com>
Co-authored-by: mitchell amihod <mitchell@amihod.com>
Signed-off-by: vitor.cassiano <vitor.cassiano@picpay.com>
Signed-off-by: vitor.cassiano <vitor.cassiano@picpay.com>
Signed-off-by: vitor.cassiano <vitor.cassiano@picpay.com>
…mage-updater to v0.13.0 (argoproj#2692)

* chore(argocd-image-updater): Update dependency argoproj-labs/argocd-image-updater to v0.13.0

* feat(argocd-image-updater): update deployment as following upstream

Signed-off-by: yu-croco <yu.croco@gmail.com>

* fix(argocd-image-updater): correct doc

Signed-off-by: yu-croco <yu.croco@gmail.com>

* fix(argocd-image-updater): fix manifest

Signed-off-by: yu-croco <yu.croco@gmail.com>

* chore(argocd-image-updater): bump version

Signed-off-by: yu-croco <yu.croco@gmail.com>

---------

Signed-off-by: yu-croco <yu.croco@gmail.com>
Co-authored-by: renovate[bot] <renovate[bot]@users.noreply.github.com>
Co-authored-by: yu-croco <yu.croco@gmail.com>
Signed-off-by: vitor.cassiano <vitor.cassiano@picpay.com>
Signed-off-by: vitor.cassiano <vitor.cassiano@picpay.com>
Signed-off-by: vitor.cassiano <vitor.cassiano@picpay.com>
Signed-off-by: vitor.cassiano <vitor.cassiano@picpay.com>
@vitorscassiano vitorscassiano marked this pull request as ready for review May 16, 2024 16:17
@@ -2,7 +2,7 @@ apiVersion: v2
appVersion: v1.6.6
description: A Helm chart for Argo Rollouts
name: argo-rollouts
version: 2.35.2
version: 2.36.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vitorscassiano According to semantic versioning, the next version after 2.35.2 would be 2.35.3. Following the convention, the last part of the version (in this case, the "2") would be incremented to indicate a fix or patch, while keeping the previous parts unchanged.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the versioning guide described in this document link. If I understand correctly, these changes include new functionality for the controller, so we should update the minor version, right?

Comment on lines +1 to +42
{{- if .Values.controller.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "argo-rollouts.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
app.kubernetes.io/component: {{ .Values.controller.component }}
{{- include "argo-rollouts.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "argo-rollouts.fullname" . }}
minReplicas: {{ .Values.controller.autoscaling.minReplicas }}
maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }}
metrics:
{{- with .Values.controller.autoscaling.metrics }}
{{- toYaml . | nindent 4 }}
{{- else }}
{{- with .Values.controller.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ . }}
{{- end }}
{{- with .Values.controller.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ . }}
{{- end }}
{{- end }}
{{- with .Values.controller.autoscaling.behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HorizontalPodAutoscaler (HPA) template looks well-structured and follows the conventions commonly seen in Kubernetes YAML manifests. However, I can provide some suggestions for improvement:
Consistency in Label Indentation: Ensure consistency in label indentation. Currently, you're using nindent 4 for some labels and not for others. It's better to maintain consistency for readability.
Conditional Checks: It's good that you have conditional checks using if statements to enable or disable autoscaling based on configuration. This provides flexibility.
Validation of Configurations: Verify that the values provided for minReplicas and maxReplicas are within acceptable ranges and that the autoscaling metrics and behaviors are configured correctly for your application's requirements.

Overall, your template seems well-structured and should work effectively for configuring HorizontalPodAutoscaler in Kubernetes environment

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated yaml are well-structured:

# Source: argo-rollouts/templates/controller/hpa.yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: release-name-argo-rollouts
  namespace: "moonlight-pipeline"
  labels:
    app.kubernetes.io/component: rollouts-controller
    helm.sh/chart: argo-rollouts-2.36.0
    app.kubernetes.io/name: argo-rollouts
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "v1.6.6"
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/part-of: argo-rollouts
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: release-name-argo-rollouts
  minReplicas: 2
  maxReplicas: 4
  metrics:
    - type: Resource
      resource:
        name: memory
        target:
          type: Utilization
          averageUtilization: 80
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 80

Signed-off-by: vitor.cassiano <vitor.cassiano@picpay.com>
@yu-croco
Copy link
Collaborator

Hi @vitorscassiano , thank you for your PR.
Can you please create values.yaml for testing autoscaling, like below? 🙋
Ref: https://github.com/argoproj/argo-helm/blob/main/charts/argo-cd/ci/ha-autoscaling-values.yaml#L8-L16

@github-actions github-actions bot added size/L and removed size/M labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants