Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
369fd81c
Commit
369fd81c
authored
Nov 14, 2017
by
Joe Betz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Align admission metric names with prometheus guidelines
parent
375e2d03
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
43 deletions
+43
-43
chain.go
staging/src/k8s.io/apiserver/pkg/admission/chain.go
+7
-7
chain_test.go
staging/src/k8s.io/apiserver/pkg/admission/chain_test.go
+7
-7
metrics.go
staging/src/k8s.io/apiserver/pkg/admission/metrics.go
+15
-15
metrics_test.go
staging/src/k8s.io/apiserver/pkg/admission/metrics_test.go
+13
-13
admission.go
...8s.io/apiserver/pkg/admission/plugin/webhook/admission.go
+1
-1
No files found.
staging/src/k8s.io/apiserver/pkg/admission/chain.go
View file @
369fd81c
...
@@ -18,7 +18,7 @@ package admission
...
@@ -18,7 +18,7 @@ package admission
import
"time"
import
"time"
// chainAdmissionHandler is an instance of admission.
Interface
that performs admission control using
// chainAdmissionHandler is an instance of admission.
NamedHandler
that performs admission control using
// a chain of admission handlers
// a chain of admission handlers
type
chainAdmissionHandler
[]
NamedHandler
type
chainAdmissionHandler
[]
NamedHandler
...
@@ -35,15 +35,15 @@ func NewNamedHandler(name string, i Interface) NamedHandler {
...
@@ -35,15 +35,15 @@ func NewNamedHandler(name string, i Interface) NamedHandler {
}
}
const
(
const
(
stepValidat
ing
=
"validating
"
stepValidat
e
=
"validate
"
step
Mutating
=
"mutating
"
step
Admit
=
"admit
"
)
)
// Admit performs an admission control check using a chain of handlers, and returns immediately on first error
// Admit performs an admission control check using a chain of handlers, and returns immediately on first error
func
(
admissionHandler
chainAdmissionHandler
)
Admit
(
a
Attributes
)
error
{
func
(
admissionHandler
chainAdmissionHandler
)
Admit
(
a
Attributes
)
error
{
start
:=
time
.
Now
()
start
:=
time
.
Now
()
err
:=
admissionHandler
.
admit
(
a
)
err
:=
admissionHandler
.
admit
(
a
)
Metrics
.
ObserveAdmissionStep
(
time
.
Since
(
start
),
err
!=
nil
,
a
,
step
Mutating
)
Metrics
.
ObserveAdmissionStep
(
time
.
Since
(
start
),
err
!=
nil
,
a
,
step
Admit
)
return
err
return
err
}
}
...
@@ -55,7 +55,7 @@ func (admissionHandler chainAdmissionHandler) admit(a Attributes) error {
...
@@ -55,7 +55,7 @@ func (admissionHandler chainAdmissionHandler) admit(a Attributes) error {
if
mutator
,
ok
:=
handler
.
Interface
()
.
(
MutationInterface
);
ok
{
if
mutator
,
ok
:=
handler
.
Interface
()
.
(
MutationInterface
);
ok
{
t
:=
time
.
Now
()
t
:=
time
.
Now
()
err
:=
mutator
.
Admit
(
a
)
err
:=
mutator
.
Admit
(
a
)
Metrics
.
ObserveAdmissionController
(
time
.
Since
(
t
),
err
!=
nil
,
handler
,
a
,
step
Mutating
)
Metrics
.
ObserveAdmissionController
(
time
.
Since
(
t
),
err
!=
nil
,
handler
,
a
,
step
Admit
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -68,7 +68,7 @@ func (admissionHandler chainAdmissionHandler) admit(a Attributes) error {
...
@@ -68,7 +68,7 @@ func (admissionHandler chainAdmissionHandler) admit(a Attributes) error {
func
(
admissionHandler
chainAdmissionHandler
)
Validate
(
a
Attributes
)
error
{
func
(
admissionHandler
chainAdmissionHandler
)
Validate
(
a
Attributes
)
error
{
start
:=
time
.
Now
()
start
:=
time
.
Now
()
err
:=
admissionHandler
.
validate
(
a
)
err
:=
admissionHandler
.
validate
(
a
)
Metrics
.
ObserveAdmissionStep
(
time
.
Since
(
start
),
err
!=
nil
,
a
,
stepValidat
ing
)
Metrics
.
ObserveAdmissionStep
(
time
.
Since
(
start
),
err
!=
nil
,
a
,
stepValidat
e
)
return
err
return
err
}
}
...
@@ -80,7 +80,7 @@ func (admissionHandler chainAdmissionHandler) validate(a Attributes) (err error)
...
@@ -80,7 +80,7 @@ func (admissionHandler chainAdmissionHandler) validate(a Attributes) (err error)
if
validator
,
ok
:=
handler
.
Interface
()
.
(
ValidationInterface
);
ok
{
if
validator
,
ok
:=
handler
.
Interface
()
.
(
ValidationInterface
);
ok
{
t
:=
time
.
Now
()
t
:=
time
.
Now
()
err
:=
validator
.
Validate
(
a
)
err
:=
validator
.
Validate
(
a
)
Metrics
.
ObserveAdmissionController
(
time
.
Since
(
t
),
err
!=
nil
,
handler
,
a
,
stepValidat
ing
)
Metrics
.
ObserveAdmissionController
(
time
.
Since
(
t
),
err
!=
nil
,
handler
,
a
,
stepValidat
e
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
staging/src/k8s.io/apiserver/pkg/admission/chain_test.go
View file @
369fd81c
...
@@ -108,7 +108,7 @@ func TestAdmitAndValidate(t *testing.T) {
...
@@ -108,7 +108,7 @@ func TestAdmitAndValidate(t *testing.T) {
}
}
labelFilter
:=
map
[
string
]
string
{
labelFilter
:=
map
[
string
]
string
{
"type"
:
"
mutating
"
,
"type"
:
"
admit
"
,
}
}
checkAdmitAndValidateMetrics
(
t
,
labelFilter
,
test
.
accept
,
test
.
calls
)
checkAdmitAndValidateMetrics
(
t
,
labelFilter
,
test
.
accept
,
test
.
calls
)
...
@@ -134,7 +134,7 @@ func TestAdmitAndValidate(t *testing.T) {
...
@@ -134,7 +134,7 @@ func TestAdmitAndValidate(t *testing.T) {
}
}
labelFilter
=
map
[
string
]
string
{
labelFilter
=
map
[
string
]
string
{
"type"
:
"validat
ing
"
,
"type"
:
"validat
e
"
,
}
}
checkAdmitAndValidateMetrics
(
t
,
labelFilter
,
test
.
accept
,
test
.
calls
)
checkAdmitAndValidateMetrics
(
t
,
labelFilter
,
test
.
accept
,
test
.
calls
)
...
@@ -154,22 +154,22 @@ func checkAdmitAndValidateMetrics(t *testing.T, labelFilter map[string]string, a
...
@@ -154,22 +154,22 @@ func checkAdmitAndValidateMetrics(t *testing.T, labelFilter map[string]string, a
if
accept
{
if
accept
{
// Ensure exactly one admission end-to-end admission accept should have been recorded.
// Ensure exactly one admission end-to-end admission accept should have been recorded.
expectHistogramCountTotal
(
t
,
"apiserver_admission_step_
latencie
s"
,
acceptFilter
,
1
)
expectHistogramCountTotal
(
t
,
"apiserver_admission_step_
admission_latencies_second
s"
,
acceptFilter
,
1
)
// Ensure the expected count of admission controllers have been executed.
// Ensure the expected count of admission controllers have been executed.
expectHistogramCountTotal
(
t
,
"apiserver_admission_controller_
latencie
s"
,
acceptFilter
,
len
(
calls
))
expectHistogramCountTotal
(
t
,
"apiserver_admission_controller_
admission_latencies_second
s"
,
acceptFilter
,
len
(
calls
))
}
else
{
}
else
{
// When not accepted, ensure exactly one end-to-end rejection has been recorded.
// When not accepted, ensure exactly one end-to-end rejection has been recorded.
expectHistogramCountTotal
(
t
,
"apiserver_admission_step_
latencie
s"
,
rejectFilter
,
1
)
expectHistogramCountTotal
(
t
,
"apiserver_admission_step_
admission_latencies_second
s"
,
rejectFilter
,
1
)
if
len
(
calls
)
>
0
{
if
len
(
calls
)
>
0
{
if
len
(
calls
)
>
1
{
if
len
(
calls
)
>
1
{
// When not accepted, ensure that all but the last controller had been accepted, since
// When not accepted, ensure that all but the last controller had been accepted, since
// the chain stops execution at the first rejection.
// the chain stops execution at the first rejection.
expectHistogramCountTotal
(
t
,
"apiserver_admission_controller_
latencie
s"
,
acceptFilter
,
len
(
calls
)
-
1
)
expectHistogramCountTotal
(
t
,
"apiserver_admission_controller_
admission_latencies_second
s"
,
acceptFilter
,
len
(
calls
)
-
1
)
}
}
// When not accepted, ensure exactly one controller has been rejected.
// When not accepted, ensure exactly one controller has been rejected.
expectHistogramCountTotal
(
t
,
"apiserver_admission_controller_
latencie
s"
,
rejectFilter
,
1
)
expectHistogramCountTotal
(
t
,
"apiserver_admission_controller_
admission_latencies_second
s"
,
rejectFilter
,
1
)
}
}
}
}
}
}
...
...
staging/src/k8s.io/apiserver/pkg/admission/metrics.go
View file @
369fd81c
...
@@ -49,7 +49,7 @@ type NamedHandler interface {
...
@@ -49,7 +49,7 @@ type NamedHandler interface {
type
AdmissionMetrics
struct
{
type
AdmissionMetrics
struct
{
step
*
metricSet
step
*
metricSet
controller
*
metricSet
controller
*
metricSet
externalWebhook
*
metricSet
webhook
*
metricSet
}
}
// newAdmissionMetrics create a new AdmissionMetrics, configured with default metric names.
// newAdmissionMetrics create a new AdmissionMetrics, configured with default metric names.
...
@@ -58,28 +58,28 @@ func newAdmissionMetrics() *AdmissionMetrics {
...
@@ -58,28 +58,28 @@ func newAdmissionMetrics() *AdmissionMetrics {
// Each step is identified by a distinct type label value.
// Each step is identified by a distinct type label value.
step
:=
newMetricSet
(
"step"
,
step
:=
newMetricSet
(
"step"
,
[]
string
{
"type"
,
"operation"
,
"group"
,
"version"
,
"resource"
,
"subresource"
,
"rejected"
},
[]
string
{
"type"
,
"operation"
,
"group"
,
"version"
,
"resource"
,
"subresource"
,
"rejected"
},
"Admission sub-step %s, broken out for each operation and API resource and step type (validat
ing or mutating
)."
)
"Admission sub-step %s, broken out for each operation and API resource and step type (validat
e or admit
)."
)
// Built-in admission controller metrics. Each admission controller is identified by name.
// Built-in admission controller metrics. Each admission controller is identified by name.
controller
:=
newMetricSet
(
"controller"
,
controller
:=
newMetricSet
(
"controller"
,
[]
string
{
"name"
,
"type"
,
"operation"
,
"group"
,
"version"
,
"resource"
,
"subresource"
,
"rejected"
},
[]
string
{
"name"
,
"type"
,
"operation"
,
"group"
,
"version"
,
"resource"
,
"subresource"
,
"rejected"
},
"Admission controller %s, identified by name and broken out for each operation and API resource and type (validat
ing or mutating
)."
)
"Admission controller %s, identified by name and broken out for each operation and API resource and type (validat
e or admit
)."
)
//
External a
dmission webhook metrics. Each webhook is identified by name.
//
A
dmission webhook metrics. Each webhook is identified by name.
externalWebhook
:=
newMetricSet
(
"external_
webhook"
,
webhook
:=
newMetricSet
(
"
webhook"
,
[]
string
{
"name"
,
"type"
,
"operation"
,
"group"
,
"version"
,
"resource"
,
"subresource"
,
"rejected"
},
[]
string
{
"name"
,
"type"
,
"operation"
,
"group"
,
"version"
,
"resource"
,
"subresource"
,
"rejected"
},
"
External admission webhook %s, identified by name and broken out for each operation and API resource and type (validating or mutating
)."
)
"
Admission webhook %s, identified by name and broken out for each operation and API resource and type (validate or admit
)."
)
step
.
mustRegister
()
step
.
mustRegister
()
controller
.
mustRegister
()
controller
.
mustRegister
()
externalW
ebhook
.
mustRegister
()
w
ebhook
.
mustRegister
()
return
&
AdmissionMetrics
{
step
:
step
,
controller
:
controller
,
externalWebhook
:
externalW
ebhook
}
return
&
AdmissionMetrics
{
step
:
step
,
controller
:
controller
,
webhook
:
w
ebhook
}
}
}
func
(
m
*
AdmissionMetrics
)
reset
()
{
func
(
m
*
AdmissionMetrics
)
reset
()
{
m
.
step
.
reset
()
m
.
step
.
reset
()
m
.
controller
.
reset
()
m
.
controller
.
reset
()
m
.
externalW
ebhook
.
reset
()
m
.
w
ebhook
.
reset
()
}
}
// ObserveAdmissionStep records admission related metrics for a admission step, identified by step type.
// ObserveAdmissionStep records admission related metrics for a admission step, identified by step type.
...
@@ -94,11 +94,11 @@ func (m *AdmissionMetrics) ObserveAdmissionController(elapsed time.Duration, rej
...
@@ -94,11 +94,11 @@ func (m *AdmissionMetrics) ObserveAdmissionController(elapsed time.Duration, rej
m
.
controller
.
observe
(
elapsed
,
handler
.
Name
(),
stepType
,
string
(
attr
.
GetOperation
()),
gvr
.
Group
,
gvr
.
Version
,
gvr
.
Resource
,
attr
.
GetSubresource
(),
strconv
.
FormatBool
(
rejected
))
m
.
controller
.
observe
(
elapsed
,
handler
.
Name
(),
stepType
,
string
(
attr
.
GetOperation
()),
gvr
.
Group
,
gvr
.
Version
,
gvr
.
Resource
,
attr
.
GetSubresource
(),
strconv
.
FormatBool
(
rejected
))
}
}
// Observe
ExternalWebhook records admission related metrics for a external
admission webhook.
// Observe
Webhook records admission related metrics for a
admission webhook.
func
(
m
*
AdmissionMetrics
)
Observe
External
Webhook
(
elapsed
time
.
Duration
,
rejected
bool
,
hook
*
v1alpha1
.
Webhook
,
attr
Attributes
)
{
func
(
m
*
AdmissionMetrics
)
ObserveWebhook
(
elapsed
time
.
Duration
,
rejected
bool
,
hook
*
v1alpha1
.
Webhook
,
attr
Attributes
)
{
t
:=
"
validating"
// TODO: pass in type (validating|mutating
) once mutating webhook functionality has been implemented
t
:=
"
admit"
// TODO: pass in type (validate|admit
) once mutating webhook functionality has been implemented
gvr
:=
attr
.
GetResource
()
gvr
:=
attr
.
GetResource
()
m
.
externalW
ebhook
.
observe
(
elapsed
,
hook
.
Name
,
t
,
string
(
attr
.
GetOperation
()),
gvr
.
Group
,
gvr
.
Version
,
gvr
.
Resource
,
attr
.
GetSubresource
(),
strconv
.
FormatBool
(
rejected
))
m
.
w
ebhook
.
observe
(
elapsed
,
hook
.
Name
,
t
,
string
(
attr
.
GetOperation
()),
gvr
.
Group
,
gvr
.
Version
,
gvr
.
Resource
,
attr
.
GetSubresource
(),
strconv
.
FormatBool
(
rejected
))
}
}
type
metricSet
struct
{
type
metricSet
struct
{
...
@@ -112,7 +112,7 @@ func newMetricSet(name string, labels []string, helpTemplate string) *metricSet
...
@@ -112,7 +112,7 @@ func newMetricSet(name string, labels []string, helpTemplate string) *metricSet
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Namespace
:
namespace
,
Namespace
:
namespace
,
Subsystem
:
subsystem
,
Subsystem
:
subsystem
,
Name
:
fmt
.
Sprintf
(
"%s_
latencie
s"
,
name
),
Name
:
fmt
.
Sprintf
(
"%s_
admission_latencies_second
s"
,
name
),
Help
:
fmt
.
Sprintf
(
helpTemplate
,
"latency histogram"
),
Help
:
fmt
.
Sprintf
(
helpTemplate
,
"latency histogram"
),
Buckets
:
latencyBuckets
,
Buckets
:
latencyBuckets
,
},
},
...
@@ -122,7 +122,7 @@ func newMetricSet(name string, labels []string, helpTemplate string) *metricSet
...
@@ -122,7 +122,7 @@ func newMetricSet(name string, labels []string, helpTemplate string) *metricSet
prometheus
.
SummaryOpts
{
prometheus
.
SummaryOpts
{
Namespace
:
namespace
,
Namespace
:
namespace
,
Subsystem
:
subsystem
,
Subsystem
:
subsystem
,
Name
:
fmt
.
Sprintf
(
"%s_
latencie
s_summary"
,
name
),
Name
:
fmt
.
Sprintf
(
"%s_
admission_latencies_second
s_summary"
,
name
),
Help
:
fmt
.
Sprintf
(
helpTemplate
,
"latency summary"
),
Help
:
fmt
.
Sprintf
(
helpTemplate
,
"latency summary"
),
MaxAge
:
latencySummaryMaxAge
,
MaxAge
:
latencySummaryMaxAge
,
},
},
...
...
staging/src/k8s.io/apiserver/pkg/admission/metrics_test.go
View file @
369fd81c
...
@@ -33,24 +33,24 @@ var (
...
@@ -33,24 +33,24 @@ var (
func
TestObserveAdmissionStep
(
t
*
testing
.
T
)
{
func
TestObserveAdmissionStep
(
t
*
testing
.
T
)
{
Metrics
.
reset
()
Metrics
.
reset
()
Metrics
.
ObserveAdmissionStep
(
2
*
time
.
Second
,
false
,
attr
,
"
mutating
"
)
Metrics
.
ObserveAdmissionStep
(
2
*
time
.
Second
,
false
,
attr
,
"
admit
"
)
wantLabels
:=
map
[
string
]
string
{
wantLabels
:=
map
[
string
]
string
{
"operation"
:
string
(
Create
),
"operation"
:
string
(
Create
),
"group"
:
resource
.
Group
,
"group"
:
resource
.
Group
,
"version"
:
resource
.
Version
,
"version"
:
resource
.
Version
,
"resource"
:
resource
.
Resource
,
"resource"
:
resource
.
Resource
,
"subresource"
:
"subresource"
,
"subresource"
:
"subresource"
,
"type"
:
"
mutating
"
,
"type"
:
"
admit
"
,
"rejected"
:
"false"
,
"rejected"
:
"false"
,
}
}
expectHistogramCountTotal
(
t
,
"apiserver_admission_step_
latencie
s"
,
wantLabels
,
1
)
expectHistogramCountTotal
(
t
,
"apiserver_admission_step_
admission_latencies_second
s"
,
wantLabels
,
1
)
expectFindMetric
(
t
,
"apiserver_admission_step_
latencie
s_summary"
,
wantLabels
)
expectFindMetric
(
t
,
"apiserver_admission_step_
admission_latencies_second
s_summary"
,
wantLabels
)
}
}
func
TestObserveAdmissionController
(
t
*
testing
.
T
)
{
func
TestObserveAdmissionController
(
t
*
testing
.
T
)
{
Metrics
.
reset
()
Metrics
.
reset
()
handler
:=
makeValidatingNamedHandler
(
"a"
,
true
,
Create
)
handler
:=
makeValidatingNamedHandler
(
"a"
,
true
,
Create
)
Metrics
.
ObserveAdmissionController
(
2
*
time
.
Second
,
false
,
handler
,
attr
,
"validat
ing
"
)
Metrics
.
ObserveAdmissionController
(
2
*
time
.
Second
,
false
,
handler
,
attr
,
"validat
e
"
)
wantLabels
:=
map
[
string
]
string
{
wantLabels
:=
map
[
string
]
string
{
"name"
:
"a"
,
"name"
:
"a"
,
"operation"
:
string
(
Create
),
"operation"
:
string
(
Create
),
...
@@ -58,17 +58,17 @@ func TestObserveAdmissionController(t *testing.T) {
...
@@ -58,17 +58,17 @@ func TestObserveAdmissionController(t *testing.T) {
"version"
:
resource
.
Version
,
"version"
:
resource
.
Version
,
"resource"
:
resource
.
Resource
,
"resource"
:
resource
.
Resource
,
"subresource"
:
"subresource"
,
"subresource"
:
"subresource"
,
"type"
:
"validat
ing
"
,
"type"
:
"validat
e
"
,
"rejected"
:
"false"
,
"rejected"
:
"false"
,
}
}
expectHistogramCountTotal
(
t
,
"apiserver_admission_controller_
latencie
s"
,
wantLabels
,
1
)
expectHistogramCountTotal
(
t
,
"apiserver_admission_controller_
admission_latencies_second
s"
,
wantLabels
,
1
)
expectFindMetric
(
t
,
"apiserver_admission_controller_
latencie
s_summary"
,
wantLabels
)
expectFindMetric
(
t
,
"apiserver_admission_controller_
admission_latencies_second
s_summary"
,
wantLabels
)
}
}
func
TestObserve
External
Webhook
(
t
*
testing
.
T
)
{
func
TestObserveWebhook
(
t
*
testing
.
T
)
{
Metrics
.
reset
()
Metrics
.
reset
()
hook
:=
&
v1alpha1
.
Webhook
{
Name
:
"x"
}
hook
:=
&
v1alpha1
.
Webhook
{
Name
:
"x"
}
Metrics
.
Observe
External
Webhook
(
2
*
time
.
Second
,
false
,
hook
,
attr
)
Metrics
.
ObserveWebhook
(
2
*
time
.
Second
,
false
,
hook
,
attr
)
wantLabels
:=
map
[
string
]
string
{
wantLabels
:=
map
[
string
]
string
{
"name"
:
"x"
,
"name"
:
"x"
,
"operation"
:
string
(
Create
),
"operation"
:
string
(
Create
),
...
@@ -76,9 +76,9 @@ func TestObserveExternalWebhook(t *testing.T) {
...
@@ -76,9 +76,9 @@ func TestObserveExternalWebhook(t *testing.T) {
"version"
:
resource
.
Version
,
"version"
:
resource
.
Version
,
"resource"
:
resource
.
Resource
,
"resource"
:
resource
.
Resource
,
"subresource"
:
"subresource"
,
"subresource"
:
"subresource"
,
"type"
:
"
validating
"
,
"type"
:
"
admit
"
,
"rejected"
:
"false"
,
"rejected"
:
"false"
,
}
}
expectHistogramCountTotal
(
t
,
"apiserver_admission_
external_webhook_latencie
s"
,
wantLabels
,
1
)
expectHistogramCountTotal
(
t
,
"apiserver_admission_
webhook_admission_latencies_second
s"
,
wantLabels
,
1
)
expectFindMetric
(
t
,
"apiserver_admission_
external_webhook_latencie
s_summary"
,
wantLabels
)
expectFindMetric
(
t
,
"apiserver_admission_
webhook_admission_latencies_second
s_summary"
,
wantLabels
)
}
}
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/admission.go
View file @
369fd81c
...
@@ -309,7 +309,7 @@ func (a *GenericAdmissionWebhook) Admit(attr admission.Attributes) error {
...
@@ -309,7 +309,7 @@ func (a *GenericAdmissionWebhook) Admit(attr admission.Attributes) error {
t
:=
time
.
Now
()
t
:=
time
.
Now
()
err
:=
a
.
callHook
(
ctx
,
hook
,
versionedAttr
)
err
:=
a
.
callHook
(
ctx
,
hook
,
versionedAttr
)
admission
.
Metrics
.
Observe
External
Webhook
(
time
.
Since
(
t
),
err
!=
nil
,
hook
,
attr
)
admission
.
Metrics
.
ObserveWebhook
(
time
.
Since
(
t
),
err
!=
nil
,
hook
,
attr
)
if
err
==
nil
{
if
err
==
nil
{
return
return
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment