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
7d67315d
Unverified
Commit
7d67315d
authored
Feb 26, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 26, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74448 from liggitt/webhook-gvk
Explicitly set GVK when sending objects to webhooks
parents
be8a9b96
e752a48a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
conversion.go
...server/pkg/admission/plugin/webhook/generic/conversion.go
+2
-0
conversion_test.go
...r/pkg/admission/plugin/webhook/generic/conversion_test.go
+8
-0
No files found.
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/conversion.go
View file @
7d67315d
...
@@ -37,5 +37,7 @@ func ConvertToGVK(obj runtime.Object, gvk schema.GroupVersionKind, o admission.O
...
@@ -37,5 +37,7 @@ func ConvertToGVK(obj runtime.Object, gvk schema.GroupVersionKind, o admission.O
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
// Explicitly set the GVK
out
.
GetObjectKind
()
.
SetGroupVersionKind
(
gvk
)
return
out
,
nil
return
out
,
nil
}
}
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/conversion_test.go
View file @
7d67315d
...
@@ -62,6 +62,10 @@ func TestConvertToGVK(t *testing.T) {
...
@@ -62,6 +62,10 @@ func TestConvertToGVK(t *testing.T) {
},
},
gvk
:
examplev1
.
SchemeGroupVersion
.
WithKind
(
"Pod"
),
gvk
:
examplev1
.
SchemeGroupVersion
.
WithKind
(
"Pod"
),
expectedObj
:
&
examplev1
.
Pod
{
expectedObj
:
&
examplev1
.
Pod
{
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
"example.apiserver.k8s.io/v1"
,
Kind
:
"Pod"
,
},
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"pod1"
,
Name
:
"pod1"
,
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
...
@@ -87,6 +91,10 @@ func TestConvertToGVK(t *testing.T) {
...
@@ -87,6 +91,10 @@ func TestConvertToGVK(t *testing.T) {
},
},
gvk
:
example2v1
.
SchemeGroupVersion
.
WithKind
(
"ReplicaSet"
),
gvk
:
example2v1
.
SchemeGroupVersion
.
WithKind
(
"ReplicaSet"
),
expectedObj
:
&
example2v1
.
ReplicaSet
{
expectedObj
:
&
example2v1
.
ReplicaSet
{
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
"example2.apiserver.k8s.io/v1"
,
Kind
:
"ReplicaSet"
,
},
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"rs1"
,
Name
:
"rs1"
,
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
...
...
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