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

Default timeoutSecond and failureThreshold values when the user opts into K8s probing #5741

Closed
wants to merge 6 commits into from
Closed

Default timeoutSecond and failureThreshold values when the user opts into K8s probing #5741

wants to merge 6 commits into from

Conversation

dineshba
Copy link

@dineshba dineshba commented Oct 2, 2019

Reproduced this issue #5732 using unit tests.

Planning to set default value for timeoutSecond and failureThreshold in this method https://github.com/knative/serving/blob/master/pkg/apis/serving/k8s_validation.go#L443. Correct me if I am wrong.

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Oct 2, 2019
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 2, 2019
@knative-prow-robot knative-prow-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 2, 2019
@knative-prow-robot
Copy link
Contributor

Hi @dineshba. Thanks for your PR.

I'm waiting for a knative 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.

@knative-prow-robot knative-prow-robot added the area/API API objects and controllers label Oct 2, 2019
@vagababov
Copy link
Contributor

/ok-to-test

@knative-prow-robot knative-prow-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 Oct 2, 2019
Copy link
Contributor

@taragu taragu 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 the PR 🙂 I think the default values for timeoutSecond and failureThreshold should be set in pkg/apis/serving/v1/revision_defaults.go

@savitaashture
Copy link
Contributor

savitaashture commented Oct 2, 2019

Thank you @taragu @dineshba
Yes it has to be handled as part of pkg/apis/serving/v1/revision_defaults.go #5732
@dineshba please let me know if you are interested to work on this issue #5732

@dineshba
Copy link
Author

dineshba commented Oct 2, 2019

@savitaashture I am interested to work on this. Shall I add commits to this PR ? OR raise a new PR?

@dineshba
Copy link
Author

dineshba commented Oct 2, 2019

@taragu Thanks for your inputs. Will look into this file pkg/apis/serving/v1/revision_defaults.go

@dineshba
Copy link
Author

dineshba commented Oct 2, 2019

Hi @savitaashture and @taragu Updated this PR with fix. Please have a look at it and provide your inputs. Thanks

probe.TimeoutSeconds = 10
}
}

Copy link
Contributor

@savitaashture savitaashture Oct 2, 2019

Choose a reason for hiding this comment

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

I would have added changes to existing SetDefaults function same as SuccessThreshold

Copy link
Author

Choose a reason for hiding this comment

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

@savitaashture Didn't notice that function. Will try to make changes as per your suggestion and amend to the PR. Thanks

@@ -471,6 +472,7 @@ func validateReadinessProbe(p *corev1.Probe) *apis.FieldError {
})
}
} else {
v1.SetDefaults(p)
Copy link
Contributor

@savitaashture savitaashture Oct 2, 2019

Choose a reason for hiding this comment

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

If you add changes in pkg/apis/serving/v1/revision_defaults.go setting default values will be taken care and you no need to handle it here again

@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 3, 2019
pkg/apis/serving/v1/revision_defaults.go Outdated Show resolved Hide resolved
pkg/apis/serving/k8s_validation_test.go Outdated Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 4, 2019
@savitaashture
Copy link
Contributor

@dineshba
Please add few more test case scenario

  1. PeriodSeconds = 0 and set some values to FailureThreshold , TimeoutSeconds validate output
  2. Don't set any values for any of the attribute and validate output

@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 4, 2019
@dineshba
Copy link
Author

dineshba commented Oct 4, 2019

@savitaashture Updated the PR with missing tests

@dineshba
Copy link
Author

@savitaashture @taragu Could you please review this PR?

Copy link
Contributor

@vagababov vagababov left a comment

Choose a reason for hiding this comment

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

I think @dgerd comented on the issue that is like this by purpose.

@@ -93,7 +93,15 @@ func (rs *RevisionSpec) SetDefaults(ctx context.Context) {
if rs.PodSpec.Containers[idx].ReadinessProbe.SuccessThreshold == 0 {
rs.PodSpec.Containers[idx].ReadinessProbe.SuccessThreshold = 1
}
if rs.PodSpec.Containers[idx].ReadinessProbe.PeriodSeconds != 0 {
if rs.PodSpec.Containers[idx].ReadinessProbe.FailureThreshold == 0 {
rs.PodSpec.Containers[idx].ReadinessProbe.FailureThreshold = 3
Copy link
Contributor

Choose a reason for hiding this comment

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

Where are those defaults coming from?

Copy link

Choose a reason for hiding this comment

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

@vagababov https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes

timeoutSeconds: Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1.
failureThreshold: When a Pod starts and the probe fails, Kubernetes will try failureThreshold times before giving up. Giving up in case of liveness probe means restarting the container. In case of readiness probe the Pod will be marked Unready. Defaults to 3. Minimum value is 1.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should they be named constant with a comment where you got them from?

@dgerd
Copy link

dgerd commented Oct 15, 2019

I added a comment on the original issue. We deviated from K8s defaults on purpose here to enable faster probes and avoid setting default based on values of other fields within the same struct.

@markusthoemmes
Copy link
Contributor

/hold

To solve the discussion in the issue first.

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 28, 2019
@markusthoemmes
Copy link
Contributor

/assign @dgerd

@markusthoemmes
Copy link
Contributor

Hanging for a month, any new status on this?

@markusthoemmes
Copy link
Contributor

@dineshba any news?

@dineshba
Copy link
Author

Its on hold. We have to finalize on this comment

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2020
@ahmetb
Copy link
Contributor

ahmetb commented Apr 15, 2020

It would be great to unblock this, as #5798 was closed in favor of this.

@vagababov
Copy link
Contributor

/assign @dprotaso @mattmoor
@dgerd is not longer with the project, so Dan and Matt, can yo chime in here so we can finish this?
Thanks.

@mattmoor mattmoor assigned dprotaso and unassigned dgerd May 6, 2020
@dprotaso
Copy link
Member

Sorry for the delay - this PR looks good to me since we're applying the k8s defaults only when periodSeconds == 0 - which is inline with option #2 here

@dineshba looks like you need to rebase

@dprotaso
Copy link
Member

/ok-to-test

@dprotaso dprotaso changed the title Added tests for missing timeoutSecond and failureThreshold Default timeoutSecond and failureThreshold values when the user opts into K8s probing May 12, 2020
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 17, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dineshba
To complete the pull request process, please assign dprotaso
You can assign the PR to them by writing /assign @dprotaso in a comment when ready.

The full list of commands accepted by this bot can be found 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

@dineshba
Copy link
Author

@dprotaso Thanks for the follow up. Update the branch with latest master branch. Please review it now

@knative-test-reporter-robot

The following jobs failed:

Test name Triggers Retries
pull-knative-serving-unit-tests 0/3

Failed non-flaky tests preventing automatic retry of pull-knative-serving-unit-tests:

cmd/activator.[build failed]
cmd/autoscaler.[build failed]
cmd/queue.[build failed]
pkg/activator/handler.[build failed]
pkg/activator/net.[build failed]
pkg/activator/util.[build failed]
pkg/apis/serving/v1.[build failed]
pkg/apis/serving/v1alpha1.[build failed]

and 30 more.

@knative-prow-robot
Copy link
Contributor

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

Test name Commit Details Rerun command
pull-knative-serving-unit-tests ab8679a link /test pull-knative-serving-unit-tests
pull-knative-serving-integration-tests ab8679a link /test pull-knative-serving-integration-tests
pull-knative-serving-build-tests ab8679a link /test pull-knative-serving-build-tests
pull-knative-serving-autotls-tests ab8679a link /test pull-knative-serving-autotls-tests
pull-knative-serving-upgrade-tests ab8679a link /test pull-knative-serving-upgrade-tests

Full PR test history. Your PR dashboard.

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.

Comment on lines +96 to +107
if rs.PodSpec.Containers[idx].ReadinessProbe.SuccessThreshold == 0 {
rs.PodSpec.Containers[idx].ReadinessProbe.SuccessThreshold = 1
}
if rs.PodSpec.Containers[idx].ReadinessProbe.PeriodSeconds != 0 {
if rs.PodSpec.Containers[idx].ReadinessProbe.FailureThreshold == 0 {
rs.PodSpec.Containers[idx].ReadinessProbe.FailureThreshold = 3
}

if rs.PodSpec.Containers[idx].ReadinessProbe.TimeoutSeconds == 0 {
rs.PodSpec.Containers[idx].ReadinessProbe.TimeoutSeconds = 1
}
}
Copy link
Member

@dprotaso dprotaso May 17, 2020

Choose a reason for hiding this comment

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

This block of code should move to the applyProbes method now

@markusthoemmes
Copy link
Contributor

@dineshba any news on this one? Are you still pursuing this?

@markusthoemmes
Copy link
Contributor

~30 days since my last inquiry. I'll close this for now. @dineshba please feel free to reopen if you're still pursuing this and want to complete this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/API API objects and controllers cla: yes Indicates the PR's author has signed the CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.