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
c75d3028
Commit
c75d3028
authored
Aug 06, 2017
by
Kubernetes Submit Queue
Committed by
GitHub
Aug 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #50159 from liggitt/includeObject
Automatic merge from submit-queue Fix includeObject parameter parsing Fixes #50149
parents
ae4fac41
a7a55114
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
3 deletions
+53
-3
BUILD
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1alpha1/BUILD
+1
-0
conversion.go
.../k8s.io/apimachinery/pkg/apis/meta/v1alpha1/conversion.go
+27
-0
register.go
...rc/k8s.io/apimachinery/pkg/apis/meta/v1alpha1/register.go
+6
-0
apiserver_test.go
staging/src/k8s.io/apiserver/pkg/endpoints/apiserver_test.go
+19
-3
No files found.
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1alpha1/BUILD
View file @
c75d3028
...
...
@@ -10,6 +10,7 @@ load(
go_library(
name = "go_default_library",
srcs = [
"conversion.go",
"deepcopy.go",
"doc.go",
"generated.pb.go",
...
...
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1alpha1/conversion.go
0 → 100644
View file @
c75d3028
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
v1alpha1
import
"k8s.io/apimachinery/pkg/conversion"
// Convert_Slice_string_To_v1alpha1_IncludeObjectPolicy allows converting a URL query parameter value
func
Convert_Slice_string_To_v1alpha1_IncludeObjectPolicy
(
input
*
[]
string
,
out
*
IncludeObjectPolicy
,
s
conversion
.
Scope
)
error
{
if
len
(
*
input
)
>
0
{
*
out
=
IncludeObjectPolicy
((
*
input
)[
0
])
}
return
nil
}
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1alpha1/register.go
View file @
c75d3028
...
...
@@ -46,6 +46,12 @@ func init() {
&
PartialObjectMetadataList
{},
)
if
err
:=
scheme
.
AddConversionFuncs
(
Convert_Slice_string_To_v1alpha1_IncludeObjectPolicy
,
);
err
!=
nil
{
panic
(
err
)
}
// register manually. This usually goes through the SchemeBuilder, which we cannot use here.
//scheme.AddGeneratedDeepCopyFuncs(GetGeneratedDeepCopyFuncs()...)
}
staging/src/k8s.io/apiserver/pkg/endpoints/apiserver_test.go
View file @
c75d3028
...
...
@@ -1885,6 +1885,20 @@ func TestGetTable(t *testing.T) {
},
},
},
{
accept
:
runtime
.
ContentTypeJSON
+
";as=Table;v=v1alpha1;g=meta.k8s.io"
,
params
:
url
.
Values
{
"includeObject"
:
[]
string
{
"Metadata"
}},
expected
:
&
metav1alpha1
.
Table
{
TypeMeta
:
metav1
.
TypeMeta
{
Kind
:
"Table"
,
APIVersion
:
"meta.k8s.io/v1alpha1"
},
ColumnDefinitions
:
[]
metav1alpha1
.
TableColumnDefinition
{
{
Name
:
"Name"
,
Type
:
"string"
,
Description
:
metaDoc
[
"name"
]},
{
Name
:
"Created At"
,
Type
:
"date"
,
Description
:
metaDoc
[
"creationTimestamp"
]},
},
Rows
:
[]
metav1alpha1
.
TableRow
{
{
Cells
:
[]
interface
{}{
"foo1"
,
now
.
Time
.
UTC
()
.
Format
(
time
.
RFC3339
)},
Object
:
runtime
.
RawExtension
{
Raw
:
encodedBody
}},
},
},
},
}
for
i
,
test
:=
range
tests
{
u
,
err
:=
url
.
Parse
(
server
.
URL
+
"/"
+
prefix
+
"/"
+
testGroupVersion
.
Group
+
"/"
+
testGroupVersion
.
Version
+
"/namespaces/default/simple/id"
)
...
...
@@ -1901,18 +1915,20 @@ func TestGetTable(t *testing.T) {
}
if
test
.
statusCode
!=
0
{
if
resp
.
StatusCode
!=
test
.
statusCode
{
t
.
Errorf
(
"%d: unexpected response: %#v"
,
resp
)
t
.
Errorf
(
"%d: unexpected response: %#v"
,
i
,
resp
)
}
continue
}
if
resp
.
StatusCode
!=
http
.
StatusOK
{
t
.
Errorf
(
"%d: unexpected response: %#v"
,
resp
)
t
.
Errorf
(
"%d: unexpected response: %#v"
,
i
,
resp
)
}
var
itemOut
metav1alpha1
.
Table
if
_
,
err
=
extractBody
(
resp
,
&
itemOut
);
err
!=
nil
{
body
,
err
:=
extractBody
(
resp
,
&
itemOut
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
!
reflect
.
DeepEqual
(
test
.
expected
,
&
itemOut
)
{
t
.
Log
(
body
)
t
.
Errorf
(
"%d: did not match: %s"
,
i
,
diff
.
ObjectReflectDiff
(
test
.
expected
,
&
itemOut
))
}
}
...
...
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