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
66e5c38d
Commit
66e5c38d
authored
Nov 16, 2016
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove TPR registration, ease validation requirements
parent
28d273c8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
18 deletions
+4
-18
factory.go
pkg/kubectl/cmd/util/factory.go
+1
-16
kubectl_test.go
test/integration/kubectl/kubectl_test.go
+3
-2
No files found.
pkg/kubectl/cmd/util/factory.go
View file @
66e5c38d
...
@@ -386,18 +386,6 @@ func (f *factory) UnstructuredObject() (meta.RESTMapper, runtime.ObjectTyper, er
...
@@ -386,18 +386,6 @@ func (f *factory) UnstructuredObject() (meta.RESTMapper, runtime.ObjectTyper, er
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
// Register unknown APIs as third party for now to make
// validation happy. TODO perhaps make a dynamic schema
// validator to avoid this.
for
_
,
group
:=
range
groupResources
{
for
_
,
version
:=
range
group
.
Group
.
Versions
{
gv
:=
unversioned
.
GroupVersion
{
Group
:
group
.
Group
.
Name
,
Version
:
version
.
Version
}
if
!
registered
.
IsRegisteredVersion
(
gv
)
{
registered
.
AddThirdPartyAPIGroupVersions
(
gv
)
}
}
}
mapper
:=
discovery
.
NewDeferredDiscoveryRESTMapper
(
discoveryClient
,
meta
.
InterfacesForUnstructured
)
mapper
:=
discovery
.
NewDeferredDiscoveryRESTMapper
(
discoveryClient
,
meta
.
InterfacesForUnstructured
)
typer
:=
discovery
.
NewUnstructuredObjectTyper
(
groupResources
)
typer
:=
discovery
.
NewUnstructuredObjectTyper
(
groupResources
)
return
NewShortcutExpander
(
mapper
,
discoveryClient
),
typer
,
nil
return
NewShortcutExpander
(
mapper
,
discoveryClient
),
typer
,
nil
...
@@ -1148,10 +1136,7 @@ func (c *clientSwaggerSchema) ValidateBytes(data []byte) error {
...
@@ -1148,10 +1136,7 @@ func (c *clientSwaggerSchema) ValidateBytes(data []byte) error {
return
err
return
err
}
}
if
ok
:=
registered
.
IsEnabledVersion
(
gvk
.
GroupVersion
());
!
ok
{
if
ok
:=
registered
.
IsEnabledVersion
(
gvk
.
GroupVersion
());
!
ok
{
return
fmt
.
Errorf
(
"API version %q isn't supported, only supports API versions %q"
,
gvk
.
GroupVersion
()
.
String
(),
registered
.
EnabledVersions
())
// if we don't have this in our scheme, just skip validation because its an object we don't recognize
}
if
registered
.
IsThirdPartyAPIGroupVersion
(
gvk
.
GroupVersion
())
{
// Don't attempt to validate third party objects
return
nil
return
nil
}
}
...
...
test/integration/kubectl/kubectl_test.go
View file @
66e5c38d
...
@@ -30,17 +30,18 @@ import (
...
@@ -30,17 +30,18 @@ import (
func
TestKubectlValidation
(
t
*
testing
.
T
)
{
func
TestKubectlValidation
(
t
*
testing
.
T
)
{
testCases
:=
[]
struct
{
testCases
:=
[]
struct
{
data
string
data
string
// Validation should not fail on missing type information.
err
bool
err
bool
}{
}{
{
`{"apiVersion": "v1", "kind": "thisObjectShouldNotExistInAnyGroup"}`
,
true
},
{
`{"apiVersion": "v1", "kind": "thisObjectShouldNotExistInAnyGroup"}`
,
true
},
{
`{"apiVersion": "invalidVersion", "kind": "Pod"}`
,
tru
e
},
{
`{"apiVersion": "invalidVersion", "kind": "Pod"}`
,
fals
e
},
{
`{"apiVersion": "v1", "kind": "Pod"}`
,
false
},
{
`{"apiVersion": "v1", "kind": "Pod"}`
,
false
},
// The following test the experimental api.
// The following test the experimental api.
// TODO: Replace with something more robust. These may move.
// TODO: Replace with something more robust. These may move.
{
`{"apiVersion": "extensions/v1beta1", "kind": "Ingress"}`
,
false
},
{
`{"apiVersion": "extensions/v1beta1", "kind": "Ingress"}`
,
false
},
{
`{"apiVersion": "extensions/v1beta1", "kind": "Job"}`
,
false
},
{
`{"apiVersion": "extensions/v1beta1", "kind": "Job"}`
,
false
},
{
`{"apiVersion": "vNotAVersion", "kind": "Job"}`
,
tru
e
},
{
`{"apiVersion": "vNotAVersion", "kind": "Job"}`
,
fals
e
},
}
}
components
:=
framework
.
NewMasterComponents
(
&
framework
.
Config
{})
components
:=
framework
.
NewMasterComponents
(
&
framework
.
Config
{})
defer
components
.
Stop
(
true
,
true
)
defer
components
.
Stop
(
true
,
true
)
...
...
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