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
3ccb26c3
Commit
3ccb26c3
authored
May 26, 2019
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apiextensions: fix metrics double registration during tests
parent
33e95bc1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
converter.go
...xtensions-apiserver/pkg/apiserver/conversion/converter.go
+6
-5
No files found.
staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/conversion/converter.go
View file @
3ccb26c3
...
@@ -35,14 +35,15 @@ type CRConverterFactory struct {
...
@@ -35,14 +35,15 @@ type CRConverterFactory struct {
// webhookConverterFactory is the factory for webhook converters.
// webhookConverterFactory is the factory for webhook converters.
// This field should not be used if CustomResourceWebhookConversion feature is disabled.
// This field should not be used if CustomResourceWebhookConversion feature is disabled.
webhookConverterFactory
*
webhookConverterFactory
webhookConverterFactory
*
webhookConverterFactory
converterMetricFactory
*
converterMetricFactory
}
}
// converterMetricFactorySingleton protects us from reregistration of metrics on repeated
// apiextensions-apiserver runs.
var
converterMetricFactorySingleton
=
newConverterMertricFactory
()
// NewCRConverterFactory creates a new CRConverterFactory
// NewCRConverterFactory creates a new CRConverterFactory
func
NewCRConverterFactory
(
serviceResolver
webhook
.
ServiceResolver
,
authResolverWrapper
webhook
.
AuthenticationInfoResolverWrapper
)
(
*
CRConverterFactory
,
error
)
{
func
NewCRConverterFactory
(
serviceResolver
webhook
.
ServiceResolver
,
authResolverWrapper
webhook
.
AuthenticationInfoResolverWrapper
)
(
*
CRConverterFactory
,
error
)
{
converterFactory
:=
&
CRConverterFactory
{
converterFactory
:=
&
CRConverterFactory
{}
converterMetricFactory
:
newConverterMertricFactory
(),
}
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
apiextensionsfeatures
.
CustomResourceWebhookConversion
)
{
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
apiextensionsfeatures
.
CustomResourceWebhookConversion
)
{
webhookConverterFactory
,
err
:=
newWebhookConverterFactory
(
serviceResolver
,
authResolverWrapper
)
webhookConverterFactory
,
err
:=
newWebhookConverterFactory
(
serviceResolver
,
authResolverWrapper
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -72,7 +73,7 @@ func (m *CRConverterFactory) NewConverter(crd *apiextensions.CustomResourceDefin
...
@@ -72,7 +73,7 @@ func (m *CRConverterFactory) NewConverter(crd *apiextensions.CustomResourceDefin
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
converter
,
err
=
m
.
converterMetricFactory
.
addMetrics
(
"webhook"
,
crd
.
Name
,
converter
)
converter
,
err
=
converterMetricFactorySingleton
.
addMetrics
(
"webhook"
,
crd
.
Name
,
converter
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
...
...
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