Set k8s normal default when assuming non aggressive probe is used#4864
Set k8s normal default when assuming non aggressive probe is used#4864nak3 wants to merge 4 commits intoknative:masterfrom
Conversation
Currently we have to set all periodSeconds, timeoutSeconds and failureThreshold greater than 0, when we would like to use k8s style readiness probe. However, it could be assume that the user would like to use non aggressive readiness probe when setting one of these values. Hence, this patch sets k8s's normal default values for such case.
knative-prow-robot
left a comment
There was a problem hiding this comment.
@nak3: 0 warnings.
Details
In response to this:
Currently we have to set all periodSeconds, timeoutSeconds and
failureThreshold greater than 0, when we would like to use k8s style
readiness probe.However, it could be assume that the user would like to use non
aggressive readiness probe when setting one of these values.
Hence, this patch sets k8s's normal default values for such case./lint
Ref #4780 (comment)
Proposed Changes
- Set k8s normal default when assuming non aggressive probe is used
Release Note
NONE
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.
|
Hi @nak3. 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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
| }, | ||
| }, | ||
| }, { | ||
| name: "defaluting non aggressive probe", |
There was a problem hiding this comment.
| name: "defaluting non aggressive probe", | |
| name: "defaulting non aggressive probe", |
(Don't use the commit button, please apply the change manually)
| rs.PodSpec.Containers[idx].Resources.Limits[corev1.ResourceMemory] = *rsrc | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Maybe fetch a pointer to the probe once to make this a bit more readable.
readinessProbe := &rs.PodSpec.Containers[idx].ReadinessProbe
I think that works, feel free to ignore if it doesn't.
There was a problem hiding this comment.
Yes, it worked and it makes more readable! Thank you for the suggestion. Updated.
There was a problem hiding this comment.
Ugh, but now you need to derefence on every call. May I instead suggest you obtain a pointer to the container at the start of the loop?
ctr := &rs.PodSpec.Containers[idx]
You can then replace a lot of boilerplate in the whole function and simplify all of the below to ctr.ReadinessProbe... which is simple enough I think. No dereferences should be needed then.
There was a problem hiding this comment.
Thank you! Updated. (Sorry, I should have noticed it by myself.)
markusthoemmes
left a comment
There was a problem hiding this comment.
/approve
I was about to propose to vendor https://github.com/kubernetes/kubernetes/blob/1cb3b5807ec37490b4582f22d991c043cc468195/pkg/apis/core/v1/defaults.go#L192-L205 and use that but... oh well, vendoring kubernetes/kubernetes is probably not a good idea for the few LoC we need here.
/assign @dgerd
Leaving the LGTM for Dan.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: markusthoemmes, nak3 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/ok-to-test |
|
/hold I don't have any problems with the code, but I would like to have a discussion on this in the API WG meeting on the behavior before merging this in. I do have some reservation with the general behavior of changing a value causing the default behavior of another value to change. To make matters worse the defaults only change some of the time (i.e. |
|
@dgerd Pingeroo! |
|
This has taken a different direction with detailed errors rather than assuming user intent. #5385 adds the error behavior that we want. |
Currently we have to set all periodSeconds, timeoutSeconds and
failureThreshold greater than 0, when we would like to use k8s style
readiness probe.
However, it could be assume that the user would like to use non
aggressive readiness probe when setting one of these values.
Hence, this patch sets k8s's normal default values for such case.
/lint
Ref #4780 (comment)
Proposed Changes
Release Note