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 numOfProbe and probeInterval in health probe configuration #950

Merged
merged 1 commit into from
Dec 27, 2021
Merged

Add numOfProbe and probeInterval in health probe configuration #950

merged 1 commit into from
Dec 27, 2021

Conversation

MartinForReal
Copy link
Contributor

@MartinForReal MartinForReal commented Dec 22, 2021

Signed-off-by: Shangxiang Fan shafan@microsoft.com

What type of PR is this?

/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #948

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Two new annotations are added in order to customize health probe behavior

service.beta.kubernetes.io/azure-load-balancer-health-probe-interval: "15"
service.beta.kubernetes.io/azure-load-balancer-health-probe-num-of-probe: "2"

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 22, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @MartinForReal. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 22, 2021
@MartinForReal
Copy link
Contributor Author

More units are being added.

@MartinForReal MartinForReal changed the title [wip] add numOfProbe and probeInterval in health probe configuration Add numOfProbe and probeInterval in health probe configuration Dec 23, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 23, 2021
@coveralls
Copy link

coveralls commented Dec 23, 2021

Coverage Status

Coverage increased (+0.06%) to 80.003% when pulling 9665e61 on MartinForReal:feat/add_probe_interval into c0a5fd8 on kubernetes-sigs:master.

@MartinForReal
Copy link
Contributor Author

/assign @nilo19 @feiskyer

@feiskyer
Copy link
Member

/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 Dec 24, 2021
numberOfProbes, err := getInt32FromAnnotations(s.Annotations, consts.ServiceAnnotationLoadBalancerHealthProbeNumOfProbe, func(val *int32) error {
//total probe should be less than 120, minimum probe interval is 2 and minimum number of unhealthy responses is 2
//number of probe values should range between 2 to 60
if *val > 60 || *val < 2 {
Copy link
Member

Choose a reason for hiding this comment

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

Could you get the interval first and validate the total probe interval by number*interval?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this business rule out of validator function and check it at the end of the function, which decouples the validator functions.


probeInterval, err := getInt32FromAnnotations(s.Annotations, consts.ServiceAnnotationLoadBalancerHealthProbeInterval, func(val *int32) error {
//total probe should be less than 120
if (*val)*(*numberOfProbes) >= 120 {
Copy link
Member

Choose a reason for hiding this comment

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

also need to check the minimum value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

validation rule is added .

return probeInterval, numberOfProbes, nil
}

type Int32BusinessValidator func(*int32) error
Copy link
Member

Choose a reason for hiding this comment

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

Could you add some comments for newly added types and functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

}
}

func Test_getProbeIntervalInSecondsAndNumOfProbe(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding those tests. Could you also add another test for updating annotation values? e.g. when the value of the probe interval annotation changes, the probe interval on LB should be updated from the old value to the new one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a common case for ccm but this case is out of current scope because here we only provide expected configuration of loadbalancer probe

@nilo19
Copy link
Contributor

nilo19 commented Dec 24, 2021

Signed-off-by: Shangxiang Fan <shafan@microsoft.com>
@MartinForReal
Copy link
Contributor Author

/retest

@nilo19
Copy link
Contributor

nilo19 commented Dec 24, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 24, 2021
Copy link
Member

@feiskyer feiskyer left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the comments. LGTM

/lgtm
/approve

After the PR merged, please file new PRs for 1) update docs and 2) cherry pick the changes to release branches

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feiskyer, MartinForReal

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 Dec 27, 2021
@k8s-ci-robot k8s-ci-robot merged commit 35267b3 into kubernetes-sigs:master Dec 27, 2021
@MartinForReal MartinForReal deleted the feat/add_probe_interval branch December 27, 2021 02:28
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. kind/feature Categorizes issue or PR as related to a new feature. 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. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more parameters support to annotations in order to customize probe behavior.
5 participants