-
Notifications
You must be signed in to change notification settings - Fork 381
Improve CRD liveness/readiness probe #2717
Improve CRD liveness/readiness probe #2717
Conversation
Hi @jasiu001. Thanks for your PR. I'm waiting for a kubernetes-sigs or kubernetes 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. 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. |
/ok-to-test |
/test pull-build-all-images-for-arm |
pkg/probe/crd_probe.go
Outdated
// DelayCRDProbe - readiness/liveness probe is run each period time defined in `periodSeconds` parameter in chart | ||
// if the value is to short then `delay` can postpone checking CRDs which is resource-intensive | ||
// period seconds for CRDProbe will be `periodSeconds` * delay | ||
DelayCRDProbe = 60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can name it a little bit different? delay for me is quite connected with time and here we have contract which is saying that we should perform check action on X execution
pkg/probe/crd_probe.go
Outdated
func (r *ReadinessCRD) check() (bool, error) { | ||
list, err := r.client.ApiextensionsV1beta1().CustomResourceDefinitions().List(v1.ListOptions{}) | ||
func (r *CRDProbe) check() (bool, error) { | ||
list, err := r.client.ApiextensionsV1beta1().CustomResourceDefinitions().List(v1.ListOptions{LabelSelector: "svcat=true"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please replace with
labels.SelectorFromSet(labels.Set{
"svcat": "true",
}).String()
I do not want to hardcode the =
sign here. It is an implementation details, so better will be to use helpers:)
pkg/probe/crd_probe.go
Outdated
func (r *CRDProbe) Check(_ *http.Request) error { | ||
if r.counter < r.delay { | ||
r.counter++ | ||
klog.V(4).Infof("CRDProbe %s skiped. Ckeck for %d iteration(s)", r.Name(), r.delay-r.counter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
klog.V(4).Infof("CRDProbe %s skiped. Ckeck for %d iteration(s)", r.Name(), r.delay-r.counter) | |
klog.V(4).Infof("%s CRDProbe skipped. Will be executed in %d iteration", r.Name(), r.delay-r.counter) |
pkg/probe/crd_probe.go
Outdated
@@ -45,6 +47,11 @@ const ( | |||
ServiceInstance = "serviceinstances.servicecatalog.k8s.io" | |||
// ServiceBinding define the name of the ServiceBinding CRD | |||
ServiceBinding = "servicebindings.servicecatalog.k8s.io" | |||
|
|||
// DelayCRDProbe - readiness/liveness probe is run each period time defined in `periodSeconds` parameter in chart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@klaudiagrz please check that description :)
pkg/probe/crd_probe.go
Outdated
@@ -45,6 +47,11 @@ const ( | |||
ServiceInstance = "serviceinstances.servicecatalog.k8s.io" | |||
// ServiceBinding define the name of the ServiceBinding CRD | |||
ServiceBinding = "servicebindings.servicecatalog.k8s.io" | |||
|
|||
// DelayCRDProbe - readiness/liveness probe is run each period time defined in `periodSeconds` parameter in chart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// DelayCRDProbe - readiness/liveness probe is run each period time defined in `periodSeconds` parameter in chart | |
// CRDProbeIterationGap - the number of iterations after which the CRD probe action is performed |
pkg/probe/crd_probe.go
Outdated
@@ -45,6 +47,11 @@ const ( | |||
ServiceInstance = "serviceinstances.servicecatalog.k8s.io" | |||
// ServiceBinding define the name of the ServiceBinding CRD | |||
ServiceBinding = "servicebindings.servicecatalog.k8s.io" | |||
|
|||
// DelayCRDProbe - readiness/liveness probe is run each period time defined in `periodSeconds` parameter in chart | |||
// if the value is to short then `delay` can postpone checking CRDs which is resource-intensive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// if the value is to short then `delay` can postpone checking CRDs which is resource-intensive | |
// The CRD probe is run after the time period defined in the `periodSeconds` parameter in the chart |
pkg/probe/crd_probe.go
Outdated
|
||
// DelayCRDProbe - readiness/liveness probe is run each period time defined in `periodSeconds` parameter in chart | ||
// if the value is to short then `delay` can postpone checking CRDs which is resource-intensive | ||
// period seconds for CRDProbe will be `periodSeconds` * delay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// period seconds for CRDProbe will be `periodSeconds` * delay | |
// Time needed for the CRD Probe to complete is `periodSeconds` * CRDProbeIterationGap |
pkg/probe/crd_probe.go
Outdated
func (r *CRDProbe) Check(_ *http.Request) error { | ||
if r.counter < r.delay { | ||
r.counter++ | ||
klog.V(4).Infof("CRDProbe %s skiped. Ckeck for %d iteration(s)", r.Name(), r.delay-r.counter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
klog.V(4).Infof("CRDProbe %s skiped. Ckeck for %d iteration(s)", r.Name(), r.delay-r.counter) | |
klog.V(4).Infof("%s CRDProbe skipped. Will be executed in %d iteration", r.Name(), r.delay-r.counter) |
/test pull-service-catalog-test-integration |
d18ff89
to
7eaced9
Compare
733b89b
to
d18ff89
Compare
d18ff89
to
6d9ef6b
Compare
/test pull-build-all-images-for-s390x |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jasiu001, mszostok 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 |
/hold cancel |
This PR is a
What this PR does / why we need it:
svcat: "true"
to CRDsThanks to delaying the probe inside probe code not at the chart, charts settings (
periodSeconds
parameter) do not include for another probe (there could be many probes for each readiness and liveness health check).The second improvement inside probe code is requested for list only CRD belonging to ServiceCatalog not all of them. Thank that response takes up less of resources.
Please leave this checklist in the PR comment so that maintainers can ensure a good PR.
Merge Checklist:
breaking the chart release and existing clients who provide a
flag that will get an error when they try to update
Related issue: