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

add custom metric to hpa template #5704

Merged
merged 1 commit into from
Jun 18, 2020
Merged

add custom metric to hpa template #5704

merged 1 commit into from
Jun 18, 2020

Conversation

oleksandrsemak
Copy link
Contributor

What this PR does / why we need it:

  • Add custom metrics support to HPA template
  • Increase resources request for reducing useless scaling HPA

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Which issue/s this PR fixes

Low resources request triggered HPA scaling even without any load

How Has This Been Tested?

Tested on K8s 1.16.10

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please log a ticket with the Linux Foundation Helpdesk: https://support.linuxfoundation.org/
  • Should you encounter any issues with the Linux Foundation Helpdesk, send a message to the backup e-mail support address at: [email protected]

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/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jun 11, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @alexandrsemak. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 11, 2020
@oleksandrsemak
Copy link
Contributor Author

I signed it

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 11, 2020
@@ -577,4 +588,4 @@ tcp: {}
# Ref: https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx/examples/udp
##
udp: {}
# 53: "kube-system/kube-dns:53"
# 53: "kube-system/kube-dns:53"
Copy link
Member

Choose a reason for hiding this comment

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

please don't remove the newline

@aledbf
Copy link
Member

aledbf commented Jun 12, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 12, 2020
@@ -226,10 +226,10 @@ controller:
resources:
# limits:
# cpu: 100m
# memory: 90Mi
# memory: 200Mi
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we changing these values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ChiefAlexander low memory value triggered hpa even w/o any load, so if you install chart with 90Mi memory it will scale hpa to maxreplicas

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. As we don't default the HPA to enabled I'd rather we leave this alone and instead make a note of that in our Charts Readme. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't mind. I will back this value

@ChiefAlexander
Copy link
Contributor

/assign @ChiefAlexander

@ChiefAlexander
Copy link
Contributor

@@ -1,6 +1,6 @@
apiVersion: v1
name: ingress-nginx
version: 2.4.0
version: 2.5.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
version: 2.5.0
version: 2.6.0

Another change got in before yours. Please bump the chart version and squash the commit. After that this lgtm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry about this. Yet another change was merged in before yours again. Gonna need to bump the minor version and rebase your changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you mean chart version 2.6.1 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

So we should bump to 2.7.0

Kubernetes follows semver, k8s docs. So Major.Minor.Patch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gotcha, done

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 17, 2020
@oleksandrsemak
Copy link
Contributor Author

/retest

@oleksandrsemak
Copy link
Contributor Author

@ChiefAlexander please could you resolve conflict?

@ChiefAlexander
Copy link
Contributor

Your PR needs a rebase against the changes in origin.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 18, 2020
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 18, 2020
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jun 18, 2020

@alexandrsemak: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-ingress-nginx-e2e-1-18 a8258d9ad10878c12f1a97f32c94770766c840fe link /test pull-ingress-nginx-e2e-1-18
pull-ingress-nginx-e2e-1-15 a8258d9ad10878c12f1a97f32c94770766c840fe link /test pull-ingress-nginx-e2e-1-15
pull-ingress-nginx-e2e-1-17 a8258d9ad10878c12f1a97f32c94770766c840fe link /test pull-ingress-nginx-e2e-1-17
pull-ingress-nginx-lualint a8258d9ad10878c12f1a97f32c94770766c840fe link /test pull-ingress-nginx-lualint
pull-ingress-nginx-test-lua a8258d9ad10878c12f1a97f32c94770766c840fe link /test pull-ingress-nginx-test-lua
pull-ingress-nginx-e2e-1-16 a8258d9ad10878c12f1a97f32c94770766c840fe link /test pull-ingress-nginx-e2e-1-16

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 18, 2020
@oleksandrsemak
Copy link
Contributor Author

@ChiefAlexander done

@ChiefAlexander
Copy link
Contributor

/lgtm
Thanks! Sorry we had to jump through so many hoops 😆

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 18, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexandrsemak, ChiefAlexander

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 18, 2020
@oleksandrsemak
Copy link
Contributor Author

yeah no problem, this is much better than support own chart

@k8s-ci-robot k8s-ci-robot merged commit 6048e63 into kubernetes:master Jun 18, 2020
# - type: Pods
# pods:
# metric:
# name: nginx_ingress_controller_nginx_process_requests_total
Copy link
Contributor

Choose a reason for hiding this comment

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

@alexandrsemak nginx_ingress_controller_nginx_process_requests_total metric is a counter IMO making it not appropriate metrics for HPA; other than being "reset" when container is restarted and pod cycled, just its rate may get reduced when additional replicas get added.

Maybe nginx_ingress_controller_nginx_process_connections would be more appropriate. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sslavic sorry for confusing by this metric it was provided just for example the main goal was add ability to add any of custom metric. BTW kubernetes use timestamp for calculate averagevalue even with counter metric it will works correct, but you right we can change it to nginx_ingress_controller_nginx_process_connections or wrap nginx_ingress_controller_nginx_process_requests_total in rate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants