mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-15 23:03:40 +00:00
Merge pull request #119341 from divyasri537/remove-ctx-canceled-failopen
Ignore context canceled from validate and mutate webhook failopen metric
This commit is contained in:
commit
fab1f606dd
@ -168,6 +168,10 @@ func (a *mutatingDispatcher) Dispatch(ctx context.Context, attr admission.Attrib
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
switch err := err.(type) {
|
switch err := err.(type) {
|
||||||
case *webhookutil.ErrCallingWebhook:
|
case *webhookutil.ErrCallingWebhook:
|
||||||
|
if ctx.Err() == context.Canceled {
|
||||||
|
klog.Warningf("Context Canceled when calling webhook %v", hook.Name)
|
||||||
|
return err
|
||||||
|
}
|
||||||
if !ignoreClientCallFailures {
|
if !ignoreClientCallFailures {
|
||||||
rejected = true
|
rejected = true
|
||||||
admissionmetrics.Metrics.ObserveWebhookRejection(ctx, hook.Name, "admit", string(versionedAttr.Attributes.GetOperation()), admissionmetrics.WebhookRejectionCallingWebhookError, int(err.Status.ErrStatus.Code))
|
admissionmetrics.Metrics.ObserveWebhookRejection(ctx, hook.Name, "admit", string(versionedAttr.Attributes.GetOperation()), admissionmetrics.WebhookRejectionCallingWebhookError, int(err.Status.ErrStatus.Code))
|
||||||
|
@ -173,6 +173,10 @@ func (d *validatingDispatcher) Dispatch(ctx context.Context, attr admission.Attr
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
switch err := err.(type) {
|
switch err := err.(type) {
|
||||||
case *webhookutil.ErrCallingWebhook:
|
case *webhookutil.ErrCallingWebhook:
|
||||||
|
if ctx.Err() == context.Canceled {
|
||||||
|
klog.Warningf("Context Canceled when calling webhook %v", hook.Name)
|
||||||
|
return
|
||||||
|
}
|
||||||
if !ignoreClientCallFailures {
|
if !ignoreClientCallFailures {
|
||||||
rejected = true
|
rejected = true
|
||||||
admissionmetrics.Metrics.ObserveWebhookRejection(ctx, hook.Name, "validating", string(versionedAttr.Attributes.GetOperation()), admissionmetrics.WebhookRejectionCallingWebhookError, int(err.Status.ErrStatus.Code))
|
admissionmetrics.Metrics.ObserveWebhookRejection(ctx, hook.Name, "validating", string(versionedAttr.Attributes.GetOperation()), admissionmetrics.WebhookRejectionCallingWebhookError, int(err.Status.ErrStatus.Code))
|
||||||
|
Loading…
Reference in New Issue
Block a user