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

ignore replicas if HPA is set #275

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

jmazzitelli
Copy link
Contributor

part of: kiali/kiali#7559

To test this:

  1. Create this file (/tmp/values.yaml) - note that HPA is defined and an abnormally large value for deployment.replicas is set - you will notice that large replicas value won't appear in the generated yaml:
deployment:
  replicas: 123456
  hpa:
    spec:
      maxReplicas: 6
      minReplicas: 3
      metrics:
      - type: Resource
        resource:
          name: cpu
          target:
            type: Utilization
            averageUtilization: 70
      - type: Resource
        resource:
          name: memory
          target:
            type: Utilization
            averageUtilization: 70
  resources:
    requests:
      memory: "1Gi"
    limits:
      memory: "2Gi"
  1. Check out this PR branch and build the helm charts: make build-helm-charts
  2. Show the deployment and HPA templates using that values file:
helm template -f /tmp/values.yaml --show-only templates/deployment.yaml --show-only templates/hpa.yaml  _output/charts/kiali-server-*.tgz
  1. Notice that there is an HPA resource generated in the output.
  2. Notice there is NO spec.replicas in the generated Deployment (notice the large value for replicas does not appear in the output):
helm template -f /tmp/values.yaml --show-only templates/deployment.yaml --show-only templates/hpa.yaml  _output/charts/kiali-server-*.tgz | grep 123456
  1. Now see that setting spec.replicas still takes effect if HPA is not defined (HPA is not defined by default, so just set the replicas on the command line, no need for a values file specified on the command line for this test, and only dump the deployment template since there is no HPA template for this test):
$ helm template --set deployment.replicas=123456 --show-only templates/deployment.yaml  _output/charts/kiali-server-*.tgz | grep 123456
  replicas: 123456

Copy link
Contributor

@hhovsepy hhovsepy left a comment

Choose a reason for hiding this comment

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

Verified, checked before and after, the issue is fixed.
Regression test on OCP cluster including the operator PR pass.

@jmazzitelli jmazzitelli merged commit 6be2d49 into kiali:master Jul 25, 2024
1 check passed
@jmazzitelli jmazzitelli deleted the 7559-hpa-replica branch July 25, 2024 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires operator PR Requires changes to the operator
Projects
Development

Successfully merging this pull request may close these issues.

2 participants