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
b51ac8f7
Commit
b51ac8f7
authored
Oct 22, 2018
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instantiate unstructured objects with versions in custom resource handler
parent
0e9b06df
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
customresource_handler.go
...ensions-apiserver/pkg/apiserver/customresource_handler.go
+1
-0
etcd.go
...iextensions-apiserver/pkg/registry/customresource/etcd.go
+9
-4
etcd_test.go
...nsions-apiserver/pkg/registry/customresource/etcd_test.go
+1
-0
No files found.
staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/customresource_handler.go
View file @
b51ac8f7
...
@@ -477,6 +477,7 @@ func (r *crdHandler) getOrCreateServingInfoFor(crd *apiextensions.CustomResource
...
@@ -477,6 +477,7 @@ func (r *crdHandler) getOrCreateServingInfoFor(crd *apiextensions.CustomResource
storages
[
v
.
Name
]
=
customresource
.
NewStorage
(
storages
[
v
.
Name
]
=
customresource
.
NewStorage
(
schema
.
GroupResource
{
Group
:
crd
.
Spec
.
Group
,
Resource
:
crd
.
Status
.
AcceptedNames
.
Plural
},
schema
.
GroupResource
{
Group
:
crd
.
Spec
.
Group
,
Resource
:
crd
.
Status
.
AcceptedNames
.
Plural
},
schema
.
GroupVersionKind
{
Group
:
crd
.
Spec
.
Group
,
Version
:
v
.
Name
,
Kind
:
crd
.
Status
.
AcceptedNames
.
Kind
},
schema
.
GroupVersionKind
{
Group
:
crd
.
Spec
.
Group
,
Version
:
v
.
Name
,
Kind
:
crd
.
Status
.
AcceptedNames
.
ListKind
},
schema
.
GroupVersionKind
{
Group
:
crd
.
Spec
.
Group
,
Version
:
v
.
Name
,
Kind
:
crd
.
Status
.
AcceptedNames
.
ListKind
},
customresource
.
NewStrategy
(
customresource
.
NewStrategy
(
typer
,
typer
,
...
...
staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/etcd.go
View file @
b51ac8f7
...
@@ -40,8 +40,8 @@ type CustomResourceStorage struct {
...
@@ -40,8 +40,8 @@ type CustomResourceStorage struct {
Scale
*
ScaleREST
Scale
*
ScaleREST
}
}
func
NewStorage
(
resource
schema
.
GroupResource
,
listKind
schema
.
GroupVersionKind
,
strategy
customResourceStrategy
,
optsGetter
generic
.
RESTOptionsGetter
,
categories
[]
string
,
tableConvertor
rest
.
TableConvertor
)
CustomResourceStorage
{
func
NewStorage
(
resource
schema
.
GroupResource
,
kind
,
listKind
schema
.
GroupVersionKind
,
strategy
customResourceStrategy
,
optsGetter
generic
.
RESTOptionsGetter
,
categories
[]
string
,
tableConvertor
rest
.
TableConvertor
)
CustomResourceStorage
{
customResourceREST
,
customResourceStatusREST
:=
newREST
(
resource
,
listKind
,
strategy
,
optsGetter
,
categories
,
tableConvertor
)
customResourceREST
,
customResourceStatusREST
:=
newREST
(
resource
,
kind
,
listKind
,
strategy
,
optsGetter
,
categories
,
tableConvertor
)
s
:=
CustomResourceStorage
{
s
:=
CustomResourceStorage
{
CustomResource
:
customResourceREST
,
CustomResource
:
customResourceREST
,
...
@@ -75,9 +75,14 @@ type REST struct {
...
@@ -75,9 +75,14 @@ type REST struct {
}
}
// newREST returns a RESTStorage object that will work against API services.
// newREST returns a RESTStorage object that will work against API services.
func
newREST
(
resource
schema
.
GroupResource
,
listKind
schema
.
GroupVersionKind
,
strategy
customResourceStrategy
,
optsGetter
generic
.
RESTOptionsGetter
,
categories
[]
string
,
tableConvertor
rest
.
TableConvertor
)
(
*
REST
,
*
StatusREST
)
{
func
newREST
(
resource
schema
.
GroupResource
,
kind
,
listKind
schema
.
GroupVersionKind
,
strategy
customResourceStrategy
,
optsGetter
generic
.
RESTOptionsGetter
,
categories
[]
string
,
tableConvertor
rest
.
TableConvertor
)
(
*
REST
,
*
StatusREST
)
{
store
:=
&
genericregistry
.
Store
{
store
:=
&
genericregistry
.
Store
{
NewFunc
:
func
()
runtime
.
Object
{
return
&
unstructured
.
Unstructured
{}
},
NewFunc
:
func
()
runtime
.
Object
{
// set the expected group/version/kind in the new object as a signal to the versioning decoder
ret
:=
&
unstructured
.
Unstructured
{}
ret
.
SetGroupVersionKind
(
kind
)
return
ret
},
NewListFunc
:
func
()
runtime
.
Object
{
NewListFunc
:
func
()
runtime
.
Object
{
// lists are never stored, only manufactured, so stomp in the right kind
// lists are never stored, only manufactured, so stomp in the right kind
ret
:=
&
unstructured
.
UnstructuredList
{}
ret
:=
&
unstructured
.
UnstructuredList
{}
...
...
staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/etcd_test.go
View file @
b51ac8f7
...
@@ -91,6 +91,7 @@ func newStorage(t *testing.T) (customresource.CustomResourceStorage, *etcdtestin
...
@@ -91,6 +91,7 @@ func newStorage(t *testing.T) (customresource.CustomResourceStorage, *etcdtestin
storage
:=
customresource
.
NewStorage
(
storage
:=
customresource
.
NewStorage
(
schema
.
GroupResource
{
Group
:
"mygroup.example.com"
,
Resource
:
"noxus"
},
schema
.
GroupResource
{
Group
:
"mygroup.example.com"
,
Resource
:
"noxus"
},
kind
,
schema
.
GroupVersionKind
{
Group
:
"mygroup.example.com"
,
Version
:
"v1beta1"
,
Kind
:
"NoxuItemList"
},
schema
.
GroupVersionKind
{
Group
:
"mygroup.example.com"
,
Version
:
"v1beta1"
,
Kind
:
"NoxuItemList"
},
customresource
.
NewStrategy
(
customresource
.
NewStrategy
(
typer
,
typer
,
...
...
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